Skip to content

Commit 8fa21d4

Browse files
authored
feat: improved input focus (#1247)
1 parent 51e66dc commit 8fa21d4

File tree

13 files changed

+37
-39
lines changed

13 files changed

+37
-39
lines changed

src/unfold/contrib/forms/templates/unfold/forms/helpers/toolbar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
<div data-trix-dialogs>
9393
<div class="absolute bg-white border-b border-base-200 -bottom-px left-0 px-4 py-2 right-0 shadow-xs translate-y-full dark:bg-base-900 dark:border-base-700" data-trix-dialog="href" data-trix-dialog-attribute="href">
9494
<div class="flex flex-row">
95-
<input type="url" name="href" class="border border-base-200 bg-white font-medium px-3 rounded-default shadow-xs text-base-500 text-sm focus:ring-3 focus:ring-primary-300 focus:border-primary-600 focus:outline-hidden group-[.errors]:border-red-600 focus:group-[.errors]:ring-red-200 dark:bg-base-900 dark:border-base-700 dark:text-font-default-dark dark:focus:ring-primary-600/30 dark:group-[.errors]:border-red-500 dark:focus:group-[.errors]:ring-red-600/40" placeholder="{% trans "Enter an URL" %}" required data-trix-input>
95+
<input type="url" name="href" class="border border-base-200 bg-white font-medium px-3 rounded-default shadow-xs text-base-500 text-sm focus:outline-2 focus:-outline-offset-2 focus:outline-primary-600 group-[.errors]:border-red-600 focus:group-[.errors]:outline-red-600 dark:bg-base-900 dark:border-base-700 dark:text-font-default-dark dark:group-[.errors]:border-red-500 dark:focus:group-[.errors]:outline-red-500" placeholder="{% trans "Enter an URL" %}" required data-trix-input>
9696

9797
<div class="bg-white border border-base-200 border-md flex flex-row ml-4 rounded-default shadow-xs dark:bg-base-900 dark:border-base-700 dark:text-font-default-dark">
9898
<button type="button" data-trix-method="setAttribute" title="{% trans "Link" %}" class="border-r border-base-200 cursor-pointer flex items-center h-8 justify-center text-base-400 transition-colors w-8 hover:text-primary-600 dark:border-base-700">

src/unfold/static/unfold/css/styles.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/unfold/styles.css

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
@plugin '@tailwindcss/typography';
33
@custom-variant dark (&:where(.dark, .dark *));
44

5-
@source inline("2xl:flex 2xl:relative pb-0 tracking-normal h-3 mb-6 -mr-3 mr-3 pr-3 py-3 max-w-80 min-w-80 w-3 h-[64px] w-[65px]! w-96 max-w-96 md:w-48");
6-
@source inline("{md:,}sticky {2xl:,}relative rounded-b-default rounded-l-default rounded-t-default left-[65px] dark:hover:bg-white/[.06] bottom-3 top-3 right-3 translate-x-1/4 -translate-y-1/4");
7-
@source inline("{dark:,}border-transparent border-0 border-2 border-l border-b-0 border-l-0 border-r-0 border-t-0 m-3 my-3 pr-3 md:border-0 md:border-r lg:border-r-0");
5+
@source inline("h-3 w-3 h-[64px] w-[65px]! left-[65px] dark:hover:bg-white/[.06] translate-x-1/4 -translate-y-1/4");
6+
@source inline("{-,}{top,bottom,left,right}-{0..4}");
7+
@source inline("rounded-{t,r,b,l}-default");
8+
@source inline("{md:,lg:,2xl:,}relative {md:,lg:,2xl:,}flex {md:,lg:,2xl:,}absolute {md:,lg:,2xl:,}sticky");
9+
@source inline("{-,}m{t,r,b,l,x,y,}-{0..4} {-,}p{t,r,b,l,x,y,}-{0..4}");
10+
@source inline("{md:,lg:,}border-{0,2} {md:,lg:,}border-{t,r,b,l}-{0,2}");
811
@source inline("{hover:,dark:,}bg-primary-{50,{100..900..100},950}");
912
@source inline("{hover:,dark:,}border-base-{50,{100..900..100},950}");
13+
@source inline("{hover:,dark:,}bg-base-{50,{100..900..100},950}");
1014
@source inline("{md:,lg:,}w-{1/2,1/3,2/3,1/4,2/4,3/4,1/5,2/5,3/5,4/5}");
1115
@source inline("{md:,lg:,}gap-{0.5,{1..12}}");
1216
@source inline("{md:,lg:,}grid-cols-{1..12}");
@@ -420,15 +424,15 @@ h3 span:nth-child(3) {
420424
}
421425

422426
.select2-container.select2-container--open .select2-dropdown {
423-
@apply border-primary-600 ring-3 ring-primary-300 pb-2 shadow-xs dark:bg-base-900 dark:border-primary-700 after:block after:bg-white after:absolute after:border-l after:border-l-primary-600 after:border-r after:border-r-primary-600 after:h-1 after:-left-px after:-right-px after:-mt-1 after:top-0 dark:after:bg-base-900 dark:after:border-l-primary-700 dark:after:border-r-primary-700 dark:ring-primary-700/50;
427+
@apply border border-transparent outline-2 -outline-offset-2 outline-primary-600 pb-2 shadow-xs dark:bg-base-900;
424428
}
425429

426430
.select2-container.select2-container--open .select2-dropdown--below {
427-
@apply rounded-t-none rounded-b;
431+
@apply rounded-t-none rounded-b -top-0.5;
428432
}
429433

430434
.select2-container.select2-container--open .select2-dropdown--above {
431-
@apply rounded-b-none rounded-default after:bottom-0 after:-mb-1 after:mt-0 after:top-auto;
435+
@apply rounded-b-none rounded-default -bottom-0.5;
432436
}
433437

434438
.select2-container.select2-container--admin-autocomplete
@@ -495,7 +499,7 @@ h3 span:nth-child(3) {
495499
}
496500

497501
.select2.select2-container--open {
498-
@apply border-b-0 border-primary-600 relative ring-3 ring-primary-300 dark:border-primary-700 dark:ring-primary-700/50;
502+
@apply border-b-0 border-primary-600 relative outline-2 -outline-offset-2 outline-primary-600;
499503
}
500504

501505
/*******************************************************

src/unfold/templates/admin/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% load admin_list i18n unfold %}
44

55
{% block base %}
6-
<div id="page" class="flex max-w-full min-h-screen dark:bg-base-950/20 {% element_classes 'page' %}">
6+
<div id="page" class="flex max-w-full min-h-screen {% element_classes 'page' %}">
77
{% if not is_popup and is_nav_sidebar_enabled %}
88
{% block nav-sidebar %}
99
{% include "admin/nav_sidebar.html" %}

src/unfold/templates/admin/login.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
{% endblock %}
2525

2626
{% block base %}
27-
<div id="page" class="flex min-h-screen">
27+
<div id="page" class="bg-white flex min-h-screen dark:bg-base-900 ">
2828
<div class="flex grow items-center justify-center mx-auto px-4 relative">
2929
<div class="w-full sm:w-96">
3030
<h1 class="font-semibold mb-10">
@@ -66,7 +66,7 @@ <h1 class="font-semibold mb-10">
6666
<button type="submit" class="bg-primary-600 border border-transparent flex flex-row font-semibold group items-center justify-center py-2 rounded-default text-sm text-white w-full">
6767
{% translate 'Log in' %}
6868

69-
<i class="material-symbols-outlined ml-2 relative right-0 text-lg transition-all group-hover:-right-1">arrow_forward</i>
69+
<span class="material-symbols-outlined ml-2 relative right-0 text-base transition-all group-hover:-right-1">arrow_forward</span>
7070
</button>
7171
</div>
7272

src/unfold/templates/admin/nav_sidebar.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<div class="relative z-50">
44
<div class="fixed hidden xl:relative xl:block w-[288px] {% element_classes 'navigation_wrapper' %}" x-bind:class="{'xl:hidden!': !sidebarDesktopOpen, 'block!': sidebarMobileOpen}">
5-
<div class="relative z-30">
6-
<div id="nav-sidebar" class="bg-gray-50 border-r border-base-200 bottom-0 fixed max-h-screen top-0 w-[288px] dark:border-base-800 {% element_classes 'navigation' %}">
5+
<div class="bg-gray-50 relative z-30 dark:bg-gray-900">
6+
<div id="nav-sidebar" class="border-r border-base-200 bottom-0 fixed max-h-screen top-0 w-[288px] dark:border-base-800 dark:bg-base-950/20 {% element_classes 'navigation' %}">
77
{% if templates.navigation %}
88
{% include templates.navigation %}
99
{% else %}

src/unfold/templates/admin/search_form.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% if cl.search_fields %}
44
<div id="toolbar">
55
<form id="changelist-search" method="get" role="search">
6-
<div class="bg-white border border-base-200 flex rounded-default overflow-hidden shadow-xs lg:w-96 focus-within:ring-3 focus-within:ring-primary-300 focus-within:border-primary-600 dark:bg-base-900 dark:border-base-700 dark:focus-within:border-primary-600 dark:focus-within:ring-primary-700/50">
6+
<div class="bg-white border border-base-200 flex rounded-default overflow-hidden shadow-xs lg:w-96 focus-within:outline-2 focus-within:-outline-offset-2 focus-within:outline-primary-600 dark:bg-base-900 dark:border-base-700">
77
<input class="font-medium grow min-w-0 h-9 px-3 text-font-default-light text-sm focus:outline-hidden dark:bg-base-900 dark:text-font-default-dark placeholder-shown:truncate placeholder-base-400" type="text" name="{{ search_var }}" value="{{ cl.query }}" id="searchbar" placeholder="{% if cl.search_help_text %}{{ cl.search_help_text }}{% else %}{% trans "Type to search" %}{% endif %}" />
88

99
<button type="submit" class="flex items-center px-2 focus:outline-hidden" id="searchbar-submit">

src/unfold/templates/registration/logged_out.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
{% load i18n %}
44

55
{% block base %}
6-
<div id="page" class="flex min-h-screen">
6+
<div id="page" class="bg-white flex min-h-screen dark:bg-base-900 ">
77
<div class="flex grow items-center justify-center mx-auto px-4">
88
<div class="w-full sm:w-96">
9-
<h1 class="font-semibold mb-4 text-xl">
10-
<span class="block leading-relaxed text-base-700 dark:text-base-200">
11-
{% trans "You have been successfully logged out from the administration" %}
12-
</span>
9+
<h1 class="font-semibold mb-4 text-font-important-light text-xl tracking-tight dark:text-font-important-dark">
10+
{% trans "You have been successfully logged out from the administration" %}
1311
</h1>
1412

15-
<p class="mb-10">
13+
<p class="leading-relaxed mb-10">
1614
{% translate "Thanks for spending some quality time with the web site today." %}
1715
</p>
1816

src/unfold/templates/unfold/helpers/search.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{% if sidebar_show_search %}
44
<div class="mb-2.5 mx-3 relative" x-data="{openSearchResults: false}">
5-
<div class="bg-white border border-base-200 flex items-center overflow-hidden rounded-default shadow-xs focus-within:ring-3 focus-within:ring-primary-300 focus-within:border-primary-600 dark:bg-base-900 dark:border-base-700 dark:focus-within:border-primary-600 dark:focus-within:ring-primary-700/50">
5+
<div class="bg-white border border-base-200 flex items-center overflow-hidden rounded-default shadow-xs focus-within:outline-2 focus-within:-outline-offset-2 focus-within:outline-primary-600 dark:bg-base-900 dark:border-base-700">
66
<span class="material-symbols-outlined md-18 pl-3 text-base-400">manage_search</span>
77

88
<input type="search"

src/unfold/templates/unfold/widgets/clearable_file_input.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<input type="text" aria-label="{% trans 'Choose file to upload' %}" value="{% if widget.value %}{{ widget.value.url }}{% else %}{% trans 'Choose file to upload' %}{% endif %}" disabled class="bg-white grow font-medium min-w-0 px-3 py-2 text-ellipsis dark:bg-base-900">
2525

2626
<div class="bg-white flex flex-none items-center leading-none self-stretch dark:bg-base-900">
27-
<div class="hidden">
27+
<div class="opacity-0">
2828
<input type="{{ widget.type }}" name="{{ widget.name }}" {% include "django/forms/widgets/attrs.html" %} />
2929
</div>
3030

0 commit comments

Comments
 (0)