-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat] Create
vizro.figures.library
to enable usage in pure Dash app (
#578) Co-authored-by: Antony Milne <[email protected]>
- Loading branch information
1 parent
c9c918e
commit b32da0d
Showing
16 changed files
with
286 additions
and
183 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
...ore/changelog.d/20240722_105528_huong_li_nguyen_create_module_pure_functions.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!-- | ||
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 | ||
|
||
- Create `vizro.figures.library` to contain KPI card Dash components that can be used outside the Vizro framework. ([#578](https://github.com/mckinsey/vizro/pull/578)) | ||
|
||
### Changed | ||
|
||
- Google Material icons library is served locally to enable offline functionality. ([#578](https://github.com/mckinsey/vizro/pull/578)) | ||
|
||
<!-- | ||
### 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)) | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
vizro-core/examples/scratch_dev/assets/images/icons/hypotheses.svg
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from vizro.figures.kpi_cards import kpi_card, kpi_card_reference | ||
from vizro.figures._kpi_cards import kpi_card, kpi_card_reference | ||
|
||
# Please keep alphabetically ordered | ||
__all__ = ["kpi_card", "kpi_card_reference"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
"""Contains unwrapped KPI card functions (suitable to use in pure Dash app).""" | ||
|
||
from vizro.figures import kpi_card, kpi_card_reference | ||
|
||
kpi_card = kpi_card.__wrapped__ | ||
kpi_card_reference = kpi_card_reference.__wrapped__ | ||
|
||
__all__ = ["kpi_card", "kpi_card_reference"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,97 @@ | ||
.card-kpi { | ||
border-left: 4px solid var(--text-secondary); | ||
border-left: 4px solid var(--bs-secondary); | ||
height: 100%; | ||
padding: 1rem; | ||
} | ||
|
||
/* We currently ship this CSS file with the package, so the font definitions need to live here at the moment. | ||
The CSS is taken from https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined and the corresponding font file | ||
downloaded to fonts/material-symbols-outlined.woff2. See: | ||
https://developers.google.com/fonts/docs/material_symbols#self-hosting_the_font | ||
https://fonts.google.com/knowledge/using_type/self_hosting_web_fonts | ||
Note the relative url works with both serve_locally=True and serve_locally=False through the CDN. | ||
*/ | ||
@font-face { | ||
font-family: MaterialSymbolsOutlined; | ||
src: url("./fonts/material-symbols-outlined.woff2") format("woff2"); | ||
} | ||
|
||
.material-symbols-outlined { | ||
direction: ltr; | ||
display: inline-block; | ||
font-family: MaterialSymbolsOutlined, sans-serif; | ||
font-feature-settings: "liga"; | ||
font-size: 24px; | ||
-webkit-font-smoothing: antialiased; | ||
font-style: normal; | ||
font-weight: 400; | ||
letter-spacing: normal; | ||
line-height: 1; | ||
text-transform: none; | ||
white-space: nowrap; | ||
word-wrap: normal; | ||
} | ||
|
||
.card-kpi .material-symbols-outlined { | ||
margin: auto 0; | ||
} | ||
|
||
/* This should be replaced, when the bootstrap theme is finalized. Currently our font tokens don't match with the | ||
bootstrap font tokens, leading to deviations which we need to overwrite. */ | ||
.card-kpi-title { | ||
font-size: 1.5rem; | ||
line-height: 1; | ||
margin: 0; | ||
} | ||
|
||
.card-kpi .card-header, | ||
.card-kpi .card-footer, | ||
.card-kpi .card-body { | ||
background: none; | ||
border: none; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
.card-kpi .card-header { | ||
display: flex; | ||
flex-direction: row; | ||
gap: 8px; | ||
} | ||
|
||
.card-kpi .card-header .material-symbols-outlined { | ||
line-height: 30px; | ||
gap: 0.5rem; | ||
} | ||
|
||
.card-kpi .card-body { | ||
align-items: center; | ||
color: var(--text-secondary); | ||
color: var(--bs-secondary); | ||
display: flex; | ||
flex-grow: 1; | ||
font-size: 3.6vh; | ||
font-weight: 600; | ||
padding: 1rem 0; | ||
} | ||
|
||
.card-kpi .card-footer { | ||
color: var(--text-secondary); | ||
color: var(--bs-secondary); | ||
display: flex; | ||
font-weight: 600; | ||
gap: 4px; | ||
gap: 0.25rem; | ||
} | ||
|
||
.card-kpi .card-footer .material-symbols-outlined { | ||
font-size: 20px; | ||
line-height: 20px; | ||
font-size: 1.25rem; | ||
} | ||
|
||
.color-pos.card-footer { | ||
color: #1a85ff; | ||
.card-kpi .color-pos.card-footer { | ||
color: var(--bs-blue); | ||
} | ||
|
||
.color-neg.card-footer { | ||
color: #d41159; | ||
.card-kpi .color-neg.card-footer { | ||
color: var(--bs-pink); | ||
} | ||
|
||
.card-kpi:has(.color-pos) { | ||
border-left: 4px solid #1a85ff; | ||
border-left: 4px solid var(--bs-blue); | ||
} | ||
|
||
.card-kpi:has(.color-neg) { | ||
border-left: 4px solid #d41159; | ||
border-left: 4px solid var(--bs-pink); | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.