dash-core-components 4.0.0-rc1 → 4.0.0-rc3

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 (103) 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 -2
  4. package/dash_core_components/async-dropdown.js.map +1 -1
  5. package/dash_core_components/async-graph.js +1 -1
  6. package/dash_core_components/async-graph.js.map +1 -1
  7. package/dash_core_components/async-highlight.js +1 -1
  8. package/dash_core_components/async-highlight.js.map +1 -1
  9. package/dash_core_components/async-markdown.js +1 -1
  10. package/dash_core_components/async-markdown.js.map +1 -1
  11. package/dash_core_components/async-mathjax.js +1 -1
  12. package/dash_core_components/async-slider.js +1 -1
  13. package/dash_core_components/async-slider.js.map +1 -1
  14. package/dash_core_components/async-upload.js +1 -1
  15. package/dash_core_components/async-upload.js.map +1 -1
  16. package/dash_core_components/dash_core_components-shared.js +1 -1
  17. package/dash_core_components/dash_core_components-shared.js.map +1 -1
  18. package/dash_core_components/dash_core_components.js +1 -1
  19. package/dash_core_components/dash_core_components.js.map +1 -1
  20. package/dash_core_components/proptypes.js +209 -6
  21. package/lib/components/Checklist.tsx +67 -0
  22. package/lib/components/Clipboard.react.js +1 -1
  23. package/lib/components/DatePickerRange.tsx +70 -0
  24. package/lib/components/DatePickerSingle.tsx +72 -0
  25. package/lib/components/Dropdown.tsx +19 -3
  26. package/lib/components/Input.tsx +1 -1
  27. package/lib/components/Loading.tsx +185 -0
  28. package/lib/components/RadioItems.tsx +69 -0
  29. package/lib/components/RangeSlider.tsx +5 -1
  30. package/lib/components/Slider.tsx +12 -1
  31. package/lib/components/Tab.tsx +19 -0
  32. package/lib/components/Tabs.tsx +311 -0
  33. package/lib/components/Textarea.tsx +79 -0
  34. package/lib/components/Tooltip.tsx +66 -0
  35. package/lib/components/css/calendar.css +66 -0
  36. package/lib/components/css/checklist.css +4 -0
  37. package/lib/components/css/datepickers.css +233 -0
  38. package/lib/components/css/dcc.css +3 -0
  39. package/lib/components/css/dropdown.css +34 -50
  40. package/lib/components/css/input.css +29 -7
  41. package/lib/components/css/optionslist.css +34 -0
  42. package/lib/components/css/radioitems.css +4 -0
  43. package/lib/components/css/sliders.css +33 -7
  44. package/lib/components/css/tabs.css +113 -0
  45. package/lib/components/css/textarea.css +21 -0
  46. package/lib/components/css/tooltip.css +127 -0
  47. package/lib/fragments/DatePickerRange.tsx +444 -0
  48. package/lib/fragments/DatePickerSingle.tsx +249 -0
  49. package/lib/fragments/Dropdown.tsx +212 -272
  50. package/lib/fragments/Graph.react.js +18 -45
  51. package/lib/fragments/Loading/spinners/CircleSpinner.tsx +185 -0
  52. package/lib/fragments/Loading/spinners/CubeSpinner.tsx +193 -0
  53. package/lib/fragments/Loading/spinners/DebugTitle.tsx +11 -0
  54. package/lib/fragments/Loading/spinners/DefaultSpinner.tsx +110 -0
  55. package/lib/fragments/Loading/spinners/DotSpinner.tsx +96 -0
  56. package/lib/fragments/Loading/spinners/GraphSpinner.tsx +332 -0
  57. package/lib/fragments/Loading/types.ts +13 -0
  58. package/lib/fragments/RangeSlider.tsx +195 -63
  59. package/lib/index.ts +9 -11
  60. package/lib/types.ts +797 -132
  61. package/lib/utils/DatePickerPersistence.ts +14 -0
  62. package/lib/utils/LazyLoader/datePickerRange.ts +4 -0
  63. package/lib/utils/LazyLoader/datePickerSingle.ts +4 -0
  64. package/lib/utils/calendar/Calendar.tsx +382 -0
  65. package/lib/utils/calendar/CalendarDay.tsx +75 -0
  66. package/lib/utils/calendar/CalendarDayPadding.tsx +15 -0
  67. package/lib/utils/calendar/CalendarMonth.tsx +247 -0
  68. package/lib/utils/calendar/CalendarMonthHeader.tsx +23 -0
  69. package/lib/utils/calendar/createMonthGrid.ts +28 -0
  70. package/lib/utils/calendar/helpers.ts +272 -0
  71. package/lib/utils/computeSliderMarkers.ts +71 -116
  72. package/lib/utils/dropdownSearch.ts +4 -4
  73. package/lib/utils/optionRendering.tsx +175 -0
  74. package/lib/utils/optionTypes.ts +5 -5
  75. package/lib/utils/sliderRendering.tsx +63 -6
  76. package/package.json +16 -14
  77. package/lib/components/Checklist.react.js +0 -193
  78. package/lib/components/DatePickerRange.react.js +0 -244
  79. package/lib/components/DatePickerSingle.react.js +0 -209
  80. package/lib/components/Dropdown.react.js.old +0 -228
  81. package/lib/components/Input.react.js.old +0 -507
  82. package/lib/components/Loading.react.js +0 -254
  83. package/lib/components/RadioItems.react.js +0 -192
  84. package/lib/components/Slider.react.js.old +0 -214
  85. package/lib/components/Tab.react.js +0 -80
  86. package/lib/components/Tabs.react.js +0 -295
  87. package/lib/components/Textarea.react.js +0 -223
  88. package/lib/components/Textarea.react.js.old +0 -287
  89. package/lib/components/Tooltip.react.js +0 -120
  90. package/lib/components/css/Dropdown.css +0 -8
  91. package/lib/fragments/DatePickerRange.react.js +0 -188
  92. package/lib/fragments/DatePickerSingle.react.js +0 -132
  93. package/lib/fragments/Loading/spinners/CircleSpinner.js +0 -68
  94. package/lib/fragments/Loading/spinners/CubeSpinner.js +0 -57
  95. package/lib/fragments/Loading/spinners/DebugTitle.js +0 -15
  96. package/lib/fragments/Loading/spinners/DefaultSpinner.js +0 -54
  97. package/lib/fragments/Loading/spinners/DotSpinner.js +0 -50
  98. package/lib/fragments/Loading/spinners/GraphSpinner.js +0 -68
  99. package/lib/utils/DatePickerPersistence.js +0 -18
  100. package/lib/utils/LazyLoader/datePickerRange.js +0 -8
  101. package/lib/utils/LazyLoader/datePickerSingle.js +0 -8
  102. package/lib/utils/convertToMoment.js +0 -30
  103. package/lib/utils/optionTypes.js +0 -39
@@ -3,6 +3,84 @@
3
3
  var pt = window.PropTypes;
4
4
  var pk = window['dash_core_components'];
5
5
 
6
+ pk.Checklist.propTypes = {options:pt.any,
7
+ value:pt.oneOfType([pt.arrayOf(pt.oneOfType([pt.string,pt.number,pt.bool]))]),
8
+ inline:pt.oneOfType([pt.bool]),
9
+ style:pt.any,
10
+ inputStyle:pt.any,
11
+ inputClassName:pt.oneOfType([pt.string]),
12
+ labelStyle:pt.any,
13
+ labelClassName:pt.oneOfType([pt.string]),
14
+ className:pt.oneOfType([pt.string]),
15
+ setProps:pt.any,
16
+ persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
17
+ persisted_props:pt.any,
18
+ persistence_type:pt.oneOf(['local','session','memory']),
19
+ id:pt.oneOfType([pt.string]),
20
+ componentPath:pt.any};
21
+ pk.DatePickerRange.propTypes = {start_date:pt.any,
22
+ end_date:pt.any,
23
+ minimum_nights:pt.oneOfType([pt.number]),
24
+ updatemode:pt.oneOf(['singledate','bothdates']),
25
+ start_date_placeholder_text:pt.oneOfType([pt.string]),
26
+ end_date_placeholder_text:pt.oneOfType([pt.string]),
27
+ start_date_id:pt.oneOfType([pt.string]),
28
+ end_date_id:pt.oneOfType([pt.string]),
29
+ setProps:pt.any,
30
+ id:pt.oneOfType([pt.string]),
31
+ componentPath:pt.any,
32
+ min_date_allowed:pt.oneOfType([pt.string]),
33
+ max_date_allowed:pt.oneOfType([pt.string]),
34
+ disabled_days:pt.oneOfType([pt.arrayOf(pt.string)]),
35
+ placeholder:pt.oneOfType([pt.string]),
36
+ initial_visible_month:pt.oneOfType([pt.string]),
37
+ clearable:pt.oneOfType([pt.bool]),
38
+ reopen_calendar_on_clear:pt.oneOfType([pt.bool]),
39
+ display_format:pt.oneOfType([pt.string]),
40
+ month_format:pt.oneOfType([pt.string]),
41
+ first_day_of_week:pt.oneOf([0,1,2,3,4,5,6]),
42
+ show_outside_days:pt.oneOfType([pt.bool]),
43
+ stay_open_on_select:pt.oneOfType([pt.bool]),
44
+ calendar_orientation:pt.oneOf(['vertical','horizontal']),
45
+ number_of_months_shown:pt.oneOfType([pt.number]),
46
+ with_portal:pt.oneOfType([pt.bool]),
47
+ with_full_screen_portal:pt.oneOfType([pt.bool]),
48
+ 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'])};
56
+ pk.DatePickerSingle.propTypes = {date:pt.any,
57
+ min_date_allowed:pt.oneOfType([pt.string]),
58
+ max_date_allowed:pt.oneOfType([pt.string]),
59
+ disabled_days:pt.oneOfType([pt.arrayOf(pt.string)]),
60
+ placeholder:pt.oneOfType([pt.string]),
61
+ initial_visible_month:pt.oneOfType([pt.string]),
62
+ clearable:pt.oneOfType([pt.bool]),
63
+ reopen_calendar_on_clear:pt.oneOfType([pt.bool]),
64
+ display_format:pt.oneOfType([pt.string]),
65
+ month_format:pt.oneOfType([pt.string]),
66
+ first_day_of_week:pt.oneOf([0,1,2,3,4,5,6]),
67
+ show_outside_days:pt.oneOfType([pt.bool]),
68
+ stay_open_on_select:pt.oneOfType([pt.bool]),
69
+ calendar_orientation:pt.oneOf(['vertical','horizontal']),
70
+ number_of_months_shown:pt.oneOfType([pt.number]),
71
+ with_portal:pt.oneOfType([pt.bool]),
72
+ with_full_screen_portal:pt.oneOfType([pt.bool]),
73
+ day_size:pt.oneOfType([pt.number]),
74
+ is_RTL:pt.oneOfType([pt.bool]),
75
+ disabled:pt.oneOfType([pt.bool]),
76
+ style:pt.any,
77
+ className: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']),
82
+ id:pt.oneOfType([pt.string]),
83
+ componentPath:pt.any};
6
84
  pk.Dropdown.propTypes = {options:pt.any,
7
85
  value:pt.oneOfType([pt.string,pt.number,pt.bool,pt.arrayOf(pt.oneOfType([pt.string,pt.number,pt.bool]))]),
8
86
  multi:pt.oneOfType([pt.bool]),
@@ -12,15 +90,17 @@ pk.Dropdown.propTypes = {options:pt.any,
12
90
  placeholder:pt.oneOfType([pt.string]),
13
91
  disabled:pt.oneOfType([pt.bool]),
14
92
  closeOnSelect:pt.oneOfType([pt.bool]),
15
- optionHeight:pt.oneOfType([pt.number]),
93
+ optionHeight:pt.oneOfType([pt.number,pt.oneOf(["auto"])]),
16
94
  maxHeight:pt.oneOfType([pt.number]),
17
95
  style:pt.any,
96
+ labels:pt.oneOfType([pt.shape({select_all:pt.oneOfType([pt.string]),deselect_all:pt.oneOfType([pt.string]),selected_count:pt.oneOfType([pt.string]),search:pt.oneOfType([pt.string]),clear_search:pt.oneOfType([pt.string]),clear_selection:pt.oneOfType([pt.string]),no_options_found:pt.oneOfType([pt.string])})]),
18
97
  className:pt.oneOfType([pt.string]),
19
- id:pt.oneOfType([pt.string]),
20
98
  setProps:pt.any,
21
99
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
22
100
  persisted_props:pt.any,
23
- persistence_type:pt.oneOf(['local','session','memory'])};
101
+ persistence_type:pt.oneOf(['local','session','memory']),
102
+ id:pt.oneOfType([pt.string]),
103
+ componentPath:pt.any};
24
104
  pk.Input.propTypes = {value:pt.oneOfType([pt.string,pt.number]),
25
105
  debounce:pt.oneOfType([pt.number,pt.bool]),
26
106
  placeholder:pt.oneOfType([pt.string,pt.number]),
@@ -56,6 +136,43 @@ pk.Input.propTypes = {value:pt.oneOfType([pt.string,pt.number]),
56
136
  persisted_props:pt.any,
57
137
  persistence_type:pt.oneOf(['local','session','memory']),
58
138
  type:pt.oneOf(['text','number','password','email','range','search','tel','url','hidden'])};
139
+ pk.Loading.propTypes = {children:pt.node,
140
+ type:pt.oneOf(['graph','cube','circle','dot','default']),
141
+ fullscreen:pt.oneOfType([pt.bool]),
142
+ debug:pt.oneOfType([pt.bool]),
143
+ style:pt.any,
144
+ parent_className:pt.oneOfType([pt.string]),
145
+ parent_style:pt.any,
146
+ overlay_style:pt.any,
147
+ color:pt.oneOfType([pt.string]),
148
+ display:pt.oneOf(['auto','show','hide']),
149
+ delay_hide:pt.oneOfType([pt.number]),
150
+ delay_show:pt.oneOfType([pt.number]),
151
+ show_initially:pt.oneOfType([pt.bool]),
152
+ target_components:pt.oneOfType([pt.shape({})]),
153
+ custom_spinner:pt.node,
154
+ className:pt.oneOfType([pt.string]),
155
+ setProps:pt.any,
156
+ persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
157
+ persisted_props:pt.any,
158
+ persistence_type:pt.oneOf(['local','session','memory']),
159
+ id:pt.oneOfType([pt.string]),
160
+ componentPath:pt.any};
161
+ pk.RadioItems.propTypes = {options:pt.any,
162
+ value:pt.oneOfType([pt.string,pt.number,pt.bool]),
163
+ inline:pt.oneOfType([pt.bool]),
164
+ style:pt.any,
165
+ inputStyle:pt.any,
166
+ inputClassName:pt.oneOfType([pt.string]),
167
+ labelStyle:pt.any,
168
+ labelClassName:pt.oneOfType([pt.string]),
169
+ className:pt.oneOfType([pt.string]),
170
+ setProps:pt.any,
171
+ persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
172
+ persisted_props:pt.any,
173
+ persistence_type:pt.oneOf(['local','session','memory']),
174
+ id:pt.oneOfType([pt.string]),
175
+ componentPath:pt.any};
59
176
  pk.RangeSlider.propTypes = {min:pt.oneOfType([pt.number]),
60
177
  max:pt.oneOfType([pt.number]),
61
178
  step:pt.oneOfType([pt.number]),
@@ -68,16 +185,18 @@ pk.RangeSlider.propTypes = {min:pt.oneOfType([pt.number]),
68
185
  count:pt.oneOfType([pt.number]),
69
186
  dots:pt.oneOfType([pt.bool]),
70
187
  included:pt.oneOfType([pt.bool]),
188
+ reverse:pt.oneOfType([pt.bool]),
71
189
  tooltip:pt.any,
72
190
  updatemode:pt.oneOf(['mouseup','drag']),
73
191
  vertical:pt.oneOfType([pt.bool]),
74
192
  verticalHeight:pt.oneOfType([pt.number]),
75
193
  className:pt.oneOfType([pt.string]),
76
- id:pt.oneOfType([pt.string]),
77
194
  setProps:pt.any,
78
195
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
79
196
  persisted_props:pt.any,
80
- persistence_type:pt.oneOf(['local','session','memory'])};
197
+ persistence_type:pt.oneOf(['local','session','memory']),
198
+ id:pt.oneOfType([pt.string]),
199
+ componentPath:pt.any};
81
200
  pk.Slider.propTypes = {min:pt.oneOfType([pt.number]),
82
201
  max:pt.oneOfType([pt.number]),
83
202
  step:pt.oneOfType([pt.number]),
@@ -87,13 +206,97 @@ pk.Slider.propTypes = {min:pt.oneOfType([pt.number]),
87
206
  disabled:pt.oneOfType([pt.bool]),
88
207
  dots:pt.oneOfType([pt.bool]),
89
208
  included:pt.oneOfType([pt.bool]),
209
+ reverse:pt.oneOfType([pt.bool]),
90
210
  tooltip:pt.any,
91
211
  updatemode:pt.oneOf(['mouseup','drag']),
92
212
  vertical:pt.oneOfType([pt.bool]),
93
213
  verticalHeight:pt.oneOfType([pt.number]),
94
214
  className:pt.oneOfType([pt.string]),
215
+ setProps:pt.any,
216
+ persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
217
+ persisted_props:pt.any,
218
+ persistence_type:pt.oneOf(['local','session','memory']),
95
219
  id:pt.oneOfType([pt.string]),
220
+ componentPath:pt.any};
221
+ pk.Tab.propTypes = {label:pt.oneOfType([pt.string,pt.node]),
222
+ children:pt.oneOfType([pt.node]),
223
+ value:pt.oneOfType([pt.string]),
224
+ disabled:pt.oneOfType([pt.bool]),
225
+ disabled_style:pt.any,
226
+ disabled_className:pt.oneOfType([pt.string]),
227
+ className:pt.oneOfType([pt.string]),
228
+ selected_className:pt.oneOfType([pt.string]),
229
+ style:pt.any,
230
+ selected_style:pt.any,
231
+ width:pt.oneOfType([pt.string,pt.number]),
96
232
  setProps:pt.any,
97
233
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
98
234
  persisted_props:pt.any,
99
- persistence_type:pt.oneOf(['local','session','memory'])};
235
+ persistence_type:pt.oneOf(['local','session','memory']),
236
+ id:pt.oneOfType([pt.string]),
237
+ componentPath:pt.any};
238
+ pk.Tabs.propTypes = {value:pt.oneOfType([pt.string]),
239
+ content_className:pt.oneOfType([pt.string]),
240
+ parent_className:pt.oneOfType([pt.string]),
241
+ style:pt.any,
242
+ parent_style:pt.any,
243
+ content_style:pt.any,
244
+ vertical:pt.oneOfType([pt.bool]),
245
+ mobile_breakpoint:pt.oneOfType([pt.number]),
246
+ children:pt.oneOfType([pt.node]),
247
+ colors:pt.oneOfType([pt.shape({border:pt.string,primary:pt.string,background:pt.string})]),
248
+ className:pt.oneOfType([pt.string]),
249
+ setProps:pt.any,
250
+ persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
251
+ persisted_props:pt.any,
252
+ persistence_type:pt.oneOf(['local','session','memory']),
253
+ id:pt.oneOfType([pt.string]),
254
+ componentPath:pt.any};
255
+ pk.Textarea.propTypes = {value:pt.oneOfType([pt.string]),
256
+ autoFocus:pt.oneOfType([pt.string]),
257
+ cols:pt.oneOfType([pt.number]),
258
+ disabled:pt.oneOfType([pt.bool,pt.oneOf(["disabled"]),pt.oneOf(["DISABLED"])]),
259
+ form:pt.oneOfType([pt.string]),
260
+ maxLength:pt.oneOfType([pt.number]),
261
+ minLength:pt.oneOfType([pt.number]),
262
+ name:pt.oneOfType([pt.string]),
263
+ placeholder:pt.oneOfType([pt.string]),
264
+ readOnly:pt.oneOfType([pt.bool,pt.oneOf(["readOnly"]),pt.oneOf(["readonly"]),pt.oneOf(["READONLY"])]),
265
+ required:pt.oneOfType([pt.bool,pt.oneOf(["required"]),pt.oneOf(["REQUIRED"])]),
266
+ rows:pt.oneOfType([pt.number]),
267
+ wrap:pt.oneOfType([pt.string]),
268
+ accessKey:pt.oneOfType([pt.string]),
269
+ contentEditable:pt.oneOfType([pt.bool]),
270
+ contextMenu:pt.oneOfType([pt.string]),
271
+ dir:pt.oneOfType([pt.string]),
272
+ draggable:pt.oneOfType([pt.bool]),
273
+ hidden:pt.oneOfType([pt.string]),
274
+ lang:pt.oneOfType([pt.string]),
275
+ spellCheck:pt.oneOfType([pt.bool]),
276
+ style:pt.any,
277
+ tabIndex:pt.oneOfType([pt.number]),
278
+ title:pt.oneOfType([pt.string]),
279
+ n_blur:pt.oneOfType([pt.number]),
280
+ n_blur_timestamp:pt.oneOfType([pt.number]),
281
+ n_clicks:pt.oneOfType([pt.number]),
282
+ n_clicks_timestamp:pt.oneOfType([pt.number]),
283
+ className:pt.oneOfType([pt.string]),
284
+ setProps:pt.any,
285
+ persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
286
+ persisted_props:pt.any,
287
+ persistence_type:pt.oneOf(['local','session','memory']),
288
+ id:pt.oneOfType([pt.string]),
289
+ componentPath:pt.any};
290
+ pk.Tooltip.propTypes = {children:pt.node,
291
+ id:pt.oneOfType([pt.string]),
292
+ className:pt.oneOfType([pt.string]),
293
+ style:pt.any,
294
+ bbox:pt.oneOfType([pt.shape({x0:pt.number,y0:pt.number,x1:pt.number,y1:pt.number})]),
295
+ show:pt.oneOfType([pt.bool]),
296
+ direction:pt.oneOf(['top','right','bottom','left']),
297
+ border_color:pt.oneOfType([pt.string]),
298
+ background_color:pt.oneOfType([pt.string]),
299
+ loading_text:pt.oneOfType([pt.string]),
300
+ zindex:pt.oneOfType([pt.number]),
301
+ targetable:pt.oneOfType([pt.bool]),
302
+ setProps:pt.any};
@@ -0,0 +1,67 @@
1
+ import React, {useMemo} from 'react';
2
+ import {ChecklistProps, PersistedProps, PersistenceTypes} from '../types';
3
+ import './css/checklist.css';
4
+
5
+ import {sanitizeOptions} from '../utils/optionTypes';
6
+ import LoadingElement from '../utils/_LoadingElement';
7
+ import {OptionsList} from '../utils/optionRendering';
8
+
9
+ /**
10
+ * Checklist is a component that encapsulates several checkboxes.
11
+ * The values and labels of the checklist are specified in the `options`
12
+ * property and the checked items are specified with the `value` property.
13
+ * Each checkbox is rendered as an input with a surrounding label.
14
+ */
15
+ export default function Checklist({
16
+ className,
17
+ id,
18
+ style,
19
+ setProps,
20
+ inputStyle = {},
21
+ inputClassName = '',
22
+ labelStyle = {},
23
+ labelClassName = '',
24
+ options = [],
25
+ value = [],
26
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
27
+ persisted_props = [PersistedProps.value],
28
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
29
+ persistence_type = PersistenceTypes.local,
30
+ inline = false,
31
+ }: ChecklistProps) {
32
+ const sanitizedOptions = useMemo(() => {
33
+ return sanitizeOptions(options);
34
+ }, [options]);
35
+
36
+ const stylingProps = {
37
+ id,
38
+ className: 'dash-checklist ' + (className ?? ''),
39
+ style,
40
+ optionClassName: inline ? 'dash-checklist-inline' : undefined,
41
+ inputStyle,
42
+ inputClassName,
43
+ labelStyle,
44
+ labelClassName,
45
+ };
46
+
47
+ return (
48
+ <LoadingElement>
49
+ {loadingProps => (
50
+ <OptionsList
51
+ {...loadingProps}
52
+ options={sanitizedOptions}
53
+ selected={value ?? []}
54
+ onSelectionChange={selection => {
55
+ setProps({value: selection});
56
+ }}
57
+ {...stylingProps}
58
+ />
59
+ )}
60
+ </LoadingElement>
61
+ );
62
+ }
63
+
64
+ Checklist.dashPersistence = {
65
+ persisted_props: [PersistedProps.value],
66
+ persistence_type: PersistenceTypes.local,
67
+ };
@@ -12,7 +12,7 @@ var _LoadingElement = _interopRequireDefault(require("../utils/LoadingElement"))
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
13
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
14
14
  function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
15
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
15
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
16
16
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
17
17
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
18
18
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -0,0 +1,70 @@
1
+ import React, {lazy, Suspense} from 'react';
2
+ import datePickerRange from '../utils/LazyLoader/datePickerRange';
3
+ import transformDate from '../utils/DatePickerPersistence';
4
+ import {DatePickerRangeProps, PersistedProps, PersistenceTypes} from '../types';
5
+
6
+ const RealDatePickerRange = lazy(datePickerRange);
7
+
8
+ /**
9
+ * DatePickerRange is designed for selecting a timespan across multiple days off
10
+ * of a calendar.
11
+ *
12
+ * The DatePicker integrates well with the Python datetime module with the
13
+ * startDate and endDate being returned in a string format suitable for
14
+ * creating datetime objects.
15
+ *
16
+ */
17
+ export default function DatePickerRange({
18
+ calendar_orientation = 'horizontal',
19
+ is_RTL = false,
20
+ // eslint-disable-next-line no-magic-numbers
21
+ day_size = 34,
22
+ with_portal = false,
23
+ with_full_screen_portal = false,
24
+ first_day_of_week = 0,
25
+ number_of_months_shown = 2,
26
+ stay_open_on_select = false,
27
+ reopen_calendar_on_clear = false,
28
+ show_outside_days = false,
29
+ clearable = false,
30
+ disabled = false,
31
+ updatemode = 'singledate',
32
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
33
+ persisted_props = [PersistedProps.start_date, PersistedProps.end_date],
34
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
35
+ persistence_type = PersistenceTypes.local,
36
+ disabled_days = [],
37
+ ...props
38
+ }: DatePickerRangeProps) {
39
+ return (
40
+ <Suspense fallback={null}>
41
+ <RealDatePickerRange
42
+ calendar_orientation={calendar_orientation}
43
+ is_RTL={is_RTL}
44
+ day_size={day_size}
45
+ show_outside_days={show_outside_days}
46
+ with_portal={with_portal}
47
+ with_full_screen_portal={with_full_screen_portal}
48
+ first_day_of_week={first_day_of_week}
49
+ number_of_months_shown={number_of_months_shown}
50
+ stay_open_on_select={stay_open_on_select}
51
+ reopen_calendar_on_clear={reopen_calendar_on_clear}
52
+ clearable={clearable}
53
+ disabled={disabled}
54
+ disabled_days={disabled_days}
55
+ updatemode={updatemode}
56
+ {...props}
57
+ />
58
+ </Suspense>
59
+ );
60
+ }
61
+
62
+ DatePickerRange.dashPersistence = {
63
+ persisted_props: [PersistedProps.start_date, PersistedProps.end_date],
64
+ persistence_type: PersistenceTypes.local,
65
+ };
66
+
67
+ DatePickerRange.persistenceTransforms = {
68
+ end_date: transformDate,
69
+ start_date: transformDate,
70
+ };
@@ -0,0 +1,72 @@
1
+ import React, {lazy, Suspense} from 'react';
2
+ import datePickerSingle from '../utils/LazyLoader/datePickerSingle';
3
+ import transformDate from '../utils/DatePickerPersistence';
4
+ import {
5
+ DatePickerSingleProps,
6
+ PersistedProps,
7
+ PersistenceTypes,
8
+ } from '../types';
9
+
10
+ const RealDatePickerSingle = lazy(datePickerSingle);
11
+
12
+ /**
13
+ * DatePickerSingle is a tailor made component designed for selecting
14
+ * a single day off of a calendar.
15
+ *
16
+ * The DatePicker integrates well with the Python datetime module with the
17
+ * startDate and endDate being returned in a string format suitable for
18
+ * creating datetime objects.
19
+ */
20
+ export default function DatePickerSingle({
21
+ placeholder = 'Select Date',
22
+ calendar_orientation = 'horizontal',
23
+ is_RTL = false,
24
+ // eslint-disable-next-line no-magic-numbers
25
+ day_size = 34,
26
+ with_portal = false,
27
+ with_full_screen_portal = false,
28
+ show_outside_days = true,
29
+ first_day_of_week = 0,
30
+ number_of_months_shown = 1,
31
+ stay_open_on_select = false,
32
+ reopen_calendar_on_clear = false,
33
+ clearable = false,
34
+ disabled = false,
35
+ disabled_days = [],
36
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
37
+ persisted_props = [PersistedProps.date],
38
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
39
+ persistence_type = PersistenceTypes.local,
40
+ ...props
41
+ }: DatePickerSingleProps) {
42
+ return (
43
+ <Suspense fallback={null}>
44
+ <RealDatePickerSingle
45
+ placeholder={placeholder}
46
+ calendar_orientation={calendar_orientation}
47
+ is_RTL={is_RTL}
48
+ day_size={day_size}
49
+ with_portal={with_portal}
50
+ with_full_screen_portal={with_full_screen_portal}
51
+ show_outside_days={show_outside_days}
52
+ first_day_of_week={first_day_of_week}
53
+ number_of_months_shown={number_of_months_shown}
54
+ stay_open_on_select={stay_open_on_select}
55
+ reopen_calendar_on_clear={reopen_calendar_on_clear}
56
+ clearable={clearable}
57
+ disabled={disabled}
58
+ disabled_days={disabled_days}
59
+ {...props}
60
+ />
61
+ </Suspense>
62
+ );
63
+ }
64
+
65
+ DatePickerSingle.dashPersistence = {
66
+ persisted_props: [PersistedProps.date],
67
+ persistence_type: PersistenceTypes.local,
68
+ };
69
+
70
+ DatePickerSingle.persistenceTransforms = {
71
+ date: transformDate,
72
+ };
@@ -1,9 +1,19 @@
1
- import React, {Component, lazy, Suspense} from 'react';
1
+ import React, {lazy, Suspense} from 'react';
2
2
  import {DropdownProps, PersistedProps, PersistenceTypes} from '../types';
3
3
  import dropdown from '../utils/LazyLoader/dropdown';
4
4
 
5
5
  const RealDropdown = lazy(dropdown);
6
6
 
7
+ const defaultLabels: DropdownProps['labels'] = {
8
+ select_all: 'Select All',
9
+ deselect_all: 'Deselect All',
10
+ selected_count: '{num_selected} selected',
11
+ search: 'Search',
12
+ clear_search: 'Clear search',
13
+ clear_selection: 'Clear selection',
14
+ no_options_found: 'No options found',
15
+ };
16
+
7
17
  /**
8
18
  * Dropdown is an interactive dropdown element for selecting one or more
9
19
  * items.
@@ -19,8 +29,8 @@ export default function Dropdown({
19
29
  disabled = false,
20
30
  multi = false,
21
31
  searchable = true,
22
- // eslint-disable-next-line no-magic-numbers
23
- optionHeight = 36,
32
+ labels = defaultLabels,
33
+ optionHeight = 'auto',
24
34
  // eslint-disable-next-line no-magic-numbers
25
35
  maxHeight = 200,
26
36
  closeOnSelect = !multi,
@@ -30,11 +40,17 @@ export default function Dropdown({
30
40
  persistence_type = PersistenceTypes.local,
31
41
  ...props
32
42
  }: DropdownProps) {
43
+ labels = {
44
+ ...defaultLabels,
45
+ ...labels,
46
+ };
47
+
33
48
  return (
34
49
  <Suspense fallback={null}>
35
50
  <RealDropdown
36
51
  clearable={clearable}
37
52
  disabled={disabled}
53
+ labels={labels}
38
54
  multi={multi}
39
55
  searchable={searchable}
40
56
  optionHeight={optionHeight}
@@ -20,7 +20,7 @@ const convert = (val: unknown) => (isNumeric(val) ? +val : NaN);
20
20
  const isEquivalent = (v1: number, v2: number) =>
21
21
  v1 === v2 || (isNaN(v1) && isNaN(v2));
22
22
 
23
- enum HTMLInputTypes {
23
+ export enum HTMLInputTypes {
24
24
  // Only allowing the input types with wide browser compatibility
25
25
  'text' = 'text',
26
26
  'number' = 'number',