dash-core-components 3.2.0 → 4.0.0-rc0

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.
Files changed (50) hide show
  1. package/dash_core_components/async-datepicker.js +1 -1
  2. package/dash_core_components/async-datepicker.js.map +1 -1
  3. package/dash_core_components/async-dropdown.js +1 -1
  4. package/dash_core_components/async-dropdown.js.map +1 -1
  5. package/dash_core_components/async-highlight.js +1 -1
  6. package/dash_core_components/async-highlight.js.map +1 -1
  7. package/dash_core_components/async-markdown.js +1 -1
  8. package/dash_core_components/async-markdown.js.map +1 -1
  9. package/dash_core_components/async-slider.js +1 -1
  10. package/dash_core_components/async-slider.js.map +1 -1
  11. package/dash_core_components/dash_core_components-shared.js +1 -1
  12. package/dash_core_components/dash_core_components-shared.js.map +1 -1
  13. package/dash_core_components/dash_core_components.js +1 -1
  14. package/dash_core_components/dash_core_components.js.map +1 -1
  15. package/dash_core_components/plotly.min.js +8 -0
  16. package/dash_core_components/proptypes.js +81 -0
  17. package/lib/components/Dropdown.react.js.old +228 -0
  18. package/lib/components/Input.react.js.old +507 -0
  19. package/lib/components/Input.tsx +543 -0
  20. package/lib/components/RangeSlider.tsx +39 -0
  21. package/lib/components/Slider.react.js.old +214 -0
  22. package/lib/components/Slider.tsx +81 -0
  23. package/lib/components/css/dcc.css +13 -0
  24. package/lib/components/css/input.css +116 -2
  25. package/lib/components/css/react-select@1.0.0-rc.3.min.css +1 -1
  26. package/lib/components/css/sliders.css +198 -4
  27. package/lib/fragments/RangeSlider.tsx +412 -0
  28. package/lib/fragments/Slider.tsx.old +364 -0
  29. package/lib/index.ts +58 -0
  30. package/lib/types.ts +331 -0
  31. package/lib/utils/LazyLoader/rangeSlider.ts +2 -0
  32. package/lib/utils/LazyLoader/slider.ts +2 -0
  33. package/lib/utils/_LoadingElement.tsx +36 -0
  34. package/lib/utils/computeSliderMarkers.ts +302 -0
  35. package/lib/utils/formatSliderTooltip.ts +20 -0
  36. package/lib/utils/sliderRendering.tsx +144 -0
  37. package/lib/utils/sliderSnapToMark.ts +17 -0
  38. package/lib/utils/sliderTooltip.tsx +65 -0
  39. package/package.json +22 -4
  40. package/lib/components/Input.react.js +0 -403
  41. package/lib/components/RangeSlider.react.js +0 -194
  42. package/lib/components/Slider.react.js +0 -179
  43. package/lib/fragments/RangeSlider.react.js +0 -143
  44. package/lib/fragments/Slider.react.js +0 -159
  45. package/lib/index.js +0 -183
  46. package/lib/utils/LazyLoader/rangeSlider.js +0 -8
  47. package/lib/utils/LazyLoader/slider.js +0 -8
  48. package/lib/utils/computeSliderMarkers.js +0 -153
  49. package/lib/utils/computeSliderStyle.js +0 -26
  50. package/lib/utils/formatSliderTooltip.js +0 -19
@@ -0,0 +1,81 @@
1
+ // AUTOGENERATED FILE - DO NOT EDIT
2
+
3
+ var pt = window.PropTypes;
4
+ var pk = window['dash_core_components'];
5
+
6
+ pk.Input.propTypes = {value:pt.oneOfType([pt.string,pt.number]),
7
+ debounce:pt.oneOfType([pt.number,pt.bool]),
8
+ placeholder:pt.oneOfType([pt.string,pt.number]),
9
+ n_submit:pt.oneOfType([pt.number]),
10
+ n_submit_timestamp:pt.oneOfType([pt.number]),
11
+ inputMode:pt.oneOf(['verbatim','latin','latin-name','latin-prose','full-width-latin','kana','katakana','numeric','tel','email','url']),
12
+ autoComplete:pt.oneOfType([pt.string]),
13
+ readOnly:pt.oneOfType([pt.bool,pt.oneOf(["readOnly"]),pt.oneOf(["readonly"]),pt.oneOf(["READONLY"])]),
14
+ required:pt.oneOfType([pt.bool,pt.oneOf(["required"]),pt.oneOf(["REQUIRED"])]),
15
+ autoFocus:pt.oneOfType([pt.bool,pt.oneOf(["autoFocus"]),pt.oneOf(["autofocus"]),pt.oneOf(["AUTOFOCUS"])]),
16
+ disabled:pt.oneOfType([pt.bool,pt.oneOf(["disabled"]),pt.oneOf(["DISABLED"])]),
17
+ list:pt.oneOfType([pt.string]),
18
+ multiple:pt.oneOfType([pt.bool]),
19
+ spellCheck:pt.oneOfType([pt.bool,pt.oneOf(["true"]),pt.oneOf(["false"])]),
20
+ name:pt.oneOfType([pt.string]),
21
+ min:pt.oneOfType([pt.string,pt.number]),
22
+ max:pt.oneOfType([pt.string,pt.number]),
23
+ step:pt.oneOfType([pt.string,pt.number]),
24
+ minLength:pt.oneOfType([pt.string,pt.number]),
25
+ maxLength:pt.oneOfType([pt.string,pt.number]),
26
+ pattern:pt.oneOfType([pt.string]),
27
+ selectionStart:pt.oneOfType([pt.string]),
28
+ selectionEnd:pt.oneOfType([pt.string]),
29
+ selectionDirection:pt.oneOfType([pt.string]),
30
+ n_blur:pt.oneOfType([pt.number]),
31
+ n_blur_timestamp:pt.oneOfType([pt.number]),
32
+ size:pt.oneOfType([pt.string]),
33
+ style:pt.any,
34
+ className:pt.oneOfType([pt.string]),
35
+ id:pt.oneOfType([pt.string]),
36
+ setProps:pt.any,
37
+ persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
38
+ persisted_props:pt.any,
39
+ persistence_type:pt.oneOf(['local','session','memory']),
40
+ type:pt.oneOf(['text','number','password','email','range','search','tel','url','hidden'])};
41
+ pk.RangeSlider.propTypes = {min:pt.oneOfType([pt.number]),
42
+ max:pt.oneOfType([pt.number]),
43
+ step:pt.oneOfType([pt.number]),
44
+ marks:pt.any,
45
+ value:pt.oneOfType([pt.arrayOf(pt.number)]),
46
+ drag_value:pt.oneOfType([pt.arrayOf(pt.number)]),
47
+ allowCross:pt.oneOfType([pt.bool]),
48
+ pushable:pt.oneOfType([pt.number,pt.bool]),
49
+ disabled:pt.oneOfType([pt.bool]),
50
+ count:pt.oneOfType([pt.number]),
51
+ dots:pt.oneOfType([pt.bool]),
52
+ included:pt.oneOfType([pt.bool]),
53
+ tooltip:pt.any,
54
+ updatemode:pt.oneOf(['mouseup','drag']),
55
+ vertical:pt.oneOfType([pt.bool]),
56
+ verticalHeight:pt.oneOfType([pt.number]),
57
+ className:pt.oneOfType([pt.string]),
58
+ id:pt.oneOfType([pt.string]),
59
+ setProps:pt.any,
60
+ persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
61
+ persisted_props:pt.any,
62
+ persistence_type:pt.oneOf(['local','session','memory'])};
63
+ pk.Slider.propTypes = {min:pt.oneOfType([pt.number]),
64
+ max:pt.oneOfType([pt.number]),
65
+ step:pt.oneOfType([pt.number]),
66
+ marks:pt.any,
67
+ value:pt.oneOfType([pt.number]),
68
+ drag_value:pt.oneOfType([pt.number]),
69
+ disabled:pt.oneOfType([pt.bool]),
70
+ dots:pt.oneOfType([pt.bool]),
71
+ included:pt.oneOfType([pt.bool]),
72
+ tooltip:pt.any,
73
+ updatemode:pt.oneOf(['mouseup','drag']),
74
+ vertical:pt.oneOfType([pt.bool]),
75
+ verticalHeight:pt.oneOfType([pt.number]),
76
+ className:pt.oneOfType([pt.string]),
77
+ id:pt.oneOfType([pt.string]),
78
+ setProps:pt.any,
79
+ persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
80
+ persisted_props:pt.any,
81
+ persistence_type:pt.oneOf(['local','session','memory'])};
@@ -0,0 +1,228 @@
1
+ import PropTypes from 'prop-types';
2
+ import React, {Component, lazy, Suspense} from 'react';
3
+ import dropdown from '../utils/LazyLoader/dropdown';
4
+
5
+ const RealDropdown = lazy(dropdown);
6
+
7
+ /**
8
+ * Dropdown is an interactive dropdown element for selecting one or more
9
+ * items.
10
+ * The values and labels of the dropdown items are specified in the `options`
11
+ * property and the selected item(s) are specified with the `value` property.
12
+ *
13
+ * Use a dropdown when you have many options (more than 5) or when you are
14
+ * constrained for space. Otherwise, you can use RadioItems or a Checklist,
15
+ * which have the benefit of showing the users all of the items at once.
16
+ */
17
+ export default class Dropdown extends Component {
18
+ render() {
19
+ return (
20
+ <Suspense fallback={null}>
21
+ <RealDropdown {...this.props} />
22
+ </Suspense>
23
+ );
24
+ }
25
+ }
26
+
27
+ Dropdown.propTypes = {
28
+ /**
29
+ * An array of options {label: [string|number], value: [string|number]},
30
+ * an optional disabled field can be used for each option
31
+ */
32
+ options: PropTypes.oneOfType([
33
+ /**
34
+ * Array of options where the label and the value are the same thing - [string|number|bool]
35
+ */
36
+ PropTypes.arrayOf(
37
+ PropTypes.oneOfType([
38
+ PropTypes.string,
39
+ PropTypes.number,
40
+ PropTypes.bool,
41
+ ])
42
+ ),
43
+ /**
44
+ * Simpler `options` representation in dictionary format. The order is not guaranteed.
45
+ * {`value1`: `label1`, `value2`: `label2`, ... }
46
+ * which is equal to
47
+ * [{label: `label1`, value: `value1`}, {label: `label2`, value: `value2`}, ...]
48
+ */
49
+ PropTypes.object,
50
+ /**
51
+ * An array of options {label: [string|number], value: [string|number]},
52
+ * an optional disabled field can be used for each option
53
+ */
54
+ PropTypes.arrayOf(
55
+ PropTypes.exact({
56
+ /**
57
+ * The option's label
58
+ */
59
+ label: PropTypes.node.isRequired,
60
+
61
+ /**
62
+ * The value of the option. This value
63
+ * corresponds to the items specified in the
64
+ * `value` property.
65
+ */
66
+ value: PropTypes.oneOfType([
67
+ PropTypes.string,
68
+ PropTypes.number,
69
+ PropTypes.bool,
70
+ ]).isRequired,
71
+
72
+ /**
73
+ * If true, this option is disabled and cannot be selected.
74
+ */
75
+ disabled: PropTypes.bool,
76
+
77
+ /**
78
+ * The HTML 'title' attribute for the option. Allows for
79
+ * information on hover. For more information on this attribute,
80
+ * see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title
81
+ */
82
+ title: PropTypes.string,
83
+
84
+ /**
85
+ * Optional search value for the option, to use if the label
86
+ * is a component or provide a custom search value different
87
+ * from the label. If no search value and the label is a
88
+ * component, the `value` will be used for search.
89
+ */
90
+ search: PropTypes.string,
91
+ })
92
+ ),
93
+ ]),
94
+
95
+ /**
96
+ * The value of the input. If `multi` is false (the default)
97
+ * then value is just a string that corresponds to the values
98
+ * provided in the `options` property. If `multi` is true, then
99
+ * multiple values can be selected at once, and `value` is an
100
+ * array of items with values corresponding to those in the
101
+ * `options` prop.
102
+ */
103
+ value: PropTypes.oneOfType([
104
+ PropTypes.string,
105
+ PropTypes.number,
106
+ PropTypes.bool,
107
+ PropTypes.arrayOf(
108
+ PropTypes.oneOfType([
109
+ PropTypes.string,
110
+ PropTypes.number,
111
+ PropTypes.bool,
112
+ ])
113
+ ),
114
+ ]),
115
+
116
+ /**
117
+ * If true, the user can select multiple values
118
+ */
119
+ multi: PropTypes.bool,
120
+
121
+ /**
122
+ * Whether or not the dropdown is "clearable", that is, whether or
123
+ * not a small "x" appears on the right of the dropdown that removes
124
+ * the selected value.
125
+ */
126
+ clearable: PropTypes.bool,
127
+
128
+ /**
129
+ * Whether to enable the searching feature or not
130
+ */
131
+ searchable: PropTypes.bool,
132
+
133
+ /**
134
+ * The value typed in the DropDown for searching.
135
+ */
136
+ search_value: PropTypes.string,
137
+
138
+ /**
139
+ * The grey, default text shown when no option is selected
140
+ */
141
+ placeholder: PropTypes.string,
142
+
143
+ /**
144
+ * If true, this dropdown is disabled and the selection cannot be changed.
145
+ */
146
+ disabled: PropTypes.bool,
147
+
148
+ /**
149
+ * If false, the menu of the dropdown will not close once a value is selected.
150
+ */
151
+ closeOnSelect: PropTypes.bool,
152
+
153
+ /**
154
+ * height of each option. Can be increased when label lengths would wrap around
155
+ */
156
+ optionHeight: PropTypes.number,
157
+
158
+ /**
159
+ * height of the options dropdown.
160
+ */
161
+ maxHeight: PropTypes.number,
162
+
163
+ /**
164
+ * Defines CSS styles which will override styles previously set.
165
+ */
166
+ style: PropTypes.object,
167
+
168
+ /**
169
+ * className of the dropdown element
170
+ */
171
+ className: PropTypes.string,
172
+
173
+ /**
174
+ * The ID of this component, used to identify dash components
175
+ * in callbacks. The ID needs to be unique across all of the
176
+ * components in an app.
177
+ */
178
+ id: PropTypes.string,
179
+
180
+ /**
181
+ * Dash-assigned callback that gets fired when the input changes
182
+ */
183
+ setProps: PropTypes.func,
184
+
185
+ /**
186
+ * Used to allow user interactions in this component to be persisted when
187
+ * the component - or the page - is refreshed. If `persisted` is truthy and
188
+ * hasn't changed from its previous value, a `value` that the user has
189
+ * changed while using the app will keep that change, as long as
190
+ * the new `value` also matches what was given originally.
191
+ * Used in conjunction with `persistence_type`.
192
+ */
193
+ persistence: PropTypes.oneOfType([
194
+ PropTypes.bool,
195
+ PropTypes.string,
196
+ PropTypes.number,
197
+ ]),
198
+
199
+ /**
200
+ * Properties whose user interactions will persist after refreshing the
201
+ * component or the page. Since only `value` is allowed this prop can
202
+ * normally be ignored.
203
+ */
204
+ persisted_props: PropTypes.arrayOf(PropTypes.oneOf(['value'])),
205
+
206
+ /**
207
+ * Where persisted user changes will be stored:
208
+ * memory: only kept in memory, reset on page refresh.
209
+ * local: window.localStorage, data is kept after the browser quit.
210
+ * session: window.sessionStorage, data is cleared once the browser quit.
211
+ */
212
+ persistence_type: PropTypes.oneOf(['local', 'session', 'memory']),
213
+ };
214
+
215
+ Dropdown.defaultProps = {
216
+ clearable: true,
217
+ disabled: false,
218
+ multi: false,
219
+ searchable: true,
220
+ optionHeight: 35,
221
+ maxHeight: 200,
222
+ closeOnSelect: true,
223
+ persisted_props: ['value'],
224
+ persistence_type: 'local',
225
+ };
226
+
227
+ export const propTypes = Dropdown.propTypes;
228
+ export const defaultProps = Dropdown.defaultProps;