dash-core-components 4.0.0-rc2 → 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 (68) 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 +116 -12
  21. package/lib/components/Clipboard.react.js +1 -1
  22. package/lib/components/DatePickerRange.tsx +70 -0
  23. package/lib/components/DatePickerSingle.tsx +72 -0
  24. package/lib/components/Input.tsx +1 -1
  25. package/lib/components/Tab.tsx +19 -0
  26. package/lib/components/Tabs.tsx +311 -0
  27. package/lib/components/css/calendar.css +66 -0
  28. package/lib/components/css/datepickers.css +233 -0
  29. package/lib/components/css/dcc.css +1 -0
  30. package/lib/components/css/dropdown.css +6 -3
  31. package/lib/components/css/input.css +8 -2
  32. package/lib/components/css/sliders.css +22 -0
  33. package/lib/components/css/tabs.css +113 -0
  34. package/lib/fragments/DatePickerRange.tsx +444 -0
  35. package/lib/fragments/DatePickerSingle.tsx +249 -0
  36. package/lib/fragments/Dropdown.tsx +8 -4
  37. package/lib/fragments/Graph.react.js +18 -45
  38. package/lib/fragments/RangeSlider.tsx +2 -0
  39. package/lib/index.ts +4 -6
  40. package/lib/types.ts +353 -27
  41. package/lib/utils/DatePickerPersistence.ts +14 -0
  42. package/lib/utils/LazyLoader/datePickerRange.ts +4 -0
  43. package/lib/utils/LazyLoader/datePickerSingle.ts +4 -0
  44. package/lib/utils/calendar/Calendar.tsx +382 -0
  45. package/lib/utils/calendar/CalendarDay.tsx +75 -0
  46. package/lib/utils/calendar/CalendarDayPadding.tsx +15 -0
  47. package/lib/utils/calendar/CalendarMonth.tsx +247 -0
  48. package/lib/utils/calendar/CalendarMonthHeader.tsx +23 -0
  49. package/lib/utils/calendar/createMonthGrid.ts +28 -0
  50. package/lib/utils/calendar/helpers.ts +272 -0
  51. package/lib/utils/computeSliderMarkers.ts +71 -116
  52. package/lib/utils/optionRendering.tsx +22 -15
  53. package/lib/utils/sliderRendering.tsx +40 -2
  54. package/package.json +16 -13
  55. package/lib/components/DatePickerRange.react.js +0 -244
  56. package/lib/components/DatePickerSingle.react.js +0 -209
  57. package/lib/components/Dropdown.react.js.old +0 -228
  58. package/lib/components/Tab.react.js +0 -80
  59. package/lib/components/Tab.react.js.old +0 -79
  60. package/lib/components/Tabs.react.js +0 -295
  61. package/lib/components/Textarea.react.js.old +0 -287
  62. package/lib/fragments/DatePickerRange.react.js +0 -188
  63. package/lib/fragments/DatePickerSingle.react.js +0 -132
  64. package/lib/utils/DatePickerPersistence.js +0 -18
  65. package/lib/utils/LazyLoader/datePickerRange.js +0 -8
  66. package/lib/utils/LazyLoader/datePickerSingle.js +0 -8
  67. package/lib/utils/convertToMoment.js +0 -30
  68. package/lib/utils/optionTypes.js +0 -39
@@ -11,12 +11,76 @@ pk.Checklist.propTypes = {options:pt.any,
11
11
  inputClassName:pt.oneOfType([pt.string]),
12
12
  labelStyle:pt.any,
13
13
  labelClassName:pt.oneOfType([pt.string]),
14
- id:pt.oneOfType([pt.string]),
15
14
  className:pt.oneOfType([pt.string]),
16
15
  setProps:pt.any,
17
16
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
18
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,
19
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};
20
84
  pk.Dropdown.propTypes = {options:pt.any,
21
85
  value:pt.oneOfType([pt.string,pt.number,pt.bool,pt.arrayOf(pt.oneOfType([pt.string,pt.number,pt.bool]))]),
22
86
  multi:pt.oneOfType([pt.bool]),
@@ -30,12 +94,13 @@ pk.Dropdown.propTypes = {options:pt.any,
30
94
  maxHeight:pt.oneOfType([pt.number]),
31
95
  style:pt.any,
32
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])})]),
33
- id:pt.oneOfType([pt.string]),
34
97
  className:pt.oneOfType([pt.string]),
35
98
  setProps:pt.any,
36
99
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
37
100
  persisted_props:pt.any,
38
- 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};
39
104
  pk.Input.propTypes = {value:pt.oneOfType([pt.string,pt.number]),
40
105
  debounce:pt.oneOfType([pt.number,pt.bool]),
41
106
  placeholder:pt.oneOfType([pt.string,pt.number]),
@@ -86,12 +151,13 @@ pk.Loading.propTypes = {children:pt.node,
86
151
  show_initially:pt.oneOfType([pt.bool]),
87
152
  target_components:pt.oneOfType([pt.shape({})]),
88
153
  custom_spinner:pt.node,
89
- id:pt.oneOfType([pt.string]),
90
154
  className:pt.oneOfType([pt.string]),
91
155
  setProps:pt.any,
92
156
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
93
157
  persisted_props:pt.any,
94
- persistence_type:pt.oneOf(['local','session','memory'])};
158
+ persistence_type:pt.oneOf(['local','session','memory']),
159
+ id:pt.oneOfType([pt.string]),
160
+ componentPath:pt.any};
95
161
  pk.RadioItems.propTypes = {options:pt.any,
96
162
  value:pt.oneOfType([pt.string,pt.number,pt.bool]),
97
163
  inline:pt.oneOfType([pt.bool]),
@@ -100,12 +166,13 @@ pk.RadioItems.propTypes = {options:pt.any,
100
166
  inputClassName:pt.oneOfType([pt.string]),
101
167
  labelStyle:pt.any,
102
168
  labelClassName:pt.oneOfType([pt.string]),
103
- id:pt.oneOfType([pt.string]),
104
169
  className:pt.oneOfType([pt.string]),
105
170
  setProps:pt.any,
106
171
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
107
172
  persisted_props:pt.any,
108
- persistence_type:pt.oneOf(['local','session','memory'])};
173
+ persistence_type:pt.oneOf(['local','session','memory']),
174
+ id:pt.oneOfType([pt.string]),
175
+ componentPath:pt.any};
109
176
  pk.RangeSlider.propTypes = {min:pt.oneOfType([pt.number]),
110
177
  max:pt.oneOfType([pt.number]),
111
178
  step:pt.oneOfType([pt.number]),
@@ -123,12 +190,13 @@ pk.RangeSlider.propTypes = {min:pt.oneOfType([pt.number]),
123
190
  updatemode:pt.oneOf(['mouseup','drag']),
124
191
  vertical:pt.oneOfType([pt.bool]),
125
192
  verticalHeight:pt.oneOfType([pt.number]),
126
- id:pt.oneOfType([pt.string]),
127
193
  className:pt.oneOfType([pt.string]),
128
194
  setProps:pt.any,
129
195
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
130
196
  persisted_props:pt.any,
131
- 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};
132
200
  pk.Slider.propTypes = {min:pt.oneOfType([pt.number]),
133
201
  max:pt.oneOfType([pt.number]),
134
202
  step:pt.oneOfType([pt.number]),
@@ -143,12 +211,47 @@ pk.Slider.propTypes = {min:pt.oneOfType([pt.number]),
143
211
  updatemode:pt.oneOf(['mouseup','drag']),
144
212
  vertical:pt.oneOfType([pt.bool]),
145
213
  verticalHeight:pt.oneOfType([pt.number]),
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']),
146
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]),
147
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]),
148
232
  setProps:pt.any,
149
233
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
150
234
  persisted_props:pt.any,
151
- 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};
152
255
  pk.Textarea.propTypes = {value:pt.oneOfType([pt.string]),
153
256
  autoFocus:pt.oneOfType([pt.string]),
154
257
  cols:pt.oneOfType([pt.number]),
@@ -177,12 +280,13 @@ pk.Textarea.propTypes = {value:pt.oneOfType([pt.string]),
177
280
  n_blur_timestamp:pt.oneOfType([pt.number]),
178
281
  n_clicks:pt.oneOfType([pt.number]),
179
282
  n_clicks_timestamp:pt.oneOfType([pt.number]),
180
- id:pt.oneOfType([pt.string]),
181
283
  className:pt.oneOfType([pt.string]),
182
284
  setProps:pt.any,
183
285
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
184
286
  persisted_props:pt.any,
185
- persistence_type:pt.oneOf(['local','session','memory'])};
287
+ persistence_type:pt.oneOf(['local','session','memory']),
288
+ id:pt.oneOfType([pt.string]),
289
+ componentPath:pt.any};
186
290
  pk.Tooltip.propTypes = {children:pt.node,
187
291
  id:pt.oneOfType([pt.string]),
188
292
  className:pt.oneOfType([pt.string]),
@@ -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
+ };
@@ -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',
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import './css/tabs.css';
3
+ import {TabProps} from '../types';
4
+
5
+ /**
6
+ * Part of dcc.Tabs - this is the child Tab component used to render a tabbed page.
7
+ * Its children will be set as the content of that tab, which if clicked will become visible.
8
+ */
9
+ function Tab({
10
+ children,
11
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
+ disabled = false,
13
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
+ disabled_style = {color: 'var(--Dash-Text-Disabled)'},
15
+ }: TabProps) {
16
+ return <>{children}</>;
17
+ }
18
+
19
+ export default Tab;