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

feat(Modal): export new Modal component to /next #2641

Merged
Show file tree
Hide file tree
Changes from 7 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
14 changes: 13 additions & 1 deletion packages/core/src/__tests__/__snapshots__/exports.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,16 @@ exports[`exports should export all components 1`] = `
]
`;

exports[`exports should export next all components 1`] = `[]`;
exports[`exports should export next all components 1`] = `
[
"Modal",
"ModalBasicLayout",
"ModalContent",
"ModalFooter",
"ModalFooterWizard",
"ModalHeader",
"ModalMedia",
"ModalMediaLayout",
"ModalSideBySideLayout",
]
`;
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
TOOLTIP
} from "../../../../storybook/components/related-components/component-description-map";

<Meta title="Internal/Components/Modal [New]" />
<Meta title="Components/Modal [New]" />

# Modal

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ export const OpenedModalPreview = forwardRef(
const isAfterFirstRender = useAfterFirstRender();
return (
<div
className={cx(styles.preview, getStyle(styles, size))}
className={cx(styles.preview, { [getStyle(styles, size)]: isDocsView })}
ref={ref}
// workaround to prevent modal from autofocusing on page load
// autofocus would work as expected when modal closes and reopens
{...(!isAfterFirstRender.current && isDocsView && { "data-no-autofocus": true })}
>
<Button onClick={onOpenModalClick}>Open Modal</Button>
{isDocsView ? modal : createPortal(modal, document.body)}
{modal}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.preview {
padding-inline-start: 32px;
padding-block-start: 40px;
height: 360px;
height: 100vh;
width: 100%;
container-type: inline-size;

Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/components/Modal/Modal/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as Modal } from "./Modal";
export { ModalProps } from "./Modal.types";
2 changes: 2 additions & 0 deletions packages/core/src/components/Modal/ModalContent/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as ModalContent } from "./ModalContent";
export { ModalContentProps } from "./ModalContent.types";
2 changes: 2 additions & 0 deletions packages/core/src/components/Modal/ModalHeader/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as ModalHeader } from "./ModalHeader";
export { ModalHeaderProps } from "./ModalHeader.types";
2 changes: 2 additions & 0 deletions packages/core/src/components/Modal/ModalMedia/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as ModalMedia } from "./ModalMedia";
export { ModalMediaProps } from "./ModalMedia.types";
5 changes: 5 additions & 0 deletions packages/core/src/components/Modal/footers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export { default as ModalFooter } from "./ModalFooter/ModalFooter";
export { ModalFooterProps } from "./ModalFooter/ModalFooter.types";

export { default as ModalFooterWizard } from "./ModalFooterWizard/ModalFooterWizard";
export { ModalFooterWizardProps } from "./ModalFooterWizard/ModalFooterWizard.types";
6 changes: 6 additions & 0 deletions packages/core/src/components/Modal/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * from "./footers";
export * from "./layouts";
export * from "./Modal";
export * from "./ModalHeader";
export * from "./ModalContent";
export * from "./ModalMedia";
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ const metaSettings = createStoryMetaSettingsDecorator({
});

export default {
title: "Internal/Components/Modal [New]/Basic modal",
title: "Components/Modal [New]/Basic modal",
Copy link
Member

Choose a reason for hiding this comment

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

Feels a bit weird title no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why?

component: Modal,
subcomponents: { ModalBasicLayout, ModalHeader, ModalContent, ModalFooter, ModalFooterWizard, TransitionView },
argTypes: metaSettings.argTypes,
decorators: metaSettings.decorators,
tags: ["internal"]
parameters: {
layout: "fullscreen"
}
} satisfies Meta<typeof Modal>;

export const Overview: Story = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Modal from "../../../Modal/Modal";
import { createStoryMetaSettingsDecorator } from "../../../../../storybook";
import ModalHeader from "../../../ModalHeader/ModalHeader";
import ModalContent from "../../../ModalContent/ModalContent";
import ModalMedia from "../../ModalMedia";
import ModalMedia from "../../../ModalMedia/ModalMedia";
import mediaImage from "./assets/media-image.png";
import ModalFooter from "../../../footers/ModalFooter/ModalFooter";
import ModalMediaLayout from "../ModalMediaLayout";
Expand All @@ -26,7 +26,7 @@ const metaSettings = createStoryMetaSettingsDecorator({
});

export default {
title: "Internal/Components/Modal [New]/Media modal",
title: "Components/Modal [New]/Media modal",
component: Modal,
subcomponents: {
ModalMediaLayout,
Expand All @@ -39,7 +39,9 @@ export default {
},
argTypes: metaSettings.argTypes,
decorators: metaSettings.decorators,
tags: ["internal"]
parameters: {
layout: "fullscreen"
}
} satisfies Meta<typeof Modal>;

export const Overview: Story = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { withOpenedModalPreview } from "../../../Modal/__stories__/Modal.stories
import ModalHeader from "../../../ModalHeader/ModalHeader";
import ModalContent from "../../../ModalContent/ModalContent";
import ModalSideBySideLayout from "../ModalSideBySideLayout";
import ModalMedia from "../../ModalMedia";
import ModalMedia from "../../../ModalMedia/ModalMedia";
import mediaImage from "./assets/media-image.png";
import useWizard from "../../../../../hooks/useWizard/useWizard";
import TransitionView from "../../../../TransitionView/TransitionView";
Expand All @@ -29,7 +29,7 @@ const metaSettings = createStoryMetaSettingsDecorator({
});

export default {
title: "Internal/Components/Modal [New]/Side by side modal",
title: "Components/Modal [New]/Side by side modal",
component: Modal,
subcomponents: {
ModalSideBySideLayout,
Expand All @@ -42,7 +42,9 @@ export default {
},
argTypes: metaSettings.argTypes,
decorators: metaSettings.decorators,
tags: ["internal"]
parameters: {
layout: "fullscreen"
}
} satisfies Meta<typeof Modal>;

export const Overview: Story = {
Expand Down
8 changes: 8 additions & 0 deletions packages/core/src/components/Modal/layouts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export { default as ModalBasicLayout } from "./ModalBasicLayout/ModalBasicLayout";
export { ModalBasicLayoutProps } from "./ModalBasicLayout/ModalBasicLayout.types";

export { default as ModalMediaLayout } from "./ModalMediaLayout/ModalMediaLayout";
export { ModalMediaLayoutProps } from "./ModalMediaLayout/ModalMediaLayout.types";

export { default as ModalSideBySideLayout } from "./ModalSideBySideLayout/ModalSideBySideLayout";
export { ModalSideBySideLayoutProps } from "./ModalSideBySideLayout/ModalSideBySideLayout.types";
2 changes: 1 addition & 1 deletion packages/core/src/components/next.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {};
export * from "./Modal";
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ import { BoxDescription } from "./descriptions/box-description";
import { TableDescription } from "./descriptions/table-description";
import { VirtualizedGridDescription } from "./descriptions/virtualized-grid-description/virtualized-grid-description";
import { MenuGridItemDescription } from "./descriptions/menu-grid-item-description";
import { ModalMediaLayoutRelatedComponent } from "../../../components/ModalNew/layouts/ModalMediaLayout/__stories__/ModalMediaLayoutRelatedComponent";
import { ModalSideBySideLayoutRelatedComponent } from "../../../components/ModalNew/layouts/ModalSideBySideLayout/__stories__/ModalSideBySideLayoutRelatedComponent";
import { ModalBasicLayoutRelatedComponent } from "../../../components/ModalNew/layouts/ModalBasicLayout/__stories__/ModalBasicLayoutRelatedComponent";
import { ModalMediaLayoutRelatedComponent } from "../../../components/Modal/layouts/ModalMediaLayout/__stories__/ModalMediaLayoutRelatedComponent";
import { ModalSideBySideLayoutRelatedComponent } from "../../../components/Modal/layouts/ModalSideBySideLayout/__stories__/ModalSideBySideLayoutRelatedComponent";
import { ModalBasicLayoutRelatedComponent } from "../../../components/Modal/layouts/ModalBasicLayout/__stories__/ModalBasicLayoutRelatedComponent";

export const SPLIT_BUTTON = "split-button";
export const BUTTON_GROUP = "button-group";
Expand Down
Loading