From d5f014b2addf2b8bd7eb7d1faef2365b05fd3c2b Mon Sep 17 00:00:00 2001 From: Carlos Lopez Jr Date: Thu, 10 Oct 2024 14:21:16 -0400 Subject: [PATCH] feat(dialog): support unpadded content --- components/Dialog.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/components/Dialog.js b/components/Dialog.js index 069d7646..8e42719c 100644 --- a/components/Dialog.js +++ b/components/Dialog.js @@ -133,13 +133,12 @@ export default CustomElement confirmAutoFocus({ default: d }) { return d === 'confirm'; }, }) .html` -
+
{headline} -
-
+
@@ -149,15 +148,17 @@ export default CustomElement
` - .recompose(({ refs: { prepend, append, dialog, slot } }) => { + .recompose(({ refs: { dialog, dialogInner, content, slot } }) => { dialog.setAttribute('aria-labelledby', 'headline'); dialog.setAttribute('aria-describedby', 'slot'); + + // Use content slot as content + // Use default slot as padded content slot.classList.add('content'); + content.append(slot); - dialog.prepend(...prepend.childNodes); - dialog.append(...append.childNodes); - prepend.remove(); - append.remove(); + dialog.prepend(...dialogInner.childNodes); + dialogInner.remove(); }) .css` /* https://m3.material.io/components/dialogs/specs */