dash-core-components 3.2.0 → 4.0.0-rc1
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-graph.js +1 -1
- package/dash_core_components/async-highlight.js +1 -1
- package/dash_core_components/async-highlight.js.map +1 -1
- package/dash_core_components/async-markdown.js +1 -1
- package/dash_core_components/async-markdown.js.map +1 -1
- package/dash_core_components/async-slider.js +1 -2
- package/dash_core_components/async-slider.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/plotly.min.js +8 -0
- package/dash_core_components/proptypes.js +99 -0
- package/lib/components/Dropdown.react.js.old +228 -0
- package/lib/components/Dropdown.tsx +52 -0
- package/lib/components/Input.react.js.old +507 -0
- package/lib/components/Input.tsx +543 -0
- package/lib/components/RangeSlider.tsx +46 -0
- package/lib/components/Slider.react.js.old +214 -0
- package/lib/components/Slider.tsx +81 -0
- package/lib/components/Textarea.react.js.old +287 -0
- package/lib/components/css/dcc.css +14 -0
- package/lib/components/css/dropdown.css +230 -0
- package/lib/components/css/input.css +116 -2
- package/lib/components/css/react-select@1.0.0-rc.3.min.css +1 -1
- package/lib/components/css/sliders.css +206 -4
- package/lib/fragments/Dropdown.tsx +577 -0
- package/lib/fragments/RangeSlider.tsx +412 -0
- package/lib/index.ts +58 -0
- package/lib/types.ts +499 -0
- package/lib/utils/LazyLoader/dropdown.ts +2 -0
- package/lib/utils/LazyLoader/rangeSlider.ts +2 -0
- package/lib/utils/LazyLoader/slider.ts +2 -0
- package/lib/utils/_LoadingElement.tsx +26 -0
- package/lib/utils/computeSliderMarkers.ts +302 -0
- package/lib/utils/dropdownSearch.ts +92 -0
- package/lib/utils/formatSliderTooltip.ts +20 -0
- package/lib/utils/optionTypes.ts +27 -0
- package/lib/utils/sliderRendering.tsx +144 -0
- package/lib/utils/sliderSnapToMark.ts +17 -0
- package/lib/utils/sliderTooltip.tsx +65 -0
- package/package.json +27 -5
- package/lib/components/Dropdown.react.js +0 -182
- package/lib/components/Input.react.js +0 -403
- package/lib/components/RangeSlider.react.js +0 -194
- package/lib/components/Slider.react.js +0 -179
- package/lib/fragments/Dropdown.react.js +0 -158
- package/lib/fragments/RangeSlider.react.js +0 -143
- package/lib/fragments/Slider.react.js +0 -159
- package/lib/index.js +0 -183
- package/lib/utils/LazyLoader/dropdown.js +0 -8
- package/lib/utils/LazyLoader/rangeSlider.js +0 -8
- package/lib/utils/LazyLoader/slider.js +0 -8
- package/lib/utils/computeSliderMarkers.js +0 -153
- package/lib/utils/computeSliderStyle.js +0 -26
- package/lib/utils/formatSliderTooltip.js +0 -19
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import React, {Component, lazy, Suspense} from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import slider from '../utils/LazyLoader/slider';
|
|
4
|
+
|
|
5
|
+
import './css/sliders.css';
|
|
6
|
+
|
|
7
|
+
const RealSlider = lazy(slider);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A slider component with a single handle.
|
|
11
|
+
*/
|
|
12
|
+
export default class Slider extends Component {
|
|
13
|
+
render() {
|
|
14
|
+
return (
|
|
15
|
+
<Suspense fallback={null}>
|
|
16
|
+
<RealSlider {...this.props} />
|
|
17
|
+
</Suspense>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
Slider.propTypes = {
|
|
23
|
+
/**
|
|
24
|
+
* Minimum allowed value of the slider
|
|
25
|
+
*/
|
|
26
|
+
min: PropTypes.number,
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Maximum allowed value of the slider
|
|
30
|
+
*/
|
|
31
|
+
max: PropTypes.number,
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Value by which increments or decrements are made
|
|
35
|
+
*/
|
|
36
|
+
step: PropTypes.number,
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Marks on the slider.
|
|
40
|
+
* The key determines the position (a number),
|
|
41
|
+
* and the value determines what will show.
|
|
42
|
+
* If you want to set the style of a specific mark point,
|
|
43
|
+
* the value should be an object which
|
|
44
|
+
* contains style and label properties.
|
|
45
|
+
*/
|
|
46
|
+
marks: PropTypes.objectOf(
|
|
47
|
+
PropTypes.oneOfType([
|
|
48
|
+
PropTypes.string,
|
|
49
|
+
PropTypes.exact({
|
|
50
|
+
label: PropTypes.string,
|
|
51
|
+
style: PropTypes.object,
|
|
52
|
+
}),
|
|
53
|
+
])
|
|
54
|
+
),
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The value of the input
|
|
58
|
+
*/
|
|
59
|
+
value: PropTypes.number,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The value of the input during a drag
|
|
63
|
+
*/
|
|
64
|
+
drag_value: PropTypes.number,
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* If true, the handles can't be moved.
|
|
68
|
+
*/
|
|
69
|
+
disabled: PropTypes.bool,
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* When the step value is greater than 1,
|
|
73
|
+
* you can set the dots to true if you want to
|
|
74
|
+
* render the slider with dots.
|
|
75
|
+
*/
|
|
76
|
+
dots: PropTypes.bool,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* If the value is true, it means a continuous
|
|
80
|
+
* value is included. Otherwise, it is an independent value.
|
|
81
|
+
*/
|
|
82
|
+
included: PropTypes.bool,
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Configuration for tooltips describing the current slider value
|
|
86
|
+
*/
|
|
87
|
+
tooltip: PropTypes.exact({
|
|
88
|
+
/**
|
|
89
|
+
* Determines whether tooltips should always be visible
|
|
90
|
+
* (as opposed to the default, visible on hover)
|
|
91
|
+
*/
|
|
92
|
+
always_visible: PropTypes.bool,
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Determines the placement of tooltips
|
|
96
|
+
* See https://github.com/react-component/tooltip#api
|
|
97
|
+
* top/bottom{*} sets the _origin_ of the tooltip, so e.g. `topLeft`
|
|
98
|
+
* will in reality appear to be on the top right of the handle
|
|
99
|
+
*/
|
|
100
|
+
placement: PropTypes.oneOf([
|
|
101
|
+
'left',
|
|
102
|
+
'right',
|
|
103
|
+
'top',
|
|
104
|
+
'bottom',
|
|
105
|
+
'topLeft',
|
|
106
|
+
'topRight',
|
|
107
|
+
'bottomLeft',
|
|
108
|
+
'bottomRight',
|
|
109
|
+
]),
|
|
110
|
+
/**
|
|
111
|
+
* Template string to display the tooltip in.
|
|
112
|
+
* Must contain `{value}`, which will be replaced with either
|
|
113
|
+
* the default string representation of the value or the result of the
|
|
114
|
+
* transform function if there is one.
|
|
115
|
+
*/
|
|
116
|
+
template: PropTypes.string,
|
|
117
|
+
/**
|
|
118
|
+
* Custom style for the tooltip.
|
|
119
|
+
*/
|
|
120
|
+
style: PropTypes.object,
|
|
121
|
+
/**
|
|
122
|
+
* Reference to a function in the `window.dccFunctions` namespace.
|
|
123
|
+
* This can be added in a script in the asset folder.
|
|
124
|
+
*
|
|
125
|
+
* For example, in `assets/tooltip.js`:
|
|
126
|
+
* ```
|
|
127
|
+
* window.dccFunctions = window.dccFunctions || {};
|
|
128
|
+
* window.dccFunctions.multByTen = function(value) {
|
|
129
|
+
* return value * 10;
|
|
130
|
+
* }
|
|
131
|
+
* ```
|
|
132
|
+
* Then in the component `tooltip={'transform': 'multByTen'}`
|
|
133
|
+
*/
|
|
134
|
+
transform: PropTypes.string,
|
|
135
|
+
}),
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Determines when the component should update its `value`
|
|
139
|
+
* property. If `mouseup` (the default) then the slider
|
|
140
|
+
* will only trigger its value when the user has finished
|
|
141
|
+
* dragging the slider. If `drag`, then the slider will
|
|
142
|
+
* update its value continuously as it is being dragged.
|
|
143
|
+
* If you want different actions during and after drag,
|
|
144
|
+
* leave `updatemode` as `mouseup` and use `drag_value`
|
|
145
|
+
* for the continuously updating value.
|
|
146
|
+
*/
|
|
147
|
+
updatemode: PropTypes.oneOf(['mouseup', 'drag']),
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* If true, the slider will be vertical
|
|
151
|
+
*/
|
|
152
|
+
vertical: PropTypes.bool,
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The height, in px, of the slider if it is vertical.
|
|
156
|
+
*/
|
|
157
|
+
verticalHeight: PropTypes.number,
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Additional CSS class for the root DOM node
|
|
161
|
+
*/
|
|
162
|
+
className: PropTypes.string,
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* The ID of this component, used to identify dash components
|
|
166
|
+
* in callbacks. The ID needs to be unique across all of the
|
|
167
|
+
* components in an app.
|
|
168
|
+
*/
|
|
169
|
+
id: PropTypes.string,
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Dash-assigned callback that gets fired when the value or drag_value changes.
|
|
173
|
+
*/
|
|
174
|
+
setProps: PropTypes.func,
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Used to allow user interactions in this component to be persisted when
|
|
178
|
+
* the component - or the page - is refreshed. If `persisted` is truthy and
|
|
179
|
+
* hasn't changed from its previous value, a `value` that the user has
|
|
180
|
+
* changed while using the app will keep that change, as long as
|
|
181
|
+
* the new `value` also matches what was given originally.
|
|
182
|
+
* Used in conjunction with `persistence_type`.
|
|
183
|
+
*/
|
|
184
|
+
persistence: PropTypes.oneOfType([
|
|
185
|
+
PropTypes.bool,
|
|
186
|
+
PropTypes.string,
|
|
187
|
+
PropTypes.number,
|
|
188
|
+
]),
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Properties whose user interactions will persist after refreshing the
|
|
192
|
+
* component or the page. Since only `value` is allowed this prop can
|
|
193
|
+
* normally be ignored.
|
|
194
|
+
*/
|
|
195
|
+
persisted_props: PropTypes.arrayOf(PropTypes.oneOf(['value'])),
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Where persisted user changes will be stored:
|
|
199
|
+
* memory: only kept in memory, reset on page refresh.
|
|
200
|
+
* local: window.localStorage, data is kept after the browser quit.
|
|
201
|
+
* session: window.sessionStorage, data is cleared once the browser quit.
|
|
202
|
+
*/
|
|
203
|
+
persistence_type: PropTypes.oneOf(['local', 'session', 'memory']),
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
Slider.defaultProps = {
|
|
207
|
+
updatemode: 'mouseup',
|
|
208
|
+
persisted_props: ['value'],
|
|
209
|
+
persistence_type: 'local',
|
|
210
|
+
verticalHeight: 400,
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export const propTypes = Slider.propTypes;
|
|
214
|
+
export const defaultProps = Slider.defaultProps;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {omit} from 'ramda';
|
|
2
|
+
import React, {lazy, Suspense, useCallback, useMemo} from 'react';
|
|
3
|
+
import {
|
|
4
|
+
PersistedProps,
|
|
5
|
+
PersistenceTypes,
|
|
6
|
+
RangeSliderProps,
|
|
7
|
+
SliderProps,
|
|
8
|
+
} from '../types';
|
|
9
|
+
import rangeSlider from '../utils/LazyLoader/rangeSlider';
|
|
10
|
+
import './css/sliders.css';
|
|
11
|
+
|
|
12
|
+
const RealSlider = lazy(rangeSlider);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A slider component with a single handle.
|
|
16
|
+
*/
|
|
17
|
+
export default function Slider({
|
|
18
|
+
updatemode = 'mouseup',
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
|
+
persisted_props = [PersistedProps.value],
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
|
+
persistence_type = PersistenceTypes.local,
|
|
23
|
+
// eslint-disable-next-line no-magic-numbers
|
|
24
|
+
verticalHeight = 400,
|
|
25
|
+
step = 1,
|
|
26
|
+
setProps,
|
|
27
|
+
value,
|
|
28
|
+
drag_value,
|
|
29
|
+
...props
|
|
30
|
+
}: SliderProps) {
|
|
31
|
+
// This is actually a wrapper around a RangeSlider.
|
|
32
|
+
// We'll modify key `Slider` props to be compatible with a Range Slider.
|
|
33
|
+
|
|
34
|
+
const mappedValue: RangeSliderProps['value'] = useMemo(() => {
|
|
35
|
+
return typeof value === 'number' ? [value] : value;
|
|
36
|
+
}, [value]);
|
|
37
|
+
|
|
38
|
+
const mappedDragValue: RangeSliderProps['drag_value'] = useMemo(() => {
|
|
39
|
+
return typeof drag_value === 'number' ? [drag_value] : drag_value;
|
|
40
|
+
}, [drag_value]);
|
|
41
|
+
|
|
42
|
+
const mappedSetProps: RangeSliderProps['setProps'] = useCallback(
|
|
43
|
+
newProps => {
|
|
44
|
+
const {value, drag_value} = newProps;
|
|
45
|
+
const mappedProps: Partial<SliderProps> = omit(
|
|
46
|
+
['value', 'drag_value', 'setProps'],
|
|
47
|
+
newProps
|
|
48
|
+
);
|
|
49
|
+
if ('value' in newProps) {
|
|
50
|
+
mappedProps.value = value ? value[0] : value;
|
|
51
|
+
}
|
|
52
|
+
if ('drag_value' in newProps) {
|
|
53
|
+
mappedProps.drag_value = drag_value
|
|
54
|
+
? drag_value[0]
|
|
55
|
+
: drag_value;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
setProps(mappedProps);
|
|
59
|
+
},
|
|
60
|
+
[setProps]
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<Suspense fallback={null}>
|
|
65
|
+
<RealSlider
|
|
66
|
+
updatemode={updatemode}
|
|
67
|
+
verticalHeight={verticalHeight}
|
|
68
|
+
step={step}
|
|
69
|
+
value={mappedValue}
|
|
70
|
+
drag_value={mappedDragValue}
|
|
71
|
+
setProps={mappedSetProps}
|
|
72
|
+
{...props}
|
|
73
|
+
/>
|
|
74
|
+
</Suspense>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
Slider.dashPersistence = {
|
|
79
|
+
persisted_props: [PersistedProps.value],
|
|
80
|
+
persistence_type: PersistenceTypes.local,
|
|
81
|
+
};
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/* eslint-disable no-unused-vars */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import {pick} from 'ramda';
|
|
5
|
+
|
|
6
|
+
const textAreaProps = [
|
|
7
|
+
'id',
|
|
8
|
+
'autoFocus',
|
|
9
|
+
'cols',
|
|
10
|
+
'disabled',
|
|
11
|
+
'form',
|
|
12
|
+
'maxLength',
|
|
13
|
+
'minLength',
|
|
14
|
+
'name',
|
|
15
|
+
'placeholder',
|
|
16
|
+
'readOnly',
|
|
17
|
+
'required',
|
|
18
|
+
'rows',
|
|
19
|
+
'wrap',
|
|
20
|
+
'accessKey',
|
|
21
|
+
'className',
|
|
22
|
+
'contentEditable',
|
|
23
|
+
'contextMenu',
|
|
24
|
+
'dir',
|
|
25
|
+
'draggable',
|
|
26
|
+
'hidden',
|
|
27
|
+
'lang',
|
|
28
|
+
'spellCheck',
|
|
29
|
+
'style',
|
|
30
|
+
'tabIndex',
|
|
31
|
+
'title',
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A basic HTML textarea for entering multiline text.
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
const Textarea = ({
|
|
39
|
+
setProps,
|
|
40
|
+
value,
|
|
41
|
+
n_blur = 0,
|
|
42
|
+
n_blur_timestamp = -1,
|
|
43
|
+
n_clicks,
|
|
44
|
+
n_clicks_timestamp = -1,
|
|
45
|
+
persisted_props,
|
|
46
|
+
persistence_type,
|
|
47
|
+
...props
|
|
48
|
+
}) => {
|
|
49
|
+
const ctx = window.dash_component_api.useDashContext();
|
|
50
|
+
const isLoading = ctx.useLoading();
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<textarea
|
|
54
|
+
data-dash-is-loading={isLoading || undefined}
|
|
55
|
+
value={value}
|
|
56
|
+
onChange={e => {
|
|
57
|
+
setProps({value: e.target.value});
|
|
58
|
+
}}
|
|
59
|
+
onBlur={() => {
|
|
60
|
+
setProps({
|
|
61
|
+
n_blur: n_blur + 1,
|
|
62
|
+
n_blur_timestamp: Date.now(),
|
|
63
|
+
});
|
|
64
|
+
}}
|
|
65
|
+
onClick={() => {
|
|
66
|
+
setProps({
|
|
67
|
+
n_clicks: n_clicks + 1,
|
|
68
|
+
n_clicks_timestamp: Date.now(),
|
|
69
|
+
});
|
|
70
|
+
}}
|
|
71
|
+
{...pick(textAreaProps, props)}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
Textarea.dashPersistence = {
|
|
77
|
+
persisted_props: ['value'],
|
|
78
|
+
persistence_type: 'local',
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
Textarea.propTypes = {
|
|
82
|
+
/**
|
|
83
|
+
* The ID of this component, used to identify dash components
|
|
84
|
+
* in callbacks. The ID needs to be unique across all of the
|
|
85
|
+
* components in an app.
|
|
86
|
+
*/
|
|
87
|
+
id: PropTypes.string,
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The value of the textarea
|
|
91
|
+
*/
|
|
92
|
+
value: PropTypes.string,
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The element should be automatically focused after the page loaded.
|
|
96
|
+
*/
|
|
97
|
+
autoFocus: PropTypes.string,
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Defines the number of columns in a textarea.
|
|
101
|
+
*/
|
|
102
|
+
cols: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Indicates whether the user can interact with the element.
|
|
106
|
+
*/
|
|
107
|
+
disabled: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Indicates the form that is the owner of the element.
|
|
111
|
+
*/
|
|
112
|
+
form: PropTypes.string,
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Defines the maximum number of characters allowed in the element.
|
|
116
|
+
*/
|
|
117
|
+
maxLength: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Defines the minimum number of characters allowed in the element.
|
|
121
|
+
*/
|
|
122
|
+
minLength: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Name of the element. For example used by the server to identify the fields in form submits.
|
|
126
|
+
*/
|
|
127
|
+
name: PropTypes.string,
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Provides a hint to the user of what can be entered in the field.
|
|
131
|
+
*/
|
|
132
|
+
placeholder: PropTypes.string,
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Indicates whether the element can be edited.
|
|
136
|
+
* readOnly is an HTML boolean attribute - it is enabled by a boolean or
|
|
137
|
+
* 'readOnly'. Alternative capitalizations `readonly` & `READONLY`
|
|
138
|
+
* are also acccepted.
|
|
139
|
+
*/
|
|
140
|
+
readOnly: PropTypes.oneOfType([
|
|
141
|
+
PropTypes.bool,
|
|
142
|
+
PropTypes.oneOf(['readOnly', 'readonly', 'READONLY']),
|
|
143
|
+
]),
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Indicates whether this element is required to fill out or not.
|
|
147
|
+
* required is an HTML boolean attribute - it is enabled by a boolean or
|
|
148
|
+
* 'required'. Alternative capitalizations `REQUIRED`
|
|
149
|
+
* are also acccepted.
|
|
150
|
+
*/
|
|
151
|
+
required: PropTypes.oneOfType([
|
|
152
|
+
PropTypes.oneOf(['required', 'REQUIRED']),
|
|
153
|
+
PropTypes.bool,
|
|
154
|
+
]),
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Defines the number of rows in a text area.
|
|
158
|
+
*/
|
|
159
|
+
rows: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Indicates whether the text should be wrapped.
|
|
163
|
+
*/
|
|
164
|
+
wrap: PropTypes.string,
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Defines a keyboard shortcut to activate or add focus to the element.
|
|
168
|
+
*/
|
|
169
|
+
accessKey: PropTypes.string,
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Often used with CSS to style elements with common properties.
|
|
173
|
+
*/
|
|
174
|
+
className: PropTypes.string,
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Indicates whether the element's content is editable.
|
|
178
|
+
*/
|
|
179
|
+
contentEditable: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Defines the ID of a <menu> element which will serve as the element's context menu.
|
|
183
|
+
*/
|
|
184
|
+
contextMenu: PropTypes.string,
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
|
|
188
|
+
*/
|
|
189
|
+
dir: PropTypes.string,
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Defines whether the element can be dragged.
|
|
193
|
+
*/
|
|
194
|
+
draggable: PropTypes.oneOfType([
|
|
195
|
+
// enumerated property, not a boolean property: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/draggable
|
|
196
|
+
PropTypes.oneOf(['true', 'false']),
|
|
197
|
+
PropTypes.bool,
|
|
198
|
+
]),
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Prevents rendering of given element, while keeping child elements, e.g. script elements, active.
|
|
202
|
+
*/
|
|
203
|
+
hidden: PropTypes.string,
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Defines the language used in the element.
|
|
207
|
+
*/
|
|
208
|
+
lang: PropTypes.string,
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Indicates whether spell checking is allowed for the element.
|
|
212
|
+
*/
|
|
213
|
+
spellCheck: PropTypes.oneOfType([
|
|
214
|
+
// enumerated property, not a boolean property: https://www.w3.org/TR/html51/editing.html#spelling-and-grammar-checking
|
|
215
|
+
PropTypes.oneOf(['true', 'false']),
|
|
216
|
+
PropTypes.bool,
|
|
217
|
+
]),
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Defines CSS styles which will override styles previously set.
|
|
221
|
+
*/
|
|
222
|
+
style: PropTypes.object,
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Overrides the browser's default tab order and follows the one specified instead.
|
|
226
|
+
*/
|
|
227
|
+
tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Text to be displayed in a tooltip when hovering over the element.
|
|
231
|
+
*/
|
|
232
|
+
title: PropTypes.string,
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Number of times the textarea lost focus.
|
|
236
|
+
*/
|
|
237
|
+
n_blur: PropTypes.number,
|
|
238
|
+
/**
|
|
239
|
+
* Last time the textarea lost focus.
|
|
240
|
+
*/
|
|
241
|
+
n_blur_timestamp: PropTypes.number,
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Number of times the textarea has been clicked.
|
|
245
|
+
*/
|
|
246
|
+
n_clicks: PropTypes.number,
|
|
247
|
+
/**
|
|
248
|
+
* Last time the textarea was clicked.
|
|
249
|
+
*/
|
|
250
|
+
n_clicks_timestamp: PropTypes.number,
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Dash-assigned callback that gets fired when the value changes.
|
|
254
|
+
*/
|
|
255
|
+
setProps: PropTypes.func,
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Used to allow user interactions in this component to be persisted when
|
|
259
|
+
* the component - or the page - is refreshed. If `persisted` is truthy and
|
|
260
|
+
* hasn't changed from its previous value, a `value` that the user has
|
|
261
|
+
* changed while using the app will keep that change, as long as
|
|
262
|
+
* the new `value` also matches what was given originally.
|
|
263
|
+
* Used in conjunction with `persistence_type`.
|
|
264
|
+
*/
|
|
265
|
+
persistence: PropTypes.oneOfType([
|
|
266
|
+
PropTypes.bool,
|
|
267
|
+
PropTypes.string,
|
|
268
|
+
PropTypes.number,
|
|
269
|
+
]),
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Properties whose user interactions will persist after refreshing the
|
|
273
|
+
* component or the page. Since only `value` is allowed this prop can
|
|
274
|
+
* normally be ignored.
|
|
275
|
+
*/
|
|
276
|
+
persisted_props: PropTypes.arrayOf(PropTypes.oneOf(['value'])),
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Where persisted user changes will be stored:
|
|
280
|
+
* memory: only kept in memory, reset on page refresh.
|
|
281
|
+
* local: window.localStorage, data is kept after the browser quit.
|
|
282
|
+
* session: window.sessionStorage, data is cleared once the browser quit.
|
|
283
|
+
*/
|
|
284
|
+
persistence_type: PropTypes.oneOf(['local', 'session', 'memory']),
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
export default Textarea;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--Dash-Spacing: 4px;
|
|
3
|
+
--Dash-Stroke-Strong: rgba(0, 18, 77, 0.45);
|
|
4
|
+
--Dash-Stroke-Weak: rgba(0, 24, 102, 0.1);
|
|
5
|
+
--Dash-Fill-Interactive-Strong: #7f4bc4;
|
|
6
|
+
--Dash-Fill-Weak: rgba(0, 30, 128, 0.04);
|
|
7
|
+
--Dash-Fill-Inverse-Strong: #fff;
|
|
8
|
+
--Dash-Text-Primary: rgba(0, 18, 77, 0.87);
|
|
9
|
+
--Dash-Text-Strong: rgba(0, 9, 38, 0.9);
|
|
10
|
+
--Dash-Text-Disabled: rgba(0, 21, 89, 0.3);
|
|
11
|
+
--Dash-Fill-Primary-Hover: rgba(0, 18, 77, 0.04);
|
|
12
|
+
--Dash-Fill-Primary-Active: rgba(0, 18, 77, 0.08);
|
|
13
|
+
--Dash-Fill-Disabled: rgba(0, 24, 102, 0.1);
|
|
14
|
+
}
|