|
1 | | -import React from 'react'; |
| 1 | +import React, {ButtonHTMLAttributes, DetailedHTMLProps} from 'react'; |
2 | 2 | import {BaseDashProps, DashComponent} from '@dash-renderer/types'; |
3 | 3 |
|
4 | 4 | export enum PersistenceTypes { |
@@ -52,6 +52,117 @@ export interface BaseDccProps<T> |
52 | 52 | persistence_type?: PersistenceTypes; |
53 | 53 | } |
54 | 54 |
|
| 55 | +export type ButtonProps = BaseDccProps<ButtonProps> & { |
| 56 | + /** |
| 57 | + * The children of this component. |
| 58 | + */ |
| 59 | + children?: React.ReactNode; |
| 60 | + /** |
| 61 | + * Defines the type of the element. |
| 62 | + */ |
| 63 | + type?: 'submit' | 'reset' | 'button'; |
| 64 | + /** |
| 65 | + * The element should be automatically focused after the page loaded. |
| 66 | + */ |
| 67 | + autoFocus?: boolean; |
| 68 | + /** |
| 69 | + * Indicates whether the user can interact with the element. |
| 70 | + */ |
| 71 | + disabled?: boolean; |
| 72 | + /** |
| 73 | + * Indicates the form that is the owner of the element. |
| 74 | + */ |
| 75 | + form?: string; |
| 76 | + /** |
| 77 | + * Indicates the action of the element, overriding the action defined in the <form>. |
| 78 | + */ |
| 79 | + formAction?: string; |
| 80 | + /** |
| 81 | + * If the button/input is a submit button (type="submit"), this attribute sets the encoding type to use during form submission. If this attribute is specified, it overrides the enctype attribute of the button's form owner. |
| 82 | + */ |
| 83 | + formEncType?: string; |
| 84 | + /** |
| 85 | + * If the button/input is a submit button (type="submit"), this attribute sets the submission method to use during form submission (GET, POST, etc.). If this attribute is specified, it overrides the method attribute of the button's form owner. |
| 86 | + */ |
| 87 | + formMethod?: string; |
| 88 | + /** |
| 89 | + * If the button/input is a submit button (type="submit"), this boolean attribute specifies that the form is not to be validated when it is submitted. If this attribute is specified, it overrides the novalidate attribute of the button's form owner. |
| 90 | + */ |
| 91 | + formNoValidate?: boolean; |
| 92 | + /** |
| 93 | + * If the button/input is a submit button (type="submit"), this attribute specifies the browsing context (for example, tab, window, or inline frame) in which to display the response that is received after submitting the form. If this attribute is specified, it overrides the target attribute of the button's form owner. |
| 94 | + */ |
| 95 | + formTarget?: string; |
| 96 | + /** |
| 97 | + * Name of the element. For example used by the server to identify the fields in form submits. |
| 98 | + */ |
| 99 | + name?: string; |
| 100 | + /** |
| 101 | + * Defines a default value which will be displayed in the element on page load. |
| 102 | + */ |
| 103 | + value?: string | string[] | number; |
| 104 | + /** |
| 105 | + * Keyboard shortcut to activate or add focus to the element. |
| 106 | + */ |
| 107 | + accessKey?: string; |
| 108 | + /** |
| 109 | + * Indicates whether the element's content is editable. |
| 110 | + */ |
| 111 | + contentEditable?: boolean | 'true' | 'false' | 'inherit'; |
| 112 | + /** |
| 113 | + * Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left). |
| 114 | + */ |
| 115 | + dir?: string; |
| 116 | + /** |
| 117 | + * Defines whether the element can be dragged. |
| 118 | + */ |
| 119 | + draggable?: boolean; |
| 120 | + /** |
| 121 | + * Prevents rendering of given element, while keeping child elements, e.g. script elements, active. |
| 122 | + */ |
| 123 | + hidden?: boolean; |
| 124 | + /** |
| 125 | + * Defines the language used in the element. |
| 126 | + */ |
| 127 | + lang?: string; |
| 128 | + /** |
| 129 | + * Defines the role of an element in the context of accessibility. |
| 130 | + */ |
| 131 | + role?: string; |
| 132 | + /** |
| 133 | + * Indicates whether spell checking is allowed for the element. |
| 134 | + */ |
| 135 | + spellCheck?: boolean; |
| 136 | + /** |
| 137 | + * Defines CSS styles which will override styles previously set. |
| 138 | + */ |
| 139 | + style?: React.CSSProperties; |
| 140 | + /** |
| 141 | + * Overrides the browser's default tab order and follows the one specified instead. |
| 142 | + */ |
| 143 | + tabIndex?: number; |
| 144 | + /** |
| 145 | + * Text to be displayed in a tooltip when hovering over the element. |
| 146 | + */ |
| 147 | + title?: string; |
| 148 | + /** |
| 149 | + * Number of times the button lost focus. |
| 150 | + */ |
| 151 | + n_blur?: number; |
| 152 | + /** |
| 153 | + * Last time the button lost focus. |
| 154 | + */ |
| 155 | + n_blur_timestamp?: number; |
| 156 | + /** |
| 157 | + * Number of times the button has been clicked. |
| 158 | + */ |
| 159 | + n_clicks?: number; |
| 160 | + /** |
| 161 | + * Last time the button was clicked. |
| 162 | + */ |
| 163 | + n_clicks_timestamp?: number; |
| 164 | +}; |
| 165 | + |
55 | 166 | export enum HTMLInputTypes { |
56 | 167 | // Only allowing the input types with wide browser compatibility |
57 | 168 | 'text' = 'text', |
|
0 commit comments