Skip to content

Commit 539fe80

Browse files
committed
Update some reflex ui components
1 parent 08ee62a commit 539fe80

5 files changed

Lines changed: 57 additions & 14 deletions

File tree

packages/reflex-ui-shared/src/reflex_ui_shared/styles/globals.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,10 +1228,10 @@
12281228
--animate-ellipse-reversed: ellipse-reversed 2400ms ease-out infinite;
12291229
/* Radius */
12301230
--radius-ui-xxs: calc(var(--radius) - 0.25rem);
1231-
--radius-ui-xs: calc(var(--radius) - 0.125rem);
1231+
--radius-ui-xs: var(--radius);
12321232
--radius-ui-sm: var(--radius);
12331233
--radius-ui-md: calc(var(--radius) + 0.125rem);
1234-
--radius-ui-lg: calc(var(--radius) + 0.25rem);
1234+
--radius-ui-lg: calc(var(--radius) + 0.125rem);
12351235
--radius-ui-xl: calc(var(--radius) + 0.375rem);
12361236
--radius-ui-2xl: calc(var(--radius) + 0.5rem);
12371237
/* Width */

packages/reflex-ui/src/reflex_ui/components/base/button.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"outline-shadow",
1919
"secondary",
2020
"ghost",
21+
"ghost-highlight",
2122
"link",
2223
"dark",
2324
]
@@ -33,9 +34,10 @@
3334
"primary-bordered": "bg-primary-9 text-primary-contrast hover:bg-primary-10 shadow-button-bordered disabled:shadow-none",
3435
"destructive": "bg-destructive-9 hover:bg-destructive-10 text-primary-contrast",
3536
"outline": "border border-secondary-a4 bg-secondary-1 hover:bg-secondary-3 text-secondary-12",
36-
"outline-shadow": "dark:border dark:border-secondary-a4 bg-white dark:bg-secondary-1 hover:bg-secondary-3 text-secondary-12 shadow-button-outline disabled:shadow-none",
37+
"outline-shadow": "dark:shadow-[0_1px_0_0_rgba(255,255,255,0.08)_inset] bg-white hover:bg-secondary-2 dark:bg-secondary-3 dark:hover:bg-secondary-4 text-secondary-12 shadow-button-outline disabled:shadow-none",
3738
"secondary": "bg-secondary-4 text-secondary-12 hover:bg-secondary-5",
3839
"ghost": "hover:bg-secondary-3 text-secondary-11",
40+
"ghost-highlight": "text-secondary-12 hover:text-primary-9",
3941
"link": "text-secondary-12 underline-offset-4 hover:underline",
4042
"dark": "bg-secondary-12 text-secondary-1 hover:bg-secondary-12/80",
4143
},

packages/reflex-ui/src/reflex_ui/components/base/input.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
class ClassNames:
3737
"""Class names for input components."""
3838

39-
INPUT = "outline-none bg-transparent text-secondary-12 placeholder:text-secondary-9 text-sm leading-normal peer disabled:text-secondary-8 disabled:placeholder:text-secondary-8 w-full data-[disabled]:pointer-events-none font-medium"
40-
DIV = "flex flex-row items-center focus-within:shadow-[0px_0px_0px_2px_var(--primary-4)] focus-within:border-primary-a6 not-data-[invalid]:focus-within:hover:border-primary-a6 bg-secondary-1 shrink-0 border border-secondary-a4 hover:border-secondary-a6 transition-[color,box-shadow] text-secondary-9 [&_svg]:pointer-events-none has-data-[disabled]:border-secondary-4 has-data-[disabled]:bg-secondary-3 has-data-[disabled]:text-secondary-8 has-data-[disabled]:cursor-not-allowed cursor-text has-data-[invalid]:border-destructive-10 has-data-[invalid]:focus-within:border-destructive-a11 has-data-[invalid]:focus-within:shadow-[0px_0px_0px_2px_var(--destructive-4)] has-data-[invalid]:hover:border-destructive-a11"
39+
INPUT = "outline-none bg-transparent text-secondary-12 placeholder:text-secondary-10 text-sm leading-normal peer disabled:text-secondary-8 disabled:placeholder:text-secondary-8 w-full data-[disabled]:pointer-events-none font-medium"
40+
DIV = "flex flex-row items-center focus-within:shadow-[0px_0px_0px_2px_var(--primary-4)] focus-within:border-primary-a6 not-data-[invalid]:focus-within:hover:border-primary-a6 bg-white dark:bg-secondary-3 shrink-0 border border-secondary-4 hover:border-secondary-a6 transition-[color,box-shadow] text-secondary-9 [&_svg]:pointer-events-none has-data-[disabled]:border-secondary-4 has-data-[disabled]:bg-secondary-3 has-data-[disabled]:text-secondary-8 has-data-[disabled]:cursor-not-allowed cursor-text has-data-[invalid]:border-destructive-10 has-data-[invalid]:focus-within:border-destructive-a11 has-data-[invalid]:focus-within:shadow-[0px_0px_0px_2px_var(--destructive-4)] has-data-[invalid]:hover:border-destructive-a11 shadow-[0_1px_2px_0_rgba(0,0,0,0.02),0_1px_4px_0_rgba(0,0,0,0.02)] dark:shadow-none dark:border-secondary-5"
4141

4242

4343
class InputBaseComponent(BaseUIComponent):
@@ -153,7 +153,7 @@ def create(cls, *children, **props) -> BaseUIComponent:
153153
return Div.create( # pyright: ignore[reportReturnType]
154154
(
155155
Span.create(
156-
hi(icon, class_name="text-secondary-9 size-4 pointer-events-none"),
156+
hi(icon, class_name="text-secondary-12 size-4 pointer-events-none"),
157157
aria_hidden="true",
158158
)
159159
if icon
@@ -183,7 +183,7 @@ def _create_clear_button(id: str, clear_events: list[EventHandler]) -> Button:
183183
*clear_events,
184184
],
185185
tab_index=-1,
186-
class_name="opacity-100 peer-placeholder-shown:opacity-0 hover:text-secondary-12 transition-colors peer-placeholder-shown:pointer-events-none peer-disabled:pointer-events-none peer-disabled:opacity-0 h-full",
186+
class_name="opacity-100 peer-placeholder-shown:opacity-0 hover:text-secondary-12 transition-colors peer-placeholder-shown:pointer-events-none peer-disabled:pointer-events-none peer-disabled:opacity-0 h-full text-secondary-11",
187187
)
188188

189189
def _exclude_props(self) -> list[str]:

packages/reflex-ui/src/reflex_ui/components/base/tabs.py

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,34 @@
99
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
1010

1111
LiteralOrientation = Literal["horizontal", "vertical"]
12+
LiteralTabsSize = Literal["sm", "md", "lg"]
1213

1314

1415
class ClassNames:
1516
"""Class names for tabs components."""
1617

1718
ROOT = "flex flex-col gap-2"
18-
LIST = "bg-secondary-3 inline-flex gap-1 p-1 items-center justify-start rounded-ui-md relative z-0"
19-
TAB = "h-7 px-1.5 rounded-ui-sm justify-center items-center gap-1.5 inline-flex text-sm font-medium text-secondary-11 cursor-pointer z-[1] hover:text-secondary-12 transition-color text-nowrap data-[active]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8"
20-
INDICATOR = "absolute top-1/2 left-0 -z-1 h-7 w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-ui-sm bg-secondary-1 shadow-small transition-all duration-200 ease-in-out"
19+
LIST = "bg-secondary-1 inline-flex items-center justify-start relative z-0 shadow-button-outline dark:border dark:border-secondary-4"
20+
TAB = "justify-center items-center inline-flex font-medium text-secondary-11 cursor-pointer z-[1] hover:text-primary-9 transition-color text-nowrap data-[active]:text-secondary-12 data-[disabled]:cursor-not-allowed data-[disabled]:text-secondary-8 text-sm"
21+
INDICATOR = "absolute left-0 inset-y-0 my-0.5 -z-1 w-(--active-tab-width) translate-x-(--active-tab-left) transition-all duration-200 ease-in-out dark:shadow-[0_1px_0_0_rgba(255,255,255,0.08)_inset] bg-white dark:bg-secondary-3 text-secondary-12 shadow-button-outline"
2122
PANEL = "flex flex-col gap-2"
23+
SIZES = {
24+
"list": {
25+
"sm": "p-0.5 rounded-ui-md gap-0.5",
26+
"md": "p-0.5 rounded-ui-md gap-0.5",
27+
"lg": "p-0.5 rounded-ui-md gap-0.5",
28+
},
29+
"tab": {
30+
"sm": "h-7 px-1.5 rounded-ui-sm gap-1",
31+
"md": "h-8 px-2 rounded-ui-sm gap-1.5",
32+
"lg": "h-9 px-2.5 rounded-ui-sm gap-2",
33+
},
34+
"indicator": {
35+
"sm": "rounded-ui-sm",
36+
"md": "rounded-ui-sm",
37+
"lg": "rounded-ui-sm",
38+
},
39+
}
2240

2341

2442
class TabsBaseComponent(BaseUIComponent):
@@ -75,17 +93,24 @@ class TabsList(TabsBaseComponent):
7593
# Whether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys. Defaults to True.
7694
loop_focus: Var[bool]
7795

96+
# The size of the tabs list. Defaults to "sm".
97+
size: Var[LiteralTabsSize]
98+
7899
@classmethod
79100
def create(cls, *children, **props) -> BaseUIComponent:
80101
"""Create the tabs list component.
81102
82103
Returns:
83104
The component.
84105
"""
106+
size = props.pop("size", "sm")
85107
props["data-slot"] = "tabs-list"
86-
cls.set_class_name(ClassNames.LIST, props)
108+
cls.set_class_name(f"{ClassNames.LIST} {ClassNames.SIZES['list'][size]}", props)
87109
return super().create(*children, **props)
88110

111+
def _exclude_props(self) -> list[str]:
112+
return [*super()._exclude_props(), "size"]
113+
89114

90115
class TabsTab(TabsBaseComponent):
91116
"""An individual interactive tab button that toggles the corresponding panel. Renders a <button> element."""
@@ -104,17 +129,24 @@ class TabsTab(TabsBaseComponent):
104129
# The render prop
105130
render_: Var[Component]
106131

132+
# The size of the tab. Defaults to "sm".
133+
size: Var[LiteralTabsSize]
134+
107135
@classmethod
108136
def create(cls, *children, **props) -> BaseUIComponent:
109137
"""Create the tabs tab component.
110138
111139
Returns:
112140
The component.
113141
"""
142+
size = props.pop("size", "sm")
114143
props["data-slot"] = "tabs-tab"
115-
cls.set_class_name(ClassNames.TAB, props)
144+
cls.set_class_name(f"{ClassNames.TAB} {ClassNames.SIZES['tab'][size]}", props)
116145
return super().create(*children, **props)
117146

147+
def _exclude_props(self) -> list[str]:
148+
return [*super()._exclude_props(), "size"]
149+
118150

119151
class TabsIndicator(TabsBaseComponent):
120152
"""A visual indicator that can be styled to match the position of the currently active tab. Renders a <span> element."""
@@ -127,17 +159,26 @@ class TabsIndicator(TabsBaseComponent):
127159
# The render prop
128160
render_: Var[Component]
129161

162+
# The size of the indicator. Defaults to "sm".
163+
size: Var[LiteralTabsSize]
164+
130165
@classmethod
131166
def create(cls, *children, **props) -> BaseUIComponent:
132167
"""Create the tabs indicator component.
133168
134169
Returns:
135170
The component.
136171
"""
172+
size = props.pop("size", "sm")
137173
props["data-slot"] = "tabs-indicator"
138-
cls.set_class_name(ClassNames.INDICATOR, props)
174+
cls.set_class_name(
175+
f"{ClassNames.INDICATOR} {ClassNames.SIZES['indicator'][size]}", props
176+
)
139177
return super().create(*children, **props)
140178

179+
def _exclude_props(self) -> list[str]:
180+
return [*super()._exclude_props(), "size"]
181+
141182

142183
class TabsPanel(TabsBaseComponent):
143184
"""A panel displayed when the corresponding tab is active. Renders a <div> element."""

packages/reflex-ui/src/reflex_ui/components/base/textarea.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class ClassNames:
1010
"""Class names for textarea components."""
1111

12-
ROOT = "focus:shadow-[0px_0px_0px_2px_var(--primary-4)] focus:border-primary-7 focus:hover:border-primary-7 bg-secondary-1 border border-secondary-a4 hover:border-secondary-a6 transition-[color,box-shadow] 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.5 font-medium"
12+
ROOT = "outline-none bg-white dark:bg-secondary-3 shrink-0 border border-secondary-4 hover:border-secondary-a6 transition-[color,box-shadow] focus:shadow-[0px_0px_0px_2px_var(--primary-4)] focus:border-primary-a6 not-data-[invalid]:focus:hover:border-primary-a6 shadow-[0_1px_2px_0_rgba(0,0,0,0.02),0_1px_4px_0_rgba(0,0,0,0.02)] dark:shadow-none dark:border-secondary-5 disabled:border-secondary-4 disabled:bg-secondary-3 disabled:text-secondary-8 disabled:placeholder:text-secondary-8 disabled:cursor-not-allowed cursor-text has-data-[invalid]:border-destructive-10 has-data-[invalid]:focus:border-destructive-a11 has-data-[invalid]:focus:shadow-[0px_0px_0px_2px_var(--destructive-4)] has-data-[invalid]:hover:border-destructive-a11 text-secondary-12 placeholder:text-secondary-10 text-sm leading-normal w-full font-medium min-h-24 max-h-[15rem] resize-none overflow-y-auto px-2.5 py-1.5 rounded-ui-md"
1313

1414

1515
class Textarea(TextareaComponent, CoreComponent):

0 commit comments

Comments
 (0)