diff --git a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-colorblind-linux.png b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-colorblind-linux.png index 19b1b7fbf61..c13c6f4cda0 100644 Binary files a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-colorblind-linux.png and b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-dimmed-linux.png b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-dimmed-linux.png index 35c5f837506..e6b97a9086d 100644 Binary files a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-dimmed-linux.png and b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-dimmed-linux.png differ diff --git a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-high-contrast-linux.png b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-high-contrast-linux.png index 5c10e00039f..382d869458a 100644 Binary files a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-high-contrast-linux.png and b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-linux.png b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-linux.png index 13aa1d17aa1..decce7e7b5e 100644 Binary files a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-linux.png and b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-linux.png differ diff --git a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-tritanopia-linux.png b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-tritanopia-linux.png index 52530c24adb..c13c6f4cda0 100644 Binary files a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-tritanopia-linux.png and b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-tritanopia-linux.png differ diff --git a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-colorblind-linux.png b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-colorblind-linux.png index ae85e989d4d..afaa32035d2 100644 Binary files a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-colorblind-linux.png and b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-colorblind-linux.png differ diff --git a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-high-contrast-linux.png b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-high-contrast-linux.png index 2289933e281..b0db00aacbd 100644 Binary files a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-high-contrast-linux.png and b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-high-contrast-linux.png differ diff --git a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-linux.png b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-linux.png index 2b32e3ff969..4ac8a8c43dd 100644 Binary files a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-linux.png and b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-linux.png differ diff --git a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-tritanopia-linux.png b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-tritanopia-linux.png index 18c46ea59b0..afaa32035d2 100644 Binary files a/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-tritanopia-linux.png and b/.playwright/snapshots/components/Dialogv1.test.ts-snapshots/Dialogv1-Default-light-tritanopia-linux.png differ diff --git a/src/Dialog.stories.tsx b/src/Dialog.stories.tsx index d085e9271fb..a637cbb2b94 100644 --- a/src/Dialog.stories.tsx +++ b/src/Dialog.stories.tsx @@ -1,145 +1,37 @@ -import React, {useState, useRef, useCallback} from 'react' +import React, {useState, useRef} from 'react' import {Meta} from '@storybook/react' - -import {BaseStyles, ThemeProvider} from '.' import {Button} from './Button' -import {Dialog, DialogWidth, DialogHeight} from './Dialog/Dialog' +import {Box, Text} from '.' +import {default as Dialog} from './Dialog' -/* Dialog Version 1? */ +/* Dialog Version 1*/ export default { title: 'Components/DialogV1', component: Dialog, - decorators: [ - Story => { - // Since portal roots are registered globally, we need this line so that each storybook - // story works in isolation. - return ( - - - - - - ) - }, - ], - args: { - width: 'xlarge', - height: 'auto', - subtitle: true, - }, - argTypes: { - width: { - control: { - type: 'radio', - }, - options: ['small', 'medium', 'large', 'xlarge'], - }, - height: { - control: { - type: 'radio', - }, - options: ['small', 'large', 'auto'], - }, - subtitle: { - name: 'show subtitle', - control: { - type: 'boolean', - }, - }, - title: {table: {disable: true}}, - - renderHeader: {table: {disable: true}}, - renderBody: {table: {disable: true}}, - renderFooter: {table: {disable: true}}, - onClose: {table: {disable: true}}, - role: {table: {disable: true}}, - ref: {table: {disable: true}}, - key: {table: {disable: true}}, - footerButtons: {table: {disable: true}}, - }, } as Meta -const lipsum = ( -
-

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sollicitudin mauris maximus elit sagittis, nec - lobortis ligula elementum. Nam iaculis, urna nec lobortis posuere, eros urna venenatis eros, vel accumsan turpis - nunc vitae enim. Maecenas et lorem lectus. Vivamus iaculis tortor eget ante placerat, nec posuere nisl tincidunt. - Cras condimentum ante in accumsan ultricies. Morbi quis porta est, sit amet congue augue. Lorem ipsum dolor sit - amet, consectetur adipiscing elit. Ut consequat nunc id quam tempus, id tincidunt neque venenatis. Mauris - fringilla tempor est, vitae fermentum enim elementum vitae. Nullam eleifend odio ut porta efficitur. Phasellus - luctus tempus posuere. -

- -

- Curabitur scelerisque bibendum faucibus. Duis rhoncus nunc est, at pharetra eros tristique a. Nam sodales turpis - lectus, quis faucibus felis fermentum in. Curabitur vel velit vel eros laoreet pharetra. Aenean in facilisis - sapien, eu porttitor ex. Donec ultrices ac arcu ut lobortis. Pellentesque vitae rutrum orci. Etiam pretium et enim - sit amet scelerisque. Nulla sed odio nec lorem dapibus condimentum at sagittis quam. Sed in ornare ex, sed luctus - sem. Mauris a est tellus. -

- -

- Sed fringilla est ac urna aliquet, eget condimentum felis vulputate. Sed sagittis eros non mauris sodales - molestie. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Nullam ante leo, - condimentum sed lectus non, rutrum octopodes urna. Mauris neque ante, interdum molestie tellus pharetra, eleifend - dapibus justo. Sed at diam ligula. Donec dapibus ipsum quis elit euismod, sed suscipit eros euismod. Aliquam - pretium felis quis risus luctus fringilla. Ut purus lacus, mattis a turpis eget, sollicitudin pellentesque neque. -

- -

- Nunc sodales quis ante quis porttitor. Vestibulum ornare lacinia ante. Donec a nisi nec arcu aliquam pretium in - nec nunc. Donec fringilla erat vitae viverra feugiat. Sed non odio vel ipsum porttitor maximus. Donec id eleifend - lectus. Proin varius felis sit amet neque eleifend, vitae porttitor ligula commodo. -

- -

- Vivamus felis quam, porttitor a justo sit amet, placerat ultricies nisl. Suspendisse potenti. Maecenas non - consequat lorem, eu porta ante. Pellentesque elementum diam sapien, nec ultrices risus convallis eget. Nam - pharetra dolor at dictum tempor. Quisque ut est a ligula hendrerit sodales. Curabitur ornare a nulla in laoreet. - Maecenas semper mi egestas, dignissim nisi et, elementum neque. -

-
-) -interface DialogStoryProps { - width: DialogWidth - height: DialogHeight - subtitle: boolean -} -export const Default = ({width, height, subtitle}: DialogStoryProps) => { +export const Default = () => { const [isOpen, setIsOpen] = useState(false) - const [secondOpen, setSecondOpen] = useState(false) - const buttonRef = useRef(null) - const onDialogClose = useCallback(() => setIsOpen(false), []) - const onSecondDialogClose = useCallback(() => setSecondOpen(false), []) - const openSecondDialog = useCallback(() => setSecondOpen(true), []) + const returnFocusRef = useRef(null) return ( - <> - - {isOpen && ( - - {lipsum} - {secondOpen && ( - - Hello world - - )} - - )} - + setIsOpen(false)} + aria-labelledby="header" + > +
+ Title + + Some content + +
+
+ ) } diff --git a/src/Dialog/Dialog.test.tsx b/src/__tests__/Dialog.test.tsx similarity index 100% rename from src/Dialog/Dialog.test.tsx rename to src/__tests__/Dialog.test.tsx diff --git a/src/Dialog/__snapshots__/Dialog.test.tsx.snap b/src/__tests__/__snapshots__/Dialog.test.tsx.snap similarity index 100% rename from src/Dialog/__snapshots__/Dialog.test.tsx.snap rename to src/__tests__/__snapshots__/Dialog.test.tsx.snap