-
Notifications
You must be signed in to change notification settings - Fork 861
[Flyout System] Support size="fill" #8982
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
[Flyout System] Support size="fill" #8982
Conversation
b8ff0c8 to
dc825bb
Compare
dc825bb to
0d95eea
Compare
a8a0907 to
013239a
Compare
💚 Build SucceededHistory
|
💚 Build Succeeded
History
|
| /** | ||
| * Composes all inline styles for a flyout based on its configuration | ||
| */ | ||
| export const composeFlyoutInlineStyles = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole function feels quite difficult to follow. I'm not sure how exactly we can simplify this, but I'd like to get back to it when we have some more time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this to the punch list. Were you thinking someone from SharedUX could do this? I think there are some devs on this team that have availability
tkajtoch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes look good. I tested the changes in Storybook and can confirm that the fill mode works as expected.
We could probably make the implementation a bit cleaner, but I'm happy to merge this PR as is since it targets the feature branch. I plan to give the whole flyout directory a cleanup pass before releasing the flyout system publicly. Let's focus on getting all functionality implemented first, though 👍🏻
…3806) ~~Depends on elastic/eui#8982 ~~Depends on elastic/eui#9202 ~~Depends on #245515 This PR enhances the core UX offerings in Kibana with `core.overlays.openSystemFlyout`. ### `core.overlays.openSystemFlyout` Opens a system flyout that integrates with the EUI Flyout Manager. Using a mount point would break the context propogation of the EUI Flyout Manager, so this method accepts React elements directly rather than `toMountPoint`. ```typescript import React, { useRef } from 'react'; import { EuiFlyoutBody, EuiFlyoutFooter, EuiText, EuiButton, EuiButtonEmpty, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import type { OverlayRef } from '@kbn/core-mount-utils-browser'; // Create a component or function that opens the system flyout const openMySystemFlyout = (overlays) => { const flyoutRef = useRef<OverlayRef | null>(null); const handleClose = () => { if (flyoutRef.current) { flyoutRef.current.close(); } }; const FlyoutContent = () => ( <> <EuiFlyoutBody> <EuiText> <p>This is a system flyout that integrates with EUI Flyout Manager.</p> <p>The header is automatically created from the title option.</p> </EuiText> </EuiFlyoutBody> <EuiFlyoutFooter> <EuiFlexGroup justifyContent="spaceBetween"> <EuiFlexItem grow={false}> <EuiButtonEmpty onClick={handleClose}> Cancel </EuiButtonEmpty> </EuiFlexItem> <EuiFlexItem grow={false}> <EuiButton onClick={() => console.log('Save')} fill> Save </EuiButton> </EuiFlexItem> </EuiFlexGroup> </EuiFlyoutFooter> </> ); flyoutRef.current = overlays.openSystemFlyout(<FlyoutContent />, { title: 'My System Flyout', type: 'overlay', size: 'm', maxWidth: 600, ownFocus: false, onClose: () => { console.log('System flyout closed'); flyoutRef.current = null; }, onActive: () => { console.log('System flyout became active'); }, }); return flyoutRef.current; }; // Open the flyout const flyoutRef = openMySystemFlyout(overlays); // Close the flyout programmatically from outside flyoutRef.close(); ``` The developer README for the Flyout System is [here](https://github.com/elastic/eui/blob/feat/flyout-system/packages/eui/src/components/flyout/README.md). ### Example plugin Along with the new service and documentation changes, a new example plugin for developers is provided that shows different integration patterns for the EUI flyout system. **Screenshot of example plugin:** <img width="1327" height="836" alt="image" src="https://github.com/user-attachments/assets/9664f0cb-f793-4a8c-8a96-c46d069756dd" /> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Ania Kowalska <ania.kowalska@elastic.co> Co-authored-by: Lene Gadewoll <lene.gadewoll@elastic.co> Co-authored-by: Weronika Olejniczak <weronika.olejniczak@elastic.co> Co-authored-by: Jorge Oliveira <jorge.oliveira@elastic.co> Co-authored-by: Tomasz Kajtoch <tomasz.kajtoch@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…stic#233806) ~~Depends on elastic/eui#8982 ~~Depends on elastic/eui#9202 ~~Depends on elastic#245515 This PR enhances the core UX offerings in Kibana with `core.overlays.openSystemFlyout`. ### `core.overlays.openSystemFlyout` Opens a system flyout that integrates with the EUI Flyout Manager. Using a mount point would break the context propogation of the EUI Flyout Manager, so this method accepts React elements directly rather than `toMountPoint`. ```typescript import React, { useRef } from 'react'; import { EuiFlyoutBody, EuiFlyoutFooter, EuiText, EuiButton, EuiButtonEmpty, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import type { OverlayRef } from '@kbn/core-mount-utils-browser'; // Create a component or function that opens the system flyout const openMySystemFlyout = (overlays) => { const flyoutRef = useRef<OverlayRef | null>(null); const handleClose = () => { if (flyoutRef.current) { flyoutRef.current.close(); } }; const FlyoutContent = () => ( <> <EuiFlyoutBody> <EuiText> <p>This is a system flyout that integrates with EUI Flyout Manager.</p> <p>The header is automatically created from the title option.</p> </EuiText> </EuiFlyoutBody> <EuiFlyoutFooter> <EuiFlexGroup justifyContent="spaceBetween"> <EuiFlexItem grow={false}> <EuiButtonEmpty onClick={handleClose}> Cancel </EuiButtonEmpty> </EuiFlexItem> <EuiFlexItem grow={false}> <EuiButton onClick={() => console.log('Save')} fill> Save </EuiButton> </EuiFlexItem> </EuiFlexGroup> </EuiFlyoutFooter> </> ); flyoutRef.current = overlays.openSystemFlyout(<FlyoutContent />, { title: 'My System Flyout', type: 'overlay', size: 'm', maxWidth: 600, ownFocus: false, onClose: () => { console.log('System flyout closed'); flyoutRef.current = null; }, onActive: () => { console.log('System flyout became active'); }, }); return flyoutRef.current; }; // Open the flyout const flyoutRef = openMySystemFlyout(overlays); // Close the flyout programmatically from outside flyoutRef.close(); ``` The developer README for the Flyout System is [here](https://github.com/elastic/eui/blob/feat/flyout-system/packages/eui/src/components/flyout/README.md). ### Example plugin Along with the new service and documentation changes, a new example plugin for developers is provided that shows different integration patterns for the EUI flyout system. **Screenshot of example plugin:** <img width="1327" height="836" alt="image" src="https://github.com/user-attachments/assets/9664f0cb-f793-4a8c-8a96-c46d069756dd" /> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Ania Kowalska <ania.kowalska@elastic.co> Co-authored-by: Lene Gadewoll <lene.gadewoll@elastic.co> Co-authored-by: Weronika Olejniczak <weronika.olejniczak@elastic.co> Co-authored-by: Jorge Oliveira <jorge.oliveira@elastic.co> Co-authored-by: Tomasz Kajtoch <tomasz.kajtoch@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
Closes #8874
Depends on #8939Why are we making this change?
Requirement for Flyout System. This PR is targeted to the flyout system feature branch.
Screenshots
Flyout.System.Fill.Mode.Demo.mp4
Impact to users
This gives developers the ability to show large-size "main" or "child" flyouts using the Flyout System.
QA
Remove or strikethrough items that do not apply to your PR.
General checklist
[ ] Added documentation[ ] Props have proper autodocs (using@defaultif default values are missing) and playground toggles[ ] Checked Code Sandbox works for any docs examples[ ] Updated visual regression tests[ ] A changelog entry exists and is marked appropriately.[ ] If applicable, added the breaking change issue label (and filled out the breaking change checklist)[ ] If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)