reflex 0.3.9a3__py3-none-any.whl → 0.3.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of reflex might be problematic. Click here for more details.
- reflex/__init__.py +3 -1
- reflex/__init__.pyi +3 -1
- reflex/app.py +116 -86
- reflex/compiler/compiler.py +110 -0
- reflex/compiler/utils.py +13 -12
- reflex/components/base/app_wrap.pyi +1 -0
- reflex/components/base/body.pyi +2 -0
- reflex/components/base/document.pyi +10 -0
- reflex/components/base/fragment.pyi +2 -0
- reflex/components/base/head.pyi +4 -0
- reflex/components/base/link.pyi +4 -0
- reflex/components/base/meta.pyi +8 -0
- reflex/components/base/script.pyi +2 -0
- reflex/components/chakra/base.pyi +7 -0
- reflex/components/chakra/datadisplay/badge.pyi +2 -0
- reflex/components/chakra/datadisplay/code.pyi +4 -0
- reflex/components/chakra/datadisplay/divider.pyi +2 -0
- reflex/components/chakra/datadisplay/keyboard_key.pyi +2 -0
- reflex/components/chakra/datadisplay/list.pyi +8 -0
- reflex/components/chakra/datadisplay/stat.pyi +12 -0
- reflex/components/chakra/datadisplay/table.pyi +18 -0
- reflex/components/chakra/datadisplay/tag.pyi +9 -0
- reflex/components/chakra/disclosure/accordion.pyi +10 -0
- reflex/components/chakra/disclosure/tabs.py +8 -0
- reflex/components/chakra/disclosure/tabs.pyi +10 -0
- reflex/components/chakra/disclosure/transition.pyi +12 -0
- reflex/components/chakra/disclosure/visuallyhidden.pyi +2 -0
- reflex/components/chakra/feedback/alert.pyi +8 -0
- reflex/components/chakra/feedback/circularprogress.pyi +4 -0
- reflex/components/chakra/feedback/progress.pyi +2 -0
- reflex/components/chakra/feedback/skeleton.pyi +6 -0
- reflex/components/chakra/feedback/spinner.pyi +2 -0
- reflex/components/chakra/forms/button.pyi +4 -0
- reflex/components/chakra/forms/checkbox.pyi +4 -0
- reflex/components/chakra/forms/colormodeswitch.pyi +7 -0
- reflex/components/chakra/forms/date_picker.pyi +2 -0
- reflex/components/chakra/forms/date_time_picker.pyi +2 -0
- reflex/components/chakra/forms/editable.pyi +8 -0
- reflex/components/chakra/forms/email.pyi +2 -0
- reflex/components/chakra/forms/form.pyi +10 -0
- reflex/components/chakra/forms/iconbutton.py +1 -0
- reflex/components/chakra/forms/iconbutton.pyi +2 -0
- reflex/components/chakra/forms/input.pyi +12 -0
- reflex/components/chakra/forms/numberinput.pyi +10 -0
- reflex/components/chakra/forms/password.pyi +2 -0
- reflex/components/chakra/forms/pininput.pyi +4 -0
- reflex/components/chakra/forms/radio.pyi +4 -0
- reflex/components/chakra/forms/rangeslider.pyi +8 -0
- reflex/components/chakra/forms/select.pyi +4 -0
- reflex/components/chakra/forms/slider.pyi +10 -0
- reflex/components/chakra/forms/switch.pyi +2 -0
- reflex/components/chakra/forms/textarea.pyi +2 -0
- reflex/components/chakra/forms/time_picker.pyi +2 -0
- reflex/components/chakra/layout/aspect_ratio.pyi +2 -0
- reflex/components/chakra/layout/box.pyi +2 -0
- reflex/components/chakra/layout/card.pyi +7 -0
- reflex/components/chakra/layout/center.pyi +6 -0
- reflex/components/chakra/layout/container.pyi +2 -0
- reflex/components/chakra/layout/flex.pyi +2 -0
- reflex/components/chakra/layout/grid.pyi +6 -0
- reflex/components/chakra/layout/html.pyi +2 -0
- reflex/components/chakra/layout/spacer.pyi +2 -0
- reflex/components/chakra/layout/stack.pyi +6 -0
- reflex/components/chakra/layout/wrap.pyi +4 -0
- reflex/components/chakra/media/avatar.pyi +6 -0
- reflex/components/chakra/media/icon.pyi +4 -0
- reflex/components/chakra/media/image.pyi +2 -0
- reflex/components/chakra/navigation/breadcrumb.pyi +8 -0
- reflex/components/chakra/navigation/link.pyi +2 -0
- reflex/components/chakra/navigation/linkoverlay.pyi +4 -0
- reflex/components/chakra/navigation/stepper.pyi +18 -0
- reflex/components/chakra/overlay/alertdialog.pyi +14 -0
- reflex/components/chakra/overlay/drawer.pyi +14 -0
- reflex/components/chakra/overlay/menu.pyi +16 -0
- reflex/components/chakra/overlay/modal.pyi +14 -0
- reflex/components/chakra/overlay/popover.pyi +18 -0
- reflex/components/chakra/overlay/tooltip.pyi +2 -0
- reflex/components/chakra/typography/heading.pyi +2 -0
- reflex/components/chakra/typography/highlight.pyi +2 -0
- reflex/components/chakra/typography/span.pyi +2 -0
- reflex/components/chakra/typography/text.pyi +2 -0
- reflex/components/component.py +41 -3
- reflex/components/core/__init__.py +2 -0
- reflex/components/core/banner.pyi +3 -0
- reflex/components/core/client_side_routing.pyi +4 -0
- reflex/components/core/colors.py +21 -0
- reflex/components/core/cond.py +11 -2
- reflex/components/core/debounce.pyi +1 -0
- reflex/components/core/layout/__init__.py +1 -0
- reflex/components/core/match.py +44 -18
- reflex/components/core/upload.py +8 -2
- reflex/components/core/upload.pyi +7 -1
- reflex/components/datadisplay/dataeditor.pyi +2 -0
- reflex/components/el/element.pyi +2 -0
- reflex/components/el/elements/base.pyi +2 -0
- reflex/components/el/elements/forms.py +3 -0
- reflex/components/el/elements/forms.pyi +32 -0
- reflex/components/el/elements/inline.pyi +56 -0
- reflex/components/el/elements/media.pyi +28 -0
- reflex/components/el/elements/metadata.pyi +10 -0
- reflex/components/el/elements/other.pyi +14 -0
- reflex/components/el/elements/scripts.pyi +6 -0
- reflex/components/el/elements/sectioning.pyi +30 -0
- reflex/components/el/elements/tables.pyi +20 -0
- reflex/components/el/elements/typography.pyi +30 -0
- reflex/components/gridjs/datatable.pyi +4 -0
- reflex/components/lucide/__init__.py +5 -0
- reflex/components/lucide/icon.py +1484 -0
- reflex/components/lucide/icon.pyi +1594 -0
- reflex/components/markdown/markdown.pyi +2 -0
- reflex/components/moment/moment.pyi +2 -0
- reflex/components/next/base.pyi +2 -0
- reflex/components/next/image.pyi +2 -0
- reflex/components/next/link.pyi +2 -0
- reflex/components/next/video.pyi +2 -0
- reflex/components/plotly/plotly.pyi +4 -0
- reflex/components/radix/primitives/__init__.py +10 -0
- reflex/components/radix/primitives/accordion.py +51 -32
- reflex/components/radix/primitives/accordion.pyi +16 -3
- reflex/components/radix/primitives/base.pyi +4 -0
- reflex/components/radix/primitives/drawer.py +240 -0
- reflex/components/radix/primitives/drawer.pyi +814 -0
- reflex/components/radix/primitives/form.py +40 -7
- reflex/components/radix/primitives/form.pyi +32 -10
- reflex/components/radix/primitives/progress.py +2 -2
- reflex/components/radix/primitives/progress.pyi +6 -0
- reflex/components/radix/primitives/slider.pyi +10 -0
- reflex/components/radix/themes/base.py +46 -12
- reflex/components/radix/themes/base.pyi +23 -9
- reflex/components/radix/themes/components/__init__.py +4 -2
- reflex/components/radix/themes/components/alertdialog.py +13 -12
- reflex/components/radix/themes/components/alertdialog.pyi +23 -351
- reflex/components/radix/themes/components/aspectratio.py +2 -5
- reflex/components/radix/themes/components/aspectratio.pyi +4 -51
- reflex/components/radix/themes/components/avatar.py +3 -4
- reflex/components/radix/themes/components/avatar.pyi +4 -57
- reflex/components/radix/themes/components/badge.py +3 -4
- reflex/components/radix/themes/components/badge.pyi +4 -56
- reflex/components/radix/themes/components/button.py +2 -3
- reflex/components/radix/themes/components/button.pyi +3 -51
- reflex/components/radix/themes/components/callout.py +9 -12
- reflex/components/radix/themes/components/callout.pyi +24 -217
- reflex/components/radix/themes/components/card.py +1 -2
- reflex/components/radix/themes/components/card.pyi +4 -51
- reflex/components/radix/themes/components/checkbox.py +11 -5
- reflex/components/radix/themes/components/checkbox.pyi +13 -112
- reflex/components/radix/themes/components/contextmenu.py +21 -21
- reflex/components/radix/themes/components/contextmenu.pyi +26 -401
- reflex/components/radix/themes/components/dialog.py +13 -16
- reflex/components/radix/themes/components/dialog.pyi +20 -303
- reflex/components/radix/themes/components/dropdownmenu.py +196 -32
- reflex/components/radix/themes/components/dropdownmenu.pyi +147 -389
- reflex/components/radix/themes/components/hovercard.py +5 -5
- reflex/components/radix/themes/components/hovercard.pyi +11 -151
- reflex/components/radix/themes/components/iconbutton.py +56 -4
- reflex/components/radix/themes/components/iconbutton.pyi +25 -71
- reflex/components/radix/themes/components/icons.pyi +4 -0
- reflex/components/radix/themes/components/inset.py +1 -2
- reflex/components/radix/themes/components/inset.pyi +4 -51
- reflex/components/radix/themes/components/popover.py +12 -12
- reflex/components/radix/themes/components/popover.pyi +14 -201
- reflex/components/radix/themes/components/radiogroup.py +47 -20
- reflex/components/radix/themes/components/radiogroup.pyi +26 -171
- reflex/components/radix/themes/components/scrollarea.py +2 -3
- reflex/components/radix/themes/components/scrollarea.pyi +4 -51
- reflex/components/radix/themes/components/select.py +28 -25
- reflex/components/radix/themes/components/select.pyi +43 -419
- reflex/components/radix/themes/components/separator.py +4 -5
- reflex/components/radix/themes/components/separator.pyi +5 -52
- reflex/components/radix/themes/components/slider.py +8 -5
- reflex/components/radix/themes/components/slider.pyi +9 -60
- reflex/components/radix/themes/components/switch.py +6 -4
- reflex/components/radix/themes/components/switch.pyi +5 -53
- reflex/components/radix/themes/components/table.py +14 -15
- reflex/components/radix/themes/components/table.pyi +22 -351
- reflex/components/radix/themes/components/tabs.py +9 -6
- reflex/components/radix/themes/components/tabs.pyi +18 -205
- reflex/components/radix/themes/components/textarea.py +2 -3
- reflex/components/radix/themes/components/textarea.pyi +10 -53
- reflex/components/radix/themes/components/textfield.py +105 -4
- reflex/components/radix/themes/components/textfield.pyi +200 -108
- reflex/components/radix/themes/components/tooltip.py +102 -2
- reflex/components/radix/themes/components/tooltip.pyi +66 -110
- reflex/components/radix/themes/layout/__init__.py +7 -0
- reflex/components/radix/themes/layout/base.pyi +2 -0
- reflex/components/radix/themes/layout/box.py +2 -2
- reflex/components/radix/themes/layout/box.pyi +4 -104
- reflex/components/radix/themes/layout/center.py +19 -0
- reflex/components/radix/themes/layout/center.pyi +261 -0
- reflex/components/radix/themes/layout/container.py +2 -2
- reflex/components/radix/themes/layout/container.pyi +4 -104
- reflex/components/radix/themes/layout/flex.py +2 -2
- reflex/components/radix/themes/layout/flex.pyi +4 -105
- reflex/components/radix/themes/layout/grid.pyi +2 -0
- reflex/components/radix/themes/layout/section.py +2 -2
- reflex/components/radix/themes/layout/section.pyi +4 -104
- reflex/components/radix/themes/layout/spacer.py +19 -0
- reflex/components/radix/themes/layout/spacer.pyi +261 -0
- reflex/components/radix/themes/layout/stack.py +60 -0
- reflex/components/radix/themes/layout/stack.pyi +537 -0
- reflex/components/radix/themes/typography/blockquote.py +2 -3
- reflex/components/radix/themes/typography/blockquote.pyi +4 -51
- reflex/components/radix/themes/typography/code.py +2 -3
- reflex/components/radix/themes/typography/code.pyi +4 -56
- reflex/components/radix/themes/typography/em.py +1 -2
- reflex/components/radix/themes/typography/em.pyi +4 -51
- reflex/components/radix/themes/typography/heading.py +2 -3
- reflex/components/radix/themes/typography/heading.pyi +4 -51
- reflex/components/radix/themes/typography/kbd.py +1 -2
- reflex/components/radix/themes/typography/kbd.pyi +4 -51
- reflex/components/radix/themes/typography/link.py +34 -3
- reflex/components/radix/themes/typography/link.pyi +41 -86
- reflex/components/radix/themes/typography/quote.py +1 -2
- reflex/components/radix/themes/typography/quote.pyi +4 -51
- reflex/components/radix/themes/typography/strong.py +1 -2
- reflex/components/radix/themes/typography/strong.pyi +4 -51
- reflex/components/radix/themes/typography/text.py +2 -3
- reflex/components/radix/themes/typography/text.pyi +4 -51
- reflex/components/radix/themes/typography.py +10 -11
- reflex/components/react_player/audio.pyi +2 -0
- reflex/components/react_player/react_player.pyi +2 -0
- reflex/components/react_player/video.pyi +2 -0
- reflex/components/recharts/cartesian.pyi +38 -0
- reflex/components/recharts/charts.pyi +22 -0
- reflex/components/recharts/general.pyi +10 -0
- reflex/components/recharts/polar.pyi +12 -0
- reflex/components/recharts/recharts.pyi +4 -0
- reflex/components/suneditor/editor.pyi +2 -0
- reflex/components/tags/tag.py +1 -1
- reflex/constants/base.py +5 -1
- reflex/constants/colors.py +80 -0
- reflex/constants/event.py +10 -1
- reflex/page.py +1 -1
- reflex/reflex.py +4 -0
- reflex/style.py +8 -3
- reflex/testing.py +21 -10
- reflex/utils/format.py +13 -9
- reflex/utils/prerequisites.py +41 -3
- reflex/utils/serializers.py +14 -0
- reflex/utils/telemetry.py +8 -2
- reflex/utils/types.py +36 -2
- reflex/vars.py +53 -18
- {reflex-0.3.9a3.dist-info → reflex-0.3.10.dist-info}/METADATA +1 -2
- {reflex-0.3.9a3.dist-info → reflex-0.3.10.dist-info}/RECORD +247 -233
- {reflex-0.3.9a3.dist-info → reflex-0.3.10.dist-info}/WHEEL +1 -1
- {reflex-0.3.9a3.dist-info → reflex-0.3.10.dist-info}/LICENSE +0 -0
- {reflex-0.3.9a3.dist-info → reflex-0.3.10.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
"""Drawer components based on Radix primitives."""
|
|
2
|
+
# Based on Vaul: https://github.com/emilkowalski/vaul
|
|
3
|
+
# Style based on https://ui.shadcn.com/docs/components/drawer
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from typing import Any, Dict, List, Literal, Optional, Union
|
|
7
|
+
|
|
8
|
+
from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
|
|
9
|
+
from reflex.constants import EventTriggers
|
|
10
|
+
from reflex.vars import Var
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DrawerComponent(RadixPrimitiveComponentWithClassName):
|
|
14
|
+
"""A Drawer component."""
|
|
15
|
+
|
|
16
|
+
library = "vaul"
|
|
17
|
+
|
|
18
|
+
lib_dependencies: List[str] = ["@radix-ui/react-dialog@^1.0.5"]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
LiteralDirectionType = Literal[
|
|
22
|
+
"top",
|
|
23
|
+
"bottom",
|
|
24
|
+
"left",
|
|
25
|
+
"right",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class DrawerRoot(DrawerComponent):
|
|
30
|
+
"""The Root component of a Drawer, contains all parts of a drawer."""
|
|
31
|
+
|
|
32
|
+
tag = "Drawer.Root"
|
|
33
|
+
|
|
34
|
+
# Whether the drawer is open or not.
|
|
35
|
+
open: Var[bool]
|
|
36
|
+
|
|
37
|
+
# Enable background scaling,
|
|
38
|
+
# it requires an element with [vaul-drawer-wrapper] data attribute to scale its background.
|
|
39
|
+
should_scale_background: Var[bool]
|
|
40
|
+
|
|
41
|
+
# Number between 0 and 1 that determines when the drawer should be closed.
|
|
42
|
+
close_threshold: Var[float]
|
|
43
|
+
|
|
44
|
+
# Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up. Should go from least visible.
|
|
45
|
+
# Also Accept px values, which doesn't take screen height into account.
|
|
46
|
+
snap_points: Optional[List[Union[str, float]]]
|
|
47
|
+
|
|
48
|
+
# Index of a snapPoint from which the overlay fade should be applied.
|
|
49
|
+
# Defaults to the last snap point.
|
|
50
|
+
# TODO: will it accept -1 then?
|
|
51
|
+
fade_from_index: Var[int]
|
|
52
|
+
|
|
53
|
+
# Duration for which the drawer is not draggable after scrolling content inside of the drawer. Defaults to 500ms
|
|
54
|
+
scroll_lock_timeout: Var[int]
|
|
55
|
+
|
|
56
|
+
# When `False`, it allows to interact with elements outside of the drawer without closing it.
|
|
57
|
+
# Defaults to `True`.
|
|
58
|
+
modal: Var[bool]
|
|
59
|
+
|
|
60
|
+
# Direction of the drawer. Defaults to `"bottom"`
|
|
61
|
+
direction: Var[LiteralDirectionType]
|
|
62
|
+
|
|
63
|
+
# When `True`, it prevents scroll restoration
|
|
64
|
+
# when the drawer is closed after a navigation happens inside of it.
|
|
65
|
+
# Defaults to `True`.
|
|
66
|
+
preventScrollRestoration: Var[bool]
|
|
67
|
+
|
|
68
|
+
def get_event_triggers(self) -> Dict[str, Any]:
|
|
69
|
+
"""Get the event triggers that pass the component's value to the handler.
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
A dict mapping the event trigger to the var that is passed to the handler.
|
|
73
|
+
"""
|
|
74
|
+
return {
|
|
75
|
+
**super().get_event_triggers(),
|
|
76
|
+
EventTriggers.ON_OPEN_CHANGE: lambda e0: [e0.target.value],
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class DrawerTrigger(DrawerComponent):
|
|
81
|
+
"""The button that opens the dialog."""
|
|
82
|
+
|
|
83
|
+
tag = "Drawer.Trigger"
|
|
84
|
+
|
|
85
|
+
as_child: Var[bool]
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class DrawerPortal(DrawerComponent):
|
|
89
|
+
"""Portals your drawer into the body."""
|
|
90
|
+
|
|
91
|
+
tag = "Drawer.Portal"
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# Based on https://www.radix-ui.com/primitives/docs/components/dialog#content
|
|
95
|
+
class DrawerContent(DrawerComponent):
|
|
96
|
+
"""Content that should be rendered in the drawer."""
|
|
97
|
+
|
|
98
|
+
tag = "Drawer.Content"
|
|
99
|
+
|
|
100
|
+
# Style set partially based on the source code at https://ui.shadcn.com/docs/components/drawer
|
|
101
|
+
def _get_style(self) -> dict:
|
|
102
|
+
"""Get the style for the component.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
The dictionary of the component style as value and the style notation as key.
|
|
106
|
+
"""
|
|
107
|
+
base_style = {
|
|
108
|
+
"left": "0",
|
|
109
|
+
"right": "0",
|
|
110
|
+
"bottom": "0",
|
|
111
|
+
"top": "0",
|
|
112
|
+
"position": "fixed",
|
|
113
|
+
"z_index": 50,
|
|
114
|
+
"display": "flex",
|
|
115
|
+
}
|
|
116
|
+
style = self.style or {}
|
|
117
|
+
base_style.update(style)
|
|
118
|
+
self.style.update(
|
|
119
|
+
{
|
|
120
|
+
"css": base_style,
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
return self.style
|
|
124
|
+
|
|
125
|
+
def get_event_triggers(self) -> Dict[str, Any]:
|
|
126
|
+
"""Get the events triggers signatures for the component.
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
The signatures of the event triggers.
|
|
130
|
+
"""
|
|
131
|
+
return {
|
|
132
|
+
**super().get_event_triggers(),
|
|
133
|
+
# DrawerContent is based on Radix DialogContent
|
|
134
|
+
# These are the same triggers as DialogContent
|
|
135
|
+
EventTriggers.ON_OPEN_AUTO_FOCUS: lambda e0: [e0.target.value],
|
|
136
|
+
EventTriggers.ON_CLOSE_AUTO_FOCUS: lambda e0: [e0.target.value],
|
|
137
|
+
EventTriggers.ON_ESCAPE_KEY_DOWN: lambda e0: [e0.target.value],
|
|
138
|
+
EventTriggers.ON_POINTER_DOWN_OUTSIDE: lambda e0: [e0.target.value],
|
|
139
|
+
EventTriggers.ON_INTERACT_OUTSIDE: lambda e0: [e0.target.value],
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class DrawerOverlay(DrawerComponent):
|
|
144
|
+
"""A layer that covers the inert portion of the view when the dialog is open."""
|
|
145
|
+
|
|
146
|
+
tag = "Drawer.Overlay"
|
|
147
|
+
|
|
148
|
+
# Style set based on the source code at https://ui.shadcn.com/docs/components/drawer
|
|
149
|
+
def _get_style(self) -> dict:
|
|
150
|
+
"""Get the style for the component.
|
|
151
|
+
|
|
152
|
+
Returns:
|
|
153
|
+
The dictionary of the component style as value and the style notation as key.
|
|
154
|
+
"""
|
|
155
|
+
base_style = {
|
|
156
|
+
"position": "fixed",
|
|
157
|
+
"left": "0",
|
|
158
|
+
"right": "0",
|
|
159
|
+
"bottom": "0",
|
|
160
|
+
"top": "0",
|
|
161
|
+
"z_index": 50,
|
|
162
|
+
"background": "rgba(0, 0, 0, 0.8)",
|
|
163
|
+
}
|
|
164
|
+
style = self.style or {}
|
|
165
|
+
base_style.update(style)
|
|
166
|
+
self.style.update(
|
|
167
|
+
{
|
|
168
|
+
"css": base_style,
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
return self.style
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
class DrawerClose(DrawerComponent):
|
|
175
|
+
"""A button that closes the drawer."""
|
|
176
|
+
|
|
177
|
+
tag = "Drawer.Close"
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class DrawerTitle(DrawerComponent):
|
|
181
|
+
"""A title for the drawer."""
|
|
182
|
+
|
|
183
|
+
tag = "Drawer.Title"
|
|
184
|
+
|
|
185
|
+
# Style set based on the source code at https://ui.shadcn.com/docs/components/drawer
|
|
186
|
+
def _get_style(self) -> dict:
|
|
187
|
+
"""Get the style for the component.
|
|
188
|
+
|
|
189
|
+
Returns:
|
|
190
|
+
The dictionary of the component style as value and the style notation as key.
|
|
191
|
+
"""
|
|
192
|
+
base_style = {
|
|
193
|
+
"font-size": "1.125rem",
|
|
194
|
+
"font-weight": "600",
|
|
195
|
+
"line-weight": "1",
|
|
196
|
+
"letter-spacing": "-0.05em",
|
|
197
|
+
}
|
|
198
|
+
style = self.style or {}
|
|
199
|
+
base_style.update(style)
|
|
200
|
+
self.style.update(
|
|
201
|
+
{
|
|
202
|
+
"css": base_style,
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
return self.style
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
class DrawerDescription(DrawerComponent):
|
|
209
|
+
"""A description for the drawer."""
|
|
210
|
+
|
|
211
|
+
tag = "Drawer.Description"
|
|
212
|
+
|
|
213
|
+
# Style set based on the source code at https://ui.shadcn.com/docs/components/drawer
|
|
214
|
+
def _get_style(self) -> dict:
|
|
215
|
+
"""Get the style for the component.
|
|
216
|
+
|
|
217
|
+
Returns:
|
|
218
|
+
The dictionary of the component style as value and the style notation as key.
|
|
219
|
+
"""
|
|
220
|
+
base_style = {
|
|
221
|
+
"font-size": "0.875rem",
|
|
222
|
+
}
|
|
223
|
+
style = self.style or {}
|
|
224
|
+
base_style.update(style)
|
|
225
|
+
self.style.update(
|
|
226
|
+
{
|
|
227
|
+
"css": base_style,
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
return self.style
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
drawer_root = DrawerRoot.create
|
|
234
|
+
drawer_trigger = DrawerTrigger.create
|
|
235
|
+
drawer_portal = DrawerPortal.create
|
|
236
|
+
drawer_content = DrawerContent.create
|
|
237
|
+
drawer_overlay = DrawerOverlay.create
|
|
238
|
+
drawer_close = DrawerClose.create
|
|
239
|
+
drawer_title = DrawerTitle.create
|
|
240
|
+
drawer_description = DrawerDescription.create
|