Skip to content

Commit

Permalink
[Tidy] Replace RadioItems and Checklist (#414)
Browse files Browse the repository at this point in the history
Co-authored-by: Pruthvi Prakasha <[email protected]>
  • Loading branch information
huong-li-nguyen and pruthvip15 authored Apr 18, 2024
1 parent 13a3538 commit a25c395
Show file tree
Hide file tree
Showing 23 changed files with 415 additions and 215 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Highlights ✨
- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->

### Removed

- Removal of classNames `checkboxes-list`, `radio-items-list` and `input-container` from Vizro stylesheets. ([#414](https://github.com/mckinsey/vizro/pull/414))

<!--
### Added
- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Changed
- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Deprecated
- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Fixed
- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Security
- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
1 change: 0 additions & 1 deletion vizro-core/src/vizro/models/_components/form/_text_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,5 @@ def build(self):
className="text-area",
),
],
className="input-container",
id=f"{self.id}_outer",
)
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,5 @@ def build(self):
className="user_input",
),
],
className="input-container",
id=f"{self.id}_outer",
)
10 changes: 4 additions & 6 deletions vizro-core/src/vizro/models/_components/form/checklist.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List, Literal, Optional

from dash import dcc, html
from dash import html

try:
from pydantic.v1 import Field, PrivateAttr, root_validator, validator
Expand Down Expand Up @@ -50,18 +50,16 @@ class Checklist(VizroBaseModel):
def build(self):
full_options, default_value = get_options_and_default(options=self.options, multi=True)

return html.Div(
return html.Fieldset(
[
dbc.Label(self.title, html_for=self.id) if self.title else None,
dcc.Checklist(
html.Legend(self.title, className="form-label") if self.title else None,
dbc.Checklist(
id=self.id,
options=full_options,
value=self.value if self.value is not None else [default_value],
persistence=True,
persistence_type="session",
className="checkboxes-list",
),
],
className="input-container",
id=f"{self.id}_outer",
)
2 changes: 0 additions & 2 deletions vizro-core/src/vizro/models/_components/form/dropdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ def build(self):
multi=self.multi,
persistence=True,
persistence_type="session",
className="selector_body_dropdown",
),
],
className="input-container",
id=f"{self.id}_outer",
)
10 changes: 4 additions & 6 deletions vizro-core/src/vizro/models/_components/form/radio_items.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List, Literal, Optional

from dash import dcc, html
from dash import html

try:
from pydantic.v1 import Field, PrivateAttr, root_validator, validator
Expand Down Expand Up @@ -51,18 +51,16 @@ class RadioItems(VizroBaseModel):
def build(self):
full_options, default_value = get_options_and_default(options=self.options, multi=False)

return html.Div(
return html.Fieldset(
[
dbc.Label(self.title, html_for=self.id) if self.title else None,
dcc.RadioItems(
html.Legend(self.title, className="form-label") if self.title else None,
dbc.RadioItems(
id=self.id,
options=full_options,
value=self.value if self.value is not None else default_value,
persistence=True,
persistence_type="session",
className="radio-items-list",
),
],
className="input-container",
id=f"{self.id}_outer",
)
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,5 @@ def build(self):
className="slider-track-without-marks" if self.marks is None else "slider-track-with-marks",
),
],
className="input-container",
id=f"{self.id}_outer",
)
1 change: 0 additions & 1 deletion vizro-core/src/vizro/models/_components/form/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,5 @@ def build(self):
className="slider-track-without-marks" if self.marks is None else "slider-track-with-marks",
),
],
className="input-container",
id=f"{self.id}_outer",
)
4 changes: 4 additions & 0 deletions vizro-core/src/vizro/static/css/bootstrap_overwrites.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ but do not want to take over to `vizro-bootstrap` as these settings might not be
.card .nav-link {
height: 100%;
}

.form-check:last-of-type {
margin-bottom: 0;
}
27 changes: 0 additions & 27 deletions vizro-core/src/vizro/static/css/checklist.css

This file was deleted.

27 changes: 0 additions & 27 deletions vizro-core/src/vizro/static/css/radio_item.css

This file was deleted.

27 changes: 0 additions & 27 deletions vizro-core/src/vizro/static/css/selectors.css

This file was deleted.

1 change: 1 addition & 0 deletions vizro-core/src/vizro/static/css/slider.css
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ input.dash-input:invalid {
display: flex;
flex-direction: row;
gap: var(--spacing-01);
margin-bottom: var(--spacing-03);
}

.slider-text-input-field {
Expand Down
Loading

0 comments on commit a25c395

Please sign in to comment.