diff --git a/src/components/modal/confirm_modal.stories.tsx b/src/components/modal/confirm_modal.stories.tsx
index 1053f8d922c..a77e9efe426 100644
--- a/src/components/modal/confirm_modal.stories.tsx
+++ b/src/components/modal/confirm_modal.stories.tsx
@@ -6,7 +6,6 @@
* Side Public License, v 1.
*/
-import React from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import { action } from '@storybook/addon-actions';
@@ -59,5 +58,4 @@ export const Playground: Story = {
onCancel,
onConfirm,
},
- render: (args) => ,
};
diff --git a/src/components/modal/modal.stories.tsx b/src/components/modal/modal.stories.tsx
index 8749ac213f4..90900090b63 100644
--- a/src/components/modal/modal.stories.tsx
+++ b/src/components/modal/modal.stories.tsx
@@ -6,19 +6,12 @@
* Side Public License, v 1.
*/
-import React, { useState } from 'react';
+import React, { MouseEvent, useState } from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import { action } from '@storybook/addon-actions';
-import { useGeneratedHtmlId } from '../../services';
import { EuiButton, EuiButtonEmpty } from '../button';
-import {
- EuiFieldText,
- EuiForm,
- EuiFormProps,
- EuiFormRow,
- EuiSwitch,
-} from '../form';
+import { EuiFieldText, EuiForm, EuiFormRow } from '../form';
import { EuiModalHeader } from './modal_header';
import { EuiModalHeaderTitle } from './modal_header_title';
@@ -62,13 +55,6 @@ export const Playground: Story = {
},
};
-export const InitialFocus: Story = {
- args: {
- initialFocus: '[name=popswitch]',
- },
- render: (args) => ,
-};
-
export const ToggleExample: Story = {
args: {
children: (
@@ -90,6 +76,48 @@ export const ToggleExample: Story = {
render: (args) => ,
};
+export const InitialFocus: Story = {
+ args: {
+ initialFocus: '[name=popfirst]',
+ },
+ render: (args) => {
+ const handleOnSubmit = (e: MouseEvent) => {
+ e.preventDefault();
+ action('onSubmit')();
+ };
+ return (
+
+
+
+ Modal title
+
+
+
+
+
+
+
+
+
+
+
+
+ Cancel
+
+
+ Save
+
+
+
+ );
+ },
+};
+
/* Story content components */
const StatefulModal = (props: EuiModalProps) => {
@@ -112,78 +140,3 @@ const StatefulModal = (props: EuiModalProps) => {
>
);
};
-
-const StatefulFormModal = (props: EuiModalProps) => {
- const { children, ...rest } = props;
- const [isOpen, setIsOpen] = useState(true);
- const modalFormId = useGeneratedHtmlId({ prefix: 'modalForm' });
- const modalTitleId = useGeneratedHtmlId();
-
- const handleOnClose = () => setIsOpen(false);
-
- return (
- <>
- setIsOpen(!isOpen)}>
- Toggle Modal
-
- {isOpen && (
- {
- setIsOpen(false);
- onClose(...args);
- }}
- >
-
-
- Modal title
-
-
-
-
-
-
-
-
- Cancel
-
-
- Save
-
-
-
- )}
- >
- );
-};
-
-const ExampleForm = ({ id }: Partial) => {
- const modalFormSwitchId = useGeneratedHtmlId({ prefix: 'modalFormSwitch' });
-
- const [isSwitchChecked, setIsSwitchChecked] = useState(true);
- const onSwitchChange = () =>
- setIsSwitchChecked((isSwitchChecked) => !isSwitchChecked);
-
- return (
-
-
-
-
-
-
-
-
-
- );
-};
diff --git a/src/components/overlay_mask/overlay_mask.stories.tsx b/src/components/overlay_mask/overlay_mask.stories.tsx
index e64685f5412..76199096d1a 100644
--- a/src/components/overlay_mask/overlay_mask.stories.tsx
+++ b/src/components/overlay_mask/overlay_mask.stories.tsx
@@ -31,9 +31,9 @@ type Story = StoryObj;
export const Playground: Story = {
render: (args) => (
-
+ <>
-
+ >
),
};