U
    ×ZßfO  ã                   @   s$   d dl mZmZ G dd„ deƒZdS )é    )Ú	ComponentÚ_explicitize_argsc                       sT   e Zd ZdZg ZdgZdZd Zee	j
e	j
e	j
e	j
e	j
e	j
e	j
f‡ fdd„	ƒZ‡  ZS )ÚLogoutButtonaå  A LogoutButton component.
    Logout button to submit a form post request to the `logout_url` prop.
    Usage is intended for dash-deployment-server authentication.

    DDS usage:

    `dcc.LogoutButton(logout_url=os.getenv('DASH_LOGOUT_URL'))`

    Custom usage:

    - Implement a login mechanism.
    - Create a flask route with a post method handler.
    `@app.server.route('/logout', methods=['POST'])`
      - The logout route should perform what's necessary for the user to logout.
      - If you store the session in a cookie, clear the cookie:
      `rep = flask.Response(); rep.set_cookie('session', '', expires=0)`

    - Create a logout button component and assign it the logout_url
    `dcc.LogoutButton(logout_url='/logout')`

    See https://dash.plotly.com/dash-core-components/logout_button
    for more documentation and examples.

    Keyword arguments:

    - id (string; optional):
        Id of the button.

    - className (string; optional):
        CSS class for the button.

    - label (string; default 'Logout'):
        Text of the button.

    - loading_state (dict; optional):
        Object that holds the loading state object coming from
        dash-renderer.

        `loading_state` is a dict with keys:

        - component_name (string; optional):
            Holds the name of the component that is loading.

        - is_loading (boolean; optional):
            Determines if the component is loading or not.

        - prop_name (string; optional):
            Holds which property is loading.

    - logout_url (string; optional):
        Url to submit a post logout request.

    - method (string; default 'post'):
        Http method to submit the logout form.

    - style (dict; optional):
        Style of the button.ÚchildrenZdash_core_componentsc                    sv   dddddddg| _ g | _dddddddg| _g | _| d¡}	tƒ ‰ ˆ  |¡ ‡ fd	d
„|	D ƒ}
tt| ƒj	f |
Ž d S )NÚidÚ	classNameÚlabelÚloading_stateÚ
logout_urlÚmethodÚstyleÚ_explicit_argsc                    s   i | ]}|ˆ | “qS © r   )Ú.0Úk©Z_localsr   ú9/tmp/pip-unpacked-wheel-47crqvv_/dash/dcc/LogoutButton.pyÚ
<dictcomp>i   s      z)LogoutButton.__init__.<locals>.<dictcomp>)
Z_prop_namesZ_valid_wildcard_attributesZavailable_propertiesZavailable_wildcard_propertiesÚpopÚlocalsÚupdateÚsuperr   Ú__init__)Úselfr   r   r
   r   r   r   r	   Úkwargsr   Úargs©Ú	__class__r   r   r   F   s.    ù	ù	

zLogoutButton.__init__)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Z_children_propsZ_base_nodesÚ
_namespaceÚ_typer   r   Ú	UNDEFINEDr   Ú__classcell__r   r   r   r   r      s   :ør   N)Zdash.development.base_componentr   r   r   r   r   r   r   Ú<module>   s   