8000 Add radio group by aaskat · Pull Request #1963 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content

Add radio group #1963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 1, 2024
commit be4b3e2f8bf0532766df238cfa63fc2ef1d9d0d9
36 changes: 19 additions & 17 deletions pyscript.core/src/stdlib/pyweb/ui/shoelace.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,10 @@ class Radio(TextShoeBase):
size = js_property("size")
disabled = js_property("disabled")
update_complete = js_property("updateComplete")

def __init__(self, content, value=None, size=None, disabled=None, style=None, **kwargs):

def __init__(
self, content, value=None, size=None, disabled=None, style=None, **kwargs
):
super().__init__(
content, value=value, size=size, disabled=disabled, style=style, **kwargs
)
Expand All @@ -399,21 +401,21 @@ class RadioGroup(ShoeBase):
validity = js_property("validity")
validation_message = js_property("validationMessage")
update_complete = js_property("updateComplete")

def __init__(
self,
children: list[Radio] = None,
label=None,
help_text=None,
name=None,
value=None,
size=None,
form=None,
required=None,
validity=None,
validation_message=None,
update_complete=None,
**kwargs
self,
children: list[Radio] = None,
label=None,
help_text=None,
name=None,
value=None,
size=None,
form=None,
required=None,
validity=None,
validation_message=None,
update_complete=None,
**kwargs,
):
super().__init__(
label=label,
Expand All @@ -426,7 +428,7 @@ def __init__(
validity=validity,
validation_message=validation_message,
update_complete=update_complete,
**kwargs
**kwargs,
)
if children:
for radio in children:
Expand Down
22 changes: 14 additions & 8 deletions pyscript.core/test/ui/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
Divider,
Icon,
Radio,
RadioGroup,
Rating,
RadioGroup
)

LOREM_IPSUM = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
Expand Down Expand Up @@ -89,15 +89,21 @@ def toggle_dialog():
"code": el.code('Radio("Option 42")'),
},
"Radio Group": {
"instance": RadioGroup([Radio("radio 1", name="radio 1", value=1, style={"margin": "20px"}),
Radio("radio 2", name="radio 2", value=2, style={"margin": "20px"}),
Radio("radio 3", name="radio 3", value=3, style={"margin": "20px"})],
label="Select an option"),
"code": el.code("""
"instance": RadioGroup(
[
Radio("radio 1", name="radio 1", value=1, style={"margin": "20px"}),
Radio("radio 2", name="radio 2", value=2, style={"margin": "20px"}),
Radio("radio 3", name="radio 3", value=3, style={"margin": "20px"}),
],
label="Select an option",
),
"code": el.code(
"""
RadioGroup([Radio("radio 1", name="radio 1", value=1, style={"margin": "20px"}),
Radio("radio 2", name="radio 2", value=2, style={"margin": "20px"}),
Radio("radio 3", name="radio 3", value=3, style={"margin": "20px"})],
label="Select an option"),""")
}
label="Select an option"),"""
),
},
}
}
0