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

Web Component Dialog #28569

Merged
Changes from 1 commit
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
7f9af9e
radio init
brianchristopherbrady Mar 3, 2023
70c55e0
styles radio
brianchristopherbrady Mar 3, 2023
f3cb7f4
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Mar 3, 2023
a72d10f
reverts branch
brianchristopherbrady Mar 3, 2023
2941fa7
Merge branch 'web-components-v3' of https://github.com/brianchristoph…
brianchristopherbrady Mar 3, 2023
9b350fc
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Mar 20, 2023
2cf59ce
input spec init
brianchristopherbrady Mar 20, 2023
79b6bff
cleans up spec
brianchristopherbrady Mar 20, 2023
5558b93
formatting
brianchristopherbrady Mar 20, 2023
3c045c3
updates component name to text input
brianchristopherbrady Mar 20, 2023
2370967
updates component name in spec
brianchristopherbrady Mar 20, 2023
9c4eb6b
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Mar 27, 2023
056b82e
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Apr 24, 2023
196ed30
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady May 9, 2023
2a9ae23
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady May 22, 2023
677a59c
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Jun 6, 2023
17819f9
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Jun 28, 2023
c6d99b9
dialog init
brianchristopherbrady Jul 18, 2023
8e367ef
dialog: updates stories, styles, and docs
brianchristopherbrady Jul 18, 2023
7e6a240
dialog: updates styles
brianchristopherbrady Jul 18, 2023
bd041b9
dialog: removes dead code, cleans up
brianchristopherbrady Jul 18, 2023
133f49b
dialog: updates styles
brianchristopherbrady Jul 19, 2023
7e3aeae
updates docs
brianchristopherbrady Jul 19, 2023
91dd5a0
deletes dead code
brianchristopherbrady Aug 3, 2023
d04442e
dialog: addresses PR feedback
brianchristopherbrady Aug 3, 2023
514f6b6
reverts dead file
brianchristopherbrady Aug 3, 2023
ac4a4c8
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Aug 9, 2023
6bdf6b7
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Aug 14, 2023
6a22421
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Aug 14, 2023
e5a9dbf
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Aug 15, 2023
9e40250
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Aug 18, 2023
807ba7c
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Aug 21, 2023
31c68ca
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Aug 21, 2023
194d786
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Aug 21, 2023
559953f
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Aug 21, 2023
8359b57
dialog: updates styles per feedback
brianchristopherbrady Aug 21, 2023
abd7b44
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Aug 23, 2023
e1a41f5
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Aug 24, 2023
45707f0
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Aug 28, 2023
3d57319
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Sep 18, 2023
321a8f1
Merge branch 'web-components-v3' into user/brianbrady/web-component-d…
brianchristopherbrady Sep 19, 2023
b7d6c59
drawer: updates template, styles
brianchristopherbrady Sep 19, 2023
344eca2
dialog: removes attr changed callback
brianchristopherbrady Sep 19, 2023
99fd3e3
dialog: updates slot names for react parity, updates docs
brianchristopherbrady Sep 19, 2023
c024a16
Merge branch 'web-components-v3' into user/brianbrady/web-component-d…
brianchristopherbrady Oct 2, 2023
51e5374
yarn change
brianchristopherbrady Oct 2, 2023
22c1726
Merge branch 'user/brianbrady/web-component-dialog' of https://github…
brianchristopherbrady Oct 2, 2023
113a05e
dialog: addresses feedback
brianchristopherbrady Oct 3, 2023
ccfde13
dialog: updates README
brianchristopherbrady Oct 3, 2023
f5659df
dialog: fixes responsive styles
brianchristopherbrady Oct 3, 2023
01049a8
Merge branch 'microsoft:web-components-v3' into web-components-v3
brianchristopherbrady Oct 10, 2023
a41f491
dialog: removes dead styles
brianchristopherbrady Oct 10, 2023
2526272
dialog: updates readme docs
brianchristopherbrady Oct 10, 2023
7a8246c
dialog: reworks dialog to use navtive html dialog element
brianchristopherbrady Oct 13, 2023
7c69db7
dialog: fixes jsdoc
brianchristopherbrady Oct 13, 2023
1dcfd48
dialog: updates slot names for closer parity with fv9, updates storie…
brianchristopherbrady Oct 23, 2023
bf6bf37
dialog: updates README
brianchristopherbrady Oct 23, 2023
0e78c12
dialog: updates template class names
brianchristopherbrady Oct 23, 2023
71b0a23
dialog: updates backdrop to use fluent token
brianchristopherbrady Oct 23, 2023
4ae3e62
dialog: adds two column layout story
brianchristopherbrady Oct 23, 2023
6f01f6c
dialog: adds additional stories
brianchristopherbrady Oct 23, 2023
573d511
dialog: adds exports to index and package json
brianchristopherbrady Oct 23, 2023
d06797a
Merge branch 'web-components-v3' into user/brianbrady/web-component-d…
brianchristopherbrady Oct 23, 2023
3f096ad
Merge branch 'web-components-v3' into user/brianbrady/web-component-d…
brianchristopherbrady Oct 24, 2023
e238714
Merge branch 'user/brianbrady/web-component-dialog' of https://github…
brianchristopherbrady Oct 24, 2023
93a3263
dialog: fixes style token imports
brianchristopherbrady Oct 24, 2023
6b1d7e4
dialog: cleans up open state
brianchristopherbrady Oct 24, 2023
e8823ba
dialog: updates template slot names
brianchristopherbrady Oct 24, 2023
614cfdd
dialog: updates property name
brianchristopherbrady Oct 24, 2023
7ded032
dialog: removes change-focus
brianchristopherbrady Oct 24, 2023
975da6e
dialog: syncs open attr
brianchristopherbrady Oct 24, 2023
bd5b13c
dialog: sync open attribute
brianchristopherbrady Oct 24, 2023
0a7ddc4
dialog: updates storybook docs
brianchristopherbrady Oct 24, 2023
25b97ae
dialog: updates readme docs
brianchristopherbrady Oct 24, 2023
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
Prev Previous commit
Next Next commit
dialog: fixes style token imports
  • Loading branch information
brianchristopherbrady committed Oct 24, 2023
commit 93a32630c01f7e73d4f1228d6fc7ab39922dee4a
59 changes: 42 additions & 17 deletions packages/web-components/src/dialog/dialog.stories.ts
Original file line number Diff line number Diff line change
@@ -52,14 +52,12 @@ const openDialog = (e: Event, id: string) => {

const openDialogControlled = (e: Event, id: string) => {
const dialog = document.getElementById(id) as FluentDialog;
dialog.open = true;
dialog.show();
dialog.setAttribute('open', '');
};

const closeDialogControlled = (e: Event, id: string) => {
const dialog = document.getElementById(id) as FluentDialog;
dialog.open = false;
dialog.hide();
dialog.removeAttribute('open');
};

const dialogTemplate = html<DialogStoryArgs>`
@@ -70,7 +68,12 @@ const dialogTemplate = html<DialogStoryArgs>`
</style>
<div>
<fluent-button @click=${(e: Event, c) => openDialog(e, 'dialog-default')}>Open Dialog</fluent-button>
<fluent-dialog id="dialog-default" modal-type="${x => x.modalType}">
<fluent-dialog
id="dialog-default"
modal-type="${x => x.modalType}"
?no-title-action="${x => x.noTitleAction}"
change-focus="${x => x.changeFocus}"
>
<fluent-text slot="title">Dialog</fluent-text>
<fluent-text as="p" weight="regular" block>
<p>
@@ -80,14 +83,14 @@ const dialogTemplate = html<DialogStoryArgs>`
</fluent-text>
<br />
<fluent-text block><code>fluent-dialog</code></fluent-text>

<fluent-button
id="dialog-default-close"
slot="footer-action"
appearance="primary"
@click="${(e: Event, c) => closeDialog(e, 'dialog-default')}"
>Close Dialog</fluent-button
>
<fluent-button slot="footer-action" tabindex="0">Do Something</fluent-button>
<fluent-button id="dialog-default-dosomething" slot="footer-action" tabindex="0">Do Something</fluent-button>
</fluent-dialog>
</div>
`;
@@ -98,16 +101,6 @@ export default {
modalType: DialogModalType.modal,
},
argTypes: {
open: {
description: 'Controls the open state of the dialog',
table: {
defaultValue: { summary: false },
},
},
onOpenChange: {
description:
'Event fired when the component transitions from its open state.<br /><br /><code>event</code>: A CustomEvent emitted when the open state changes.<br /><br /> <code>detail</code>: An object containing relevant information, such as the open value and the type of interaction that triggered the event.',
},
modalType: {
description:
'<code>modal</code>: When this type of dialog is open, the rest of the page is dimmed out and cannot be interacted with. The tab sequence is kept within the dialog and moving the focus outside the dialog will imply closing it. This is the default type of the component.<br /><br /><code>non-modal</code>: When a non-modal dialog is open, the rest of the page is not dimmed out and users can interact with the rest of the page. This also implies that the tab focus can move outside the dialog when it reaches the last focusable element.<br /><br /><code>alert</code>: A special type of modal dialog that interrupts the users workflow to communicate an important message or ask for a decision. Unlike a typical modal dialog, the user must take an action through the options given to dismiss the dialog, and it cannot be dismissed through the dimmed background.',
@@ -120,6 +113,38 @@ export default {
},
defaultValue: DialogModalType.modal,
},
changeFocus: {
description: 'Used to set the id of the element that should receive focus when the dialog is opened',
table: {
defaultValue: { summary: 'undefined' },
},
control: {
type: 'select',
options: ['dialog-default-close', 'dialog-default-dosomething'],
},
defaultValue: undefined,
},
noTitleAction: {
description:
'Used to opt out of rendering the default title action that is rendered when the dialog <code>type</code>is set to <code>non-modal</code>',
table: {
defaultValue: { summary: false },
},
control: {
type: 'boolean',
},
defaultValue: false,
},
open: {
description: 'Controls the open state of the dialog',
table: {
defaultValue: { summary: false },
},
},
onOpenChange: {
description:
'Event fired when the component transitions from its open state.<br /><br /><code>event</code>: A CustomEvent emitted when the open state changes.<br /><br /> <code>detail</code>: An object containing relevant information, such as the open value and the type of interaction that triggered the event.',
},
},
} as DialogStoryMeta;

12 changes: 8 additions & 4 deletions packages/web-components/src/dialog/dialog.styles.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation';
import {
borderRadiusXLarge,
colorBackgroundOverlay,
@@ -17,16 +19,18 @@ import {
spacingVerticalS,
spacingVerticalXXL,
strokeWidthThin,
} from '@fluentui/web-components';
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation';
} from '../theme/design-tokens.js';

/** Dialog styles
* @public
*/
export const styles = css`
${display('flex')}

:host {
--dialog-backdrop: ${colorBackgroundOverlay};
}

dialog {
background: ${colorNeutralBackground1};
border: ${strokeWidthThin} solid ${colorTransparentStroke};
@@ -45,7 +49,7 @@ export const styles = css`
}

dialog::backdrop {
background: ${colorBackgroundOverlay};
background: var(--dialog-backdrop, rgba(0, 0, 0, 0.4));
}

.root {