From a2e9775a2c7e78e84eb469415a77a86d6e28530b Mon Sep 17 00:00:00 2001 From: Ronan Berder Date: Sun, 13 Jul 2025 10:39:13 +0800 Subject: [PATCH] Fixing minor bugs and starting work on carousel --- docs/src/assets/styles.css | 2 +- docs/src/components/carousel.njk | 102 +++++++++++++++++++++++++++++ docs/src/test.njk | 108 +++++++++++-------------------- src/css/basecoat.css | 2 +- src/jinja/dialog.html.jinja | 4 +- src/js/select.js | 14 ++-- src/nunjucks/dialog.njk | 4 +- 7 files changed, 152 insertions(+), 84 deletions(-) create mode 100644 docs/src/components/carousel.njk diff --git a/docs/src/assets/styles.css b/docs/src/assets/styles.css index de31d8f..f4bcd6f 100644 --- a/docs/src/assets/styles.css +++ b/docs/src/assets/styles.css @@ -4134,7 +4134,7 @@ pointer-events: none; visibility: hidden; position: absolute; - z-index: 50; + z-index: 60; width: fit-content; max-width: var(--container-xs); --tw-scale-x: 95%; diff --git a/docs/src/components/carousel.njk b/docs/src/components/carousel.njk new file mode 100644 index 0000000..27bd002 --- /dev/null +++ b/docs/src/components/carousel.njk @@ -0,0 +1,102 @@ +--- +layout: layouts/page.njk +title: Carousel +description: A carousel with motion and swipe. +toc: + - label: Usage + id: usage +--- + + + + +
+ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + +
+
+ 1 +
+
+ 2 +
+
+ 3 +
+
+ 4 +
+
+ 5 +
+
+ 6 +
+
+ 7 +
+
+ 8 +
+
+ 9 +
+
+
\ No newline at end of file diff --git a/docs/src/test.njk b/docs/src/test.njk index 4e32864..cae0a59 100644 --- a/docs/src/test.njk +++ b/docs/src/test.njk @@ -1,71 +1,39 @@ - - - - - - Anchor Positioning Test (Top, End) - - - - - - - -
- I should be anchored above the button, aligned to the right. -
- - - \ No newline at end of file +{% from "dialog.njk" import dialog %} +{% set footer %} + + +{% endset %} +{% call dialog( +id="demo-dialog-edit-profile", +title="Edit profile", +description="Make changes to your profile here. Click save when you're done.", +trigger="Edit Profile", +trigger_attrs={"class": "btn-outline"}, +dialog_attrs={"class": "w-full sm:max-w-[425px] max-h-[612px]"}, +footer=footer +) %} +
+{% from "select.njk" import select %} +{{ select( + trigger_attrs={"class": "w-[180px]"}, + is_combobox=true, + items=[ + { + type: "group", + label: "Fruits", + items: [ + { type: "item", value: "apple", label: "Apple" }, + { type: "item", value: "banana", label: "Banana" }, + { type: "item", value: "blueberry", label: "Blueberry" }, + { type: "item", value: "pineapple", label: "Grapes" }, + { type: "item", value: "pineapple", label: "Pineapple" } + ] + } + ] +) }} +
+{% endcall %} \ No newline at end of file diff --git a/src/css/basecoat.css b/src/css/basecoat.css index 886dd31..098f84d 100644 --- a/src/css/basecoat.css +++ b/src/css/basecoat.css @@ -1038,7 +1038,7 @@ @apply relative; &:before { - @apply absolute content-[attr(data-tooltip)] bg-primary text-primary-foreground z-50 truncate max-w-xs w-fit rounded-md px-3 py-1.5 text-xs invisible opacity-0 scale-95 transition-all pointer-events-none; + @apply absolute content-[attr(data-tooltip)] bg-primary text-primary-foreground z-[60] truncate max-w-xs w-fit rounded-md px-3 py-1.5 text-xs invisible opacity-0 scale-95 transition-all pointer-events-none; } &:hover:before { @apply visible opacity-100 scale-100; diff --git a/src/jinja/dialog.html.jinja b/src/jinja/dialog.html.jinja index acdbc18..26b8552 100644 --- a/src/jinja/dialog.html.jinja +++ b/src/jinja/dialog.html.jinja @@ -48,12 +48,12 @@ class="dialog {{ dialog_attrs.class }}" aria-labelledby="{{ id }}-title" {% if description %}aria-describedby="{{ id }}-description"{% endif %} - {% if close_on_overlay_click %}onclick="this.close()"{% endif %} + {% if close_on_overlay_click %}onclick="if (event.target === this) this.close()"{% endif %} {% for key, value in dialog_attrs.items() %} {% if key != 'class' %}{{ key }}="{{ value }}"{% endif %} {% endfor %} > -
+
{% if title or description %}
{ diff --git a/src/nunjucks/dialog.njk b/src/nunjucks/dialog.njk index a9537cb..7c6bf5f 100644 --- a/src/nunjucks/dialog.njk +++ b/src/nunjucks/dialog.njk @@ -48,12 +48,12 @@ class="dialog {{ dialog_attrs.class }}" aria-labelledby="{{ id }}-title" {% if description %}aria-describedby="{{ id }}-description"{% endif %} - {% if close_on_overlay_click %}onclick="this.close()"{% endif %} + {% if close_on_overlay_click %}onclick="if (event.target === this) this.close()"{% endif %} {% for key, value in dialog_attrs %} {% if key != 'class' %}{{ key }}="{{ value }}"{% endif %} {% endfor %} > -
+
{% if title or description %}