Skip to content

Commit e420fb2

Browse files
authored
ENG-6774: Textarea and pin some component versions (#32)
1 parent 34f29d2 commit e420fb2

File tree

10 files changed

+313
-15
lines changed

10 files changed

+313
-15
lines changed

reflex_ui/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"components.base.slider": ["slider"],
2323
"components.base.switch": ["switch"],
2424
"components.base.tabs": ["tabs"],
25+
"components.base.textarea": ["textarea"],
2526
"components.base.theme_switcher": ["theme_switcher"],
2627
"components.base.toggle_group": ["toggle_group"],
2728
"components.base.toggle": ["toggle"],

reflex_ui/__init__.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ from .components.base.skeleton import skeleton
2424
from .components.base.slider import slider
2525
from .components.base.switch import switch
2626
from .components.base.tabs import tabs
27+
from .components.base.textarea import textarea
2728
from .components.base.theme_switcher import theme_switcher
2829
from .components.base.toggle import toggle
2930
from .components.base.toggle_group import toggle_group
@@ -52,6 +53,7 @@ _REFLEX_UI_MAPPING = {
5253
"components.base.slider": ["slider"],
5354
"components.base.switch": ["switch"],
5455
"components.base.tabs": ["tabs"],
56+
"components.base.textarea": ["textarea"],
5557
"components.base.theme_switcher": ["theme_switcher"],
5658
"components.base.toggle_group": ["toggle_group"],
5759
"components.base.toggle": ["toggle"],
@@ -92,6 +94,7 @@ __all__ = [
9294
"spinner",
9395
"switch",
9496
"tabs",
97+
"textarea",
9598
"theme_switcher",
9699
"toggle",
97100
"toggle_group",

reflex_ui/components/base/__init__.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ from .skeleton import skeleton
2424
from .slider import slider
2525
from .switch import switch
2626
from .tabs import tabs
27+
from .textarea import textarea
2728
from .theme_switcher import theme_switcher
2829
from .toggle import toggle
2930
from .toggle_group import toggle_group
@@ -54,6 +55,7 @@ __all__ = [
5455
"slider",
5556
"switch",
5657
"tabs",
58+
"textarea",
5759
"theme_switcher",
5860
"toggle",
5961
"toggle_group",
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""Custom Textarea component."""
2+
3+
from reflex.components.component import Component
4+
from reflex.components.el import Textarea as TextareaComponent
5+
6+
from reflex_ui.components.component import CoreComponent
7+
8+
9+
class ClassNames:
10+
"""Class names for textarea components."""
11+
12+
ROOT = "focus:shadow-[0px_0px_0px_2px_var(--primary-4)] focus:border-primary-7 focus:hover:border-primary-7 bg-secondary-1 shrink-0 border border-secondary-a4 hover:border-secondary-a6 transition-all disabled:border-secondary-4 disabled:bg-secondary-3 disabled:text-secondary-8 disabled:cursor-not-allowed cursor-text min-h-24 rounded-ui-md text-secondary-12 placeholder:text-secondary-9 text-sm disabled:placeholder:text-secondary-8 w-full outline-none max-h-[15rem] resize-none overflow-y-auto px-3 py-2 font-medium"
13+
14+
15+
class Textarea(TextareaComponent, CoreComponent):
16+
"""Root component for Textarea."""
17+
18+
@classmethod
19+
def create(cls, *children, **props) -> Component:
20+
"""Create the textarea component."""
21+
props.setdefault(
22+
"custom_attrs",
23+
{
24+
"autoComplete": "off",
25+
"autoCapitalize": "none",
26+
"autoCorrect": "off",
27+
"spellCheck": "false",
28+
},
29+
)
30+
props["data-slot"] = "textarea"
31+
cls.set_class_name(ClassNames.ROOT, props)
32+
return super().create(*children, **props)
33+
34+
35+
textarea = Textarea.create
Lines changed: 261 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
1+
"""Stub file for reflex_ui/components/base/textarea.py"""
2+
3+
# ------------------- DO NOT EDIT ----------------------
4+
# This file was generated by `reflex/utils/pyi_generator.py`!
5+
# ------------------------------------------------------
6+
from collections.abc import Mapping, Sequence
7+
from typing import Any, Literal
8+
9+
from reflex.components.core.breakpoints import Breakpoints
10+
from reflex.components.el import Textarea as TextareaComponent
11+
from reflex.event import EventType, KeyInputInfo, PointerEventInfo
12+
from reflex.vars.base import Var
13+
14+
from reflex_ui.components.component import CoreComponent
15+
16+
class ClassNames:
17+
ROOT = "focus:shadow-[0px_0px_0px_2px_var(--primary-4)] focus:border-primary-7 focus:hover:border-primary-7 bg-secondary-1 shrink-0 border border-secondary-a4 hover:border-secondary-a6 transition-all disabled:border-secondary-4 disabled:bg-secondary-3 disabled:text-secondary-8 disabled:cursor-not-allowed cursor-text min-h-24 rounded-ui-md text-secondary-12 placeholder:text-secondary-9 text-sm disabled:placeholder:text-secondary-8 w-full outline-none max-h-[15rem] resize-none overflow-y-auto px-3 py-2 font-medium"
18+
19+
class Textarea(TextareaComponent, CoreComponent):
20+
@classmethod
21+
def create(
22+
cls,
23+
*children,
24+
auto_complete: Var[str] | str | None = None,
25+
auto_focus: Var[bool] | bool | None = None,
26+
auto_height: Var[bool] | bool | None = None,
27+
cols: Var[int | str] | int | str | None = None,
28+
default_value: Var[str] | str | None = None,
29+
dirname: Var[str] | str | None = None,
30+
disabled: Var[bool] | bool | None = None,
31+
enter_key_submit: Var[bool] | bool | None = None,
32+
form: Var[str] | str | None = None,
33+
max_length: Var[int | str] | int | str | None = None,
34+
min_length: Var[int | str] | int | str | None = None,
35+
name: Var[str] | str | None = None,
36+
placeholder: Var[str] | str | None = None,
37+
read_only: Var[bool] | bool | None = None,
38+
required: Var[bool] | bool | None = None,
39+
rows: Var[int | str] | int | str | None = None,
40+
value: Var[str] | str | None = None,
41+
wrap: Var[str] | str | None = None,
42+
access_key: Var[str] | str | None = None,
43+
auto_capitalize: Literal[
44+
"characters", "none", "off", "on", "sentences", "words"
45+
]
46+
| Var[Literal["characters", "none", "off", "on", "sentences", "words"]]
47+
| None = None,
48+
content_editable: Literal["inherit", "plaintext-only", False, True]
49+
| Var[Literal["inherit", "plaintext-only", False, True]]
50+
| None = None,
51+
context_menu: Var[str] | str | None = None,
52+
dir: Var[str] | str | None = None,
53+
draggable: Var[bool] | bool | None = None,
54+
enter_key_hint: Literal[
55+
"done", "enter", "go", "next", "previous", "search", "send"
56+
]
57+
| Var[Literal["done", "enter", "go", "next", "previous", "search", "send"]]
58+
| None = None,
59+
hidden: Var[bool] | bool | None = None,
60+
input_mode: Literal[
61+
"decimal", "email", "none", "numeric", "search", "tel", "text", "url"
62+
]
63+
| Var[
64+
Literal[
65+
"decimal", "email", "none", "numeric", "search", "tel", "text", "url"
66+
]
67+
]
68+
| None = None,
69+
item_prop: Var[str] | str | None = None,
70+
lang: Var[str] | str | None = None,
71+
role: Literal[
72+
"alert",
73+
"alertdialog",
74+
"application",
75+
"article",
76+
"banner",
77+
"button",
78+
"cell",
79+
"checkbox",
80+
"columnheader",
81+
"combobox",
82+
"complementary",
83+
"contentinfo",
84+
"definition",
85+
"dialog",
86+
"directory",
87+
"document",
88+
"feed",
89+
"figure",
90+
"form",
91+
"grid",
92+
"gridcell",
93+
"group",
94+
"heading",
95+
"img",
96+
"link",
97+
"list",
98+
"listbox",
99+
"listitem",
100+
"log",
101+
"main",
102+
"marquee",
103+
"math",
104+
"menu",
105+
"menubar",
106+
"menuitem",
107+
"menuitemcheckbox",
108+
"menuitemradio",
109+
"navigation",
110+
"none",
111+
"note",
112+
"option",
113+
"presentation",
114+
"progressbar",
115+
"radio",
116+
"radiogroup",
117+
"region",
118+
"row",
119+
"rowgroup",
120+
"rowheader",
121+
"scrollbar",
122+
"search",
123+
"searchbox",
124+
"separator",
125+
"slider",
126+
"spinbutton",
127+
"status",
128+
"switch",
129+
"tab",
130+
"table",
131+
"tablist",
132+
"tabpanel",
133+
"term",
134+
"textbox",
135+
"timer",
136+
"toolbar",
137+
"tooltip",
138+
"tree",
139+
"treegrid",
140+
"treeitem",
141+
]
142+
| Var[
143+
Literal[
144+
"alert",
145+
"alertdialog",
146+
"application",
147+
"article",
148+
"banner",
149+
"button",
150+
"cell",
151+
"checkbox",
152+
"columnheader",
153+
"combobox",
154+
"complementary",
155+
"contentinfo",
156+
"definition",
157+
"dialog",
158+
"directory",
159+
"document",
160+
"feed",
161+
"figure",
162+
"form",
163+
"grid",
164+
"gridcell",
165+
"group",
166+
"heading",
167+
"img",
168+
"link",
169+
"list",
170+
"listbox",
171+
"listitem",
172+
"log",
173+
"main",
174+
"marquee",
175+
"math",
176+
"menu",
177+
"menubar",
178+
"menuitem",
179+
"menuitemcheckbox",
180+
"menuitemradio",
181+
"navigation",
182+
"none",
183+
"note",
184+
"option",
185+
"presentation",
186+
"progressbar",
187+
"radio",
188+
"radiogroup",
189+
"region",
190+
"row",
191+
"rowgroup",
192+
"rowheader",
193+
"scrollbar",
194+
"search",
195+
"searchbox",
196+
"separator",
197+
"slider",
198+
"spinbutton",
199+
"status",
200+
"switch",
201+
"tab",
202+
"table",
203+
"tablist",
204+
"tabpanel",
205+
"term",
206+
"textbox",
207+
"timer",
208+
"toolbar",
209+
"tooltip",
210+
"tree",
211+
"treegrid",
212+
"treeitem",
213+
]
214+
]
215+
| None = None,
216+
slot: Var[str] | str | None = None,
217+
spell_check: Var[bool] | bool | None = None,
218+
tab_index: Var[int] | int | None = None,
219+
title: Var[str] | str | None = None,
220+
unstyled: Var[bool] | bool | None = None,
221+
style: Sequence[Mapping[str, Any]]
222+
| Mapping[str, Any]
223+
| Var[Mapping[str, Any]]
224+
| Breakpoints
225+
| None = None,
226+
key: Any | None = None,
227+
id: Any | None = None,
228+
ref: Var | None = None,
229+
class_name: Any | None = None,
230+
autofocus: bool | None = None,
231+
custom_attrs: dict[str, Var | Any] | None = None,
232+
on_blur: EventType[()] | EventType[str] | None = None,
233+
on_change: EventType[()] | EventType[str] | None = None,
234+
on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
235+
on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
236+
on_double_click: EventType[()] | EventType[PointerEventInfo] | None = None,
237+
on_focus: EventType[()] | EventType[str] | None = None,
238+
on_key_down: EventType[()]
239+
| EventType[str]
240+
| EventType[str, KeyInputInfo]
241+
| None = None,
242+
on_key_up: EventType[()]
243+
| EventType[str]
244+
| EventType[str, KeyInputInfo]
245+
| None = None,
246+
on_mount: EventType[()] | None = None,
247+
on_mouse_down: EventType[()] | None = None,
248+
on_mouse_enter: EventType[()] | None = None,
249+
on_mouse_leave: EventType[()] | None = None,
250+
on_mouse_move: EventType[()] | None = None,
251+
on_mouse_out: EventType[()] | None = None,
252+
on_mouse_over: EventType[()] | None = None,
253+
on_mouse_up: EventType[()] | None = None,
254+
on_scroll: EventType[()] | None = None,
255+
on_scroll_end: EventType[()] | None = None,
256+
on_unmount: EventType[()] | None = None,
257+
**props,
258+
) -> Textarea:
259+
"""Create the textarea component."""
260+
261+
textarea = Textarea.create

reflex_ui/components/base_ui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from reflex_ui.components.component import CoreComponent
66

77
PACKAGE_NAME = "@base-ui-components/react"
8-
PACKAGE_VERSION = "^1.0.0-beta.1"
8+
PACKAGE_VERSION = "1.0.0-beta.1"
99

1010

1111
class BaseUIComponent(CoreComponent):

reflex_ui/components/base_ui.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ from reflex.vars.base import Var
1313
from reflex_ui.components.component import CoreComponent
1414

1515
PACKAGE_NAME = "@base-ui-components/react"
16-
PACKAGE_VERSION = "^1.0.0-beta.1"
16+
PACKAGE_VERSION = "1.0.0-beta.1"
1717

1818
class BaseUIComponent(CoreComponent):
1919
@classmethod

reflex_ui/components/icons/hugeicon.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class HugeIcon(CoreComponent):
1111
"""A HugeIcon component."""
1212

13-
library = "@hugeicons/react@^1.0.5"
13+
library = "@hugeicons/[email protected]"
1414

1515
tag = "HugeiconsIcon"
1616

@@ -50,7 +50,11 @@ def create(cls, *children, **props) -> Component:
5050
props[prop] = Var(
5151
icon_name,
5252
_var_data=VarData(
53-
imports={"@hugeicons/core-free-icons": ImportVar(tag=icon_name)}
53+
imports={
54+
"@hugeicons/[email protected]": ImportVar(
55+
tag=icon_name
56+
)
57+
}
5458
),
5559
)
5660
stroke_width = props.pop("stroke_width", 2)

rxconfig.py

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

0 commit comments

Comments
 (0)