dash-core-components 4.0.0-rc3 → 4.0.0-rc5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dash_core_components/async-datepicker.js +1 -1
- package/dash_core_components/async-datepicker.js.map +1 -1
- package/dash_core_components/async-dropdown.js +1 -1
- package/dash_core_components/async-dropdown.js.map +1 -1
- package/dash_core_components/async-slider.js +1 -1
- package/dash_core_components/async-slider.js.map +1 -1
- package/dash_core_components/async-upload.js +2 -1
- package/dash_core_components/async-upload.js.map +1 -1
- package/dash_core_components/dash_core_components-shared.js +1 -1
- package/dash_core_components/dash_core_components-shared.js.map +1 -1
- package/dash_core_components/dash_core_components.js +1 -1
- package/dash_core_components/dash_core_components.js.map +1 -1
- package/dash_core_components/proptypes.js +44 -9
- package/lib/components/Button.tsx +48 -0
- package/lib/components/Input.tsx +13 -234
- package/lib/components/RadioItems.tsx +3 -1
- package/lib/components/Tooltip.tsx +1 -0
- package/lib/components/Upload.react.js +13 -1
- package/lib/components/css/button.css +50 -0
- package/lib/components/css/calendar.css +24 -6
- package/lib/components/css/datepickers.css +43 -43
- package/lib/components/css/dcc.css +1 -1
- package/lib/components/css/dropdown.css +36 -8
- package/lib/components/css/input.css +8 -2
- package/lib/components/css/optionslist.css +2 -1
- package/lib/components/css/sliders.css +31 -5
- package/lib/components/css/tabs.css +3 -3
- package/lib/components/css/textarea.css +10 -0
- package/lib/components/css/tooltip.css +1 -1
- package/lib/fragments/DatePickerRange.tsx +37 -47
- package/lib/fragments/DatePickerSingle.tsx +9 -8
- package/lib/fragments/Dropdown.tsx +53 -18
- package/lib/fragments/RangeSlider.tsx +21 -66
- package/lib/fragments/Upload.react.js +243 -1
- package/lib/index.ts +2 -0
- package/lib/types.ts +307 -1
- package/lib/utils/calendar/Calendar.tsx +64 -34
- package/lib/utils/optionRendering.tsx +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,40 @@
|
|
|
3
3
|
var pt = window.PropTypes;
|
|
4
4
|
var pk = window['dash_core_components'];
|
|
5
5
|
|
|
6
|
+
pk.Button.propTypes = {className:pt.oneOfType([pt.string]),
|
|
7
|
+
setProps:pt.any,
|
|
8
|
+
persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
|
|
9
|
+
persisted_props:pt.any,
|
|
10
|
+
persistence_type:pt.oneOf(['local','session','memory']),
|
|
11
|
+
id:pt.oneOfType([pt.string]),
|
|
12
|
+
componentPath:pt.any,
|
|
13
|
+
children:pt.node,
|
|
14
|
+
type:pt.oneOf(['submit','reset','button']),
|
|
15
|
+
autoFocus:pt.oneOfType([pt.bool]),
|
|
16
|
+
disabled:pt.oneOfType([pt.bool]),
|
|
17
|
+
form:pt.oneOfType([pt.string]),
|
|
18
|
+
formAction:pt.oneOfType([pt.string]),
|
|
19
|
+
formEncType:pt.oneOfType([pt.string]),
|
|
20
|
+
formMethod:pt.oneOfType([pt.string]),
|
|
21
|
+
formNoValidate:pt.oneOfType([pt.bool]),
|
|
22
|
+
formTarget:pt.oneOfType([pt.string]),
|
|
23
|
+
name:pt.oneOfType([pt.string]),
|
|
24
|
+
value:pt.oneOfType([pt.string,pt.number,pt.arrayOf(pt.string)]),
|
|
25
|
+
accessKey:pt.oneOfType([pt.string]),
|
|
26
|
+
contentEditable:pt.oneOfType([pt.bool,pt.oneOf(["true"]),pt.oneOf(["false"]),pt.oneOf(["inherit"])]),
|
|
27
|
+
dir:pt.oneOfType([pt.string]),
|
|
28
|
+
draggable:pt.oneOfType([pt.bool]),
|
|
29
|
+
hidden:pt.oneOfType([pt.bool]),
|
|
30
|
+
lang:pt.oneOfType([pt.string]),
|
|
31
|
+
role:pt.oneOfType([pt.string]),
|
|
32
|
+
spellCheck:pt.oneOfType([pt.bool]),
|
|
33
|
+
style:pt.any,
|
|
34
|
+
tabIndex:pt.oneOfType([pt.number]),
|
|
35
|
+
title:pt.oneOfType([pt.string]),
|
|
36
|
+
n_blur:pt.oneOfType([pt.number]),
|
|
37
|
+
n_blur_timestamp:pt.oneOfType([pt.number]),
|
|
38
|
+
n_clicks:pt.oneOfType([pt.number]),
|
|
39
|
+
n_clicks_timestamp:pt.oneOfType([pt.number])};
|
|
6
40
|
pk.Checklist.propTypes = {options:pt.any,
|
|
7
41
|
value:pt.oneOfType([pt.arrayOf(pt.oneOfType([pt.string,pt.number,pt.bool]))]),
|
|
8
42
|
inline:pt.oneOfType([pt.bool]),
|
|
@@ -29,6 +63,12 @@ pk.DatePickerRange.propTypes = {start_date:pt.any,
|
|
|
29
63
|
setProps:pt.any,
|
|
30
64
|
id:pt.oneOfType([pt.string]),
|
|
31
65
|
componentPath:pt.any,
|
|
66
|
+
className:pt.oneOfType([pt.string]),
|
|
67
|
+
persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
|
|
68
|
+
persisted_props:pt.any,
|
|
69
|
+
persistence_type:pt.oneOf(['local','session','memory']),
|
|
70
|
+
disabled:pt.oneOfType([pt.bool]),
|
|
71
|
+
style:pt.any,
|
|
32
72
|
min_date_allowed:pt.oneOfType([pt.string]),
|
|
33
73
|
max_date_allowed:pt.oneOfType([pt.string]),
|
|
34
74
|
disabled_days:pt.oneOfType([pt.arrayOf(pt.string)]),
|
|
@@ -46,13 +86,7 @@ pk.DatePickerRange.propTypes = {start_date:pt.any,
|
|
|
46
86
|
with_portal:pt.oneOfType([pt.bool]),
|
|
47
87
|
with_full_screen_portal:pt.oneOfType([pt.bool]),
|
|
48
88
|
day_size:pt.oneOfType([pt.number]),
|
|
49
|
-
is_RTL:pt.oneOfType([pt.bool])
|
|
50
|
-
disabled:pt.oneOfType([pt.bool]),
|
|
51
|
-
style:pt.any,
|
|
52
|
-
className:pt.oneOfType([pt.string]),
|
|
53
|
-
persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
|
|
54
|
-
persisted_props:pt.any,
|
|
55
|
-
persistence_type:pt.oneOf(['local','session','memory'])};
|
|
89
|
+
is_RTL:pt.oneOfType([pt.bool])};
|
|
56
90
|
pk.DatePickerSingle.propTypes = {date:pt.any,
|
|
57
91
|
min_date_allowed:pt.oneOfType([pt.string]),
|
|
58
92
|
max_date_allowed:pt.oneOfType([pt.string]),
|
|
@@ -102,6 +136,7 @@ pk.Dropdown.propTypes = {options:pt.any,
|
|
|
102
136
|
id:pt.oneOfType([pt.string]),
|
|
103
137
|
componentPath:pt.any};
|
|
104
138
|
pk.Input.propTypes = {value:pt.oneOfType([pt.string,pt.number]),
|
|
139
|
+
type:pt.oneOf(['text','number','password','email','range','search','tel','url','hidden']),
|
|
105
140
|
debounce:pt.oneOfType([pt.number,pt.bool]),
|
|
106
141
|
placeholder:pt.oneOfType([pt.string,pt.number]),
|
|
107
142
|
n_submit:pt.oneOfType([pt.number]),
|
|
@@ -130,12 +165,12 @@ pk.Input.propTypes = {value:pt.oneOfType([pt.string,pt.number]),
|
|
|
130
165
|
size:pt.oneOfType([pt.string]),
|
|
131
166
|
style:pt.any,
|
|
132
167
|
className:pt.oneOfType([pt.string]),
|
|
133
|
-
id:pt.oneOfType([pt.string]),
|
|
134
168
|
setProps:pt.any,
|
|
135
169
|
persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
|
|
136
170
|
persisted_props:pt.any,
|
|
137
171
|
persistence_type:pt.oneOf(['local','session','memory']),
|
|
138
|
-
|
|
172
|
+
id:pt.oneOfType([pt.string]),
|
|
173
|
+
componentPath:pt.any};
|
|
139
174
|
pk.Loading.propTypes = {children:pt.node,
|
|
140
175
|
type:pt.oneOf(['graph','cube','circle','dot','default']),
|
|
141
176
|
fullscreen:pt.oneOfType([pt.bool]),
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {ButtonProps} from '../types';
|
|
3
|
+
import './css/button.css';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Similar to dash.html.Button, but with theming and styles applied.
|
|
7
|
+
*/
|
|
8
|
+
const Button = ({
|
|
9
|
+
setProps,
|
|
10
|
+
n_blur = 0,
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12
|
+
n_blur_timestamp = -1,
|
|
13
|
+
n_clicks = 0,
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
|
+
n_clicks_timestamp = -1,
|
|
16
|
+
type = 'button',
|
|
17
|
+
className,
|
|
18
|
+
children,
|
|
19
|
+
...props
|
|
20
|
+
}: ButtonProps) => {
|
|
21
|
+
const ctx = window.dash_component_api.useDashContext();
|
|
22
|
+
const isLoading = ctx.useLoading();
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<button
|
|
26
|
+
data-dash-is-loading={isLoading || undefined}
|
|
27
|
+
className={'dash-button ' + (className ?? '')}
|
|
28
|
+
onBlur={() => {
|
|
29
|
+
setProps({
|
|
30
|
+
n_blur: n_blur + 1,
|
|
31
|
+
n_blur_timestamp: Date.now(),
|
|
32
|
+
});
|
|
33
|
+
}}
|
|
34
|
+
onClick={() => {
|
|
35
|
+
setProps({
|
|
36
|
+
n_clicks: n_clicks + 1,
|
|
37
|
+
n_clicks_timestamp: Date.now(),
|
|
38
|
+
});
|
|
39
|
+
}}
|
|
40
|
+
type={type}
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
{children}
|
|
44
|
+
</button>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default Button;
|
package/lib/components/Input.tsx
CHANGED
|
@@ -11,7 +11,12 @@ import React, {
|
|
|
11
11
|
import uniqid from 'uniqid';
|
|
12
12
|
import fastIsNumeric from 'fast-isnumeric';
|
|
13
13
|
import LoadingElement from '../utils/_LoadingElement';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
HTMLInputTypes,
|
|
16
|
+
InputProps,
|
|
17
|
+
PersistedProps,
|
|
18
|
+
PersistenceTypes,
|
|
19
|
+
} from '../types';
|
|
15
20
|
import './css/input.css';
|
|
16
21
|
|
|
17
22
|
const isNumeric = (val: unknown): val is number => fastIsNumeric(val);
|
|
@@ -20,238 +25,6 @@ const convert = (val: unknown) => (isNumeric(val) ? +val : NaN);
|
|
|
20
25
|
const isEquivalent = (v1: number, v2: number) =>
|
|
21
26
|
v1 === v2 || (isNaN(v1) && isNaN(v2));
|
|
22
27
|
|
|
23
|
-
export enum HTMLInputTypes {
|
|
24
|
-
// Only allowing the input types with wide browser compatibility
|
|
25
|
-
'text' = 'text',
|
|
26
|
-
'number' = 'number',
|
|
27
|
-
'password' = 'password',
|
|
28
|
-
'email' = 'email',
|
|
29
|
-
'range' = 'range',
|
|
30
|
-
'search' = 'search',
|
|
31
|
-
'tel' = 'tel',
|
|
32
|
-
'url' = 'url',
|
|
33
|
-
'hidden' = 'hidden',
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
type InputProps = {
|
|
37
|
-
/**
|
|
38
|
-
* The value of the input
|
|
39
|
-
*/
|
|
40
|
-
value?: string | number;
|
|
41
|
-
/**
|
|
42
|
-
* If true, changes to input will be sent back to the Dash server only on enter or when losing focus.
|
|
43
|
-
* If it's false, it will send the value back on every change.
|
|
44
|
-
* If a number, it will not send anything back to the Dash server until the user has stopped
|
|
45
|
-
* typing for that number of seconds.
|
|
46
|
-
*/
|
|
47
|
-
debounce?: boolean | number;
|
|
48
|
-
/**
|
|
49
|
-
* A hint to the user of what can be entered in the control . The placeholder text must not contain carriage returns or line-feeds. Note: Do not use the placeholder attribute instead of a <label> element, their purposes are different. The <label> attribute describes the role of the form element (i.e. it indicates what kind of information is expected), and the placeholder attribute is a hint about the format that the content should take. There are cases in which the placeholder attribute is never displayed to the user, so the form must be understandable without it.
|
|
50
|
-
*/
|
|
51
|
-
placeholder?: string | number;
|
|
52
|
-
/**
|
|
53
|
-
* Number of times the `Enter` key was pressed while the input had focus.
|
|
54
|
-
*/
|
|
55
|
-
n_submit?: number;
|
|
56
|
-
/**
|
|
57
|
-
* Last time that `Enter` was pressed.
|
|
58
|
-
*/
|
|
59
|
-
n_submit_timestamp?: number;
|
|
60
|
-
/**
|
|
61
|
-
* Provides a hint to the browser as to the type of data that might be
|
|
62
|
-
* entered by the user while editing the element or its contents.
|
|
63
|
-
*/
|
|
64
|
-
inputMode?: /**
|
|
65
|
-
* Alphanumeric, non-prose content such as usernames and passwords.
|
|
66
|
-
*/
|
|
67
|
-
| 'verbatim'
|
|
68
|
-
/**
|
|
69
|
-
* Latin-script input in the user's preferred language with typing aids such as text prediction enabled. For human-to-computer communication such as search boxes.
|
|
70
|
-
*/
|
|
71
|
-
| 'latin'
|
|
72
|
-
/**
|
|
73
|
-
* As latin, but for human names.
|
|
74
|
-
*/
|
|
75
|
-
| 'latin-name'
|
|
76
|
-
/**
|
|
77
|
-
* As latin, but with more aggressive typing aids. For human-to-human communication such as instant messaging or email.
|
|
78
|
-
*/
|
|
79
|
-
| 'latin-prose'
|
|
80
|
-
/**
|
|
81
|
-
* As latin-prose, but for the user's secondary languages.
|
|
82
|
-
*/
|
|
83
|
-
| 'full-width-latin'
|
|
84
|
-
/**
|
|
85
|
-
* Kana or romaji input, typically hiragana input, using full-width characters, with support for converting to kanji. Intended for Japanese text input.
|
|
86
|
-
*/
|
|
87
|
-
| 'kana'
|
|
88
|
-
/**
|
|
89
|
-
* Katakana input, using full-width characters, with support for converting to kanji. Intended for Japanese text input.
|
|
90
|
-
*/
|
|
91
|
-
| 'katakana'
|
|
92
|
-
/**
|
|
93
|
-
* Numeric input, including keys for the digits 0 to 9, the user's preferred thousands separator character, and the character for indicating negative numbers. Intended for numeric codes (e.g. credit card numbers). For actual numbers, prefer using type="number"
|
|
94
|
-
*/
|
|
95
|
-
| 'numeric'
|
|
96
|
-
/**
|
|
97
|
-
* Telephone input, including asterisk and pound key. Use type="tel" if possible instead.
|
|
98
|
-
*/
|
|
99
|
-
| 'tel'
|
|
100
|
-
/**
|
|
101
|
-
* Email input. Use type="email" if possible instead.
|
|
102
|
-
*/
|
|
103
|
-
| 'email'
|
|
104
|
-
/**
|
|
105
|
-
* URL input. Use type="url" if possible instead.
|
|
106
|
-
*/
|
|
107
|
-
| 'url';
|
|
108
|
-
/**
|
|
109
|
-
* This attribute indicates whether the value of the control can be automatically completed by the browser.
|
|
110
|
-
*/
|
|
111
|
-
autoComplete?: string;
|
|
112
|
-
/**
|
|
113
|
-
* This attribute indicates that the user cannot modify the value of the control. The value of the attribute is irrelevant. If you need read-write access to the input value, do not add the "readonly" attribute. It is ignored if the value of the type attribute is hidden, range, color, checkbox, radio, file, or a button type (such as button or submit).
|
|
114
|
-
* readOnly is an HTML boolean attribute - it is enabled by a boolean or
|
|
115
|
-
* 'readOnly'. Alternative capitalizations `readonly` & `READONLY`
|
|
116
|
-
* are also acccepted.
|
|
117
|
-
*/
|
|
118
|
-
readOnly?: boolean | 'readOnly' | 'readonly' | 'READONLY';
|
|
119
|
-
/**
|
|
120
|
-
* This attribute specifies that the user must fill in a value before submitting a form. It cannot be used when the type attribute is hidden, image, or a button type (submit, reset, or button). The :optional and :required CSS pseudo-classes will be applied to the field as appropriate.
|
|
121
|
-
* required is an HTML boolean attribute - it is enabled by a boolean or
|
|
122
|
-
* 'required'. Alternative capitalizations `REQUIRED`
|
|
123
|
-
* are also acccepted.
|
|
124
|
-
*/
|
|
125
|
-
required?: boolean | 'required' | 'REQUIRED';
|
|
126
|
-
/**
|
|
127
|
-
* The element should be automatically focused after the page loaded.
|
|
128
|
-
* autoFocus is an HTML boolean attribute - it is enabled by a boolean or
|
|
129
|
-
* 'autoFocus'. Alternative capitalizations `autofocus` & `AUTOFOCUS`
|
|
130
|
-
* are also acccepted.
|
|
131
|
-
*/
|
|
132
|
-
autoFocus?: boolean | 'autoFocus' | 'autofocus' | 'AUTOFOCUS';
|
|
133
|
-
/**
|
|
134
|
-
* If true, the input is disabled and can't be clicked on.
|
|
135
|
-
* disabled is an HTML boolean attribute - it is enabled by a boolean or
|
|
136
|
-
* 'disabled'. Alternative capitalizations `DISABLED`
|
|
137
|
-
*/
|
|
138
|
-
disabled?: boolean | 'disabled' | 'DISABLED';
|
|
139
|
-
/**
|
|
140
|
-
* Identifies a list of pre-defined options to suggest to the user.
|
|
141
|
-
* The value must be the id of a <datalist> element in the same document.
|
|
142
|
-
* The browser displays only options that are valid values for this
|
|
143
|
-
* input element.
|
|
144
|
-
* This attribute is ignored when the type attribute's value is
|
|
145
|
-
* hidden, checkbox, radio, file, or a button type.
|
|
146
|
-
*/
|
|
147
|
-
list?: string;
|
|
148
|
-
/**
|
|
149
|
-
* This Boolean attribute indicates whether the user can enter more than one value. This attribute applies when the type attribute is set to email or file, otherwise it is ignored.
|
|
150
|
-
*/
|
|
151
|
-
multiple?: boolean;
|
|
152
|
-
/**
|
|
153
|
-
* Setting the value of this attribute to true indicates that the element needs to have its spelling and grammar checked. The value default indicates that the element is to act according to a default behavior, possibly based on the parent element's own spellcheck value. The value false indicates that the element should not be checked.
|
|
154
|
-
*/
|
|
155
|
-
spellCheck?: boolean | 'true' | 'false';
|
|
156
|
-
/**
|
|
157
|
-
* The name of the control, which is submitted with the form data.
|
|
158
|
-
*/
|
|
159
|
-
name?: string;
|
|
160
|
-
/**
|
|
161
|
-
* The minimum (numeric or date-time) value for this item, which must not be greater than its maximum (max attribute) value.
|
|
162
|
-
*/
|
|
163
|
-
min?: string | number;
|
|
164
|
-
/**
|
|
165
|
-
* The maximum (numeric or date-time) value for this item, which must not be less than its minimum (min attribute) value.
|
|
166
|
-
*/
|
|
167
|
-
max?: string | number;
|
|
168
|
-
/**
|
|
169
|
-
* Works with the min and max attributes to limit the increments at which a numeric or date-time value can be set. It can be the string any or a positive floating point number. If this attribute is not set to any, the control accepts only values at multiples of the step value greater than the minimum.
|
|
170
|
-
*/
|
|
171
|
-
step?: string | number;
|
|
172
|
-
/**
|
|
173
|
-
* If the value of the type attribute is text, email, search, password, tel, or url, this attribute specifies the minimum number of characters (in Unicode code points) that the user can enter. For other control types, it is ignored.
|
|
174
|
-
*/
|
|
175
|
-
minLength?: string | number;
|
|
176
|
-
/**
|
|
177
|
-
* If the value of the type attribute is text, email, search, password, tel, or url, this attribute specifies the maximum number of characters (in UTF-16 code units) that the user can enter. For other control types, it is ignored. It can exceed the value of the size attribute. If it is not specified, the user can enter an unlimited number of characters. Specifying a negative number results in the default behavior (i.e. the user can enter an unlimited number of characters). The constraint is evaluated only when the value of the attribute has been changed.
|
|
178
|
-
*/
|
|
179
|
-
maxLength?: string | number;
|
|
180
|
-
/**
|
|
181
|
-
* A regular expression that the control's value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is text, search, tel, url, email, or password, otherwise it is ignored. The regular expression language is the same as JavaScript RegExp algorithm, with the 'u' parameter that makes it treat the pattern as a sequence of unicode code points. The pattern is not surrounded by forward slashes.
|
|
182
|
-
*/
|
|
183
|
-
pattern?: string;
|
|
184
|
-
/**
|
|
185
|
-
* The offset into the element's text content of the first selected character. If there's no selection, this value indicates the offset to the character following the current text input cursor position (that is, the position the next character typed would occupy).
|
|
186
|
-
*/
|
|
187
|
-
selectionStart?: string;
|
|
188
|
-
/**
|
|
189
|
-
* The offset into the element's text content of the last selected character. If there's no selection, this value indicates the offset to the character following the current text input cursor position (that is, the position the next character typed would occupy).
|
|
190
|
-
*/
|
|
191
|
-
selectionEnd?: string;
|
|
192
|
-
/**
|
|
193
|
-
* The direction in which selection occurred. This is "forward" if the selection was made from left-to-right in an LTR locale or right-to-left in an RTL locale, or "backward" if the selection was made in the opposite direction. On platforms on which it's possible this value isn't known, the value can be "none"; for example, on macOS, the default direction is "none", then as the user begins to modify the selection using the keyboard, this will change to reflect the direction in which the selection is expanding.
|
|
194
|
-
*/
|
|
195
|
-
selectionDirection?: string;
|
|
196
|
-
/**
|
|
197
|
-
* Number of times the input lost focus.
|
|
198
|
-
*/
|
|
199
|
-
n_blur?: number;
|
|
200
|
-
/**
|
|
201
|
-
* Last time the input lost focus.
|
|
202
|
-
*/
|
|
203
|
-
n_blur_timestamp?: number;
|
|
204
|
-
/**
|
|
205
|
-
* The initial size of the control. This value is in pixels unless the value of the type attribute is text or password, in which case it is an integer number of characters. Starting in, this attribute applies only when the type attribute is set to text, search, tel, url, email, or password, otherwise it is ignored. In addition, the size must be greater than zero. If you do not specify a size, a default value of 20 is used.' simply states "the user agent should ensure that at least that many characters are visible", but different characters can have different widths in certain fonts. In some browsers, a certain string with x characters will not be entirely visible even if size is defined to at least x.
|
|
206
|
-
*/
|
|
207
|
-
size?: string;
|
|
208
|
-
/**
|
|
209
|
-
* The input's inline styles
|
|
210
|
-
*/
|
|
211
|
-
style?: React.CSSProperties;
|
|
212
|
-
/**
|
|
213
|
-
* The class of the input element
|
|
214
|
-
*/
|
|
215
|
-
className?: string;
|
|
216
|
-
/**
|
|
217
|
-
* The ID of this component, used to identify dash components
|
|
218
|
-
* in callbacks. The ID needs to be unique across all of the
|
|
219
|
-
* components in an app.
|
|
220
|
-
*/
|
|
221
|
-
id?: string;
|
|
222
|
-
/**
|
|
223
|
-
* Dash-assigned callback that gets fired when the value changes.
|
|
224
|
-
*/
|
|
225
|
-
setProps: (props: Partial<InputProps>) => void;
|
|
226
|
-
/**
|
|
227
|
-
* Used to allow user interactions in this component to be persisted when
|
|
228
|
-
* the component - or the page - is refreshed. If `persisted` is truthy and
|
|
229
|
-
* hasn't changed from its previous value, a `value` that the user has
|
|
230
|
-
* changed while using the app will keep that change, as long as
|
|
231
|
-
* the new `value` also matches what was given originally.
|
|
232
|
-
* Used in conjunction with `persistence_type`.
|
|
233
|
-
*/
|
|
234
|
-
persistence?: boolean | string | number;
|
|
235
|
-
/**
|
|
236
|
-
* Properties whose user interactions will persist after refreshing the
|
|
237
|
-
* component or the page. Since only `value` is allowed this prop can
|
|
238
|
-
* normally be ignored.
|
|
239
|
-
*/
|
|
240
|
-
persisted_props?: PersistedProps[];
|
|
241
|
-
/**
|
|
242
|
-
* Where persisted user changes will be stored:
|
|
243
|
-
* memory: only kept in memory, reset on page refresh.
|
|
244
|
-
* local: window.localStorage, data is kept after the browser quit.
|
|
245
|
-
* session: window.sessionStorage, data is cleared once the browser quit.
|
|
246
|
-
*/
|
|
247
|
-
persistence_type?: PersistenceTypes;
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* The type of control to render.
|
|
251
|
-
*/
|
|
252
|
-
type?: HTMLInputTypes;
|
|
253
|
-
};
|
|
254
|
-
|
|
255
28
|
const inputProps = [
|
|
256
29
|
'type',
|
|
257
30
|
'placeholder',
|
|
@@ -289,12 +62,17 @@ function Input({
|
|
|
289
62
|
type = HTMLInputTypes.text,
|
|
290
63
|
inputMode = 'verbatim',
|
|
291
64
|
n_blur = 0,
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
292
66
|
n_blur_timestamp = -1,
|
|
293
67
|
n_submit = 0,
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
294
69
|
n_submit_timestamp = -1,
|
|
295
70
|
debounce = false,
|
|
296
71
|
step = 'any',
|
|
72
|
+
autoComplete = 'off',
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
297
74
|
persisted_props = [PersistedProps.value],
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
298
76
|
persistence_type = PersistenceTypes.local,
|
|
299
77
|
disabled,
|
|
300
78
|
...props
|
|
@@ -470,11 +248,12 @@ function Input({
|
|
|
470
248
|
type,
|
|
471
249
|
inputMode,
|
|
472
250
|
step,
|
|
251
|
+
autoComplete,
|
|
473
252
|
disabled: disabledAsBool,
|
|
474
253
|
}) as Pick<InputHTMLAttributes<HTMLInputElement>, HTMLInputProps>;
|
|
475
254
|
|
|
476
255
|
const isNumberInput = type === HTMLInputTypes.number;
|
|
477
|
-
const currentNumericValue =
|
|
256
|
+
const currentNumericValue = parseFloat(String(value ?? 0)) || 0;
|
|
478
257
|
const minValue = convert(props.min);
|
|
479
258
|
const maxValue = convert(props.max);
|
|
480
259
|
const isDecrementDisabled =
|
|
@@ -54,7 +54,9 @@ export default function RadioItems({
|
|
|
54
54
|
options={sanitizedOptions}
|
|
55
55
|
selected={isNil(value) ? [] : [value]}
|
|
56
56
|
onSelectionChange={selection => {
|
|
57
|
-
|
|
57
|
+
if (selection.length) {
|
|
58
|
+
setProps({value: selection[selection.length - 1]});
|
|
59
|
+
}
|
|
58
60
|
}}
|
|
59
61
|
{...stylingProps}
|
|
60
62
|
/>
|
|
@@ -31,6 +31,7 @@ const Tooltip = ({
|
|
|
31
31
|
height: `${position?.y1 - position?.y0}px`,
|
|
32
32
|
display: `${show_tooltip ? 'inline-block' : 'none'}`,
|
|
33
33
|
pointerEvents: `${targetable ? 'auto' : 'none'}`,
|
|
34
|
+
'--Dash-Tooltip-PointerEvents': targetable ? 'auto' : 'none',
|
|
34
35
|
'--Dash-Tooltip-Border-Color': border_color,
|
|
35
36
|
'--Dash-Tooltip-Background-Color': background_color,
|
|
36
37
|
'--Dash-Tooltip-ZIndex': zindex,
|
|
@@ -99,9 +99,20 @@ Upload.propTypes = {
|
|
|
99
99
|
*/
|
|
100
100
|
min_size: _propTypes.default.number,
|
|
101
101
|
/**
|
|
102
|
-
* Allow dropping multiple files
|
|
102
|
+
* Allow dropping multiple files.
|
|
103
|
+
* When true, enables folder drag-and-drop support.
|
|
104
|
+
* The folder hierarchy is preserved in filenames (e.g., 'folder/subfolder/file.txt').
|
|
105
|
+
* Note: Folder drag-and-drop is supported in Chrome, Edge, and Opera.
|
|
103
106
|
*/
|
|
104
107
|
multiple: _propTypes.default.bool,
|
|
108
|
+
/**
|
|
109
|
+
* Enable folder selection in the file picker dialog.
|
|
110
|
+
* When true with multiple=True, the file picker allows selecting folders instead of files.
|
|
111
|
+
* Note: When folder selection is enabled, individual files cannot be selected via the button.
|
|
112
|
+
* Use separate Upload components if you need both file and folder selection options.
|
|
113
|
+
* Folder selection is supported in Chrome, Edge, and Opera.
|
|
114
|
+
*/
|
|
115
|
+
enable_folder_selection: _propTypes.default.bool,
|
|
105
116
|
/**
|
|
106
117
|
* HTML class name of the component
|
|
107
118
|
*/
|
|
@@ -145,6 +156,7 @@ Upload.defaultProps = {
|
|
|
145
156
|
max_size: -1,
|
|
146
157
|
min_size: 0,
|
|
147
158
|
multiple: false,
|
|
159
|
+
enable_folder_selection: false,
|
|
148
160
|
style: {},
|
|
149
161
|
style_active: {
|
|
150
162
|
borderStyle: 'solid',
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
.dash-button {
|
|
2
|
+
line-height: 32px;
|
|
3
|
+
background: var(--Dash-Fill-Interactive-Weak);
|
|
4
|
+
color: var(--Dash-Fill-Interactive-Strong);
|
|
5
|
+
padding: 0 calc(var(--Dash-Spacing) * 2);
|
|
6
|
+
border-radius: 4px;
|
|
7
|
+
border: 1px solid var(--Dash-Fill-Interactive-Strong);
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
vertical-align: middle;
|
|
10
|
+
font-family: inherit;
|
|
11
|
+
font-size: inherit;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* Hover state - stronger background */
|
|
15
|
+
.dash-button:hover {
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
background: var(--Dash-Fill-Inverse-Strong);
|
|
18
|
+
color: var(--Dash-Fill-Interactive-Strong);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Active state (clicking) - inverted colors */
|
|
22
|
+
.dash-button:active {
|
|
23
|
+
background: var(--Dash-Fill-Interactive-Strong);
|
|
24
|
+
color: var(--Dash-Fill-Inverse-Strong);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Keyboard focus - inverted colors */
|
|
28
|
+
.dash-button:focus-visible {
|
|
29
|
+
outline: 1px solid var(--Dash-Fill-Interactive-Strong);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Hover after keyboard focus - keep inverted but acknowledge hover */
|
|
33
|
+
.dash-button:focus-visible:hover {
|
|
34
|
+
outline: 1px solid var(--Dash-Fill-Interactive-Strong);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Active state after keyboard focus - inverted colors */
|
|
38
|
+
.dash-button:focus-visible:active {
|
|
39
|
+
background: var(--Dash-Fill-Interactive-Strong);
|
|
40
|
+
color: var(--Dash-Fill-Inverse-Strong);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Disabled state */
|
|
44
|
+
.dash-button:disabled {
|
|
45
|
+
opacity: 0.6;
|
|
46
|
+
cursor: not-allowed;
|
|
47
|
+
background: var(--Dash-Fill-Disabled);
|
|
48
|
+
color: var(--Dash-Text-Strong);
|
|
49
|
+
border-color: var(--Dash-Stroke-Weak);
|
|
50
|
+
}
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
font-weight: normal;
|
|
17
17
|
color: var(--Dash-Text-Weak);
|
|
18
18
|
text-align: center;
|
|
19
|
-
border-radius: 4px;
|
|
20
19
|
cursor: default;
|
|
21
20
|
user-select: none;
|
|
22
21
|
-webkit-user-select: none;
|
|
@@ -37,16 +36,13 @@
|
|
|
37
36
|
.dash-datepicker-calendar td:focus {
|
|
38
37
|
outline: 2px solid var(--Dash-Fill-Interactive-Strong);
|
|
39
38
|
outline-offset: -2px;
|
|
39
|
+
border-radius: 4px;
|
|
40
40
|
z-index: 1;
|
|
41
41
|
position: relative;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.dash-datepicker-calendar td.dash-datepicker-calendar-date-highlighted {
|
|
45
|
-
background-color:
|
|
46
|
-
in srgb,
|
|
47
|
-
var(--Dash-Fill-Interactive-Strong) 5%,
|
|
48
|
-
transparent 95%
|
|
49
|
-
);
|
|
45
|
+
background-color: var(--Dash-Fill-Interactive-Weak);
|
|
50
46
|
color: var(--Dash-Fill-Interactive-Strong);
|
|
51
47
|
}
|
|
52
48
|
|
|
@@ -55,6 +51,28 @@
|
|
|
55
51
|
color: var(--Dash-Fill-Inverse-Strong);
|
|
56
52
|
}
|
|
57
53
|
|
|
54
|
+
.dash-datepicker-calendar td.dash-datepicker-calendar-date-selected {
|
|
55
|
+
background-color: var(--Dash-Fill-Interactive-Strong);
|
|
56
|
+
color: var(--Dash-Fill-Inverse-Strong);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* start_date selector: a selected date which is preceded by an unselected date */
|
|
60
|
+
.dash-datepicker-calendar
|
|
61
|
+
td:not(.dash-datepicker-calendar-date-highlighted)
|
|
62
|
+
+ td.dash-datepicker-calendar-date-selected {
|
|
63
|
+
border-start-start-radius: 4px;
|
|
64
|
+
border-end-start-radius: 4px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* end_date selector: a selected date which is followed by an unselected date */
|
|
68
|
+
.dash-datepicker-calendar
|
|
69
|
+
td.dash-datepicker-calendar-date-selected:not(
|
|
70
|
+
:has(+ td.dash-datepicker-calendar-date-highlighted)
|
|
71
|
+
) {
|
|
72
|
+
border-start-end-radius: 4px;
|
|
73
|
+
border-end-end-radius: 4px;
|
|
74
|
+
}
|
|
75
|
+
|
|
58
76
|
.dash-datepicker-calendar td.dash-datepicker-calendar-date-disabled {
|
|
59
77
|
opacity: 0.6;
|
|
60
78
|
cursor: not-allowed;
|