django-unfold 0.53.0__py3-none-any.whl → 0.54.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
unfold/styles.css CHANGED
@@ -264,12 +264,13 @@ table tr.selected th {
264
264
  @apply hidden;
265
265
  }
266
266
 
267
+ .tabular-table tbody.has_original,
267
268
  .tabular-table .template tr {
268
269
  @apply border-t border-base-200 dark:border-base-800;
269
270
  }
270
271
 
271
272
  .add-row {
272
- @apply align-middle bg-base-50 px-3 py-5 font-normal text-right dark:bg-white/[.02];
273
+ @apply align-middle bg-white px-3 py-5 font-normal text-right dark:bg-base-900;
273
274
  }
274
275
 
275
276
  [data-inline-type="stacked"] .add-row {
@@ -74,21 +74,23 @@
74
74
  {% include cl.model_admin.list_before_template %}
75
75
  {% endif %}
76
76
 
77
- <div class="flex flex-col gap-4 mb-4 sm:flex-row empty:hidden lg:border lg:border-base-200 lg:dark:border-base-800 lg:-mb-8 lg:p-3 lg:pb-11 lg:rounded-t">
78
- {% block search %}
79
- {% search_form cl %}
80
- {% endblock %}
77
+ {% spaceless %}
78
+ <div class="flex flex-col gap-4 mb-4 sm:flex-row empty:hidden lg:border lg:border-base-200 lg:dark:border-base-800 lg:-mb-8 lg:p-3 lg:pb-11 lg:rounded-t">
79
+ {% block search %}
80
+ {% search_form cl %}
81
+ {% endblock %}
81
82
 
82
- {% block filters %}
83
- {% if cl.has_filters %}
84
- <a class="{% if cl.has_active_filters %}bg-primary-600 border-primary-600 text-white{% else %}bg-white border-base-200 hover:text-primary-600 dark:bg-base-900 dark:border-base-700 dark:hover:text-primary-500{% endif %} border cursor-pointer flex font-medium gap-2 group items-center px-3 py-2 rounded shadow-sm text-sm lg:ml-auto md:mt-0 {% if not cl.model_admin.list_filter_sheet %}2xl:hidden{% endif %}" x-on:click="filterOpen = true" x-on:keydown.escape.window="filterOpen = false">
85
- {% trans "Filters" %}
83
+ {% block filters %}
84
+ {% if cl.has_filters %}
85
+ <a class="{% if cl.has_active_filters %}bg-primary-600 border-primary-600 text-white{% else %}bg-white border-base-200 hover:text-primary-600 dark:bg-base-900 dark:border-base-700 dark:hover:text-primary-500{% endif %} border cursor-pointer flex font-medium gap-2 group items-center px-3 py-2 rounded shadow-sm text-sm lg:ml-auto md:mt-0 {% if not cl.model_admin.list_filter_sheet %}2xl:hidden{% endif %}" x-on:click="filterOpen = true" x-on:keydown.escape.window="filterOpen = false">
86
+ {% trans "Filters" %}
86
87
 
87
- <span class="material-symbols-outlined md-18 ml-auto">filter_list</span>
88
- </a>
89
- {% endif %}
90
- {% endblock %}
91
- </div>
88
+ <span class="material-symbols-outlined md-18 ml-auto">filter_list</span>
89
+ </a>
90
+ {% endif %}
91
+ {% endblock %}
92
+ </div>
93
+ {% endspaceless %}
92
94
 
93
95
  <form id="changelist-form" class="group" method="post"{% if cl.formset and cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %} novalidate>
94
96
  {% csrf_token %}
@@ -100,7 +100,7 @@
100
100
 
101
101
  {% if cl.model_admin.list_sections|length > 0 %}
102
102
  <tr class="block mb-3 lg:table-row" x-show="rowOpen">
103
- <td colspan="{{ result|length|add:1 }}" class="border bg-base-200/10 block border-base-200 relative rounded p-3 lg:shadow-inner lg:border-0 lg:border-t lg:rounded-none lg:table-cell dark:border-base-800">
103
+ <td colspan="{{ result|length|add:2 }}" class="border bg-base-200/10 block border-base-200 relative rounded p-3 lg:shadow-inner lg:border-0 lg:border-t lg:rounded-none lg:table-cell dark:border-base-800">
104
104
  <div class="absolute bg-primary-600 h-full hidden left-0 top-0 w-0.5 lg:block"></div>
105
105
 
106
106
  <div class="grid gap-3 {{ cl.model_admin.list_sections_classes }}">
@@ -18,9 +18,8 @@
18
18
  {% if inline_admin_formset.is_collapsible %}</summary>{% endif %}
19
19
 
20
20
  {{ inline_admin_formset.formset.non_form_errors }}
21
-
22
21
  <div class="border border-base-200 mb-6 overflow-x-auto rounded shadow-sm dark:border-base-800" data-simplebar data-simplebar-auto-hide="false">
23
- <table class="tabular-table w-full" {% if inline_admin_formset.opts.ordering_field %}data-ordering-field="{{ inline_admin_formset.opts.ordering_field }}" x-on:end="sortRecords" x-sort.ghost{% endif %}>
22
+ <table class="tabular-table w-full [&>tbody:nth-child(odd)]:bg-base-50 [&>tbody:nth-child(odd)]:dark:bg-white/[.02]" {% if inline_admin_formset.opts.ordering_field %}data-ordering-field="{{ inline_admin_formset.opts.ordering_field }}" x-on:end="sortRecords" x-sort.ghost{% endif %}>
24
23
  {% include "unfold/helpers/edit_inline/tabular_heading.html" %}
25
24
 
26
25
  {% for inline_admin_form in inline_admin_formset %}
@@ -5,7 +5,7 @@
5
5
  <th></th>
6
6
 
7
7
  {% for header in data.headers %}
8
- <th class="font-normal px-3 pb-2.5 text-left ">
8
+ <th class="font-normal px-3 pb-2.5 text-left">
9
9
  <div class="font-semibold text-font-important-light truncate dark:text-font-important-dark">
10
10
  {{ header.title }}
11
11
  </div>
@@ -25,7 +25,7 @@
25
25
  <tr class="h-full">
26
26
  <td>
27
27
  <div class="pr-3 py-2.5">
28
- <div class="font-semibold text-font-important-light dark:text-font-important-dark">
28
+ <div class="font-semibold text-font-important-light truncate dark:text-font-important-dark">
29
29
  {{ row.header.title }}
30
30
  </div>
31
31
 
@@ -10,8 +10,8 @@
10
10
  {% preserve_filters %}
11
11
  {% endif %}
12
12
 
13
- <div class="flex flex-col grow gap-4 overflow-auto *:mb-0" data-simplebar data-simplebar-direction="rtl">
14
- <div class="flex flex-col gap-4 mx-1 px-2 py-2.5 {% if not cl.model_admin.list_filter_sheet %} 2xl:px-0 2xl:py-0{% endif %} *:mb-0">
13
+ <div class="flex flex-col grow gap-4 overflow-auto *:mb-0 {% if not cl.model_admin.list_filter_sheet %}2xl:-mx-1{% endif %}" data-simplebar data-simplebar-direction="rtl">
14
+ <div class="flex flex-col gap-4 px-3 py-2.5 {% if not cl.model_admin.list_filter_sheet %}2xl:pb-1 2xl:px-1 2xl:py-0{% endif %} *:mb-0">
15
15
  {% for spec in cl.filter_specs %}
16
16
  {% admin_list_filter cl spec %}
17
17
  {% endfor %}
@@ -1,31 +1,33 @@
1
1
  {% load i18n %}
2
2
 
3
- <div class="bg-white border-t border-base-200 p-3 py-2.5 dark:bg-base-800 dark:border-base-700{% if not cl.model_admin.list_filter_sheet %} 2xl:!border-t-0 2xl:!bg-transparent 2xl:px-0{% endif %}">
4
- {% if cl.model_admin.list_filter_submit %}
5
- <button type="submit" class="bg-primary-600 block border border-transparent font-medium px-3 py-2 rounded text-white w-full">
6
- {% trans "Apply Filters" %}
7
- </button>
8
- {% endif %}
3
+ {% if cl.model_admin.list_filter_submit or cl.is_facets_optional or cl.has_active_filters %}
4
+ <div class="bg-white border-t border-base-200 p-3 py-2.5 dark:bg-base-800 dark:border-base-700{% if not cl.model_admin.list_filter_sheet %} 2xl:!border-t-0 2xl:!bg-transparent 2xl:px-0{% endif %}">
5
+ {% if cl.model_admin.list_filter_submit %}
6
+ <button type="submit" class="bg-primary-600 block border border-transparent font-medium px-3 py-2 rounded text-white w-full">
7
+ {% trans "Apply Filters" %}
8
+ </button>
9
+ {% endif %}
9
10
 
10
- {% if cl.is_facets_optional or cl.has_active_filters %}
11
- <span id="changelist-filter-extra-actions" class="flex flex-row gap-2 items-center mt-2">
12
- {% if cl.is_facets_optional %}
13
- {% if cl.add_facets %}
14
- <a href="{{ cl.remove_facet_link }}" class="hidelink border flex-grow font-medium px-3 py-2 rounded text-center transition-all w-full hover:bg-base-50 lg:w-auto dark:border-base-700 dark:hover:text-base-200">
15
- {% trans "Hide counts" %}
16
- </a>
17
- {% else %}
18
- <a href="{{ cl.add_facet_link }}" class="viewlink border flex-grow font-medium px-3 py-2 rounded text-center transition-all w-full lg:w-auto dark:border-base-700 dark:hover:text-base-200">
19
- {% trans "Show counts" %}
20
- </a>
11
+ {% if cl.is_facets_optional or cl.has_active_filters %}
12
+ <span id="changelist-filter-extra-actions" class="flex flex-row gap-2 items-center mt-2">
13
+ {% if cl.is_facets_optional %}
14
+ {% if cl.add_facets %}
15
+ <a href="{{ cl.remove_facet_link }}" class="hidelink border flex-grow font-medium px-3 py-2 rounded text-center transition-all w-full hover:bg-base-50 lg:w-auto dark:border-base-700 dark:hover:text-base-200">
16
+ {% trans "Hide counts" %}
17
+ </a>
18
+ {% else %}
19
+ <a href="{{ cl.add_facet_link }}" class="viewlink border flex-grow font-medium px-3 py-2 rounded text-center transition-all w-full lg:w-auto dark:border-base-700 dark:hover:text-base-200">
20
+ {% trans "Show counts" %}
21
+ </a>
22
+ {% endif %}
21
23
  {% endif %}
22
- {% endif %}
23
24
 
24
- {% if cl.has_active_filters %}
25
- <a href="{{ cl.clear_all_filters_qs }}" class="border flex-grow font-medium px-3 py-2 rounded text-center transition-all w-full lg:w-auto dark:border-base-700 dark:hover:text-base-200">
26
- {% trans "Clear all filters" %}
27
- </a>
28
- {% endif %}
29
- </span>
30
- {% endif %}
31
- </div>
25
+ {% if cl.has_active_filters %}
26
+ <a href="{{ cl.clear_all_filters_qs }}" class="border flex-grow font-medium px-3 py-2 rounded text-center transition-all w-full lg:w-auto dark:border-base-700 dark:hover:text-base-200">
27
+ {% trans "Clear all filters" %}
28
+ </a>
29
+ {% endif %}
30
+ </span>
31
+ {% endif %}
32
+ </div>
33
+ {% endif %}
@@ -12,14 +12,16 @@
12
12
  {% if field.is_readonly %}
13
13
  {% include "unfold/helpers/field_readonly_value.html" with tabular=1 %}
14
14
  {% else %}
15
- {{ field.field }}
15
+ <div class="flex flex-col">
16
+ {{ field.field }}
16
17
 
17
- {% if field.field.errors|length > 0 %}
18
- <div class="mt-1 text-red-600 text-sm dark:text-red-500">
19
- {% for error in field.field.errors %}
20
- {{ error }}
21
- {% endfor %}
22
- </div>
23
- {% endif %}
18
+ {% if field.field.errors|length > 0 %}
19
+ <div class="mt-1 text-red-600 text-sm dark:text-red-500">
20
+ {% for error in field.field.errors %}
21
+ {{ error }}
22
+ {% endfor %}
23
+ </div>
24
+ {% endif %}
25
+ </div>
24
26
  {% endif %}
25
27
  </div>
@@ -1,4 +1,6 @@
1
- {% if field.field.widget.input_type == "checkbox" %}
1
+ {% load unfold %}
2
+
3
+ {% if field.field.widget.input_type == "checkbox" and field.field.widget|class_name != "UnfoldAdminCheckboxSelectMultiple"%}
2
4
  <div class="{% if field.errors %}errors {% endif %}flex flex-col group mb-6 last:mb-4">
3
5
  <div class="flex flex-row gap-2 items-center">
4
6
  {{ field }}
@@ -11,7 +13,7 @@
11
13
  {% include "unfold/helpers/help_text.html" with help_text=field.help_text %}
12
14
  </div>
13
15
  {% else %}
14
- <div class="{% if field.errors %}errors {% endif %}flex flex-col group mb-6 last:mb-4">
16
+ <div class="{% if field.errors %}errors {% endif %}flex flex-col gap-2 group mb-6 last:mb-4">
15
17
  {% include "unfold/helpers/form_label.html" with field=field %}
16
18
 
17
19
  {{ field }}
@@ -1,4 +1,4 @@
1
- <label for="{{ field.id_for_label }}" class="block text-font-important-light dark:text-font-important-dark{% if field.field.widget.input_type == "checkbox" %}{% else %} font-semibold mb-2{% endif %}">
1
+ <label for="{{ field.id_for_label }}" class="block font-semibold text-font-important-light dark:text-font-important-dark">
2
2
  {{ field.label }}
3
3
 
4
4
  {% if field.field.required %}
@@ -15,8 +15,23 @@
15
15
  {{ title }}
16
16
 
17
17
  {% if not link %}
18
- <span class="material-symbols-outlined ml-auto rotate-90">
19
- chevron_right
18
+ <span class="border-l border-base-200 flex items-center select-none self-stretch ml-1 -mr-1 -my-2 pl-2
19
+ {% if action.variant.value == "primary" %}
20
+ border-primary-700 dark:border-primary-500
21
+ {% elif action.variant.value == "danger" %}
22
+ border-red-700 dark:border-red-500
23
+ {% elif action.variant.value == "success" %}
24
+ border-green-700 dark:border-green-500
25
+ {% elif action.variant.value == "info" %}
26
+ border-blue-700 dark:border-blue-500
27
+ {% elif action.variant.value == "warning" %}
28
+ border-orange-700 dark:border-orange-500
29
+ {% else %}
30
+ border-base-200 dark:border-base-700
31
+ {% endif %}">
32
+ <span class="material-symbols-outlined ml-auto rotate-90 transition-transform" x-bind:class="{'!-rotate-90': actionDropdownOpen }">
33
+ chevron_right
34
+ </span>
20
35
  </span>
21
36
  {% endif %}
22
37
  </a>
@@ -5,7 +5,7 @@
5
5
  {% include "django/forms/widgets/input.html" %}
6
6
 
7
7
  {% if widget.wrap_label %}
8
- <span>
8
+ <span class="truncate">
9
9
  {{ widget.label }}
10
10
  </span>
11
11
  </label>
@@ -438,41 +438,46 @@ def action_item_classes(context: Context, action: UnfoldAction) -> str:
438
438
  if variant == ActionVariant.PRIMARY:
439
439
  classes.extend(
440
440
  [
441
- "border-primary-600",
441
+ "border-primary-700",
442
442
  "bg-primary-600",
443
443
  "text-white",
444
+ "dark:border-primary-500",
444
445
  ]
445
446
  )
446
447
  elif variant == ActionVariant.DANGER:
447
448
  classes.extend(
448
449
  [
449
- "border-red-600",
450
+ "border-red-700",
450
451
  "bg-red-600",
451
452
  "text-white",
453
+ "dark:border-red-500",
452
454
  ]
453
455
  )
454
456
  elif variant == ActionVariant.SUCCESS:
455
457
  classes.extend(
456
458
  [
457
- "border-green-600",
459
+ "border-green-700",
458
460
  "bg-green-600",
459
461
  "text-white",
462
+ "dark:border-green-500",
460
463
  ]
461
464
  )
462
465
  elif variant == ActionVariant.INFO:
463
466
  classes.extend(
464
467
  [
465
- "border-blue-600",
468
+ "border-blue-700",
466
469
  "bg-blue-600",
467
470
  "text-white",
471
+ "dark:border-blue-500",
468
472
  ]
469
473
  )
470
474
  elif variant == ActionVariant.WARNING:
471
475
  classes.extend(
472
476
  [
473
- "border-orange-600",
477
+ "border-orange-700",
474
478
  "bg-orange-600",
475
479
  "text-white",
480
+ "dark:border-orange-500",
476
481
  ]
477
482
  )
478
483
  else:
@@ -480,6 +485,7 @@ def action_item_classes(context: Context, action: UnfoldAction) -> str:
480
485
  [
481
486
  "border-base-200",
482
487
  "hover:text-primary-600",
488
+ "dark:hover:text-primary-500",
483
489
  "dark:border-base-700",
484
490
  ]
485
491
  )
unfold/widgets.py CHANGED
@@ -146,6 +146,7 @@ CHECKBOX_CLASSES = [
146
146
  "border-base-300",
147
147
  "cursor-pointer",
148
148
  "h-4",
149
+ "min-w-4",
149
150
  "relative",
150
151
  "rounded-[4px]",
151
152
  "shadow-sm",
@@ -189,6 +190,7 @@ RADIO_CLASSES = [
189
190
  "border-base-300",
190
191
  "cursor-pointer",
191
192
  "h-4",
193
+ "min-w-4",
192
194
  "relative",
193
195
  "rounded-full",
194
196
  "w-4",