Skip to content

Commit 498d716

Browse files
authored
feat: better expandable textarea - field sizing (#1149)
1 parent 1a12d4c commit 498d716

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
@tailwind utilities;
66

7+
@layer utilities {
8+
.field-sizing-content {
9+
field-sizing: content;
10+
}
11+
}
712

813
/*******************************************************
914
Classes

src/unfold/templates/unfold/widgets/textarea_expandable.html

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/unfold/widgets.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,8 @@
104104
]
105105

106106
TEXTAREA_EXPANDABLE_CLASSES = [
107-
"absolute",
108-
"bottom-0",
109-
"left-0",
110-
"right-0",
111-
"top-0",
112-
"h-full",
107+
"field-sizing-content",
108+
"!max-w-2xl",
113109
]
114110

115111
SELECT_CLASSES = [
@@ -472,9 +468,7 @@ def __init__(self, attrs: Optional[dict[str, Any]] = None) -> None:
472468
)
473469

474470

475-
class UnfoldAdminExpandableTextareaWidget(AdminTextareaWidget):
476-
template_name = "unfold/widgets/textarea_expandable.html"
477-
471+
class UnfoldAdminExpandableTextareaWidget(UnfoldAdminTextareaWidget):
478472
def __init__(self, attrs: Optional[dict[str, Any]] = None) -> None:
479473
attrs = attrs or {}
480474

0 commit comments

Comments
 (0)