dash-core-components 4.0.0-rc2 → 4.0.0-rc4

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 (71) 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 +153 -14
  21. package/lib/components/Button.tsx +48 -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/Input.tsx +12 -233
  26. package/lib/components/RadioItems.tsx +3 -1
  27. package/lib/components/Tab.tsx +19 -0
  28. package/lib/components/Tabs.tsx +311 -0
  29. package/lib/components/css/button.css +55 -0
  30. package/lib/components/css/calendar.css +66 -0
  31. package/lib/components/css/datepickers.css +239 -0
  32. package/lib/components/css/dcc.css +1 -0
  33. package/lib/components/css/dropdown.css +19 -6
  34. package/lib/components/css/input.css +9 -3
  35. package/lib/components/css/sliders.css +41 -1
  36. package/lib/components/css/tabs.css +113 -0
  37. package/lib/fragments/DatePickerRange.tsx +448 -0
  38. package/lib/fragments/DatePickerSingle.tsx +248 -0
  39. package/lib/fragments/Dropdown.tsx +44 -19
  40. package/lib/fragments/Graph.react.js +18 -45
  41. package/lib/fragments/RangeSlider.tsx +24 -66
  42. package/lib/index.ts +6 -6
  43. package/lib/types.ts +660 -28
  44. package/lib/utils/DatePickerPersistence.ts +14 -0
  45. package/lib/utils/LazyLoader/datePickerRange.ts +4 -0
  46. package/lib/utils/LazyLoader/datePickerSingle.ts +4 -0
  47. package/lib/utils/calendar/Calendar.tsx +382 -0
  48. package/lib/utils/calendar/CalendarDay.tsx +75 -0
  49. package/lib/utils/calendar/CalendarDayPadding.tsx +15 -0
  50. package/lib/utils/calendar/CalendarMonth.tsx +247 -0
  51. package/lib/utils/calendar/CalendarMonthHeader.tsx +23 -0
  52. package/lib/utils/calendar/createMonthGrid.ts +28 -0
  53. package/lib/utils/calendar/helpers.ts +272 -0
  54. package/lib/utils/computeSliderMarkers.ts +71 -116
  55. package/lib/utils/optionRendering.tsx +22 -15
  56. package/lib/utils/sliderRendering.tsx +40 -2
  57. package/package.json +16 -13
  58. package/lib/components/DatePickerRange.react.js +0 -244
  59. package/lib/components/DatePickerSingle.react.js +0 -209
  60. package/lib/components/Dropdown.react.js.old +0 -228
  61. package/lib/components/Tab.react.js +0 -80
  62. package/lib/components/Tab.react.js.old +0 -79
  63. package/lib/components/Tabs.react.js +0 -295
  64. package/lib/components/Textarea.react.js.old +0 -287
  65. package/lib/fragments/DatePickerRange.react.js +0 -188
  66. package/lib/fragments/DatePickerSingle.react.js +0 -132
  67. package/lib/utils/DatePickerPersistence.js +0 -18
  68. package/lib/utils/LazyLoader/datePickerRange.js +0 -8
  69. package/lib/utils/LazyLoader/datePickerSingle.js +0 -8
  70. package/lib/utils/convertToMoment.js +0 -30
  71. package/lib/utils/optionTypes.js +0 -39
@@ -3,6 +3,40 @@
3
3
  var pt = window.PropTypes;
4
4
  var pk = window['dash_core_components'];
5
5
 
6
+ pk.Button.propTypes = {className:pt.oneOfType([pt.string]),
7
+ setProps:pt.any,
8
+ persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
9
+ persisted_props:pt.any,
10
+ persistence_type:pt.oneOf(['local','session','memory']),
11
+ id:pt.oneOfType([pt.string]),
12
+ componentPath:pt.any,
13
+ children:pt.node,
14
+ type:pt.oneOf(['submit','reset','button']),
15
+ autoFocus:pt.oneOfType([pt.bool]),
16
+ disabled:pt.oneOfType([pt.bool]),
17
+ form:pt.oneOfType([pt.string]),
18
+ formAction:pt.oneOfType([pt.string]),
19
+ formEncType:pt.oneOfType([pt.string]),
20
+ formMethod:pt.oneOfType([pt.string]),
21
+ formNoValidate:pt.oneOfType([pt.bool]),
22
+ formTarget:pt.oneOfType([pt.string]),
23
+ name:pt.oneOfType([pt.string]),
24
+ value:pt.oneOfType([pt.string,pt.number,pt.arrayOf(pt.string)]),
25
+ accessKey:pt.oneOfType([pt.string]),
26
+ contentEditable:pt.oneOfType([pt.bool,pt.oneOf(["true"]),pt.oneOf(["false"]),pt.oneOf(["inherit"])]),
27
+ dir:pt.oneOfType([pt.string]),
28
+ draggable:pt.oneOfType([pt.bool]),
29
+ hidden:pt.oneOfType([pt.bool]),
30
+ lang:pt.oneOfType([pt.string]),
31
+ role:pt.oneOfType([pt.string]),
32
+ spellCheck:pt.oneOfType([pt.bool]),
33
+ style:pt.any,
34
+ tabIndex:pt.oneOfType([pt.number]),
35
+ title:pt.oneOfType([pt.string]),
36
+ n_blur:pt.oneOfType([pt.number]),
37
+ n_blur_timestamp:pt.oneOfType([pt.number]),
38
+ n_clicks:pt.oneOfType([pt.number]),
39
+ n_clicks_timestamp:pt.oneOfType([pt.number])};
6
40
  pk.Checklist.propTypes = {options:pt.any,
7
41
  value:pt.oneOfType([pt.arrayOf(pt.oneOfType([pt.string,pt.number,pt.bool]))]),
8
42
  inline:pt.oneOfType([pt.bool]),
@@ -11,12 +45,76 @@ pk.Checklist.propTypes = {options:pt.any,
11
45
  inputClassName:pt.oneOfType([pt.string]),
12
46
  labelStyle:pt.any,
13
47
  labelClassName:pt.oneOfType([pt.string]),
48
+ className:pt.oneOfType([pt.string]),
49
+ setProps:pt.any,
50
+ persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
51
+ persisted_props:pt.any,
52
+ persistence_type:pt.oneOf(['local','session','memory']),
14
53
  id:pt.oneOfType([pt.string]),
54
+ componentPath:pt.any};
55
+ pk.DatePickerRange.propTypes = {start_date:pt.any,
56
+ end_date:pt.any,
57
+ minimum_nights:pt.oneOfType([pt.number]),
58
+ updatemode:pt.oneOf(['singledate','bothdates']),
59
+ start_date_placeholder_text:pt.oneOfType([pt.string]),
60
+ end_date_placeholder_text:pt.oneOfType([pt.string]),
61
+ start_date_id:pt.oneOfType([pt.string]),
62
+ end_date_id:pt.oneOfType([pt.string]),
63
+ setProps:pt.any,
64
+ id:pt.oneOfType([pt.string]),
65
+ componentPath:pt.any,
66
+ className:pt.oneOfType([pt.string]),
67
+ persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
68
+ persisted_props:pt.any,
69
+ persistence_type:pt.oneOf(['local','session','memory']),
70
+ disabled:pt.oneOfType([pt.bool]),
71
+ style:pt.any,
72
+ min_date_allowed:pt.oneOfType([pt.string]),
73
+ max_date_allowed:pt.oneOfType([pt.string]),
74
+ disabled_days:pt.oneOfType([pt.arrayOf(pt.string)]),
75
+ placeholder:pt.oneOfType([pt.string]),
76
+ initial_visible_month:pt.oneOfType([pt.string]),
77
+ clearable:pt.oneOfType([pt.bool]),
78
+ reopen_calendar_on_clear:pt.oneOfType([pt.bool]),
79
+ display_format:pt.oneOfType([pt.string]),
80
+ month_format:pt.oneOfType([pt.string]),
81
+ first_day_of_week:pt.oneOf([0,1,2,3,4,5,6]),
82
+ show_outside_days:pt.oneOfType([pt.bool]),
83
+ stay_open_on_select:pt.oneOfType([pt.bool]),
84
+ calendar_orientation:pt.oneOf(['vertical','horizontal']),
85
+ number_of_months_shown:pt.oneOfType([pt.number]),
86
+ with_portal:pt.oneOfType([pt.bool]),
87
+ with_full_screen_portal:pt.oneOfType([pt.bool]),
88
+ day_size:pt.oneOfType([pt.number]),
89
+ is_RTL:pt.oneOfType([pt.bool])};
90
+ pk.DatePickerSingle.propTypes = {date:pt.any,
91
+ min_date_allowed:pt.oneOfType([pt.string]),
92
+ max_date_allowed:pt.oneOfType([pt.string]),
93
+ disabled_days:pt.oneOfType([pt.arrayOf(pt.string)]),
94
+ placeholder:pt.oneOfType([pt.string]),
95
+ initial_visible_month:pt.oneOfType([pt.string]),
96
+ clearable:pt.oneOfType([pt.bool]),
97
+ reopen_calendar_on_clear:pt.oneOfType([pt.bool]),
98
+ display_format:pt.oneOfType([pt.string]),
99
+ month_format:pt.oneOfType([pt.string]),
100
+ first_day_of_week:pt.oneOf([0,1,2,3,4,5,6]),
101
+ show_outside_days:pt.oneOfType([pt.bool]),
102
+ stay_open_on_select:pt.oneOfType([pt.bool]),
103
+ calendar_orientation:pt.oneOf(['vertical','horizontal']),
104
+ number_of_months_shown:pt.oneOfType([pt.number]),
105
+ with_portal:pt.oneOfType([pt.bool]),
106
+ with_full_screen_portal:pt.oneOfType([pt.bool]),
107
+ day_size:pt.oneOfType([pt.number]),
108
+ is_RTL:pt.oneOfType([pt.bool]),
109
+ disabled:pt.oneOfType([pt.bool]),
110
+ style:pt.any,
15
111
  className:pt.oneOfType([pt.string]),
16
112
  setProps:pt.any,
17
113
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
18
114
  persisted_props:pt.any,
19
- persistence_type:pt.oneOf(['local','session','memory'])};
115
+ persistence_type:pt.oneOf(['local','session','memory']),
116
+ id:pt.oneOfType([pt.string]),
117
+ componentPath:pt.any};
20
118
  pk.Dropdown.propTypes = {options:pt.any,
21
119
  value:pt.oneOfType([pt.string,pt.number,pt.bool,pt.arrayOf(pt.oneOfType([pt.string,pt.number,pt.bool]))]),
22
120
  multi:pt.oneOfType([pt.bool]),
@@ -30,13 +128,15 @@ pk.Dropdown.propTypes = {options:pt.any,
30
128
  maxHeight:pt.oneOfType([pt.number]),
31
129
  style:pt.any,
32
130
  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
131
  className:pt.oneOfType([pt.string]),
35
132
  setProps:pt.any,
36
133
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
37
134
  persisted_props:pt.any,
38
- persistence_type:pt.oneOf(['local','session','memory'])};
135
+ persistence_type:pt.oneOf(['local','session','memory']),
136
+ id:pt.oneOfType([pt.string]),
137
+ componentPath:pt.any};
39
138
  pk.Input.propTypes = {value:pt.oneOfType([pt.string,pt.number]),
139
+ type:pt.oneOf(['text','number','password','email','range','search','tel','url','hidden']),
40
140
  debounce:pt.oneOfType([pt.number,pt.bool]),
41
141
  placeholder:pt.oneOfType([pt.string,pt.number]),
42
142
  n_submit:pt.oneOfType([pt.number]),
@@ -65,12 +165,12 @@ pk.Input.propTypes = {value:pt.oneOfType([pt.string,pt.number]),
65
165
  size:pt.oneOfType([pt.string]),
66
166
  style:pt.any,
67
167
  className:pt.oneOfType([pt.string]),
68
- id:pt.oneOfType([pt.string]),
69
168
  setProps:pt.any,
70
169
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
71
170
  persisted_props:pt.any,
72
171
  persistence_type:pt.oneOf(['local','session','memory']),
73
- type:pt.oneOf(['text','number','password','email','range','search','tel','url','hidden'])};
172
+ id:pt.oneOfType([pt.string]),
173
+ componentPath:pt.any};
74
174
  pk.Loading.propTypes = {children:pt.node,
75
175
  type:pt.oneOf(['graph','cube','circle','dot','default']),
76
176
  fullscreen:pt.oneOfType([pt.bool]),
@@ -86,12 +186,13 @@ pk.Loading.propTypes = {children:pt.node,
86
186
  show_initially:pt.oneOfType([pt.bool]),
87
187
  target_components:pt.oneOfType([pt.shape({})]),
88
188
  custom_spinner:pt.node,
89
- id:pt.oneOfType([pt.string]),
90
189
  className:pt.oneOfType([pt.string]),
91
190
  setProps:pt.any,
92
191
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
93
192
  persisted_props:pt.any,
94
- persistence_type:pt.oneOf(['local','session','memory'])};
193
+ persistence_type:pt.oneOf(['local','session','memory']),
194
+ id:pt.oneOfType([pt.string]),
195
+ componentPath:pt.any};
95
196
  pk.RadioItems.propTypes = {options:pt.any,
96
197
  value:pt.oneOfType([pt.string,pt.number,pt.bool]),
97
198
  inline:pt.oneOfType([pt.bool]),
@@ -100,12 +201,13 @@ pk.RadioItems.propTypes = {options:pt.any,
100
201
  inputClassName:pt.oneOfType([pt.string]),
101
202
  labelStyle:pt.any,
102
203
  labelClassName:pt.oneOfType([pt.string]),
103
- id:pt.oneOfType([pt.string]),
104
204
  className:pt.oneOfType([pt.string]),
105
205
  setProps:pt.any,
106
206
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
107
207
  persisted_props:pt.any,
108
- persistence_type:pt.oneOf(['local','session','memory'])};
208
+ persistence_type:pt.oneOf(['local','session','memory']),
209
+ id:pt.oneOfType([pt.string]),
210
+ componentPath:pt.any};
109
211
  pk.RangeSlider.propTypes = {min:pt.oneOfType([pt.number]),
110
212
  max:pt.oneOfType([pt.number]),
111
213
  step:pt.oneOfType([pt.number]),
@@ -123,12 +225,13 @@ pk.RangeSlider.propTypes = {min:pt.oneOfType([pt.number]),
123
225
  updatemode:pt.oneOf(['mouseup','drag']),
124
226
  vertical:pt.oneOfType([pt.bool]),
125
227
  verticalHeight:pt.oneOfType([pt.number]),
126
- id:pt.oneOfType([pt.string]),
127
228
  className:pt.oneOfType([pt.string]),
128
229
  setProps:pt.any,
129
230
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
130
231
  persisted_props:pt.any,
131
- persistence_type:pt.oneOf(['local','session','memory'])};
232
+ persistence_type:pt.oneOf(['local','session','memory']),
233
+ id:pt.oneOfType([pt.string]),
234
+ componentPath:pt.any};
132
235
  pk.Slider.propTypes = {min:pt.oneOfType([pt.number]),
133
236
  max:pt.oneOfType([pt.number]),
134
237
  step:pt.oneOfType([pt.number]),
@@ -143,12 +246,47 @@ pk.Slider.propTypes = {min:pt.oneOfType([pt.number]),
143
246
  updatemode:pt.oneOf(['mouseup','drag']),
144
247
  vertical:pt.oneOfType([pt.bool]),
145
248
  verticalHeight:pt.oneOfType([pt.number]),
249
+ className:pt.oneOfType([pt.string]),
250
+ setProps:pt.any,
251
+ persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
252
+ persisted_props:pt.any,
253
+ persistence_type:pt.oneOf(['local','session','memory']),
146
254
  id:pt.oneOfType([pt.string]),
255
+ componentPath:pt.any};
256
+ pk.Tab.propTypes = {label:pt.oneOfType([pt.string,pt.node]),
257
+ children:pt.oneOfType([pt.node]),
258
+ value:pt.oneOfType([pt.string]),
259
+ disabled:pt.oneOfType([pt.bool]),
260
+ disabled_style:pt.any,
261
+ disabled_className:pt.oneOfType([pt.string]),
147
262
  className:pt.oneOfType([pt.string]),
263
+ selected_className:pt.oneOfType([pt.string]),
264
+ style:pt.any,
265
+ selected_style:pt.any,
266
+ width:pt.oneOfType([pt.string,pt.number]),
148
267
  setProps:pt.any,
149
268
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
150
269
  persisted_props:pt.any,
151
- persistence_type:pt.oneOf(['local','session','memory'])};
270
+ persistence_type:pt.oneOf(['local','session','memory']),
271
+ id:pt.oneOfType([pt.string]),
272
+ componentPath:pt.any};
273
+ pk.Tabs.propTypes = {value:pt.oneOfType([pt.string]),
274
+ content_className:pt.oneOfType([pt.string]),
275
+ parent_className:pt.oneOfType([pt.string]),
276
+ style:pt.any,
277
+ parent_style:pt.any,
278
+ content_style:pt.any,
279
+ vertical:pt.oneOfType([pt.bool]),
280
+ mobile_breakpoint:pt.oneOfType([pt.number]),
281
+ children:pt.oneOfType([pt.node]),
282
+ colors:pt.oneOfType([pt.shape({border:pt.string,primary:pt.string,background:pt.string})]),
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};
152
290
  pk.Textarea.propTypes = {value:pt.oneOfType([pt.string]),
153
291
  autoFocus:pt.oneOfType([pt.string]),
154
292
  cols:pt.oneOfType([pt.number]),
@@ -177,12 +315,13 @@ pk.Textarea.propTypes = {value:pt.oneOfType([pt.string]),
177
315
  n_blur_timestamp:pt.oneOfType([pt.number]),
178
316
  n_clicks:pt.oneOfType([pt.number]),
179
317
  n_clicks_timestamp:pt.oneOfType([pt.number]),
180
- id:pt.oneOfType([pt.string]),
181
318
  className:pt.oneOfType([pt.string]),
182
319
  setProps:pt.any,
183
320
  persistence:pt.oneOfType([pt.string,pt.number,pt.bool]),
184
321
  persisted_props:pt.any,
185
- persistence_type:pt.oneOf(['local','session','memory'])};
322
+ persistence_type:pt.oneOf(['local','session','memory']),
323
+ id:pt.oneOfType([pt.string]),
324
+ componentPath:pt.any};
186
325
  pk.Tooltip.propTypes = {children:pt.node,
187
326
  id:pt.oneOfType([pt.string]),
188
327
  className:pt.oneOfType([pt.string]),
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import {ButtonProps} from '../types';
3
+ import './css/button.css';
4
+
5
+ /**
6
+ * Similar to dash.html.Button, but with theming and styles applied.
7
+ */
8
+ const Button = ({
9
+ setProps,
10
+ n_blur = 0,
11
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
+ n_blur_timestamp = -1,
13
+ n_clicks = 0,
14
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
+ n_clicks_timestamp = -1,
16
+ type = 'button',
17
+ className,
18
+ children,
19
+ ...props
20
+ }: ButtonProps) => {
21
+ const ctx = window.dash_component_api.useDashContext();
22
+ const isLoading = ctx.useLoading();
23
+
24
+ return (
25
+ <button
26
+ data-dash-is-loading={isLoading || undefined}
27
+ className={'dash-button ' + (className ?? '')}
28
+ onBlur={() => {
29
+ setProps({
30
+ n_blur: n_blur + 1,
31
+ n_blur_timestamp: Date.now(),
32
+ });
33
+ }}
34
+ onClick={() => {
35
+ setProps({
36
+ n_clicks: n_clicks + 1,
37
+ n_clicks_timestamp: Date.now(),
38
+ });
39
+ }}
40
+ type={type}
41
+ {...props}
42
+ >
43
+ {children}
44
+ </button>
45
+ );
46
+ };
47
+
48
+ export default Button;
@@ -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
+ };