Commit Graph

171 Commits

Author SHA1 Message Date
Thomas Brandého
1810288007
remove inheritance from Flex for list components (#2936) 2024-03-28 10:58:36 -07:00
Thomas Brandého
f19a6a8c8d
use radix box instead of chakra one for responsive elements (#2921) 2024-03-25 15:16:48 -07:00
Masen Furer
432fcd4a5b
Account for imports of @rx.memo components for frontend package installation (#2863)
* CustomComponent ignores the annotation type in favor of the passed value

Do not require rx.memo wrapped functions to have 100% correct annotations.

* test_custom_component_get_imports: test imports from wrapped custom components

* Account for imports of custom components for frontend installation

Create new ImportVar that only install the package to avoid rendering the
imports in the page that contains the custom component itself.

* Handle Imports that should never be installed

* Fix up double negative logic

* Perf Optimization: use the imports we already calculate during compile

Instead of augmenting _get_imports with a weird, slow, recursive crawl and
dictionary reconstruction, just use the imports that we compile into the
components.js file to install frontend packages needed by the custom
components.

Same effect, but adds essentially zero overhead to the compilation.
2024-03-15 09:59:59 -07:00
benedikt-bartscher
2d56441a28
fix black+ruff (#2750) 2024-02-28 14:51:50 -08:00
Amir Molavi
842c7e6882
Add config to rx.plotly component (#2745) 2024-02-28 12:44:33 -08:00
Thomas Brandého
0464a7723e
remove chakra from markdown component_map (#2709) 2024-02-26 19:34:22 -08:00
Masen Furer
3350fa0388
Component: translate underscore suffix for props supported by chakra (#2636)
* Component: translate underscore suffix for props supported by chakra

type_ becomes type
min_ becomes min
max_ becomes max
id_ becomes id

The deprecation warning is only displayed when the underscore suffix prop is
passed and the non-underscore suffix prop is defined on the given component.

* Rename type_ to type in accordion and scroll_area

All of the new radix components avoid the underscore suffix names where
possible.

* Update deprecation warning wording

* Refactor for readability

* Do not raise deprecation warning for `id_`

id is kind of a special prop because it exists on all components

* Add test case for deprecating underscore suffix props
2024-02-15 20:46:06 -08:00
Masen Furer
f12746d859
Inherit _rename_props from parent classes (#2613)
Ensure that _rename_props from base classes add to the list of _rename_props in subclasses.

Add a test case to validate this behavior.
2024-02-14 14:36:01 -08:00
invrainbow
e729a315f8
Fix fstrings being escaped improperly (#2571) 2024-02-13 14:32:44 -08:00
Elijah Ahianyo
5e9b472d1b
[REF-1919] Valid Children/parents to allow Foreach,Cond,Match and Fragment (#2591) 2024-02-13 14:22:22 -08:00
Masen Furer
4206afeb7b
[REF-1958] Remove shadowed radix css props (#2590)
* style: shorthand replacements need camelCase

Avoid warning on terminal and in browser console from using kebab-case CSS
props with emotion.

* _rename_props only replace prop name once

In case the value also contains the prop name, we don't want to replace it
multiple times.

* pyi_generator: ignore _rename_props in create signature

* Avoid shadowing CSS prop `display` and `gap`

Replace usages of `gap` with `spacing` to retain Radix sizing number system,
while allowing users to specify a responsive `gap` using CSS units.

Remove `display` props from radix components, allowing `display` to accept
responsive lists.

* checkbox: apply `gap` to `flex` if provided

* Remove _rename_props from .create signatures

* Fix spacing prop in blank template

* Fixup tests after changing style shorthand to return camelCase
2024-02-13 10:06:28 -08:00
invrainbow
61234ae164
Fix operator precedence (#2573) 2024-02-12 19:30:25 -08:00
Masen Furer
58b5e2f5bd
Merge remote-tracking branch 'origin/main' into reflex-0.4.0 2024-02-09 19:38:35 -08:00
Elijah Ahianyo
ccc9c32c95
Get rx.color working with fstrings (#2562)
* fix for rx.color working with fstrings

* Fix fstrings issues
2024-02-09 17:06:55 -08:00
Masen Furer
78c54b3486
Use rx.el.img as rx.image (#2558)
* Use rx.el.img as rx.image

* Update test_image to work with plain rx.el.img
2024-02-08 14:44:53 -08:00
Masen Furer
d28109f4c4
Merge remote-tracking branch 'origin/main' into reflex-0.4.0 2024-02-08 11:54:02 -08:00
Elijah Ahianyo
601dd34792
rx.color to work with conditional vars (#2546) 2024-02-08 11:45:15 -08:00
Masen Furer
b607531318
Unbreak tests after recent changes in main (p2) 2024-02-08 10:46:40 -08:00
Masen Furer
c596651de6
Fix pre-commit issues introduced from merging origin/main 2024-02-08 10:28:45 -08:00
Masen Furer
c124650082
Merge remote-tracking branch 'origin/main' into reflex-0.4.0 2024-02-07 13:53:39 -08:00
Elijah Ahianyo
ce867d2f81
Support for Shorthand css props. (#2547) 2024-02-07 12:05:04 -08:00
Nikhil Rao
eacd534137
Increase debounce timeout to 300ms (#2541) 2024-02-07 11:55:43 -08:00
Masen Furer
f99c48806a
Top-level namespace tweaks (#2523)
* pyi_generator: always ignore files starting with `tests`

* Move CodeBlock out of chakra namespace

* Expose additional names in the top-level namespace

* code pyi fixup

* expose input and quote at the top-level

* add text_field to top-level namespace (maybe)

* fixup chakra code.pyi

* Remove `text_field` from top level namespace

* Remove top-level big C Cond

* fixup top level pyi
2024-02-05 11:14:02 -08:00
Nikhil Rao
05d1be2182
Move core components to radix namespace (#2506) 2024-02-02 14:26:46 -08:00
Nikhil Rao
5176a7cb14
Support component create methods as keys in global styles (#2498) 2024-01-31 12:25:18 -08:00
Tianze
209c5fab7b
Tabs validate parent is proper tab container (#2463) 2024-01-30 11:45:00 -08:00
wassaf shahzad
069892d8ee
fixed issue with hypens (#2450) 2024-01-26 14:14:46 -08:00
Elijah Ahianyo
abfc099779
rx.match component (#2318)
* initial commit

* add more tests

* refactor match jinja template

* add docstrings

* cleanup

* possible fix for pyright

* fix conflicts

* fix conflicts again

* comments

* fixed bug from review

* fix tests

* address PR comment

* fix tests

* type error improvement

* formatting

* darglint fix

* more tests

* stringify switch condition and cases as js doesnt support complex types(lists and dicts) in switch cases.

* Update reflex/vars.py

Co-authored-by: Masen Furer <m_github@0x26.net>

* change usages

* Precommit fix

---------

Co-authored-by: Alek Petuskey <alek@pynecone.io>
Co-authored-by: Masen Furer <m_github@0x26.net>
Co-authored-by: Alek Petuskey <alekpetuskey@aleks-mbp.lan>
2024-01-04 09:48:18 -08:00
Masen Furer
0211e9a0e5
Avoid passing props to lists and list items (#2326) 2023-12-21 15:58:45 -08:00
Nikhil Rao
93c97383d9
Refactor chakra components into separate folder (#2315) 2023-12-21 09:52:08 -08:00
Elijah Ahianyo
9629b59617
DataFrame Serializer fix (#2281) 2023-12-12 14:03:40 -08:00
Thomas Brandého
caf32605ca
add next/image and next-video in next namespace (#2223) 2023-12-07 10:38:47 -08:00
Elijah Ahianyo
e3ee98098a
RED-1052/rx.State as Base State (#2146) 2023-11-29 09:43:33 -08:00
Masen Furer
527437cf23
[REF-144] Add context in each component to prevent rerenders (#2198) 2023-11-27 16:05:59 -08:00
Masen Furer
1603144c7d
[REF-889] useContext per substate (#2149) 2023-11-21 11:52:06 -08:00
Nikhil Rao
e9437ad941
Use singleton app provider to speed up compiles (#2172) 2023-11-20 18:11:24 -08:00
Thomas Brandého
1a83f85783
_valid_children and _invalid_children accessible from class (#2192) 2023-11-17 12:30:18 -08:00
Masen Furer
7eccc6d988
[REF-723+] Upload with progress and cancellation (#1899) 2023-11-16 15:46:13 -08:00
Masen Furer
f3929f47e3
form: only pass handleSubmit when on_submit is defined (#2162) 2023-11-13 23:27:42 -08:00
Elijah Ahianyo
ea22452b27
Reduce Syntax highlighter footprint (#2037) 2023-11-13 12:47:55 -08:00
Nikhil Rao
e703d87450
Set unique index vars in rx.foreach (#2126) 2023-11-03 16:20:42 -07:00
Masen Furer
56476d0a86
Expose DOM event actions on EventHandler, EventSpec, and EventChain (stopPropagation) (#1891)
* Expose preventDefault and stopPropagation for DOM events

All EventHandler, EventSpec, and EventChain can now carry these extra
"event_actions" that will be applied inside the frontend code when an event is
triggered from the DOM.

Fix #1621
Fix REF-675

* Test cases (and fixes) for "event_actions"

* form: from __future__ import annotations

for py38, py39 compat

* Revert overzealous merge conflict resolution
2023-10-31 11:42:42 -07:00
Elijah Ahianyo
06bdf9ed8a
Remove 0.3.0 deprecated features (#1947) 2023-10-19 09:44:32 -07:00
Masen Furer
024cb5fa9b
Var field cleanup (#1943) 2023-10-13 14:53:55 -07:00
Alek Petuskey
67eb661704
Core Graphing -> Recharts (#1878) 2023-10-04 15:05:08 -07:00
Thomas Brandého
58933278ad
fix rx.image src not working with state (#1915) 2023-10-04 14:15:18 -07:00
Nikhil Rao
53d205ad9f
Improve default rx.markdown styling (#1904) 2023-10-02 11:52:16 -07:00
Elijah Ahianyo
26885d98cf
rx.table __bool__ regression fix (#1828) 2023-09-28 09:31:01 -07:00
Nikhil Rao
8231993e5a
Improvements to custom styles in rx.markdown (#1852) 2023-09-25 15:59:48 -07:00
Thomas Brandého
211dc15995
New API to define triggers (#1820) 2023-09-21 09:47:22 -07:00
Nikhil Rao
ac8dfc5f91
Format component as React string (#1848) 2023-09-20 19:30:38 -07:00
Nikhil Rao
1938a6cc58
Add serializers for different var types (#1816) 2023-09-15 17:19:26 -07:00
Thomas Brandého
043648da07
improve pyi files generation (#1765) 2023-09-07 00:23:17 -07:00
Masen Furer
71811a600c
Var: __bool__ and __iter__ always raise a TypeError (#1750) 2023-09-05 13:44:22 -07:00
Elijah Ahianyo
829a7751b5
Refactor: Move format_prop Static Method for Improved Reusability (#1714) 2023-09-01 13:01:11 -07:00
Masen Furer
2392c52928
Implement on_mount and on_unmount for all components. (#1636) 2023-08-30 09:50:39 -07:00
Martin Xu
82dc237f44
Revert "Use DebounceInput wrapper for fully controlled Editable" (#1670) 2023-08-23 17:16:03 -07:00
Elijah Ahianyo
217a5806ee
Validate component children (#1647) 2023-08-23 15:56:27 -07:00
Martin Xu
d884b7ba96
Use DebounceInput wrapper for fully controlled Editable (#1650) 2023-08-21 14:25:56 -07:00
Masen Furer
042710ca91
Handle file uploads with component-local state (#1616) 2023-08-18 13:12:17 -07:00
Masen Furer
26e45c1f18
format_dict: only unescape quotes when removing outer quotes (#1609) 2023-08-17 09:45:25 -07:00
Nikhil Rao
6d15326abf
Support f-strings in component children and non-style props (#1575) 2023-08-14 11:33:16 -07:00
Masen Furer
4a658ef9be
Wrap Input and TextArea with DebounceInput for full control (#1484) 2023-08-07 14:27:42 -07:00
Elijah Ahianyo
d4abf5ff2b
Update tests for Foreach (#1394) 2023-07-21 11:49:55 -07:00
Masen Furer
bfec196d84
Expose Script component from next/script (#1355) 2023-07-18 18:57:50 -07:00
Nikhil Rao
139ce38df1
Rename pynecone to reflex (#1236) 2023-06-25 16:56:55 -07:00
TaiJuWu
0531d611dc
feature: support custom attribute for components (#1085) 2023-05-26 11:49:57 -07:00
Nikhil Rao
9485127c1c
Handle multi-select (#1082) 2023-05-26 10:50:16 -07:00
Elijah Ahianyo
368b79f160
pc table validation (#1075) 2023-05-24 13:14:27 -07:00
Elijah Ahianyo
bb1cf4322e
Foreach support for other data structures(dict, set, tuple) (#1029) 2023-05-17 16:11:41 -07:00
Elijah Ahianyo
0c33ad19f6
bugfix for upload event (#1042) 2023-05-17 10:08:11 -07:00
Alek Petuskey
4a580b54ff
Visual CLI improvements (#1032) 2023-05-16 20:42:53 -07:00
Nikhil Rao
e6a679d3a3
Update pc.form on_submit args (#1033) 2023-05-16 12:09:15 -07:00
Nikhil Rao
98f1b30735
Fix event default call (#1031) 2023-05-15 21:10:42 -07:00
Nikhil Rao
948ec90fc4
Add pc.form component (#929) 2023-05-14 22:34:10 -07:00
Elijah Ahianyo
139e4cf05b
Update upload event to use queue (#1005) 2023-05-12 16:44:16 -07:00
iron3oxide
32f3a387ae
Rename var module to vars (#983) 2023-05-09 23:01:25 -07:00
PeterYusuke
3b88e7c329
[Fix 477] Use jinja2 for templating (#915) 2023-05-09 14:34:47 -07:00
Thomas Brandého
893c0b132e
Make argument optional for event handlers (#950) 2023-05-06 13:10:35 -07:00
Elijah Ahianyo
18c715670a
Revamp Imports (#926) 2023-05-04 22:11:01 -07:00
Nikhil Rao
1a254aca8e
Add pc.set_value (#835) 2023-04-29 19:01:37 -07:00
Nikhil Rao
60323a3aec
Revert fstrings change (#895) 2023-04-27 14:36:20 -07:00
Nikhil Rao
23a23d437c
Fix f-strings in props (#891) 2023-04-26 21:20:40 -07:00
Nikhil Rao
f0346506d7
Allow fstrings as component children (#890) 2023-04-26 19:32:51 -07:00
Nikhil Rao
e03e5f8033
Use Python truthiness in pc.cond (#889) 2023-04-26 17:16:38 -07:00
Elijah Ahianyo
29945504bc
Dynamic vars initialization unit tests(#880) 2023-04-26 14:41:47 -07:00
Elijah Ahianyo
a52145e52a
Python 3.10 tag issubclass bug: (#832) 2023-04-17 10:08:43 -07:00
Masen Furer
c3148d348c
component.get_hooks: inject hook code into component func (#810) 2023-04-15 22:10:17 -07:00
Elijah Ahianyo
e8387c8e26
Fix Event chaining in the on_load event handler return not working (#773)
* Fix Event chaining in the on_load event handler return not working

* added async tests

* addressed comments
2023-04-06 22:26:43 -07:00
Nikhil Rao
8eea6ac822
Add component memoization (#770) 2023-04-03 17:38:56 -07:00
Elijah Ahianyo
50cdfac24c
bugfix/723: pc.data_table not working well with pandas as computed vars (#745)
* bugfix/723: pc.data_table not working well with pandas as computed vars

Turns out this isnt really a bug. You need to specify an annotation for the computed var to work. This Pr adds a check for annotations on computed vars for data tables

* added more validation for column field
2023-04-02 16:49:50 -07:00
Elijah Ahianyo
1fdc01fa56
Bugfix: 719-File-upload-props-not-working (#738) 2023-03-29 18:26:02 -07:00
iron3oxide
7067baf176
Refactor utils module (#666) 2023-03-16 14:59:27 -07:00
Nikhil Rao
2ee8c73d5a
Add error message for invalid var ops (#664) 2023-03-11 21:11:59 -08:00
Elijah Ahianyo
e106b7aedf
Bugfix for properly rendering datatables (#638) 2023-03-07 13:50:04 -08:00
Nikhil Rao
3491955995
Fix format dict props (#641) 2023-03-06 17:38:21 -08:00
Nikhil Rao
d74efb9bff
Fix cond component render (#639) 2023-03-06 16:45:10 -08:00
Nikhil Rao
8ba22ed92d
Factor out responsive helpers (#624) 2023-03-03 13:29:17 -08:00
Xiaojing Chen
37edaa2f6b
[Fix: issue 582] Icon tag should work despite case sensitivity. (#588) 2023-02-21 17:32:34 -08:00
Nikhil Rao
f88d4ce4b4
Add tests for pc.icon (#562) 2023-02-17 12:01:30 -08:00