Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": [
"@babel/plugin-transform-object-rest-spread",
"@babel/plugin-transform-runtime"
],
"env": {
"test": {
"plugins": ["@babel/plugin-transform-class-properties"]
}
}
"plugins": ["@babel/plugin-transform-runtime"]
}
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ restrictions:

- Please **do not** use the issue tracker for personal support requests. Stack
Overflow ([`plotly-dash`](https://stackoverflow.com/questions/tagged/plotly-dash) tag),
or the [Plotly Community Forum](https://community.plot.ly) are better places to get help.
or the [Plotly Community Forum](https://community.plotly.com) are better places to get help.

- Please **do not** derail or troll issues. Keep the discussion on topic and
respect the opinions of others.
Expand Down
5 changes: 4 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"singleQuote": true,
"bracketSpacing": false,
"arrowParens": "avoid",
"trailingComma": "none"
"trailingComma": "none",
"importOrder": ["^react$", "<THIRD_PARTY_MODULES>", "^@/.*$", "^[./]"],
"importOrderSeparation": true,
"plugins": ["@trivago/prettier-plugin-sort-imports"]
}
5 changes: 0 additions & 5 deletions dash_bootstrap_components/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Bootstrap themed components for use in Plotly Dash"""

import os

from dash_bootstrap_components import _components, icons, themes
from dash_bootstrap_components._components import * # noqa
from dash_bootstrap_components._components import Table
Expand All @@ -10,9 +8,6 @@

__all__ = _components.__all__ + ["icons", "themes"]

_current_path = os.path.dirname(os.path.abspath(__file__))
_METADATA_PATH = os.path.join(_current_path, "_components", "metadata.json")

_js_dist = [
{
"relative_package_path": ("_components/dash_bootstrap_components.min.js"),
Expand Down
18 changes: 10 additions & 8 deletions demo/Demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* eslint-disable react/prop-types */
import React, {useState} from 'react';

import {
Alert,
Badge,
Expand Down Expand Up @@ -37,29 +39,29 @@ import {
Tooltip
} from '../src';

const StateWrapper = ({tag: Tag, ...otherProps}) => {
function StateWrapper({tag: Tag, ...otherProps}) {
// helper to mimic setProps functionality
const [state, setState] = useState(otherProps);
return <Tag setProps={props => setState({...state, ...props})} {...state} />;
};
}

const CollapseComponent = ({children}) => {
function CollapseComponent({children}) {
const [isOpen, setIsOpen] = useState(false);

return (
<div>
<Button onClick={() => setIsOpen(!isOpen)}>Toggle collapse</Button>
<Button setProps={() => setIsOpen(!isOpen)}>Toggle collapse</Button>
<Collapse is_open={isOpen}>{children}</Collapse>
</div>
);
};
}

const FadeComponent = ({children}) => {
const [isIn, setIsIn] = useState(false);

return (
<div>
<Button onClick={() => setIsOpen(!isIn)}>Toggle fade</Button>
<Button setProps={() => setIsIn(!isIn)}>Toggle fade</Button>
<Fade is_in={isIn}>{children}</Fade>
</div>
);
Expand Down Expand Up @@ -212,7 +214,7 @@ const Demo = () => (
<Col md={3}>
<Card>
<CardBody>
<h5 className="card-title">Here's another card</h5>
<h5 className="card-title">Here&apos;s another card</h5>
<p className="card-text">With some text, and a button</p>
<Button color="success">Click here</Button>
</CardBody>
Expand All @@ -221,7 +223,7 @@ const Demo = () => (
<Col md={3}>
<Card>
<CardBody>
<h5 className="card-title">Here's yet another card</h5>
<h5 className="card-title">Here&apos;s yet another card</h5>
<p className="card-text">With some text, and some links</p>
<CardLink href="https://www.asidatascience.com">
External
Expand Down
10 changes: 5 additions & 5 deletions demo/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';

import {createRoot} from 'react-dom/client';

import Demo from './Demo';

const rootInstance = ReactDOM.render(
<Demo />,
document.getElementById('react-demo-entry-point')
);
const root = createRoot(document.getElementById('react-demo-entry-point'));

root.render(<Demo />);
2 changes: 1 addition & 1 deletion docs/components_page/components/carousel.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This is a carousel with slides only. The default cycle time is 5000ms, but here

## With controls

Here we add the previous and next controls. The default is for the slideshow to autoplay after the user manually cycles the first item. Set `ride="carousel"` to start the slideshow on page load.
Here we add the previous and next controls.

{{example:components/carousel/controls.py:carousel}}

Expand Down
1 change: 0 additions & 1 deletion docs/components_page/components/carousel/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
controls=False,
indicators=False,
interval=2000,
ride="carousel",
)
2 changes: 1 addition & 1 deletion docs/components_page/components/index/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@

# 5. Start the Dash server
if __name__ == "__main__":
app.run_server()
app.run()
6 changes: 3 additions & 3 deletions docs/components_page/components/navbar/navbar.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dash_bootstrap_components as dbc
from dash import Input, Output, State, html

PLOTLY_LOGO = "https://images.plot.ly/logo/new-branding/plotly-logomark.png"
LOGO = "https://placehold.co/100x100"

search_bar = dbc.Row(
[
Expand All @@ -22,13 +22,13 @@
# Use row and col to control vertical alignment of logo / brand
dbc.Row(
[
dbc.Col(html.Img(src=PLOTLY_LOGO, height="30px")),
dbc.Col(html.Img(src=LOGO, height="30px")),
dbc.Col(dbc.NavbarBrand("Navbar", className="ms-2")),
],
align="center",
className="g-0",
),
href="https://plotly.com",
href="https://placehold.co/",
style={"textDecoration": "none"},
),
dbc.NavbarToggler(id="navbar-toggler", n_clicks=0),
Expand Down
2 changes: 1 addition & 1 deletion docs/components_page/components/table/kwargs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# using the same table as in the above example
table_header + table_body,
bordered=True,
dark=True,
color="dark",
hover=True,
responsive=True,
striped=True,
Expand Down
26 changes: 0 additions & 26 deletions docs/components_page/metadata.py

This file was deleted.

2 changes: 1 addition & 1 deletion docs/content/docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ app.layout = dbc.Container(
)

if __name__ == "__main__":
app.run_server()
app.run()
```

## Examples
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/demo_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ def for_path(self, component):
if __name__ == "__main__":
app = Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
app.layout = _layout
app.run_server(port=8888, debug=True)
app.run(port=8888, debug=True)
2 changes: 1 addition & 1 deletion docs/demos/theme_explorer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ def open_toast(_):


if __name__ == "__main__":
app.run_server(debug=True)
app.run(debug=True)
2 changes: 1 addition & 1 deletion docs/demos/theme_explorer/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@
dbc.Table(
[table_header, table_body],
bordered=True,
dark=True,
hover=True,
responsive=True,
striped=True,
className="mb-2",
color="dark",
),
),
]
Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dash>=2.0.0
dash_bootstrap_components==ci-fixes
dash==3.0.0rc3
dash_bootstrap_components==2.0.0b2
gunicorn
markdown
pandas
Expand Down
15 changes: 0 additions & 15 deletions docs/static/docs.css
Original file line number Diff line number Diff line change
Expand Up @@ -294,21 +294,6 @@ span.hljs-meta {
}
}

.dbcd-masthead .btn-outline-secondary {
color: #fa7268;
border-color: #fa7268;
}

.dbcd-masthead .btn-outline-secondary:hover {
color: #fff;
background-color: #fa7268;
}

.dbcd-masthead .btn-secondary {
background-color: #fa7268;
border-color: #fa7268;
}

.dbcd-main.changelog h2 {
font-size: 1.5rem;
}
Expand Down
Binary file removed docs/static/images/dbciconblack128.png
Binary file not shown.
Binary file removed docs/static/images/dbciconwhite16.png
Binary file not shown.
Binary file added docs/static/images/dbclogo128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/static/images/favicon.ico
Binary file not shown.
11 changes: 11 additions & 0 deletions docs/static/js/v2-alert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var migrationAlertContainer = document.getElementById('v2-alert-container');

if (!window.localStorage.getItem('dbc-v2-alert-seen')) {
migrationAlertContainer.setAttribute('style', 'display:block');
}

var migrationAlert = document.getElementById('v2-alert');
migrationAlert.addEventListener('closed.bs.alert', function () {
window.localStorage.setItem('dbc-v2-alert-seen', 'true');
migrationAlertContainer.setAttribute('style', 'display:none');
});
1 change: 1 addition & 0 deletions docs/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
</head>
<body>
{% block header %}{% endblock %}
{% include "partials/v2-alert.html" %}
{% block body %}{% endblock %}
{% block scripts %}{% include "partials/scripts.html" %}{% endblock %}
</body>
Expand Down
8 changes: 4 additions & 4 deletions docs/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div style="width:250px;height:250px;margin:auto;padding:1rem;background-color:white;border-radius:1rem;box-sizing:content-box;">
<object
type="image/svg+xml"
data="https://cdn.opensource.faculty.ai/dbc/assets/logo.svg"
data="https://cdn.jsdelivr.net/gh/facultyai/dash-bootstrap-components@main/logo/logo.svg"
style="width:100%;height:100%;"
>
dash-bootstrap-components logo
Expand All @@ -28,11 +28,11 @@ <h1 class="font-weight-light">Dash Bootstrap Components</h1>
apps with complex, responsive layouts.
</p>
<a
class="btn btn-outline-secondary"
class="btn btn-outline-primary"
href="https://github.com/facultyai/dash-bootstrap-components"
>Source Code<i class="bi bi-github ms-1"></i></a
>
<a class="btn btn-secondary" href="/docs">Get Started »</a>
<a class="btn btn-primary" href="/docs">Get Started »</a>
</div>
</div>
</div>
Expand Down Expand Up @@ -68,7 +68,7 @@ <h2>Get started quickly</h2>
)

if __name__ == "__main__":
app.run_server()</code></pre>
app.run()</code></pre>
</div>
</div>
<hr />
Expand Down
2 changes: 1 addition & 1 deletion docs/templates/macros/example-navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="container-fluid">
<span class="me-2 bg-white" style="padding:2px;border-radius:4px">
<img
src="/static/images/dbciconblack128.png"
src="/static/images/dbclogo128.png"
width="36"
height="36"
alt="dbc logo thumbnail"
Expand Down
2 changes: 1 addition & 1 deletion docs/templates/macros/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="container">
<span class="me-2 bg-white" style="padding:2px;border-radius:4px">
<img
src="/static/images/dbciconblack128.png"
src="/static/images/dbclogo128.png"
width="36"
height="36"
alt="dbc logo thumbnail"
Expand Down
4 changes: 2 additions & 2 deletions docs/templates/macros/theme-explorer-navbar.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% macro theme_explorer_navbar() -%}
<nav class="navbar navbar-expand navbar-dark sticky-top bg-dark">
<span
class="me-2 bg-white"
class="mx-2 bg-white"
style="padding:2px;border-radius:4px;margin-right: 0.5rem;"
>
<img
src="/static/images/dbciconblack128.png"
src="/static/images/dbclogo128.png"
width="36"
height="36"
alt="dbc logo thumbnail"
Expand Down
2 changes: 1 addition & 1 deletion docs/templates/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/tomorrow-night-eighties.min.css" />
<link rel="stylesheet" href="/static/docs.css" />
<link rel="shortcut icon" type="image/png" href="/static/images/dbciconwhite16.png" />
<link rel="shortcut icon" type="image/x-icon" href="/static/images/favicon.ico" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css" />
1 change: 1 addition & 0 deletions docs/templates/partials/scripts.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="/static/js/v2-alert.js"></script>
<script src="/static/js/highlight.min.js"></script>
<script>
hljs.configure({ignoreUnescapedHTML: true})
Expand Down
9 changes: 9 additions & 0 deletions docs/templates/partials/v2-alert.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div id="v2-alert-container" style="display:none" class="mt-3 px-5">
<div id="v2-alert" class="alert alert-warning alert-dismissible mx-auto" style="max-width:1000px;"
role="alert">
You are viewing the documentation for
<i>dash-bootstrap-components</i> version 2! Please check our
<a href="/changelog">changelog</a> for details on breaking changes.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</div>
Loading