django-unfold 0.48.0__py3-none-any.whl → 0.49.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,13 @@
12
12
  {% endif %}
13
13
 
14
14
  {% for action in actions_submit_line %}
15
- <button type="submit" {% if not action.attrs.name %}name="{{ action.action_name }}"{% endif %} class="border border-base-200 font-medium px-3 py-2 rounded transition-all w-full hover:bg-base-50 lg:w-auto dark:border-base-700 dark:hover:text-base-200 dark:hover:bg-base-900" {% include "unfold/helpers/attrs.html" with attrs=action.attrs %}>
15
+ <button type="submit" {% if not action.attrs.name %}name="{{ action.action_name }}"{% endif %} class="border border-base-200 flex font-medium gap-2 items-center px-3 py-2 rounded transition-all w-full hover:bg-base-50 lg:w-auto dark:border-base-700 dark:hover:text-base-200 dark:hover:bg-base-900" {% include "unfold/helpers/attrs.html" with attrs=action.attrs %}>
16
+ {% if action.icon %}
17
+ <span class="material-symbols-outlined">
18
+ {{ action.icon }}
19
+ </span>
20
+ {% endif %}
21
+
16
22
  {{ action.description }}
17
23
  </button>
18
24
  {% endfor %}
@@ -4,15 +4,25 @@
4
4
  <td data-label="{% trans "More actions" %}" class="field-actions_holder align-middle flex border-t border-base-200 font-normal px-3 py-2 text-left text-sm before:block before:capitalize before:content-[attr(data-label)] before:mr-auto before:text-base-500 dark:before:text-base-300 lg:before:hidden lg:py-3 lg:table-cell dark:border-base-800 lg:w-px">
5
5
  {% with action_id=instance_pk|cut:"-" %}
6
6
  <div class="group/action leading-none relative" x-data="{ openActionsId{{ action_id }}: false }">
7
- <span x-ref="rowDropdown{{ action_id }}" class="cursor-pointer flex h-7 material-symbols-outlined md-18 -my-1 !leading-7 rounded text-center text-base-400 w-7 group-hover/action:bg-base-100 group-hover/action:text-base-700 dark:text-font-default-dark group-hover/action:dark:bg-base-800 group-hover/action:dark:text-white" @click="openActionsId{{ action_id }} = !openActionsId{{ action_id }}">
7
+ <span x-ref="rowDropdown{{ action_id }}" class="cursor-pointer flex h-7 material-symbols-outlined md-18 -my-1 !leading-7 rounded text-center text-base-400 w-7 group-hover/action:bg-base-100 group-hover/action:text-base-700 dark:text-font-default-dark group-hover/action:dark:bg-base-800 group-hover/action:dark:text-white"
8
+ x-on:click="openActionsId{{ action_id }} = !openActionsId{{ action_id }}"
9
+ x-bind:class="{'bg-base-100 text-base-700 dark:bg-base-800 dark:text-white': openActionsId{{ action_id }} }">
8
10
  more_horiz
9
11
  </span>
10
12
 
11
13
  <template x-teleport="body">
12
- <nav x-anchor.bottom-end.offset.4="$refs.rowDropdown{{ action_id }}" class="bg-white border flex flex-col leading-none py-1 rounded shadow-lg text-sm top-7 z-50 w-48 dark:bg-base-800 dark:border-base-700" x-cloak x-show="openActionsId{{ action_id }}" x-transition x-on:click.outside="openActionsId{{ action_id }} = false">
14
+ <nav x-anchor.bottom-end.offset.4="$refs.rowDropdown{{ action_id }}" class="bg-white border flex flex-col py-1 rounded shadow-lg text-sm top-7 z-50 w-48 dark:bg-base-800 dark:border-base-700" x-cloak x-show="openActionsId{{ action_id }}" x-transition x-on:click.outside="openActionsId{{ action_id }} = false">
13
15
  {% for action in actions %}
14
- <a href="{% url action.raw_path instance_pk %}" class="mx-1 px-3 py-2 rounded truncate hover:bg-base-100 dark:hover:bg-base-700 dark:hover:text-base-200"{% for attr_name, attr_value in action.attrs.items %} {{ attr_name }}="{{ attr_value }}"{% endfor %}>
15
- {{ action.title }}
16
+ <a href="{% url action.raw_path instance_pk %}" class="flex items-center gap-2 mx-1 px-3 py-2 max-h-[30px] rounded hover:bg-base-100 dark:hover:bg-base-700 dark:hover:text-base-200"{% for attr_name, attr_value in action.attrs.items %} {{ attr_name }}="{{ attr_value }}"{% endfor %}>
17
+ {% if action.icon %}
18
+ <span class="material-symbols-outlined">
19
+ {{ action.icon }}
20
+ </span>
21
+ {% endif %}
22
+
23
+ <span class="grow truncate">
24
+ {{ action.title }}
25
+ </span>
16
26
  </a>
17
27
  {% endfor %}
18
28
  </nav>
@@ -1,7 +1,10 @@
1
1
  <div class="border-b border-base-200 flex gap-3 items-center h-[65px] mb-5 dark:border-base-800 px-3" {% if site_dropdown %}x-data="{ openDropdown: false }"{% endif %}>
2
- <div class="bg-transparent border border-transparent flex font-semibold gap-3 grow -mx-px h-[48px] items-center px-3 {% if site_dropdown %}cursor-pointer rounded transition-all hover:bg-white hover:border-base-200 hover:shadow-sm hover:dark:bg-base-800 hover:dark:border-base-700{% endif %}"
3
- x-on:click="openDropdown = !openDropdown"
4
- x-bind:class="{'bg-white border-base-200 shadow-sm dark:bg-base-800 dark:border-base-700': openDropdown, 'bg-transparent border-transparent': !openDropdown}">
2
+ <div class="bg-transparent border border-transparent flex font-semibold gap-3 grow min-w-0 -mx-px h-[48px] items-center px-3 {% if site_dropdown %}cursor-pointer rounded transition-all hover:bg-white hover:border-base-200 hover:shadow-sm hover:dark:bg-base-800 hover:dark:border-base-700{% endif %}"
3
+ {% if site_dropdown %}
4
+ x-on:click="openDropdown = !openDropdown"
5
+ x-bind:class="{'bg-white border-base-200 shadow-sm dark:bg-base-800 dark:border-base-700': openDropdown, 'bg-transparent border-transparent': !openDropdown}"
6
+ {% endif %}
7
+ >
5
8
  {% if site_logo %}
6
9
  {% include "unfold/helpers/site_logo.html" %}
7
10
  {% elif branding %}
@@ -3,7 +3,7 @@
3
3
  {% if site_dropdown %}
4
4
  <div class="absolute bg-white border flex flex-col left-3 py-1 rounded shadow-lg top-[73px] w-[264px] z-50 dark:bg-base-800 dark:border-base-700" x-cloak x-show="openDropdown" x-transition x-on:click.outside="openDropdown = false">
5
5
  {% for item in site_dropdown %}
6
- <a href="{{ item.link }}" class="flex items-center gap-3 max-h-[30px] mx-1 px-2 py-2 rounded hover:bg-base-100 hover:text-base-700 dark:hover:bg-base-700 dark:hover:text-base-200">
6
+ <a href="{{ item.link }}" class="flex flex-row items-center gap-3 max-h-[30px] mx-1 px-2 py-2 rounded hover:bg-base-100 hover:text-base-700 dark:hover:bg-base-700 dark:hover:text-base-200">
7
7
  {% if item.icon %}
8
8
  <span class="material-symbols-outlined">
9
9
  {{ item.icon }}
@@ -1,28 +1,30 @@
1
1
  {% load i18n %}
2
2
 
3
3
  {% if site_icon %}
4
- <a href="{% url "admin:index" %}">
5
- {% if site_icon.light and site_icon.dark %}
6
- <img src="{{ site_icon.dark }}" alt="{% trans 'Home' %}" class="h-8 hidden dark:block"/>
4
+ <div class="shrink-0">
5
+ <a href="{% url "admin:index" %}">
6
+ {% if site_icon.light and site_icon.dark %}
7
+ <img src="{{ site_icon.dark }}" alt="{% trans 'Home' %}" class="h-8 hidden dark:block"/>
7
8
 
8
- <img src="{{ site_icon.light }}" alt="{% trans 'Home' %}" class="block h-8 dark:hidden" />
9
- {% else %}
10
- <img src="{{ site_icon }}" class="h-8" alt="{% trans 'Home' %}" />
11
- {% endif %}
12
- </a>
9
+ <img src="{{ site_icon.light }}" alt="{% trans 'Home' %}" class="block h-8 dark:hidden" />
10
+ {% else %}
11
+ <img src="{{ site_icon }}" class="h-8" alt="{% trans 'Home' %}" />
12
+ {% endif %}
13
+ </a>
14
+ </div>
13
15
  {% else %}
14
16
  <a href="{% url "admin:index" %}" class="bg-primary-600 flex h-8 items-center justify-center rounded text-white text-xs w-8">
15
17
  <span class="material-symbols-outlined md-18">{% if site_symbol %}{{ site_symbol }}{% else %}settings{% endif %}</span>
16
18
  </a>
17
19
  {% endif %}
18
20
 
19
- <div class="flex flex-col gap-1">
20
- <div class="text-font-important-light leading-none tracking-tight dark:text-font-important-dark *:leading-none {% if site_subheader %}xl:text-sm{% else %}xl:text-base{% endif %}">
21
+ <div class="flex flex-col grow min-w-0">
22
+ <div class="text-font-important-light leading-normal tracking-tight dark:text-font-important-dark *:leading-none {% if site_subheader %}xl:text-sm{% else %}xl:text-base{% endif %}">
21
23
  {{ branding }}
22
24
  </div>
23
25
 
24
26
  {% if site_subheader %}
25
- <div class="font-normal leading-none text-font-subtle-light text-xs dark:text-font-subtle-dark">
27
+ <div class="font-normal leading-normal text-font-subtle-light text-xs truncate dark:text-font-subtle-dark">
26
28
  {{ site_subheader }}
27
29
  </div>
28
30
  {% endif %}
@@ -1,5 +1,38 @@
1
- <li class="border-b flex-grow text-center md:border-b-0 md:border-r last:border-0 dark:border-base-700">
2
- <a href="{{ link }}" class="block px-4 py-2 text-left whitespace-nowrap hover:text-primary-600 dark:hover:text-primary-500"{% if blank %} target="_blank"{% endif %} {% include "unfold/helpers/attrs.html" with attrs=action.attrs %}>
1
+ {% load unfold %}
2
+
3
+ <li class="border-b flex-grow relative text-center md:border-b-0 md:border-r last:border-0 dark:border-base-700" {% if not link %}x-data="{actionDropdownOpen: false}"{% endif %}>
4
+ <a {% if link %}href="{{ link }}"{% endif %}class="cursor-pointer flex items-center gap-2 px-4 py-2 text-left whitespace-nowrap hover:text-primary-600 dark:hover:text-primary-500"{% if blank %} target="_blank"{% endif %} {% include "unfold/helpers/attrs.html" with attrs=action.attrs %} {% if not link %}x-on:click="actionDropdownOpen = !actionDropdownOpen" x-bind:class="{'text-primary-600 dark:text-primary-500': actionDropdownOpen }"{% endif %}>
5
+
6
+ {% if action.icon %}
7
+ <span class="material-symbols-outlined -ml-1">
8
+ {{ action.icon }}
9
+ </span>
10
+ {% endif %}
11
+
3
12
  {{ title }}
13
+
14
+ {% if not link %}
15
+ <span class="material-symbols-outlined -mr-1 rotate-90">
16
+ chevron_right
17
+ </span>
18
+ {% endif %}
4
19
  </a>
20
+
21
+ {% if not link %}
22
+ <nav class="absolute bg-white border flex flex-col -mr-px py-1 right-0 rounded shadow-lg top-10 w-52 z-50 dark:bg-base-800 dark:border-base-700" x-transition x-show="actionDropdownOpen" x-on:click.outside="actionDropdownOpen = false">
23
+ {% for item in action.items %}
24
+ <a href="{{ item.path }}" class="flex items-center font-normal gap-2 max-h-[30px] mx-1 px-3 py-2 rounded text-left hover:bg-base-100 hover:text-base-700 dark:hover:bg-base-700 dark:hover:text-base-200"{% if blank %} target="_blank"{% endif %} {% include "unfold/helpers/attrs.html" with attrs=action.attrs %}>
25
+ {% if item.icon %}
26
+ <span class="material-symbols-outlined -ml-1">
27
+ {{ item.icon }}
28
+ </span>
29
+ {% endif %}
30
+
31
+ <span class="grow truncate">
32
+ {{ item.title }}
33
+ </span>
34
+ </a>
35
+ {% endfor %}
36
+ </nav>
37
+ {% endif %}
5
38
  </li>
unfold/typing.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from collections.abc import Iterable
2
- from typing import Any, Protocol, Union
2
+ from typing import Any, Optional, Protocol, Union
3
3
 
4
4
 
5
5
  class ActionFunction(Protocol):
@@ -13,6 +13,7 @@ class ActionFunction(Protocol):
13
13
  short_description: str
14
14
  url_path: str
15
15
  attrs: dict[str, Any]
16
+ icon: Optional[str] = None
16
17
 
17
18
  def __call__(self, *args, **kwargs):
18
19
  pass
unfold/widgets.py CHANGED
@@ -177,7 +177,9 @@ CHECKBOX_CLASSES = [
177
177
  "after:w-4",
178
178
  "after:dark:text-base-700",
179
179
  "checked:bg-primary-600",
180
+ "checked:dark:bg-primary-600",
180
181
  "checked:border-primary-600",
182
+ "checked:dark:border-primary-600",
181
183
  "checked:transition-all",
182
184
  "checked:hover:border-primary-600",
183
185
  ]