Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to disable ColorPicker, FileUploader, Multiselect, & Selectbox #4148

Merged

Conversation

mayagbarnes
Copy link
Collaborator

@mayagbarnes mayagbarnes commented Dec 8, 2021

馃摎 Context

We want to add the ability to disable widgets through their st.widget() calls, so they cannot be interacted with. The disabled param was implemented as a keyword-only arg to avoid a breaking change.

This PR covers the following widgets: st.color_picker, st.file_uploader, st.multiselect, & st.selectbox

  • What kind of change does this PR introduce?
    • Feature

馃 Description of Changes

  • Add disabled keyword only param to widget functions with a default of False

  • Pass disabled value to corresponding protos

  • Reconcile widget proto's disabled value and disabled state in ElementNodeRenderer.tsx

  • Revise styling of WidgetLabel if widget is disabled

    • This is a visible (user-facing) change
Screenshots:

Revised Light Mode:
Screen Shot 2021-12-08 at 12 07 27 AM

Revised Dark Mode:
Screen Shot 2021-12-08 at 12 16 46 AM

馃И Testing Done

  • Screenshots included
  • Added/Updated unit tests
  • Added/Updated e2e tests

馃寪 References

Part 3 of 3 PRs to address:


Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@mayagbarnes mayagbarnes changed the base branch from feature/disable-widgets to develop December 8, 2021 21:09
@mayagbarnes mayagbarnes changed the base branch from develop to feature/disable-widgets December 8, 2021 21:10
@mayagbarnes mayagbarnes marked this pull request as ready for review December 8, 2021 22:22
Copy link
Collaborator

@LukasMasuch LukasMasuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)


interface Props {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From looking at other components, it seems like that styled-components should only contain Style-related props (in this case: StyledWidgetLabelProps with the disabled attribute). And the component file contains Props with all relevant attributes. For example:

export interface StyledTextInputProps {

But I'm not sure if this is a general convention to follow.

@mayagbarnes mayagbarnes merged commit 211cf2b into streamlit:feature/disable-widgets Dec 10, 2021
@mayagbarnes mayagbarnes mentioned this pull request Dec 10, 2021
5 tasks
mayagbarnes added a commit that referenced this pull request Dec 13, 2021
* Ability to disable Button, DownloadButton, Checkbox, Radio, & Slider Widgets (#4146)

* Update styling for WidgetLabel

* Implement & test disabled - button widget

* Implement & test disabled - download button widget

* Implement & test disabled - checkbox widget

* Implement & test disabled - radio widget

* Implement & test disabled - slider widget

* Plumb widget disabled params to FE through ElementNodeRenderer

* Improve disabled radio

* Ability to disable DateInput, NumberInput, TimeInput, TextInput, & TextArea (#4147)

* Implement & test disabled - time input widget

* Implement & test disabled - date input widget

* Implement & test disabled - number input widget

* Implement & test disabled - text input widget

* Implement & test disabled - text area widget

* Update styling for WidgetLabel

* Plumb widget disabled params to FE in ElementNodeRenderer

* Update number input increment/decrement styling

* Fix number_input e2e test

* Update placeholder styling & screenshots for text widgets

* Update disabled param descriptions

* Fix lint

* Ability to disable ColorPicker, FileUploader, Multiselect, & Selectbox (#4148)

* Update styling for WidgetLabel

* Implement & test disabled - color picker widget

* Implement & test disabled - file uploader widget

* Implement & test disabled - multiselect widget

* Implement & test disabled - selectbox widget

* Plumb widget disabled params to FE in ElementNodeRenderer

* Update disabled param descriptions

* Refactor WidgetLabel Props
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants