Skip to content

Commit ce12994

Browse files
authored
Add migration guide (#690)
* Add migration guide * Add migration guide alert
1 parent 0d60f10 commit ce12994

File tree

10 files changed

+207
-45
lines changed

10 files changed

+207
-45
lines changed

dash_bootstrap_components/__init__.py

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -38,47 +38,3 @@
3838
sys.modules[__name__].Table.from_dataframe = classmethod(
3939
_generate_table_from_df
4040
)
41-
42-
43-
# DatePicker deprecation warnings
44-
class DatePickerSingle(object):
45-
def __init__(self, *args, **kwargs):
46-
raise AttributeError(
47-
"DatePickerSingle has been removed from dash-bootstrap-components."
48-
" Use DatePickerSingle from dash-core-components instead."
49-
)
50-
51-
52-
class DatePickerRange(object):
53-
def __init__(self, *args, **kwargs):
54-
raise AttributeError(
55-
"DatePickerRange has been removed from dash-bootstrap-components. "
56-
"Use DatePickerRange from dash-core-components instead."
57-
)
58-
59-
60-
class CardTitle(object):
61-
def __init__(self, *args, **kwargs):
62-
raise AttributeError(
63-
"CardTitle has been removed from dash-bootstrap-components. Set "
64-
"class_name='card-title' on a html.H* component instead. "
65-
"CardTitle originally used H5."
66-
)
67-
68-
69-
class CardSubtitle(object):
70-
def __init__(self, *args, **kwargs):
71-
raise AttributeError(
72-
"CardSubtitle has been removed from dash-bootstrap-components. "
73-
"Set class_name='card-subtitle' on a html.H* component instead. "
74-
"CardSubtitle originally used H6."
75-
)
76-
77-
78-
class CardText(object):
79-
def __init__(self, *args, **kwargs):
80-
raise AttributeError(
81-
"CardText has been removed from dash-bootstrap-components. Set "
82-
"class_name='card-text' on a html component such as Div, or P "
83-
"instead. CardText originally used P."
84-
)

docs/content/changelog.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@ title: Changelog
66

77
This page documents notable changes in dash-bootstrap-components releases.
88

9+
## 1.0.0 - 2021/XX/XX
10+
11+
v1 of _dash-bootstrap-components_! This release contains loads of new features, but also breaking changes. Please read the changelog carefully for full details.
12+
13+
### Added
14+
- Six new components! [Accordion](/docs/components/accordion), [Breadcrumb](/docs/components/breadcrumb), [FormFloating](/docs/components/form), [Offcanvas](/docs/components/offcanvas), [Pagination](/docs/components/pagination), and [Switch](/docs/components/input) ([PR 646](https://github.com/facultyai/dash-bootstrap-components/pull/646)) ([PR 689](https://github.com/facultyai/dash-bootstrap-components/pull/689))
15+
- New CDN links for icons from Bootstrap Icons and Font Awesome ([PR 661](https://github.com/facultyai/dash-bootstrap-components/pull/661))
16+
- CDN Links for four new Bootswatch themes: `QUARTZ`, `MORPH`, `VAPOR` and `ZEPHYR`.
17+
- All components now accept `class_name` as an alternative to `className`. If both are specified then `class_name` will take precedence. `class_name` should be preferred from now on. ([PR 642](https://github.com/facultyai/dash-bootstrap-components/pull/642))
18+
19+
### Fixed
20+
- The `loading_state` is no longer passed to underlying DOM nodes in any components ([PR 666](https://github.com/facultyai/dash-bootstrap-components/pull/666))
21+
- `Popover` doesn't error if `is_open` defaults to true. ([PR 646](https://github.com/facultyai/dash-bootstrap-components/pull/646))
22+
23+
### Changed
24+
- Components are all now built for Bootstrap 5. CDN links have all been updated. There are multiple breaking changes in the component props. Please see the [migration-guide](/migration-guide) for full details on the changes ([PR 646](https://github.com/facultyai/dash-bootstrap-components/pull/646)).
25+
926
## 0.13.0 - 2021/7/31
1027

1128
### Added

docs/content/migration-guide.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
---
2+
title: Migration guide
3+
---
4+
5+
# Migration guide for dash-bootstrap-components v1
6+
7+
_dash-bootstrap-components_ v1 contains loads of new features, but also some breaking changes. This is for two reasons:
8+
9+
- First, now that the library has matured, we have taken the opportunity to clean up the API and make things more consistent across components.
10+
- Second we have updated all components to support Bootstrap 5 (previously we supported Bootstrap 4). Since Bootstrap 5 also contains a number of breaking changes, we have inherited those in _dash-bootstrap-components_. For more information about the changes in Bootstrap 5, see the upstream [Bootstrap migration guide.](https://v5.getbootstrap.com/docs/5.0/migration) and the [Bootstrap 5 Documentation](https://getbootstrap.com/docs/5.0/layout/grid/).
11+
12+
This guide introduces the new features, and also covers the changes you must make to run your apps with _dash-bootstrap-components_ 1.0.0 rather than 0.13.x (the final v0 releases). If you find any issues not covered here, or bugs in v1 please [raise an issue](https://github.com/facultyai/dash-bootstrap-components/issues/new/choose) on our GitHub repository.
13+
14+
## Dependencies
15+
16+
<span class="badge bg-danger">Breaking</span> _dash-bootstrap-components_ v1 requires Dash 2.0.0 or greater. The primary implication of this is that we have dropped support for Python 2.7 and 3.5. All apps using _dash-bootstrap-components_ v1 should be run with Python 3.6+.
17+
18+
See the [Dash 2.0 migration guide](https://dash.plotly.com/dash-2-0-migration) for more details on changes within Dash itself.
19+
20+
## New Themes
21+
22+
Check out the four new themes: `QUARTZ`, `MORPH`, `VAPOR` and `ZEPHYR` in the [Theme Explorer](/docs/themes/explorer/)
23+
24+
## Icons
25+
26+
Include Bootstrap and Font Awesome icons to your app as easily as adding a Bootstrap Theme using bundled links to CDNs for [Bootstrap Icons](https://icons.getbootstrap.com/) and [Font Awesome](https://fontawesome.com/). See more information in the [Icons](/docs/icons) section of the docs.
27+
28+
## Components
29+
30+
There are six new components in _dash-bootstrap-components_: `Accordion`, `Breadcrumb`, `FormFloating`, `Offcanvas`, `Pagination`, and `Switch`. Additionally many components have changes to their props.
31+
32+
Notably previously there was a mix of `size` and `bs_size` props for controlling the size of some components. All components that allow size to be changed now consistently use `size`. To set the HTML `size` property of the underlying `<input />` in the `Input` component, use `html_size` instead.
33+
34+
### Accordion <span class="badge bg-success">New</span>
35+
- Added new accordion component. Check out the documentation [here](/docs/components/accordion)
36+
37+
### Badge
38+
- <span class="badge bg-danger">Breaking</span> The `color` property now only sets the background color. Use the new `text_color` prop to change the color of the text. You’ll likely need to set a dark text color when using `color="light"`.
39+
40+
### Breadcrumb <span class="badge bg-success">New</span>
41+
- Added new Breadcrumb component. Check out the documentation [here](/docs/components/breadcrumb)
42+
43+
### Buttons
44+
- <span class="badge bg-danger">Breaking</span> The default color for the buttons is now `primary` rather than `secondary`. This change was made to match the Bootstrap convention.
45+
46+
- <span class="badge bg-danger">Breaking</span> The `block` property has been dropped. Instead, wrap the buttons in a `html.Div` and use the Bootstrap utilities classes such as `"d-grid"` and a `"gap-*"` in the `className` to space the buttons as needed. See [the docs](/docs/components/button) for examples.
47+
48+
- Disabled buttons now have `pointer-events: none` as a default.
49+
50+
### ButtonGroup
51+
- <span class="badge bg-danger">Breaking</span> The default color for the buttons is now `primary` rather than `secondary`. This change was made to match the Bootstrap convention.
52+
53+
### Card
54+
- <span class="badge bg-danger">Breaking</span> Dropped `CardDeck` component. Use the Bootstrap grid classes to arrange the cards like a card deck. See
55+
the [Bootstrap grid docs](https://getbootstrap.com/docs/5.0/layout/grid/#row-columns) for more information.
56+
57+
- <span class="badge bg-danger">Breaking</span> Dropped `CardColumns` component. `CardColumns` had many [issues in Bootstrap 4](https://github.com/twbs/bootstrap/pull/28922) and was dropped in Bootstrap 5.
58+
59+
### Carousel
60+
- Added `dark` property for dark text, controls, and indicators. This is great for lighter backgrounds.
61+
- Replaced chevron icons for carousel controls with new SVGs from Bootstrap Icons.
62+
63+
### Collapse
64+
- <span class="badge bg-danger">Breaking</span> Dropped the `tag` property.
65+
- Removed the Accordion example since we now have a new Accordion component.
66+
67+
### DropdownMenu
68+
- <span class="badge bg-danger">Breaking</span> The default color for the buttons is now `primary` rather than `secondary`. This change was made to match the Bootstrap convention.
69+
- <span class="badge bg-danger">Breaking</span> Changed the `direction` prop options from right and left to start and end to match the Bootstrap 5 convention.
70+
- <span class="badge bg-danger">Breaking</span> Changed the name of the `right` prop to `align_end`.
71+
- <span class="badge bg-danger">Breaking</span> Changed the name of the `bs_size` property to `size`.
72+
- Added `menu_variant` prop to make the dropdown menu a dark color scheme.
73+
74+
### Fade
75+
- <span class="badge bg-danger">Breaking</span> Dropped `base_class` property.
76+
- <span class="badge bg-danger">Breaking</span> Dropped `base_class_active` property.
77+
78+
### FormGroup
79+
- <span class="badge bg-danger">Breaking</span> Dropped `FormGroup`. It is no longer necessary to use `FormGroup` to align components in a form. Use `Row` `Col` and gutter modifier classes and spacing utilities instead. See [the documentation](/docs/components/form) for examples
80+
81+
### FormFloating <span class="badge bg-success">New</span>
82+
- Added `FormFloating` component to create a label that floats over the form field. See the documentation [here](/docs/components/form)
83+
84+
### Input
85+
- <span class="badge bg-danger">Breaking</span> Dropped `bs_size` property. Use `size` instead. Use `html_size` to set the HTML size property on the underlying input.
86+
87+
### InputGroup
88+
- <span class="badge bg-danger">Breaking</span> Dropped `InputGroupAddon` component. It's not necessary to use `InputGroupAddon` because things like `Button` and `InputGroupText` can be added to `InputGroup` as direct children. See the [docs](/docs/components/input_group/) for more examples.
89+
90+
### Jumbotron
91+
- <span class="badge bg-danger">Breaking</span> Dropped the Jumbotron component. The [docs have an example](/docs/components/jumbotron/) of how to replicate it with Bootstrap utilities.
92+
93+
### Layout
94+
- <span class="badge bg-danger">Breaking</span> Dropped `no_gutters` prop. Use gutter modifier classes instead. See the [docs](/docs/components/layout/) for examples.
95+
- <span class="badge bg-danger">Breaking</span> When specifying the `order` of the columns, it accepts the integers 1, ..., 5, only rather than integers 1, ..., 12.
96+
97+
### ListGroup
98+
- <span class="badge bg-danger">Breaking</span> Dropped the `ListGroupHeading` and `ListGroupItemText` components. Both are unnecessary since you can pass any Dash components to the children of `ListGroupItem`. See the [docs](/docs/components/list_group/) for updated examples.
99+
100+
### Modal
101+
- Added `fullscreen` property
102+
- Added `keyboard` property to close modal when escape key is pressed.
103+
104+
### Nav
105+
- <span class="badge bg-danger">Breaking</span> - Dropped `active` property in `NavItem`. You should only need to set `active` on the child `NavLink` instead.
106+
- Added `navbar_scroll` property. This enables vertical scrolling within the toggleable contents of the nav when used inside a collapsed `Navbar`.
107+
108+
### Navbar
109+
- <span class="badge bg-danger">Breaking</span> - Bootstrap navbars now must be constructed with a container. If you're using `NavbarSimple` you don't need to make any changes! If you are using `Navbar` with a custom layout you probably will need to make changes. See the [docs](/docs/components/list_group/) for updated examples.
110+
111+
### Offcanvas <span class="badge bg-success">New</span>
112+
- Added the new offcanvas component. See the [docs](/docs/components/offcanvas) for more information.
113+
114+
### Pagination <span class="badge bg-success">New</span>
115+
- Added a new Pagination component. See the [docs](/docs/components/pagination) for more information.
116+
117+
### Progress
118+
- <span class="badge bg-danger">Breaking</span> Dropped `barClassName` property. Use `className`
119+
- <span class="badge bg-danger">Breaking</span> Dropped `bar_style` property. Use `style`
120+
- <span class="badge bg-danger">Breaking</span> Dropped `tag` property.
121+
- Added a `label` property that should be used instead of `children` to render text on the progress bar.
122+
- Added a `hide_label` property to hide the label.
123+
124+
### Select
125+
- <span class="badge bg-danger">Breaking</span> Dropped `bs_size` property. Use `size` instead.
126+
127+
### Switch <span class="badge bg-success">New</span>
128+
- New `Switch` component. See the documentation [here](/docs/components/input)
129+
130+
### Table
131+
- <span class="badge bg-danger">Breaking</span> Dropped `tag` property.
132+
- Added `color` property.
133+
134+
### Tabs
135+
- <span class="badge bg-danger">Breaking</span> Dropped `card` property. It's no longer necessary to set `card=True` to put tabs in a `Card`.
136+
137+
### TextArea
138+
- <span class="badge bg-danger">Breaking</span> Dropped `bs_size` property. Use `size` instead.
139+
140+
### Toast
141+
- <span class="badge bg-danger">Breaking</span> Dropped `fade` property.
142+
- Added `color` property to set the background color.
143+
144+
### Tooltip
145+
- <span class="badge bg-danger">Breaking</span> Dropped the following properties: `arrowClassName`, `autohide`, `boundaries_element`, `container`, `hide_arrow`, `innerClassName`, `offset`

docs/server.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,11 @@ def changelog():
111111
except TemplateNotFound:
112112
abort(404)
113113

114+
@server.route("/migration-guide/")
115+
def migration_guide():
116+
try:
117+
return render_template("generated/migration-guide.html")
118+
except TemplateNotFound:
119+
abort(404)
120+
114121
return server
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var migrationAlertContainer = document.getElementById(
2+
'migration-guide-alert-container'
3+
);
4+
5+
if (!window.localStorage.getItem('dbc-migration-alert-seen')) {
6+
migrationAlertContainer.setAttribute('style', 'display:block');
7+
}
8+
9+
var migrationAlert = document.getElementById('migration-guide-alert');
10+
migrationAlert.addEventListener('closed.bs.alert', function() {
11+
window.localStorage.setItem('dbc-migration-alert-seen', 'true');
12+
migrationAlertContainer.setAttribute('style', 'display:none');
13+
});

docs/templates/base.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
</head>
77
<body>
88
{% block header %}{% endblock %}
9+
{% include "partials/migration-guide-alert.html" %}
910
{% block body %}{% endblock %}
1011
{% block scripts %}{% include "partials/scripts.html" %}{% endblock %}
1112
</body>

docs/templates/changelog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{% extends "base.html" %}
33
{% block header %}{{ navbar("more") }}{% endblock %}
44
{% block body %}
5-
<div class="container">
5+
<div class="container" style="max-width:960px;">
66
<main class="dbcd-main mb-5 changelog">{% block content %}{% endblock %}</main>
77
</div>
88
{% endblock %}

docs/templates/macros/navbar.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
More
4848
</a>
4949
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
50+
<a class="dropdown-item" href="/migration-guide"
51+
>Migration guide for v1</a
52+
>
5053
<a class="dropdown-item" href="/changelog">Changelog</a>
5154
<a
5255
class="dropdown-item"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<div id="migration-guide-alert-container" style="display:none" class="mt-3 px-5">
2+
<div
3+
id="migration-guide-alert"
4+
class="alert alert-warning alert-dismissible mx-auto"
5+
style="max-width:1000px;"
6+
role="alert"
7+
>
8+
You are viewing the documentation for
9+
<i>dash-bootstrap-components</i> version 1. Please check our
10+
<a href="/migration-guide">migration guide</a> if you're upgrading from
11+
version 0.13.x.
12+
<button
13+
type="button"
14+
class="btn-close"
15+
data-bs-dismiss="alert"
16+
aria-label="Close"
17+
></button>
18+
</div>
19+
</div>

docs/templates/partials/scripts.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj"
44
crossorigin="anonymous"
55
></script>
6+
<script src="/static/js/migration-guide-alert.js"></script>
67
<script src="/static/js/highlight.min.js"></script>
78
<script>
89
hljs.configure({ignoreUnescapedHTML: true});

0 commit comments

Comments
 (0)