Skip to content

Commit

Permalink
Merge branch 'main' into tidy/lint
Browse files Browse the repository at this point in the history
  • Loading branch information
antonymilne authored Jan 20, 2025
2 parents 2db891b + 5d21dc9 commit fb176de
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
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
- A bullet item for the Removed 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))
-->
<!--
### 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))
-->
6 changes: 2 additions & 4 deletions vizro-core/src/vizro/models/_components/form/date_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class DatePicker(VizroBaseModel):
max: Optional[date] = Field(None, description="End date for date picker.")
value: Optional[Union[list[date], date]] = Field(None, description="Default date for date picker")
title: str = Field("", description="Title to be displayed.")

range: bool = Field(True, description="Boolean flag for displaying range picker.")
actions: list[Action] = []

Expand All @@ -65,9 +64,8 @@ def build(self):
persistence_type="session",
type="range" if self.range else "default",
allowSingleDateInRange=True,
className="datepicker",
# removes the default red color for weekend days
styles={"day": {"color": "var(--mantine-color-text"}},
# Required for styling to remove gaps between cells
withCellSpacing=False,
)

return html.Div(
Expand Down
4 changes: 2 additions & 2 deletions vizro-core/src/vizro/models/_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ def build(self):
)
return dmc.MantineProvider(
layout,
# Use the `theme` to style all Mantine components with a Vizro theme. For more info see https://www.dash-mantine-components.com/components/mantineprovider
theme={"primaryColor": "gray"},
# Applies to all Mantine components
theme={"fontFamily": "Inter, sans-serif, Arial, serif", "primaryColor": "gray", "defaultRadius": 0},
)

def _validate_logos(self):
Expand Down
61 changes: 61 additions & 0 deletions vizro-core/src/vizro/static/css/datepicker.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/* Dropdown field showing selection */
.mantine-DatePickerInput-input {
background-color: var(--field-enabled);
border: none;
box-shadow: var(--elevation-0);
color: var(--text-secondary);
}

.mantine-DatePickerInput-input:hover {
color: var(--text-primaryHover);
}

/* Calendar view with selected range */
.mantine-DatePickerInput-dropdown,
.mantine-Popover-dropdown {
background: var(--field-enabled);
border: inherit;
box-shadow: var(--elevation-1);
padding: 0.5rem 0.75rem;
}

.mantine-DatePickerInput-day {
background: var(--field-enabled);
color: var(--text-secondary);
}

.mantine-DatePickerInput-day[data-in-range] {
background: var(--stateOverlays-selectedRange);
color: var(--text-primary);
}

.mantine-DatePickerInput-day[data-selected] {
background: var(--stateOverlays-selected-inverted);
color: var(--text-primary-inverted);
text-decoration: underline;
}

/* Single month or year selection */
.mantine-PickerControl-pickerControl,
.mantine-DatePickerInput-monthsListControl {
color: var(--text-secondary);
}

/* Important tags are required as otherwise mantine media queries will have higher specificity */
.mantine-DatePickerInput-day:hover,
.mantine-PickerControl-pickerControl:hover,
.mantine-DatePickerInput-monthsListControl:hover {
background: var(--stateOverlays-hover) !important;
color: var(--text-primaryHover) !important;
}

/* Header inside calendar view */
.mantine-DatePickerInput-calendarHeader {
color: var(--text-secondary);
}

.mantine-DatePickerInput-calendarHeaderControlIcon:hover,
.mantine-DatePickerInput-calendarHeader .mantine-UnstyledButton-root:hover {
background: transparent;
color: var(--text-primaryHover);
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ def test_datepicker_build(self, range, value):
persistence_type="session",
type="range" if range else "default",
allowSingleDateInRange=True,
className="datepicker",
# removes the default red color for weekend days
styles={"day": {"color": "var(--mantine-color-text"}},
withCellSpacing=False,
),
],
)
Expand Down
2 changes: 1 addition & 1 deletion vizro-core/tests/unit/vizro/models/test_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def test_dashboard_build(self, vizro_app, page_1, page_2):
dash.page_container,
],
),
theme={"primaryColor": "gray"},
theme={"fontFamily": "Inter, sans-serif, Arial, serif", "primaryColor": "gray", "defaultRadius": 0},
)
assert_component_equal(dashboard.build(), expected_dashboard_container)

Expand Down

0 comments on commit fb176de

Please sign in to comment.