reflex/reflex/components
Masen Furer c636c91c9c
[REF-2273] Implement .setvar special EventHandler (#3163)
* Allow EventHandler args to be partially applied

When an EventHandler is called with an incomplete set of args it creates a
partial EventSpec. This change allows Component._create_event_chain to apply
remaining args from an args_spec to an existing EventSpec to make it
functional.

Instead of requiring the use of `lambda` functions to pass arguments to an
EventHandler, they can now be passed directly and any remaining args defined in
the event trigger will be applied after those.

* [REF-2273] Implement `.setvar` special EventHandler

All State subclasses will now have a special `setvar` EventHandler which
appears in the autocomplete drop down, passes static analysis, and canbe used
to set State Vars in response to event triggers.

Before:
    rx.input(value=State.a, on_change=State.set_a)

After:
    rx.input(value=State.a, on_change=State.setvar("a"))

This reduces the "magic" because `setvar` is statically defined on all State
subclasses.

* Catch invalid Var names and types at compile time

* Add test cases for State.setvar

* Use a proper redis-compatible token
2024-05-01 17:13:55 -07:00
..
base [REF-2524] Tuple unpacking should apply at component level (#3062) 2024-04-11 14:04:19 -07:00
chakra ruff-format: unify Black with Ruff v0.1 (#2837) 2024-04-23 14:40:06 -07:00
core [REF-2574] Default width for Stack (+children) and default padding for container (#3104) 2024-04-30 13:15:57 -07:00
datadisplay Update CodeBlock class to accept rx.color in custom_style (#3168) 2024-05-01 14:48:33 -07:00
el extend rx.input allowed types (#3149) 2024-04-24 16:04:56 -07:00
gridjs [REF-2524] Tuple unpacking should apply at component level (#3062) 2024-04-11 14:04:19 -07:00
lucide IconButton for color_mode with nice default and a position props to control it (#3165) 2024-04-26 12:08:09 -07:00
markdown ruff-format: unify Black with Ruff v0.1 (#2837) 2024-04-23 14:40:06 -07:00
media Refactor chakra components into separate folder (#2315) 2023-12-21 09:52:08 -08:00
moment generate pyi files when building/publishing 3rd party component (#2945) 2024-03-29 09:54:21 -07:00
next [REF-2524] Tuple unpacking should apply at component level (#3062) 2024-04-11 14:04:19 -07:00
plotly [REF-2524] Tuple unpacking should apply at component level (#3062) 2024-04-11 14:04:19 -07:00
radix [REF-2574] Default width for Stack (+children) and default padding for container (#3104) 2024-04-30 13:15:57 -07:00
react_player [REF-2524] Tuple unpacking should apply at component level (#3062) 2024-04-11 14:04:19 -07:00
recharts [REF-2524] Tuple unpacking should apply at component level (#3062) 2024-04-11 14:04:19 -07:00
suneditor generate pyi files when building/publishing 3rd party component (#2945) 2024-03-29 09:54:21 -07:00
tags [REF-2682] Foreach over dict uses Tuple arg value (#3160) 2024-04-25 09:10:55 -07:00
__init__.py Use rx.el.img as rx.image (#2558) 2024-02-08 14:44:53 -08:00
component.py [REF-2273] Implement .setvar special EventHandler (#3163) 2024-05-01 17:13:55 -07:00
literals.py Chakra input component type_ prop literal (#2292) 2023-12-18 15:43:51 -08:00