GithubHelp home page GithubHelp logo

plotly / dash-html-components Goto Github PK

View Code? Open in Web Editor NEW
152.0 53.0 81.0 7.37 MB

OBSOLETE - now part of https://github.com/plotly/dash

Home Page: https://dash.plotly.com

License: Other

Python 78.07% Julia 21.93%
dash

dash-html-components's Introduction

Notice

As of Dash 2, the development of dash-html-components has been moved to the main Dash repo

This package exists for backward compatibility


dash-html-components

Vanilla HTML components for Dash

Install dependencies

  1. Create a virtual env and activate.

    $ virtualenv venv
    $ venv/bin/activate
    

    Note: venv\Scripts\activate for Windows

  2. Install Python packages required to build components.

    $ pip install -r dev-requirements.txt
    
  3. Generate components and install npm packages

    $ npm install
    

Generating HTML Components

The components in src/components, as well as the export index in src/index.js are programmatically generated from element definitions in scripts/. To regenerate:

$ npm run generate-components

The list of attributes is regenerated by scraping the MDN HTML attribute reference.

Note: This step will have already been done for you when you ran npm install

Development

Testing your components in Dash

  1. Watch for changes

     $ npm run build:watch
    
  2. Install module locally (after every change)

     # Generate metadata, and build the JavaScript bundle
     $ npm run install-local
    
     # Now you're done. For subsequent changes, if you've got `npm run build:watch`
     $ python setup.py install
    
  3. Run the Dash layout you want to test

     # Import dash_html_components to your layout, then run it:
     $ python my_dash_layout.py
    

Installing Python package locally

Before publishing to PyPi, you can test installing the module locally:

# Install in `site-packages` on your machine
$ npm run install-local

Uninstalling Python package locally

$ npm run uninstall-local

Contributing

See the contributing guide for guidelines on contributing to this project.

Create a production build and publish:

  1. Build your code:

    $ npm run build
    
  2. Create a Python tarball

    $ python setup.py sdist
    

    This distribution tarball will get generated in the dist/ folder

  3. Test your tarball by copying it into a new environment and installing it locally:

    $ pip install dash-html-components-<new-version>.tar.gz
    
  4. If it works, then you can publish the component to NPM and PyPI:

    1. Publish on PyPI
      $ twine upload dist/*
      
    2. Cleanup the dist folder (optional)
      $ rm -rf dist
      
    3. Publish on NPM (Optional if chosen False in publish_on_npm)
      $ npm publish
      
      Publishing your component to NPM will make the JavaScript bundles available on the unpkg CDN. By default, Dash servers the component library's CSS and JS from the remote unpkg CDN, so if you haven't published the component package to NPM you'll need to set the serve_locally flags to True (unless you choose False on publish_on_npm). We will eventually make serve_locally=True the default, follow our progress in this issue.

dash-html-components's People

Contributors

akronix avatar alexcjohnson avatar ann-marie-ward avatar byronz avatar chriddyp avatar coopy avatar dependabot[bot] avatar hammadtheone avatar harryturr avatar jackluo avatar jbampton avatar jonmmease avatar marc-andre-rivet avatar mjclawar avatar mkcor avatar ned2 avatar nicolaskruchten avatar pravj avatar rmarren1 avatar rpkyle avatar shammamah-zz avatar synapticarbors avatar t4rk1n avatar valentijnnieman avatar waralex avatar wbrgss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dash-html-components's Issues

`html.Label` should be able to support the `for` attribute

The html.Label component does not support the for attribute, presumably because it's a Python reserved keyword.

It would be desirable to support this attribute somehow, in order to enable linking the label with associated input controls. As mentioned by MDN This helps makes pages more accessible with screen readers and clicking on the label will also activate the relevant input.

This can currently be achieved by nesting the input within a label, however this doesn't allow as much flexibility of page layout as using the for attribute to link to the input's ID.

Missing dash-html-components/dash_html_components/metadata.json file in repo

I'm testing the dash-display-error-messages.py demo file from dash-recipes repo and get this error message:

IOError: [Errno 2] No such file or directory: '/Users/xxxxxxxx/GitHub/dash-html-components/dash_html_components/metadata.json'

This file is not included in the dash-html-components repo so not sure what's happening.

I've cloned the following repos onto my local machine (/Users/xxxxxxxx/GitHub/):

  • dash
  • dash-core-components
  • dash-html-components
  • dash-renderer
  • dash-recipes

Stacktrace:

Traceback (most recent call last):
  File "/Users/xxxxxxxx/GitHub/dash-recipes/dash-display-error-messages.py", line 4, in <module>
    import dash_html_components as html
  File "/Users/xxxxxxxx/GitHub/dash-html-components/dash_html_components/__init__.py", line 13, in <module>
    'dash_html_components'
  File "/Users/xxxxxxxx/GitHub/dash/dash/development/component_loader.py", line 24, in load_components
    with open(metadata_path) as data_file:
IOError: [Errno 2] No such file or directory: '/Users/xxxxxxxx/GitHub/dash-html-components/dash_html_components/metadata.json'

These are my installed packages in the venv taken from requirements.txt of the dash repo (excluding other dash packages):

appnope==0.1.0
backports.shutil-get-terminal-size==1.0.0
certifi==2016.2.28
click==6.7
decorator==4.0.11
enum34==1.1.6
Flask==0.12
Flask-Compress==1.4.0
Flask-SeaSurf==0.2.2
funcsigs==1.0.2
functools32==3.2.3.post2
ipdb==0.10.2
ipython==5.3.0
ipython-genutils==0.2.0
itsdangerous==0.24
Jinja2==2.9.5
jsonschema==2.6.0
jupyter-core==4.3.0
MarkupSafe==1.0
mock==2.0.0
nbformat==4.3.0
numpy==1.11.0
pathlib2==2.2.1
pbr==2.1.0
pexpect==4.2.1
pickleshare==0.7.4
plotly==2.0.8
pluggy==0.4.0
prompt-toolkit==1.0.14
ptyprocess==0.5.1
py==1.4.33
Pygments==2.2.0
python-dateutil==2.5.3
pytz==2017.2
requests==2.13.0
requests-file==1.4.1
scandir==1.5
simplegeneric==0.8.1
six==1.10.0
tox==2.7.0
traitlets==4.3.2
virtualenv==15.1.0
wcwidth==0.1.7
Werkzeug==0.12.1

Allow links to open in new tab/window

Like many people, I often open links in a new tab (Ctrl-click).

dcc.Link appears not to support this.

React Router appears to support this via target="_blank", but the target attribute is not allowed on dcc.Link.

Bug when hovering html.A

Problem

I have a basic Dash app with a hyperlink that should change colour when hovered over. However, this doesn't happen, until I manually change the colour in my browser devtools: see this video.

MWE

Consider following folder structure:

folder/
  ├─ dash-app.py
  └─ assets/
      └─ style.css

With files as following:

  • dash-app.py:
import dash
import dash_html_components as html

from os import path as os_path

# Configuring the app
app = dash.Dash(
    __name__,
    url_base_pathname= '/',
    assets_url_path= '/assets/',
    assets_folder= os_path.join(os_path.dirname(os_path.abspath(__file__)), 'assets/')
)
app.layout = html.Main(
    [
        html.P(
            [
            '''
                Morbi vitae nibh vel ex commodo tempus quis sit amet libero.
            ''',
            html.A(
                'This is an inline hyperlink.',
                href='/',
            ),
            '''
                And some more text after it.
            ''',
            ]
        ),
    ]
)

if __name__ == '__main__':
    app.config.update({
        'routes_pathname_prefix': '/',
        'requests_pathname_prefix': '/',
    })
    app.run_server(
        debug=True,
    )
  • style.css:
a {
  text-decoration: underline;
  color: inherit;
}
a:hover, a:active {
  color:   #f00; 
}

You can see the demo of my problem on this video. I'm using Firefox Developer Edition v.65.0b5 (64-bit).

Details open attribute isn't working for callbacks

You can set the open attribute for the details component correctly but you can't change it afterwards in a callback. This seems to be a problem with react and I found this solution:

const onToggle = event => {
  event.preventDefault();
  setOpen(!open);
};

// Later on...
return (
  <div className="App">
    <details open={open} onClick={onToggle}>...</details>
  </div>
)

Source: facebook/react#15486

Could somebody fix this?

Remove Event system

Companion issue to plotly/dash#531

The only use of events in this repo is that every component gets a click event. But there is also an n_clicks property (and n_clicks_timestamp) so nobody needs to use the click event here. But users who are using the event will need to update their code when we remove the event.

[Pull Request Proposal] Support React.Fragment

Reposted from plotly/dash/issues/811 (should have been here anyway, but original post was to see if there were alternatives to something like html.Fragment())

I plan to open a PR to add html.Fragment() (Update: will create PR against dcc)


From the getting started guide, app.layout = html.Div(children=[...])
creates an unnecessary <div>...</div> element, which would instead be a Fragment if written directly in React (React.Fragment).

Full example below:

# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

# > Proposed html.Fragment below! <
app.layout = html.Fragment(children=[
    html.H1(children='Hello Dash'),

    html.Div(children='''
        Dash: A web application framework for Python.
    '''),

    dcc.Graph(
        id='example-graph',
        figure={
            'data': [
                {'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
                {'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
            ],
            'layout': {
                'title': 'Dash Data Visualization'
            }
        }
    )
])

if __name__ == '__main__':
    app.run_server(debug=True)

A more realistic example would be for laying out tiles with Bulma CSS

import dash_html_components as html
import numpy as np
import pandas as pd
import plotly_express as px
from dash_charts.helpers import MinGraph


class BulmaStylingDemo:
    """Demo laying out a 3 column grid with Bulma where.

    - the first column has three tiles
    - the middle column is half the full screen width
    - the tiles will wrap on smaller screens

    """

    def __init__(self):
        """Initialize app."""
        self.app = helpers.initApp()

    def run(self, *, debug=True, **kwargs):
        """Run the application passing any kwargs to dash."""
        self._createLayout()
        self.app.run_server(debug=debug, **kwargs)

    def _createLayout(self):
        """Create application layout."""
        # Initialize the dashboard layout
        self.app.layout = html.Div(className='section', children=[
            html.Div(className='tile is-ancestor', children=[
                html.Div(className='tile is-parent is-vertical is-3', children=[
                    html.Article(className='tile is-child notification', children=[
                        html.P(className='title', children='Top Vertical Tile'),
                        html.P(
                            className='subtitle',
                            children='Uses notification class for grey background and internal padding',
                        ),
                        html.P(className='subtitle', children='Could also add is-info, is-warning, etc.'),
                    ]),
                    html.Article(className='tile is-child', children=[
                        html.P(className='title', children='Vertical...'),
                        html.P(className='subtitle', children='(Top tile)'),
                        MinGraph(
                            figure=px.scatter(px.data.iris(), x="sepal_width", y="sepal_length", height=200),
                        ),
                    ]),
                    html.Article(className='tile is-child', children=[
                        html.P(className='title', children='...tiles'),
                        html.P(className='subtitle', children='(Bottom tile)'),
                        MinGraph(
                            figure=px.scatter(px.data.iris(), x="sepal_width", y="sepal_length", height=200),
                        ),
                    ]),
                ]),
                MinGraph(
                    className='tile is-child is-6 is-block-desktop',
                    figure=px.scatter(px.data.iris(), x="sepal_width", y="sepal_length"),
                ),
                html.Article(className='tile is-child is-3 is-block-desktop', children=[
                    html.P(className='title', children='A Small Chart'),
                    MinGraph(
                        figure=px.scatter(px.data.iris(), x="sepal_width", y="sepal_length", height=350),
                    ),
                    html.P(className='subtitle', children='An Image'),
                    html.Img(src='https://media.giphy.com/media/JGQe5mxayVF04/giphy.gif')
                ]),
            ]),
        ])


if __name__ == '__main__':
    BulmaStylingDemo().run()

Where for a more complicated layout, I might want to write something like:

    def _createLayout(self):
        """Create application layout."""
        # Initialize the dashboard layout
        self.app.layout = html.Div(className='section', children=[
            html.Div(className='tile is-ancestor', children=[
                self.leftVerticalTiles(),
                MinGraph(
                    className='tile is-child is-6 is-block-desktop',
                    figure=self.exRolling.createFigure(df=self.dfDemo, dataLbl='Demo Data', rollingCount=4),
                ),
                html.Article(className='tile is-child is-3 is-block-desktop', children=[
                    html.P(className='title', children='A Small Chart'),
                    MinGraph(
                        figure=px.scatter(px.data.iris(), x="sepal_width", y="sepal_length", height=350),
                    ),
                    html.P(className='subtitle', children='An Image'),
                    html.Img(src='https://media.giphy.com/media/JGQe5mxayVF04/giphy.gif')
                ]),
            ]),
        ])

    def leftVerticalTiles(self):
        """Would not work with: `return html.Div(...)`"""
        return html.Fragment(children=[
            html.Div(className='tile is-parent is-vertical is-3', children=[
                html.Article(className='tile is-child notification', children=[
                    html.P(className='title', children='Top Vertical Tile'),
                    html.P(
                        className='subtitle',
                        children='Uses notification class for grey background and internal padding',
                    ),
                    html.P(className='subtitle', children='Could also add is-info, is-warning, etc.'),
                ]),
                html.Article(className='tile is-child', children=[
                    html.P(className='title', children='Vertical...'),
                    html.P(className='subtitle', children='(Top tile)'),
                    MinGraph(
                        figure=px.scatter(px.data.iris(), x="sepal_width", y="sepal_length", height=200),
                    ),
                ]),
                html.Article(className='tile is-child', children=[
                    html.P(className='title', children='...tiles'),
                    html.P(className='subtitle', children='(Bottom tile)'),
                    MinGraph(
                        figure=px.scatter(px.data.iris(), x="sepal_width", y="sepal_length", height=200),
                    ),
                ]),
            ]),
        ])

Where if return html.Div(... was used instead of return html.Fragment(... (of course, assuming html.Fragment existed), the extra div would cause the vertical tiles to be aligned incorrectly


Note: I've been experimenting with classes for laying out Dash apps and it is really helpful to avoid pitfalls of having global variables. I'm working on a class-based boilerplate charting library and a full, class-based Dash app Personal Finance Explorer - Example OOP profile page"

Clicking on an anchor tag refreshes the page and loses state

If I use html.A("Go to section1", href="#section1")
to scroll to an anchor, the page seems to refresh and lose its state. This makes it very difficult to use anchor tags at all because state is instantly lost... Ideally, I would like to store state within the url but this isn't currently possible because of #44

Not sure if this is a bug or just a problem with my implimentation though.

Set R examples to run for CRAN checks

As requested during the most recent CRAN submission, we should remove \dontrun from all R examples, and instead preface with

if (interactive()) {
  ...
}

All PropTypes are 'string'

A detail I noticed with the property validation PR is that all properties that are not n_click, n_click_timestamp and children in dash-html-components are strings.

Some HTML props sort of behave like they are booleans, numbers, ect. and are transparently serialized to a string. For example, Details.open can be set to True which will serialize as 'true', HTML interprets this as the presence of a string and sets the value open to be true.

This pattern currently breaks with the property validation PR (plotly/dash#340) since props have PropType.string, you would have to set the value to be 'true' or some other string.

I haven't been able to find a good resource that has each HTML attribute and its type, so I was thinking of just not validating anything from dash-html-components since having to convert everything to a string would get tedious.

Anyone have any thoughts on this / ideas to remedy?

failed to install metadata.json and manifest.md missing

Hey,
No idea what is necessary to recreate this error ( bloody n00b)...

but installing this via
$ python setup.py install
on anaconda (not available on anaconda cloud anyway for windows)
the resulting error using
$ import dash_html_components
was
$ FileNotFoundError: [Errno 2] No such file or directory: 'E:\anaconda3\lib\site-packages\dash_html_components-0.10.0-py3.6.egg\dash_html_components\metadata.json'

aswell as the "manifest.md" file

Of course, I might have skipped sth. in the installation process.
Copying the files manually from git into the folders where they were expected seemed to solve the issue...for now...
( was able to run dash-stock-tickers-demo-app-master and )

Boolean attributes in button: disabled

Hello.

I'm trying to use the disabled attribute in the button element.

Firstly, I've noticed that its type is String instead of Boolean.
Secondly, I've trying to set the prop disabled='disabled', but it does not work; and it is still enabled.

Other props of button with expected similar behaviour (boolean props) are: autoFocus, contentEditable, draggable, hidden, spellCheck, etc.

Video missing Type

I want to set the type of video, but there is no type parameter?

To be more clear I want to do the following in:

<video id="player" class="video-js vjs-default-skin" height="360" width="640" controls preload="none"> <source src="http://localhost:8080/hls/stream.m3u8" type="application/x-mpegURL" /> </video>

but 'type' is no parameter.

propTypes aren't honored

All HTML components have propTypes defined according to the documentation:
https://facebook.github.io/react/docs/reusable-components.html#stateless-functions

The style propType is set to PropTypes.object for all components.

Yet, when running a basic layout in Dash, we get propType warnings:

util.js:242 Warning: Failed propType: Invalid prop `style` of type `object` supplied to `Pre`, expected `string`. Check the render method of `UnconnectedContainer`.
  1. How come Pre.propTypes = {style: PropTypes.object} is ignored?
  2. Where is the string propType coming from?

Cannot use HTML tags in children text

It seems like when I add HTML to an html_component children text, it is somehow keeping the browser from parsing it into anything but plain text. For example, trying to use an <a> tag results in the actual text <a> instead of a link.

An example to clarify:

html.Div('If you\'re interested in viewing trends, please' + ' check out <a href="https://trends.google.com" target="_blank"> Google Trends</a>' + ' for more information.' ),

This results in being displayed on the webpage as:

If you're interested in viewing trends, please checkout <a href="https//trends.google.com" target="_blank"> Google Trends</a> for more information.

can't load `dash_html_components` into Python 3.7

can't load dash_html_components into Python 3.7

File "app.py", line 3, in <module>
    import dash_html_components as html
  File "/home/ben/.virtualenvs/spark-livy-dash/lib/python3.7/site-packages/dash_html_components/__init__.py", line 20, in <module>
    'dash_html_components'
  File "/home/ben/.virtualenvs/spark-livy-dash/lib/python3.7/site-packages/dash/development/component_loader.py", line 51, in load_components
    namespace
  File "/home/ben/.virtualenvs/spark-livy-dash/lib/python3.7/site-packages/dash/development/base_component.py", line 441, in generate_class
    exec(string, scope)
  File "<string>", line 44
    def __init__(self, children=None, id=Component.UNDEFINED, n_clicks=Component.UNDEFINED, n_clicks_timestamp=Component.UNDEFINED, key=Component.UNDEFINED, role=Component.UNDEFINED, async=Component.UNDEFINED, charSet=Component.UNDEFINED, crossOrigin=Component.UNDEFINED, defer=Component.UNDEFINED, integrity=Component.UNDEFINED, src=Component.UNDEFINED, type=Component.UNDEFINED, accessKey=Component.UNDEFINED, className=Component.UNDEFINED, contentEditable=Component.UNDEFINED, contextMenu=Component.UNDEFINED, dir=Component.UNDEFINED, draggable=Component.UNDEFINED, hidden=Component.UNDEFINED, lang=Component.UNDEFINED, spellCheck=Component.UNDEFINED, style=Component.UNDEFINED, tabIndex=Component.UNDEFINED, title=Component.UNDEFINED, **kwargs):
                                                                                                                                                                                           ^
SyntaxError: invalid syntax

the app is literally just

import dash_html_components as html

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organiszation’s settings page, under Installed GitHub Apps.

Several components have limited or no functionality in current browsers

We recently prepared examples for dashHtmlComponents in advance of submission to CRAN.

As a result, several components were identified as non-functional or obsolete by those writing up the examples; this is most likely the result of browsers deprecating previously valid HTML elements.

A list of these follows below. 🚫 indicates a component which is suspected not to function anymore.

From @rpkyle:

  • 🚫 htmlBasefont: this HTML5 element is deprecated, but the component does not suit the specifications as written and does not work.

From @CanerIrfanoglu:

  • htmlListing: Deprecated. Example working.
  • htmlMarquee: Obsolete. Example working.
  • htmlMeta: Example added but injects <meta> tag to <body>. Not sure if this is acceptable.
  • htmlMultiCol: Obsolete. Example added (requires col arg and Netscape 4 to work).
  • 🚫 htmlNextid: Needs to be injected in the <head> and not supported by any browser.
  • 🚫 htmlObjectEl: Example created but not working. object tag has data attribute but htmlObjectEl does not. There is an issue created earlier.
  • htmlOptgroup: Example working. However, labels are blank. Noted that optgroup should have label argument. Below is how it looks vs. how it is supposed to look:
    Screen Shot 2019-07-30 at 5 11 45 PM Screen Shot 2019-07-30 at 5 12 15 PM
  • 🚫 htmlOutput: Need oninput attribute of htmlForm & htmlInput(does not exist) to create a working example.
  • 🚫 htmlParam: Example added but not working. Depends on data attribute of htmlObjectEl
  • 🚫 htmlPlaintext: Obsolete. Example added but does not work as intended (should render rest of html as plain-text)

From @sacul-git:

  • 🚫 htmlScript: I did not successfully create a minimal htmlScript that actually works.
  • htmlShadow: This is deprecated, and I'm not sure how to show a meaningful example in the context of a Dash app.
  • htmlSlot: I'm not sure how to show a meaningful example in the context of a Dash app.
  • htmlSpacer: non-standard and obsolete
  • htmlTitle: Because an app's title is set through Dash$new(name = "title"), I'm not sure how to show a meaningful example of htmlTitle.
  • htmlTrack: Not sure how to use this within a Dash app with audio or video, and if there is a way, I'm not sure where I should source a vtt file from.

@alexcjohnson

generate-components components generates buggy entry for nextid element

When I run npm run generate-components, I get an unhappy looking component file in src/components: Nextid: the next id element (obsolete).react.js and a correspondingly bogus line in index.js:

import Nextid: the next id element (obsolete) from './components/Nextid: the next id element (obsolete).react';

Apparently this element is deprecated. Might this be the problem?

How to add a button with a link?

Forgive the naive question, I am extremely new to web programming. We'd like to add a feedback button, but this code:

                html.Button('Submit feedback!', className='three columns',
                            href='https://github.com/czbiohub/singlecell-dash/issues/new'),

Produces the error that href is not a valid property:

Traceback (most recent call last):
  File "../singlecell-dash/app.py", line 681, in <module>
    cli()
  File "/Users/olgabot/anaconda3/envs/maca-dash/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/olgabot/anaconda3/envs/maca-dash/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/olgabot/anaconda3/envs/maca-dash/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/olgabot/anaconda3/envs/maca-dash/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "../singlecell-dash/app.py", line 360, in cli
    href='https://github.com/czbiohub/singlecell-dash/issues/new'),
  File "<string>", line 45, in __init__
  File "/Users/olgabot/anaconda3/envs/maca-dash/lib/python3.6/site-packages/dash/development/base_component.py", line 23, in __init__
    ', '.join(self._prop_names)
Exception: Unexpected keyword argument `href`
Allowed arguments: children, autoFocus, disabled, form, formAction, name, type, value, accessKey, className, contentEditable, contextMenu, dir, draggable, hidden, lang, spellCheck, style, tabIndex, title, id
make: *** [dev] Error 1

What's the correct way to add a button with a link?

'async' prop of Script with python 3.7

In Python 3.7, setting the async prop of the Script component will not work normally since async is a reserved keyword in Python 3.7.

To get the same functionality, set it as follows:
html.Script(id='hello', **{'async': 'blah'})

We should change async to something else in the future.

Using the object tag with data property

for a small dash app I am working , I also need to display an embedded PDF in a section.
While using HTML I could do something like this to display the PDF.
<object type="application/pdf" data="sample.pdf#toolbar=1&navpanes=1&scrollbar=1&page=25" width="500" height="375" >

I am unable to replicate this within dash.I am using the ObjectEl html component(I believe this is the corresponding element for HTML object tag), but it doesn't have a data property to set.

Any suggestion would be highly appreciated!

Thanks.

PropType for n_clicks and n_clicks_timestamp is not valid

First of all, thanks very much for making Dash! We use it a lot.

dash-html-components defines the prop type for n_clicks and n_clicks_timestamp as integer here. That's not, as far as I can tell, valid prop types (see a list of PropTypes here). The correct prop type is number.

This doesn't seem to stop react-docgen from creating the correct metadata, but it does make it confusing for people developing new components that depend on the HTML components. If you enable prop types checking, you get lots of errors about n_clicks and n_clicks_timestamp being invalid.

Am I missing something here? Is there a good reason why this should be integer instead of number? If not, I'm very happy to submit a PR.


Reproducing the issue

The quickest route to reproducing the issue is to start from the documentation on creating custom components.

builder-init dash-components-archetype
npm install --save dash-html-components

We now need to enable prop types checking. The easiest is to remove the declaration that React and ReactDOM are external dependencies in
node_modules/dash-components-archetype/config/webpack/webpack.config.js. This means we actually get warnings for bad propTypes.

Now change demo/Demo.react.js to this:

import React, {Component} from 'react';
import {ExampleComponent} from '../src';

import {dash_html_components} from 'dash-html-components/lib/bundle';
const {Details} = dash_html_components;

const Demo = props => {
    return (
	<div>
	    <h1>reproduce-dash-error Demo</h1>

	    <h2>Example details</h2>
	    <Details>
		<p>Hello inside details</p>
		<summary>Hello summary</summary>
	    </Details>
	    <hr/>

	</div>
    );
}

export default Demo

Now run:

npm run demo

In the browser console, you can see:

screen shot 2018-06-24 at 14 07 09

You can make the errors go away by explicitly overriding the prop types:

Details.propTypes = {
    ...Details.propTypes,
    n_clicks: PropTypes.number,
    n_clicks_timestamp: PropTypes.number
}

dev instructions lead to failure

to reproduce: follow the documentation exactly

first error: no dash-generate-components found
solution: pip install dash

second error: no yaml found
solution: pip install pyyaml

Need copyright & author info for CRAN package

CRAN has requested that we add Authors@R and copyright holder information within DESCRIPTION. We should provide these things for dashHtmlComponents to complete the submission process.

Updating README/new developer friction

Is the README in this repo up to date? I'm trying to run the instructions from the top and hitting all sorts of issues... conda can't install the requirements.txt and the Python deps aren't documented at all. yarn install throws errors relating to webpack...

Furthermore, and this might require a separate issue, but running npm run generate-python-classes mutates some of the Python, suggesting that things aren't fully in sync? Script.py gets an async element added to it. To mitigate this, I tried to revert to the last released version, but there is no tag for 0.13.2 so that's also something that's adding friction to my getting going with this repo :)

/cc @rpkyle

[BUG] html.ObjectEl does not accept the data keyword

Hi,
I'm using Dash with the following configuration:

dash-core-components==1.5.0
dash-html-components==1.0.1
dash-renderer==1.2.0

The issue is that html.ObjectEl() does not accept the data keyword but only a "data-*" wildcard

Indeed the following python code is raising an exception:

html.ObjectEl("your browser doesn’t support the object tag", data= "/a_link")

Exception:

TypeError: Unexpected keyword argument 'data'
Allowed arguments: accessKey, aria-*, children, className, contentEditable, contextMenu, data-*, dir, draggable, form, height, hidden, id, key, lang, loading_state, n_clicks, n_clicks_timestamp, name, role, spellCheck, style, tabIndex, title, type, useMap, width

Instead the expected behaviour should be the following HTML:

<object data="/a_link"> 
    Your browser doesn’t support the object tag. 
</object>

calling the constructor with the wildcard works, but the produced HTML is different from the expected one:

html.ObjectEl("your browser doesn’t support the object tag", **{'data-test': "/a_link"})

return the HTML:

<object data-test="/a_link"> 
    Your browser doesn’t support the object tag. 
</object>

Td attribute does not support more than 1 argument

For example, trying to put an input inside a Td, followed by some text results in the following error:
TypeError: __init__() takes from 1 to 2 positional arguments but 3 were given
If I am reporting this bug in the wrong repository please redirect me
Thanks in advance

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organiszation’s settings page, under Installed GitHub Apps.

button click event not working in v0.10.0

I noticed that “click” event of button doesn’t work for me in v0.10.0. It says button doesn’t have this event in error message. However, same codes worked fine in v0.8.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.