reflex 0.5.9.dev1__py3-none-any.whl → 0.5.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.

Files changed (170) hide show
  1. reflex/.templates/web/utils/client_side_routing.js +6 -1
  2. reflex/__init__.py +21 -2
  3. reflex/__init__.pyi +0 -1
  4. reflex/app.py +1 -1
  5. reflex/components/__init__.py +0 -1
  6. reflex/components/__init__.pyi +0 -1
  7. reflex/components/markdown/markdown.py +1 -1
  8. reflex/components/recharts/cartesian.py +3 -0
  9. reflex/components/recharts/cartesian.pyi +2 -0
  10. reflex/components/sonner/toast.py +27 -1
  11. reflex/components/sonner/toast.pyi +5 -0
  12. reflex/constants/base.py +2 -0
  13. reflex/constants/installer.py +2 -0
  14. reflex/experimental/hooks.py +1 -1
  15. reflex/reflex.py +0 -15
  16. reflex/state.py +22 -22
  17. reflex/testing.py +8 -3
  18. reflex/utils/net.py +43 -0
  19. reflex/utils/prerequisites.py +27 -126
  20. reflex/utils/registry.py +48 -0
  21. reflex/utils/types.py +1 -1
  22. reflex/vars.py +4 -2
  23. {reflex-0.5.9.dev1.dist-info → reflex-0.5.10.dist-info}/METADATA +2 -1
  24. {reflex-0.5.9.dev1.dist-info → reflex-0.5.10.dist-info}/RECORD +27 -168
  25. reflex/components/chakra/__init__.py +0 -204
  26. reflex/components/chakra/base.py +0 -210
  27. reflex/components/chakra/base.pyi +0 -319
  28. reflex/components/chakra/datadisplay/__init__.py +0 -10
  29. reflex/components/chakra/datadisplay/badge.py +0 -16
  30. reflex/components/chakra/datadisplay/badge.pyi +0 -96
  31. reflex/components/chakra/datadisplay/code.py +0 -11
  32. reflex/components/chakra/datadisplay/code.pyi +0 -87
  33. reflex/components/chakra/datadisplay/divider.py +0 -20
  34. reflex/components/chakra/datadisplay/divider.pyi +0 -100
  35. reflex/components/chakra/datadisplay/keyboard_key.py +0 -9
  36. reflex/components/chakra/datadisplay/keyboard_key.pyi +0 -87
  37. reflex/components/chakra/datadisplay/list.py +0 -60
  38. reflex/components/chakra/datadisplay/list.pyi +0 -339
  39. reflex/components/chakra/datadisplay/stat.py +0 -80
  40. reflex/components/chakra/datadisplay/stat.pyi +0 -477
  41. reflex/components/chakra/datadisplay/table.py +0 -305
  42. reflex/components/chakra/datadisplay/table.pyi +0 -737
  43. reflex/components/chakra/datadisplay/tag.py +0 -85
  44. reflex/components/chakra/datadisplay/tag.pyi +0 -433
  45. reflex/components/chakra/disclosure/__init__.py +0 -14
  46. reflex/components/chakra/disclosure/accordion.py +0 -110
  47. reflex/components/chakra/disclosure/accordion.pyi +0 -411
  48. reflex/components/chakra/disclosure/tabs.py +0 -117
  49. reflex/components/chakra/disclosure/tabs.pyi +0 -496
  50. reflex/components/chakra/disclosure/transition.py +0 -73
  51. reflex/components/chakra/disclosure/transition.pyi +0 -509
  52. reflex/components/chakra/disclosure/visuallyhidden.py +0 -9
  53. reflex/components/chakra/disclosure/visuallyhidden.pyi +0 -87
  54. reflex/components/chakra/feedback/__init__.py +0 -7
  55. reflex/components/chakra/feedback/alert.py +0 -68
  56. reflex/components/chakra/feedback/alert.pyi +0 -335
  57. reflex/components/chakra/feedback/circularprogress.py +0 -68
  58. reflex/components/chakra/feedback/circularprogress.pyi +0 -185
  59. reflex/components/chakra/feedback/progress.py +0 -33
  60. reflex/components/chakra/feedback/progress.pyi +0 -101
  61. reflex/components/chakra/feedback/skeleton.py +0 -70
  62. reflex/components/chakra/feedback/skeleton.pyi +0 -271
  63. reflex/components/chakra/feedback/spinner.py +0 -25
  64. reflex/components/chakra/feedback/spinner.pyi +0 -102
  65. reflex/components/chakra/forms/__init__.py +0 -49
  66. reflex/components/chakra/forms/button.py +0 -83
  67. reflex/components/chakra/forms/button.pyi +0 -262
  68. reflex/components/chakra/forms/checkbox.py +0 -77
  69. reflex/components/chakra/forms/checkbox.pyi +0 -247
  70. reflex/components/chakra/forms/colormodeswitch.py +0 -104
  71. reflex/components/chakra/forms/colormodeswitch.pyi +0 -473
  72. reflex/components/chakra/forms/date_picker.py +0 -11
  73. reflex/components/chakra/forms/date_picker.pyi +0 -129
  74. reflex/components/chakra/forms/date_time_picker.py +0 -11
  75. reflex/components/chakra/forms/date_time_picker.pyi +0 -129
  76. reflex/components/chakra/forms/editable.py +0 -67
  77. reflex/components/chakra/forms/editable.pyi +0 -343
  78. reflex/components/chakra/forms/email.py +0 -11
  79. reflex/components/chakra/forms/email.pyi +0 -129
  80. reflex/components/chakra/forms/form.py +0 -103
  81. reflex/components/chakra/forms/form.pyi +0 -484
  82. reflex/components/chakra/forms/iconbutton.py +0 -38
  83. reflex/components/chakra/forms/iconbutton.pyi +0 -108
  84. reflex/components/chakra/forms/input.py +0 -130
  85. reflex/components/chakra/forms/input.pyi +0 -566
  86. reflex/components/chakra/forms/multiselect.py +0 -355
  87. reflex/components/chakra/forms/numberinput.py +0 -128
  88. reflex/components/chakra/forms/numberinput.pyi +0 -442
  89. reflex/components/chakra/forms/password.py +0 -11
  90. reflex/components/chakra/forms/password.pyi +0 -129
  91. reflex/components/chakra/forms/pininput.py +0 -201
  92. reflex/components/chakra/forms/pininput.pyi +0 -215
  93. reflex/components/chakra/forms/radio.py +0 -101
  94. reflex/components/chakra/forms/radio.pyi +0 -197
  95. reflex/components/chakra/forms/rangeslider.py +0 -149
  96. reflex/components/chakra/forms/rangeslider.pyi +0 -354
  97. reflex/components/chakra/forms/select.py +0 -103
  98. reflex/components/chakra/forms/select.pyi +0 -204
  99. reflex/components/chakra/forms/slider.py +0 -130
  100. reflex/components/chakra/forms/slider.pyi +0 -449
  101. reflex/components/chakra/forms/switch.py +0 -49
  102. reflex/components/chakra/forms/switch.pyi +0 -159
  103. reflex/components/chakra/forms/textarea.py +0 -79
  104. reflex/components/chakra/forms/textarea.pyi +0 -123
  105. reflex/components/chakra/forms/time_picker.py +0 -11
  106. reflex/components/chakra/forms/time_picker.pyi +0 -129
  107. reflex/components/chakra/layout/__init__.py +0 -14
  108. reflex/components/chakra/layout/aspect_ratio.py +0 -13
  109. reflex/components/chakra/layout/aspect_ratio.pyi +0 -89
  110. reflex/components/chakra/layout/box.py +0 -31
  111. reflex/components/chakra/layout/box.pyi +0 -93
  112. reflex/components/chakra/layout/card.py +0 -100
  113. reflex/components/chakra/layout/card.pyi +0 -379
  114. reflex/components/chakra/layout/center.py +0 -21
  115. reflex/components/chakra/layout/center.pyi +0 -239
  116. reflex/components/chakra/layout/container.py +0 -13
  117. reflex/components/chakra/layout/container.pyi +0 -89
  118. reflex/components/chakra/layout/flex.py +0 -33
  119. reflex/components/chakra/layout/flex.pyi +0 -101
  120. reflex/components/chakra/layout/grid.py +0 -125
  121. reflex/components/chakra/layout/grid.pyi +0 -293
  122. reflex/components/chakra/layout/spacer.py +0 -9
  123. reflex/components/chakra/layout/spacer.pyi +0 -87
  124. reflex/components/chakra/layout/stack.py +0 -48
  125. reflex/components/chakra/layout/stack.pyi +0 -305
  126. reflex/components/chakra/layout/wrap.py +0 -57
  127. reflex/components/chakra/layout/wrap.pyi +0 -179
  128. reflex/components/chakra/media/__init__.py +0 -7
  129. reflex/components/chakra/media/avatar.py +0 -58
  130. reflex/components/chakra/media/avatar.pyi +0 -267
  131. reflex/components/chakra/media/icon.py +0 -111
  132. reflex/components/chakra/media/icon.pyi +0 -171
  133. reflex/components/chakra/media/image.py +0 -74
  134. reflex/components/chakra/media/image.pyi +0 -118
  135. reflex/components/chakra/navigation/__init__.py +0 -18
  136. reflex/components/chakra/navigation/breadcrumb.py +0 -98
  137. reflex/components/chakra/navigation/breadcrumb.pyi +0 -351
  138. reflex/components/chakra/navigation/link.py +0 -62
  139. reflex/components/chakra/navigation/link.pyi +0 -105
  140. reflex/components/chakra/navigation/linkoverlay.py +0 -22
  141. reflex/components/chakra/navigation/linkoverlay.pyi +0 -167
  142. reflex/components/chakra/navigation/stepper.py +0 -113
  143. reflex/components/chakra/navigation/stepper.pyi +0 -762
  144. reflex/components/chakra/overlay/__init__.py +0 -50
  145. reflex/components/chakra/overlay/alertdialog.py +0 -153
  146. reflex/components/chakra/overlay/alertdialog.pyi +0 -612
  147. reflex/components/chakra/overlay/drawer.py +0 -168
  148. reflex/components/chakra/overlay/drawer.pyi +0 -652
  149. reflex/components/chakra/overlay/menu.py +0 -225
  150. reflex/components/chakra/overlay/menu.pyi +0 -708
  151. reflex/components/chakra/overlay/modal.py +0 -166
  152. reflex/components/chakra/overlay/modal.pyi +0 -600
  153. reflex/components/chakra/overlay/popover.py +0 -183
  154. reflex/components/chakra/overlay/popover.pyi +0 -757
  155. reflex/components/chakra/overlay/tooltip.py +0 -70
  156. reflex/components/chakra/overlay/tooltip.pyi +0 -129
  157. reflex/components/chakra/typography/__init__.py +0 -10
  158. reflex/components/chakra/typography/heading.py +0 -16
  159. reflex/components/chakra/typography/heading.pyi +0 -96
  160. reflex/components/chakra/typography/highlight.py +0 -23
  161. reflex/components/chakra/typography/highlight.pyi +0 -91
  162. reflex/components/chakra/typography/span.py +0 -15
  163. reflex/components/chakra/typography/span.pyi +0 -89
  164. reflex/components/chakra/typography/text.py +0 -18
  165. reflex/components/chakra/typography/text.pyi +0 -91
  166. reflex/components/media/__init__.py +0 -1
  167. reflex/components/media/icon.py +0 -3
  168. {reflex-0.5.9.dev1.dist-info → reflex-0.5.10.dist-info}/LICENSE +0 -0
  169. {reflex-0.5.9.dev1.dist-info → reflex-0.5.10.dist-info}/WHEEL +0 -0
  170. {reflex-0.5.9.dev1.dist-info → reflex-0.5.10.dist-info}/entry_points.txt +0 -0
@@ -1,118 +0,0 @@
1
- """Stub file for reflex/components/chakra/media/image.py"""
2
-
3
- # ------------------- DO NOT EDIT ----------------------
4
- # This file was generated by `reflex/utils/pyi_generator.py`!
5
- # ------------------------------------------------------
6
- from typing import Any, Callable, Dict, Literal, Optional, Union, overload
7
-
8
- from reflex.components.chakra import ChakraComponent
9
- from reflex.components.component import Component
10
- from reflex.event import EventHandler, EventSpec
11
- from reflex.style import Style
12
- from reflex.vars import BaseVar, Var
13
-
14
- class Image(ChakraComponent):
15
- @overload
16
- @classmethod
17
- def create( # type: ignore
18
- cls,
19
- *children,
20
- align: Optional[Union[Var[str], str]] = None,
21
- fallback: Optional[Component] = None,
22
- fallback_src: Optional[Union[Var[str], str]] = None,
23
- fit: Optional[Union[Var[str], str]] = None,
24
- html_height: Optional[Union[Var[str], str]] = None,
25
- html_width: Optional[Union[Var[str], str]] = None,
26
- ignore_fallback: Optional[Union[Var[bool], bool]] = None,
27
- loading: Optional[
28
- Union[Var[Literal["eager", "lazy"]], Literal["eager", "lazy"]]
29
- ] = None,
30
- src: Optional[Union[Var[Any], Any]] = None,
31
- alt: Optional[Union[Var[str], str]] = None,
32
- src_set: Optional[Union[Var[str], str]] = None,
33
- style: Optional[Style] = None,
34
- key: Optional[Any] = None,
35
- id: Optional[Any] = None,
36
- class_name: Optional[Any] = None,
37
- autofocus: Optional[bool] = None,
38
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
39
- on_blur: Optional[
40
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
41
- ] = None,
42
- on_click: Optional[
43
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
44
- ] = None,
45
- on_context_menu: Optional[
46
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
47
- ] = None,
48
- on_double_click: Optional[
49
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
50
- ] = None,
51
- on_error: Optional[
52
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
53
- ] = None,
54
- on_focus: Optional[
55
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
56
- ] = None,
57
- on_load: Optional[
58
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
59
- ] = None,
60
- on_mount: Optional[
61
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
62
- ] = None,
63
- on_mouse_down: Optional[
64
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
65
- ] = None,
66
- on_mouse_enter: Optional[
67
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
68
- ] = None,
69
- on_mouse_leave: Optional[
70
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
71
- ] = None,
72
- on_mouse_move: Optional[
73
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
74
- ] = None,
75
- on_mouse_out: Optional[
76
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
77
- ] = None,
78
- on_mouse_over: Optional[
79
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
80
- ] = None,
81
- on_mouse_up: Optional[
82
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
83
- ] = None,
84
- on_scroll: Optional[
85
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
86
- ] = None,
87
- on_unmount: Optional[
88
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
89
- ] = None,
90
- **props,
91
- ) -> "Image":
92
- """Create an Image component.
93
-
94
- Args:
95
- *children: The children of the image.
96
- align: How to align the image within its bounds. It maps to css `object-position` property.
97
- fallback: Fallback Reflex component to show if image is loading or image fails.
98
- fallback_src: Fallback image src to show if image is loading or image fails.
99
- fit: How the image to fit within its bounds. It maps to css `object-fit` property.
100
- html_height: The native HTML height attribute to the passed to the img.
101
- html_width: The native HTML width attribute to the passed to the img.
102
- ignore_fallback: If true, opt out of the fallbackSrc logic and use as img.
103
- loading: "eager" | "lazy"
104
- src: The path/url to the image or PIL image object.
105
- alt: The alt text of the image.
106
- src_set: Provide multiple sources for an image, allowing the browser to select the most appropriate source based on factors like screen resolution and device capabilities. Learn more _[here](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images)_
107
- style: The style of the component.
108
- key: A unique key for the component.
109
- id: The id for the component.
110
- class_name: The class name for the component.
111
- autofocus: Whether the component should take the focus once the page is loaded
112
- custom_attrs: custom attribute
113
- **props: The props of the image.
114
-
115
- Returns:
116
- The Image component.
117
- """
118
- ...
@@ -1,18 +0,0 @@
1
- """Navigation components."""
2
-
3
- from .breadcrumb import Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbSeparator
4
- from .link import Link
5
- from .linkoverlay import LinkBox, LinkOverlay
6
- from .stepper import (
7
- Step,
8
- StepDescription,
9
- StepIcon,
10
- StepIndicator,
11
- StepNumber,
12
- Stepper,
13
- StepSeparator,
14
- StepStatus,
15
- StepTitle,
16
- )
17
-
18
- __all__ = [f for f in dir() if f[0].isupper()] # type: ignore
@@ -1,98 +0,0 @@
1
- """Breadcrumb components."""
2
-
3
- from reflex.components.chakra import ChakraComponent
4
- from reflex.components.chakra.navigation.link import Link
5
- from reflex.components.component import Component
6
- from reflex.components.core.foreach import Foreach
7
- from reflex.vars import Var
8
-
9
-
10
- class Breadcrumb(ChakraComponent):
11
- """The parent container for breadcrumbs."""
12
-
13
- tag = "Breadcrumb"
14
-
15
- # The visual separator between each breadcrumb item
16
- separator: Var[str]
17
-
18
- # The left and right margin applied to the separator
19
- separator_margin: Var[str]
20
-
21
- @classmethod
22
- def create(cls, *children, items=None, **props) -> Component:
23
- """Create a breadcrumb component.
24
-
25
- If the kw-args `items` is provided and is a list, they will be added as children.
26
-
27
- Args:
28
- *children: The children of the component.
29
- items (list): The items of the breadcrumb: (label, link)
30
- **props: The properties of the component.
31
-
32
- Returns:
33
- The breadcrumb component.
34
- """
35
- if len(children) == 0:
36
- if isinstance(items, Var):
37
- children = [
38
- Foreach.create(
39
- items,
40
- lambda item: BreadcrumbItem.create(label=item[0], href=item[1]),
41
- ),
42
- ]
43
-
44
- else:
45
- children = []
46
- for label, link in items or []:
47
- children.append(BreadcrumbItem.create(label=label, href=link))
48
- return super().create(*children, **props)
49
-
50
-
51
- class BreadcrumbItem(ChakraComponent):
52
- """Individual breadcrumb element containing a link and a divider."""
53
-
54
- tag = "BreadcrumbItem"
55
-
56
- # Is the current page of the breadcrumb.
57
- is_current_page: Var[bool]
58
-
59
- # Is the last child of the breadcrumb.
60
- is_last_child: Var[bool]
61
-
62
- # The visual separator between each breadcrumb item
63
- separator: Var[str]
64
-
65
- # The left and right margin applied to the separator
66
- spacing: Var[str]
67
-
68
- @classmethod
69
- def create(cls, *children, label=None, href=None, **props):
70
- """Create a Breadcrumb Item component.
71
-
72
- Args:
73
- *children: The children of the component.
74
- label: The label used in the link. Defaults to None.
75
- href: The URL of the link. Defaults to None.
76
- **props: The properties of the component.
77
-
78
- Returns:
79
- The BreadcrumbItem component
80
- """
81
- if len(children) == 0:
82
- children = [BreadcrumbLink.create(label or "", href=href or "")] # type: ignore
83
- return super().create(*children, **props)
84
-
85
-
86
- class BreadcrumbSeparator(ChakraComponent):
87
- """The visual separator between each breadcrumb."""
88
-
89
- tag = "BreadcrumbSeparator"
90
-
91
-
92
- class BreadcrumbLink(Link):
93
- """The breadcrumb link."""
94
-
95
- tag = "BreadcrumbLink"
96
-
97
- # Is the current page of the breadcrumb.
98
- is_current_page: Var[bool]
@@ -1,351 +0,0 @@
1
- """Stub file for reflex/components/chakra/navigation/breadcrumb.py"""
2
-
3
- # ------------------- DO NOT EDIT ----------------------
4
- # This file was generated by `reflex/utils/pyi_generator.py`!
5
- # ------------------------------------------------------
6
- from typing import Any, Callable, Dict, Optional, Union, overload
7
-
8
- from reflex.components.chakra import ChakraComponent
9
- from reflex.components.chakra.navigation.link import Link
10
- from reflex.event import EventHandler, EventSpec
11
- from reflex.style import Style
12
- from reflex.vars import BaseVar, Var
13
-
14
- class Breadcrumb(ChakraComponent):
15
- @overload
16
- @classmethod
17
- def create( # type: ignore
18
- cls,
19
- *children,
20
- items=None,
21
- separator: Optional[Union[Var[str], str]] = None,
22
- separator_margin: Optional[Union[Var[str], str]] = None,
23
- style: Optional[Style] = None,
24
- key: Optional[Any] = None,
25
- id: Optional[Any] = None,
26
- class_name: Optional[Any] = None,
27
- autofocus: Optional[bool] = None,
28
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
29
- on_blur: Optional[
30
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
31
- ] = None,
32
- on_click: Optional[
33
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
34
- ] = None,
35
- on_context_menu: Optional[
36
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
37
- ] = None,
38
- on_double_click: Optional[
39
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
40
- ] = None,
41
- on_focus: Optional[
42
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
43
- ] = None,
44
- on_mount: Optional[
45
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
46
- ] = None,
47
- on_mouse_down: Optional[
48
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
49
- ] = None,
50
- on_mouse_enter: Optional[
51
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
52
- ] = None,
53
- on_mouse_leave: Optional[
54
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
55
- ] = None,
56
- on_mouse_move: Optional[
57
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
58
- ] = None,
59
- on_mouse_out: Optional[
60
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
61
- ] = None,
62
- on_mouse_over: Optional[
63
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
64
- ] = None,
65
- on_mouse_up: Optional[
66
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
67
- ] = None,
68
- on_scroll: Optional[
69
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
70
- ] = None,
71
- on_unmount: Optional[
72
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
73
- ] = None,
74
- **props,
75
- ) -> "Breadcrumb":
76
- """Create a breadcrumb component.
77
-
78
- If the kw-args `items` is provided and is a list, they will be added as children.
79
-
80
- Args:
81
- *children: The children of the component.
82
- items (list): The items of the breadcrumb: (label, link)
83
- separator: The visual separator between each breadcrumb item
84
- separator_margin: The left and right margin applied to the separator
85
- style: The style of the component.
86
- key: A unique key for the component.
87
- id: The id for the component.
88
- class_name: The class name for the component.
89
- autofocus: Whether the component should take the focus once the page is loaded
90
- custom_attrs: custom attribute
91
- **props: The properties of the component.
92
-
93
- Returns:
94
- The breadcrumb component.
95
- """
96
- ...
97
-
98
- class BreadcrumbItem(ChakraComponent):
99
- @overload
100
- @classmethod
101
- def create( # type: ignore
102
- cls,
103
- *children,
104
- label=None,
105
- href=None,
106
- is_current_page: Optional[Union[Var[bool], bool]] = None,
107
- is_last_child: Optional[Union[Var[bool], bool]] = None,
108
- separator: Optional[Union[Var[str], str]] = None,
109
- spacing: Optional[Union[Var[str], str]] = None,
110
- style: Optional[Style] = None,
111
- key: Optional[Any] = None,
112
- id: Optional[Any] = None,
113
- class_name: Optional[Any] = None,
114
- autofocus: Optional[bool] = None,
115
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
116
- on_blur: Optional[
117
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
118
- ] = None,
119
- on_click: Optional[
120
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
121
- ] = None,
122
- on_context_menu: Optional[
123
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
124
- ] = None,
125
- on_double_click: Optional[
126
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
127
- ] = None,
128
- on_focus: Optional[
129
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
130
- ] = None,
131
- on_mount: Optional[
132
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
133
- ] = None,
134
- on_mouse_down: Optional[
135
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
136
- ] = None,
137
- on_mouse_enter: Optional[
138
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
139
- ] = None,
140
- on_mouse_leave: Optional[
141
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
142
- ] = None,
143
- on_mouse_move: Optional[
144
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
145
- ] = None,
146
- on_mouse_out: Optional[
147
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
148
- ] = None,
149
- on_mouse_over: Optional[
150
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
151
- ] = None,
152
- on_mouse_up: Optional[
153
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
154
- ] = None,
155
- on_scroll: Optional[
156
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
157
- ] = None,
158
- on_unmount: Optional[
159
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
160
- ] = None,
161
- **props,
162
- ) -> "BreadcrumbItem":
163
- """Create a Breadcrumb Item component.
164
-
165
- Args:
166
- *children: The children of the component.
167
- label: The label used in the link. Defaults to None.
168
- href: The URL of the link. Defaults to None.
169
- is_current_page: Is the current page of the breadcrumb.
170
- is_last_child: Is the last child of the breadcrumb.
171
- separator: The visual separator between each breadcrumb item
172
- spacing: The left and right margin applied to the separator
173
- style: The style of the component.
174
- key: A unique key for the component.
175
- id: The id for the component.
176
- class_name: The class name for the component.
177
- autofocus: Whether the component should take the focus once the page is loaded
178
- custom_attrs: custom attribute
179
- **props: The properties of the component.
180
-
181
- Returns:
182
- The BreadcrumbItem component
183
- """
184
- ...
185
-
186
- class BreadcrumbSeparator(ChakraComponent):
187
- @overload
188
- @classmethod
189
- def create( # type: ignore
190
- cls,
191
- *children,
192
- style: Optional[Style] = None,
193
- key: Optional[Any] = None,
194
- id: Optional[Any] = None,
195
- class_name: Optional[Any] = None,
196
- autofocus: Optional[bool] = None,
197
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
198
- on_blur: Optional[
199
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
200
- ] = None,
201
- on_click: Optional[
202
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
203
- ] = None,
204
- on_context_menu: Optional[
205
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
206
- ] = None,
207
- on_double_click: Optional[
208
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
209
- ] = None,
210
- on_focus: Optional[
211
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
212
- ] = None,
213
- on_mount: Optional[
214
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
215
- ] = None,
216
- on_mouse_down: Optional[
217
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
218
- ] = None,
219
- on_mouse_enter: Optional[
220
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
221
- ] = None,
222
- on_mouse_leave: Optional[
223
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
224
- ] = None,
225
- on_mouse_move: Optional[
226
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
227
- ] = None,
228
- on_mouse_out: Optional[
229
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
230
- ] = None,
231
- on_mouse_over: Optional[
232
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
233
- ] = None,
234
- on_mouse_up: Optional[
235
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
236
- ] = None,
237
- on_scroll: Optional[
238
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
239
- ] = None,
240
- on_unmount: Optional[
241
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
242
- ] = None,
243
- **props,
244
- ) -> "BreadcrumbSeparator":
245
- """Create the component.
246
-
247
- Args:
248
- *children: The children of the component.
249
- style: The style of the component.
250
- key: A unique key for the component.
251
- id: The id for the component.
252
- class_name: The class name for the component.
253
- autofocus: Whether the component should take the focus once the page is loaded
254
- custom_attrs: custom attribute
255
- **props: The props of the component.
256
-
257
- Returns:
258
- The component.
259
- """
260
- ...
261
-
262
- class BreadcrumbLink(Link):
263
- @overload
264
- @classmethod
265
- def create( # type: ignore
266
- cls,
267
- *children,
268
- is_current_page: Optional[Union[Var[bool], bool]] = None,
269
- rel: Optional[Union[Var[str], str]] = None,
270
- href: Optional[Union[Var[str], str]] = None,
271
- text: Optional[Union[Var[str], str]] = None,
272
- as_: Optional[Union[Var[str], str]] = None,
273
- is_external: Optional[Union[Var[bool], bool]] = None,
274
- style: Optional[Style] = None,
275
- key: Optional[Any] = None,
276
- id: Optional[Any] = None,
277
- class_name: Optional[Any] = None,
278
- autofocus: Optional[bool] = None,
279
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
280
- on_blur: Optional[
281
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
282
- ] = None,
283
- on_click: Optional[
284
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
285
- ] = None,
286
- on_context_menu: Optional[
287
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
288
- ] = None,
289
- on_double_click: Optional[
290
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
291
- ] = None,
292
- on_focus: Optional[
293
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
294
- ] = None,
295
- on_mount: Optional[
296
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
297
- ] = None,
298
- on_mouse_down: Optional[
299
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
300
- ] = None,
301
- on_mouse_enter: Optional[
302
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
303
- ] = None,
304
- on_mouse_leave: Optional[
305
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
306
- ] = None,
307
- on_mouse_move: Optional[
308
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
309
- ] = None,
310
- on_mouse_out: Optional[
311
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
312
- ] = None,
313
- on_mouse_over: Optional[
314
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
315
- ] = None,
316
- on_mouse_up: Optional[
317
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
318
- ] = None,
319
- on_scroll: Optional[
320
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
321
- ] = None,
322
- on_unmount: Optional[
323
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
324
- ] = None,
325
- **props,
326
- ) -> "BreadcrumbLink":
327
- """Create a Link component.
328
-
329
- Args:
330
- *children: The children of the component.
331
- is_current_page: Is the current page of the breadcrumb.
332
- rel: The rel.
333
- href: The page to link to.
334
- text: The text to display.
335
- as_: What the link renders to.
336
- is_external: If true, the link will open in new tab.
337
- style: The style of the component.
338
- key: A unique key for the component.
339
- id: The id for the component.
340
- class_name: The class name for the component.
341
- autofocus: Whether the component should take the focus once the page is loaded
342
- custom_attrs: custom attribute
343
- **props: The props of the component.
344
-
345
- Raises:
346
- ValueError: in case of missing children
347
-
348
- Returns:
349
- Component: The link component
350
- """
351
- ...
@@ -1,62 +0,0 @@
1
- """A link component."""
2
-
3
- from reflex.components.chakra import ChakraComponent
4
- from reflex.components.component import Component
5
- from reflex.components.next.link import NextLink
6
- from reflex.utils.imports import ImportDict
7
- from reflex.vars import BaseVar, Var
8
-
9
- next_link = NextLink.create()
10
-
11
-
12
- class Link(ChakraComponent):
13
- """Link to another page."""
14
-
15
- tag = "Link"
16
-
17
- # The rel.
18
- rel: Var[str]
19
-
20
- # The page to link to.
21
- href: Var[str]
22
-
23
- # The text to display.
24
- text: Var[str]
25
-
26
- # What the link renders to.
27
- as_: Var[str] = BaseVar.create(
28
- value="{NextLink}", _var_is_local=False, _var_is_string=False
29
- ) # type: ignore
30
-
31
- # If true, the link will open in new tab.
32
- is_external: Var[bool]
33
-
34
- def add_imports(self) -> ImportDict:
35
- """Add imports for the link component.
36
-
37
- Returns:
38
- The import dict.
39
- """
40
- return next_link._get_imports() # type: ignore
41
-
42
- @classmethod
43
- def create(cls, *children, **props) -> Component:
44
- """Create a Link component.
45
-
46
- Args:
47
- *children: The children of the component.
48
- **props: The props of the component.
49
-
50
- Raises:
51
- ValueError: in case of missing children
52
-
53
- Returns:
54
- Component: The link component
55
- """
56
- if props.get("href") is not None:
57
- if not len(children):
58
- raise ValueError("Link without a child will not display")
59
- else:
60
- # Don't use a NextLink if there is no href.
61
- props["as_"] = ""
62
- return super().create(*children, **props)