/** * @license * Copyright 2023 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import '@material/web/button/filled-button.js'; import '@material/web/button/filled-tonal-button.js'; import '@material/web/button/text-button.js'; import '@material/web/dialog/dialog.js'; import '@material/web/icon/icon.js'; import '@material/web/iconbutton/icon-button.js'; import '@material/web/radio/radio.js'; import '@material/web/textfield/filled-text-field.js'; import {MdDialog} from '@material/web/dialog/dialog.js'; import {MaterialStoryInit} from './material-collection.js'; import {css, html, nothing} from 'lit'; /** Knob types for dialog stories. */ export interface StoryKnobs { quick: boolean; noFocusTrap: boolean; icon: string; headline: string; supportingText: string; } function showDialog(event: Event) { ((event.target as Element).nextElementSibling as MdDialog)?.show(); } const standard: MaterialStoryInit = { name: 'Dialog', render({icon, headline, supportingText, quick, noFocusTrap}) { return html` Open ${icon ? html`${icon}` : nothing}
${headline}
${supportingText}
Close OK
`; }, }; const alert: MaterialStoryInit = { name: 'Alert', render({quick, noFocusTrap}) { return html` Alert
Alert dialog
This is a standard alert dialog. Alert dialogs interrupt users with urgent information, details, or actions.
OK
`; }, }; const confirm: MaterialStoryInit = { name: 'Confirm', render({quick, noFocusTrap}) { return html` Confirm
Permanently delete?
delete_outline
Deleting the selected photos will also remove them from all synced devices.
Delete Cancel
`; }, }; const choose: MaterialStoryInit = { name: 'Choose', styles: css` label { display: flex; align-items: center; } `, render({quick, noFocusTrap}) { return html` Choice
Choose your favorite pet
Cancel OK
`; }, }; const contacts: MaterialStoryInit = { name: 'Form', styles: css` .contacts { min-width: calc(100vw - 212px); } .contacts [slot='header'] { display: flex; flex-direction: row-reverse; align-items: center; } .contacts .headline { flex: 1; } .contact-content, .contact-row { display: flex; gap: 8px; } .contact-content { flex-direction: column; } .contact-row > * { flex: 1; } `, render({quick, noFocusTrap}) { return html` Form close Create new contact
Reset
Cancel Save
`; }, }; const floatingSheet: MaterialStoryInit = { name: 'Floating sheet', render({quick, noFocusTrap}) { return html` Floating sheet Floating Sheet close
This is a floating sheet with title. Floating sheets offer no action buttons at the bottom, but there's a close icon button at the top right. They accept any HTML content.
`; }, }; /** Dialog stories. */ export const stories = [ standard, alert, confirm, choose, contacts, floatingSheet, ];