o
    e=
                     @  sh   d Z ddlmZ ddlZddlmZ ddlmZmZ ddl	m
Z
mZ ed edG d	d
 d
e
ZdS )z[ Predefined buttons with bound events that can be included in a gr.Blocks for convenience.     )annotationsN)Literal)documentset_documentation_group)Button	Component	componentaddc                      sN   e Zd ZdZdZ	d!ddddddddddddd" fddZd#dd Z  ZS )$ClearButtonaH  
    Button that clears the value of a component or a list of components when clicked. It is instantiated with the list of components to clear.
    Preprocessing: passes the button value as a {str} into the function
    Postprocessing: expects a {str} to be returned from a function, which is set as the label of the button
    TNZClearZ	secondary)valuevariantsizeiconlinkvisibleinteractiveelem_idelem_classesscale	min_width
components"None | list[Component] | Componentr   strr   'Literal['primary', 'secondary', 'stop']r   Literal['sm', 'lg'] | Noner   
str | Noner   r   boolr   r   r   list[str] | str | Noner   
int | Noner   c                  s8   t  j|f|||||||	|
||d
| | | d S )N)
r   r   r   r   r   r   r   r   r   r   )super__init__r	   )selfr   r   r   r   r   r   r   r   r   r   r   r   kwargs	__class__ ND:\Projects\ConvertPro\env\Lib\site-packages\gradio/components/clear_button.pyr       s"   zClearButton.__init__"None | Component | list[Component]returnc                 C  sH   |s| S t |tr|g}tdd |D }| jdg |d| d | S )z
        Adds a component or list of components to the list of components that will be cleared when the button is clicked.
        c                 S  s   g | ]}| d qS N)postprocess).0r   r%   r%   r&   
<listcomp>G   s    z#ClearButton.add.<locals>.<listcomp>Nz() => )Z_js)
isinstancer   jsondumpsZclick)r!   r   Zclear_valuesr%   r%   r&   r	   :   s   
zClearButton.addr)   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r'   r(   r
   )__name__
__module____qualname____doc__Zis_templater    r	   __classcell__r%   r%   r#   r&   r
      s$    !r
   )r3   
__future__r   r.   typingr   Zgradio_client.documentationr   r   Zgradio.componentsr   r   r
   r%   r%   r%   r&   <module>   s    