diff --git a/.changeset/real-bananas-beam.md b/.changeset/real-bananas-beam.md new file mode 100644 index 0000000..d85d424 --- /dev/null +++ b/.changeset/real-bananas-beam.md @@ -0,0 +1,5 @@ +--- +"water.css": minor +--- + +Add styles for element diff --git a/docs/index.html b/docs/index.html index af367c9..850c60f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -278,6 +278,27 @@

Lorem ipsum dolor sit blah blah.

+

The dialog (form, and menu) tag

+ +
+ + +
+ + +
This is a sample dialog
+
+

What is your favorite pet animal?

+ + + + + +
+
+

Typography

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque dictum hendrerit velit, quis diff --git a/docs/script.js b/docs/script.js index 6f7e5ac..fb821c0 100644 --- a/docs/script.js +++ b/docs/script.js @@ -77,3 +77,12 @@ copyButton.addEventListener('click', () => { .catch(() => { copyButtonFeedback.textContent = '❌' }) .then(() => setTimeout(() => { copyButtonFeedback.textContent = '' }, 1000)) }) + +document.getElementById('dialog-trigger').addEventListener('click', () => { + document.getElementById('dialog-result').innerText = '' + document.getElementById('dialog').showModal() +}) + +document.getElementById('dialog').addEventListener('close', (event) => { + document.getElementById('dialog-result').innerText = `Your answer: ${event.target.returnValue}` +}) diff --git a/src/parts/_misc.css b/src/parts/_misc.css index 6bbe92d..aa01272 100644 --- a/src/parts/_misc.css +++ b/src/parts/_misc.css @@ -109,6 +109,28 @@ summary::-webkit-details-marker { color: var(--text-main); } +dialog { + background-color: var(--background-alt); + color: var(--text-main); + border: none; + border-radius: 6px; + border-color: var(--border); + padding: 10px 30px; +} + +dialog > header:first-child { + background-color: var(--background); + border-radius: 6px 6px 0 0; + margin: -10px -30px 10px; + padding: 10px; + text-align: center; +} + +dialog::backdrop { + background: #0000009c; + backdrop-filter: blur(4px); +} + footer { border-top: 1px solid var(--border); padding-top: 10px;