From 48c1da8b718cd1ceda5baee54df86d1b7c47c7ca Mon Sep 17 00:00:00 2001 From: PhilipdeRijk Date: Tue, 11 Nov 2025 19:02:13 +0100 Subject: [PATCH] Fix dialog overlay close on drag/click events --- src/jinja/dialog.html.jinja | 82 ++++++++++++++++--------------------- src/nunjucks/dialog.njk | 3 +- 2 files changed, 38 insertions(+), 47 deletions(-) diff --git a/src/jinja/dialog.html.jinja b/src/jinja/dialog.html.jinja index 1433ec5..ea01b93 100644 --- a/src/jinja/dialog.html.jinja +++ b/src/jinja/dialog.html.jinja @@ -1,58 +1,48 @@ {# - Renders a dialog component with optional trigger, header, body, and footer. +Renders a dialog component with optional trigger, header, body, and footer. - @param id {string} - Unique identifier for the dialog component. - @param trigger {string} [optional] - Text or HTML for the button that triggers the dialog. - @param title {string} [optional] - Title text displayed in the dialog header. - @param description {string} [optional] - Description text displayed below the title. - @param footer {string} [optional] - HTML content for the dialog footer. - @param main_attrs {object} [optional] - Additional HTML attributes for the main container div. - @param trigger_attrs {object} [optional] - Additional HTML attributes for the trigger button. - @param dialog_attrs {object} [optional] - Additional HTML attributes for the dialog content container. - @param header_attrs {object} [optional] - Additional HTML attributes for the dialog header. - @param body_attrs {object} [optional] - Additional HTML attributes for the dialog body section. - @param footer_attrs {object} [optional] - Additional HTML attributes for the dialog footer. - @param open {boolean} [optional] [default=false] - Whether the dialog should be open initially. - @param close_button {boolean} [optional] [default=true] - Whether to include a close button. - @param close_on_overlay_click {boolean} [optional] [default=true] - Whether clicking the overlay closes the dialog. +@param id {string} - Unique identifier for the dialog component. +@param trigger {string} [optional] - Text or HTML for the button that triggers the dialog. +@param title {string} [optional] - Title text displayed in the dialog header. +@param description {string} [optional] - Description text displayed below the title. +@param footer {string} [optional] - HTML content for the dialog footer. +@param main_attrs {object} [optional] - Additional HTML attributes for the main container div. +@param trigger_attrs {object} [optional] - Additional HTML attributes for the trigger button. +@param dialog_attrs {object} [optional] - Additional HTML attributes for the dialog content container. +@param header_attrs {object} [optional] - Additional HTML attributes for the dialog header. +@param body_attrs {object} [optional] - Additional HTML attributes for the dialog body section. +@param footer_attrs {object} [optional] - Additional HTML attributes for the dialog footer. +@param open {boolean} [optional] [default=false] - Whether the dialog should be open initially. +@param close_button {boolean} [optional] [default=true] - Whether to include a close button. +@param close_on_overlay_click {boolean} [optional] [default=true] - Whether clicking the overlay closes the dialog. #} {% macro dialog( - id=None, - trigger=None, - title=None, - description=None, - footer=None, - dialog_attrs={}, - trigger_attrs={}, - header_attrs={}, - body_attrs={}, - footer_attrs={}, - open=false, - close_button=true, - close_on_overlay_click=true +id=None, +trigger=None, +title=None, +description=None, +footer=None, +dialog_attrs={}, +trigger_attrs={}, +header_attrs={}, +body_attrs={}, +footer_attrs={}, +open=false, +close_button=true, +close_on_overlay_click=true ) %} {% set id = id or ("dialog-" + (range(100000, 999999) | random | string)) %} {% if trigger %} - {% endif %} - +
{% if title or description %}