diff --git a/package-lock.json b/package-lock.json index 2dd3e031..61ca5905 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "dash-core-components", - "version": "1.17.0", + "version": "1.17.1", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "1.17.0", + "version": "1.17.1", "license": "MIT", "dependencies": { "@fortawesome/fontawesome-svg-core": "^1.2.35", @@ -64,8 +64,8 @@ "webpack-cli": "^4.7.2" }, "peerDependencies": { - "react": "^16.9", - "react-dom": "^16.9" + "react": ">=16", + "react-dom": ">=16" } }, "node_modules/@babel/cli": { @@ -10569,7 +10569,7 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", - "deprecated": "The", + "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", "engines": { "node": ">=0.4.x" } diff --git a/src/components/Dropdown.react.js b/src/components/Dropdown.react.js index 604cebfe..80417c1d 100644 --- a/src/components/Dropdown.react.js +++ b/src/components/Dropdown.react.js @@ -109,6 +109,11 @@ Dropdown.propTypes = { */ multi: PropTypes.bool, + /** + * If true, dropdown menu closes when option is selected + */ + close_on_select: PropTypes.bool, + /** * The grey, default text shown when no option is selected */ @@ -186,6 +191,7 @@ Dropdown.defaultProps = { clearable: true, disabled: false, multi: false, + close_on_select: true, searchable: true, optionHeight: 35, persisted_props: ['value'], diff --git a/src/fragments/Dropdown.react.js b/src/fragments/Dropdown.react.js index 2f819b35..493f97ba 100644 --- a/src/fragments/Dropdown.react.js +++ b/src/fragments/Dropdown.react.js @@ -49,6 +49,7 @@ export default class Dropdown extends Component { id, clearable, multi, + close_on_select, options, setProps, style, @@ -94,6 +95,7 @@ export default class Dropdown extends Component { setProps({value}); } }} + closeOnSelect={close_on_select} onInputChange={search_value => setProps({search_value})} backspaceRemoves={clearable} deleteRemoves={clearable} diff --git a/tests/dash_core_components_page.py b/tests/dash_core_components_page.py index 5e9469e4..9ce1e68c 100644 --- a/tests/dash_core_components_page.py +++ b/tests/dash_core_components_page.py @@ -32,9 +32,7 @@ def is_month_valid(elem): filtered = [_ for _ in days if _.text == str(day) and is_month_valid(_)] if not filtered or len(filtered) > 1: logger.error( - "cannot find the matched day with index=%s, day=%s", - index, - day, + "cannot find the matched day with index=%s, day=%s", index, day, ) matched = filtered[0] else: diff --git a/tests/integration/confirmdialog/test_confirm.py b/tests/integration/confirmdialog/test_confirm.py index 568652e9..9c3b0dde 100644 --- a/tests/integration/confirmdialog/test_confirm.py +++ b/tests/integration/confirmdialog/test_confirm.py @@ -44,20 +44,14 @@ def on_click_confirm(n_clicks): @app.callback( Output("confirmed", "children"), - [ - Input("confirm", "submit_n_clicks"), - Input("confirm", "cancel_n_clicks"), - ], + [Input("confirm", "submit_n_clicks"), Input("confirm", "cancel_n_clicks"),], [ State("confirm", "submit_n_clicks_timestamp"), State("confirm", "cancel_n_clicks_timestamp"), ], ) def on_confirmed( - submit_n_clicks, - cancel_n_clicks, - submit_timestamp, - cancel_timestamp, + submit_n_clicks, cancel_n_clicks, submit_timestamp, cancel_timestamp, ): count.value += 1 @@ -102,8 +96,7 @@ def test_cnfd002_injected_confirm(dash_dcc): ) @app.callback( - Output("confirm-container", "children"), - [Input("button", "n_clicks")], + Output("confirm-container", "children"), [Input("button", "n_clicks")], ) def on_click(n_clicks): if n_clicks: diff --git a/tests/integration/graph/test_graph_responsive.py b/tests/integration/graph/test_graph_responsive.py index 60135041..3b27d97a 100644 --- a/tests/integration/graph/test_graph_responsive.py +++ b/tests/integration/graph/test_graph_responsive.py @@ -46,11 +46,7 @@ def test_grrs001_graph(dash_dcc, responsive, autosize, height, width, is_respons figure=dict( layout=dict(autosize=autosize, height=height, width=width), data=[ - dict( - x=[1, 2, 3, 4], - y=[5, 4, 3, 6], - line=dict(shape="spline"), - ) + dict(x=[1, 2, 3, 4], y=[5, 4, 3, 6], line=dict(shape="spline"),) ], ), ) diff --git a/tests/integration/graph/test_graph_varia.py b/tests/integration/graph/test_graph_varia.py index 1bd9d2f8..4c3b2e99 100644 --- a/tests/integration/graph/test_graph_varia.py +++ b/tests/integration/graph/test_graph_varia.py @@ -122,8 +122,7 @@ def test_grva002_graphs_with_different_figures(dash_dcc, is_eager): ) @app.callback( - Output("restyle-data", "children"), - [Input("example-graph", "restyleData")], + Output("restyle-data", "children"), [Input("example-graph", "restyleData")], ) def show_restyle_data(data): if data is None: # ignore initial @@ -131,8 +130,7 @@ def show_restyle_data(data): return json.dumps(data) @app.callback( - Output("relayout-data", "children"), - [Input("example-graph", "relayoutData")], + Output("relayout-data", "children"), [Input("example-graph", "relayoutData")], ) def show_relayout_data(data): if data is None or "autosize" in data: # ignore initial & auto width @@ -351,12 +349,7 @@ def display_data(trigger, fig): ) comparison = json.dumps( - [ - dict( - x=[5, 6, 7, 8, 9, 10, 11], - y=[0.1, 0.2, 0.3, 0.4, 0.5, 0, 0.5], - ) - ] + [dict(x=[5, 6, 7, 8, 9, 10, 11], y=[0.1, 0.2, 0.3, 0.4, 0.5, 0, 0.5],)] ) dash_dcc.wait_for_text_to_equal( "#output_trace_will_prepend_with_max_points", comparison @@ -521,12 +514,7 @@ def display_data(trigger, fig): dash_dcc.wait_for_text_to_equal("#output_trace_will_extend_selectively", comparison) comparison = json.dumps( - [ - dict( - x=[3, 4, 5, 6, 7, 8, 9], - y=[0.5, 0, 0.1, 0.2, 0.3, 0.4, 0.5], - ) - ] + [dict(x=[3, 4, 5, 6, 7, 8, 9], y=[0.5, 0, 0.1, 0.2, 0.3, 0.4, 0.5],)] ) dash_dcc.wait_for_text_to_equal( "#output_trace_will_extend_with_max_points", comparison diff --git a/tests/integration/interval/test_interval.py b/tests/integration/interval/test_interval.py index 85153a47..76b0ae20 100644 --- a/tests/integration/interval/test_interval.py +++ b/tests/integration/interval/test_interval.py @@ -31,12 +31,7 @@ def test_intv002_restart(dash_dcc): app = dash.Dash(__name__) app.layout = html.Div( [ - dcc.Interval( - id="interval", - interval=100, - n_intervals=0, - max_intervals=-1, - ), + dcc.Interval(id="interval", interval=100, n_intervals=0, max_intervals=-1,), html.Button("Start", id="start", n_clicks_timestamp=-1), html.Button("Stop", id="stop", n_clicks_timestamp=-1), html.Div(id="output"), @@ -45,10 +40,7 @@ def test_intv002_restart(dash_dcc): @app.callback( Output("interval", "max_intervals"), - [ - Input("start", "n_clicks_timestamp"), - Input("stop", "n_clicks_timestamp"), - ], + [Input("start", "n_clicks_timestamp"), Input("stop", "n_clicks_timestamp"),], ) def start_stop(start, stop): if start < stop: diff --git a/tests/integration/misc/conftest.py b/tests/integration/misc/conftest.py index 1359d95b..145eed2d 100644 --- a/tests/integration/misc/conftest.py +++ b/tests/integration/misc/conftest.py @@ -90,10 +90,7 @@ def platter_app(): dcc.Input(value="", placeholder="type here", id="textinput"), html.Label("Disabled Text Input"), dcc.Input( - value="disabled", - type="text", - id="disabled-textinput", - disabled=True, + value="disabled", type="text", id="disabled-textinput", disabled=True, ), html.Label("Slider"), dcc.Slider( diff --git a/tests/integration/store/test_component_props.py b/tests/integration/store/test_component_props.py index 89f30cd1..e4cfc69d 100644 --- a/tests/integration/store/test_component_props.py +++ b/tests/integration/store/test_component_props.py @@ -42,8 +42,7 @@ def test_stcp002_modified_ts(store_app, dash_dcc): ) @app.callback( - Output("initial-storage", "data"), - [Input("set-init-storage", "n_clicks")], + Output("initial-storage", "data"), [Input("set-init-storage", "n_clicks")], ) def on_init(n_clicks): if n_clicks is None: diff --git a/tests/integration/tab/test_tabs_with_graphs.py b/tests/integration/tab/test_tabs_with_graphs.py index af5945be..d3279a3f 100644 --- a/tests/integration/tab/test_tabs_with_graphs.py +++ b/tests/integration/tab/test_tabs_with_graphs.py @@ -38,8 +38,7 @@ def test_graph_does_not_resize_in_tabs(dash_dcc, is_eager): ) @app.callback( - Output("tabs-content-example", "children"), - [Input("tabs-example", "value")], + Output("tabs-content-example", "children"), [Input("tabs-example", "value")], ) def render_content(tab): if tab == "tab-1-example": diff --git a/tests/integration/upload/test_upload_different_file_types.py b/tests/integration/upload/test_upload_different_file_types.py index 752745b4..0861f4fc 100644 --- a/tests/integration/upload/test_upload_different_file_types.py +++ b/tests/integration/upload/test_upload_different_file_types.py @@ -50,9 +50,7 @@ def load_data_by_type(filetype, contents): def test_upft001_test_upload_with_different_file_types(filetype, dash_dcc): filepath = os.path.join( - os.path.dirname(__file__), - "upload-assets", - "upft001.{}".format(filetype), + os.path.dirname(__file__), "upload-assets", "upft001.{}".format(filetype), ) app = dash.Dash(__name__)