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
package/lib/types.ts CHANGED
@@ -1,16 +1,5 @@
1
- import React from 'react';
2
- import {DashComponent} from '@dash-renderer/types/component';
3
- import ExternalWrapper from '@dash-renderer/wrapper/ExternalWrapper';
4
- import {useDashContext} from '@dash-renderer/wrapper/DashContext';
5
-
6
- declare global {
7
- interface Window {
8
- dash_component_api: {
9
- useDashContext: typeof useDashContext;
10
- ExternalWrapper: typeof ExternalWrapper;
11
- };
12
- }
13
- }
1
+ import React, {ButtonHTMLAttributes, DetailedHTMLProps} from 'react';
2
+ import {BaseDashProps, DashComponent} from '@dash-renderer/types';
14
3
 
15
4
  export enum PersistenceTypes {
16
5
  'local' = 'local',
@@ -20,16 +9,13 @@ export enum PersistenceTypes {
20
9
 
21
10
  export enum PersistedProps {
22
11
  'value' = 'value',
12
+ 'date' = 'date',
13
+ 'start_date' = 'start_date',
14
+ 'end_date' = 'end_date',
23
15
  }
24
16
 
25
- export interface BaseComponentProps<T> {
26
- /**
27
- * The ID of this component, used to identify dash components
28
- * in callbacks. The ID needs to be unique across all of the
29
- * components in an app.
30
- */
31
- id?: string;
32
-
17
+ export interface BaseDccProps<T>
18
+ extends Pick<BaseDashProps, 'id' | 'componentPath'> {
33
19
  /**
34
20
  * Additional CSS class for the root DOM node
35
21
  */
@@ -66,6 +52,312 @@ export interface BaseComponentProps<T> {
66
52
  persistence_type?: PersistenceTypes;
67
53
  }
68
54
 
55
+ export type ButtonProps = BaseDccProps<ButtonProps> & {
56
+ /**
57
+ * The children of this component.
58
+ */
59
+ children?: React.ReactNode;
60
+ /**
61
+ * Defines the type of the element.
62
+ */
63
+ type?: 'submit' | 'reset' | 'button';
64
+ /**
65
+ * The element should be automatically focused after the page loaded.
66
+ */
67
+ autoFocus?: boolean;
68
+ /**
69
+ * Indicates whether the user can interact with the element.
70
+ */
71
+ disabled?: boolean;
72
+ /**
73
+ * Indicates the form that is the owner of the element.
74
+ */
75
+ form?: string;
76
+ /**
77
+ * Indicates the action of the element, overriding the action defined in the <form>.
78
+ */
79
+ formAction?: string;
80
+ /**
81
+ * If the button/input is a submit button (type="submit"), this attribute sets the encoding type to use during form submission. If this attribute is specified, it overrides the enctype attribute of the button's form owner.
82
+ */
83
+ formEncType?: string;
84
+ /**
85
+ * If the button/input is a submit button (type="submit"), this attribute sets the submission method to use during form submission (GET, POST, etc.). If this attribute is specified, it overrides the method attribute of the button's form owner.
86
+ */
87
+ formMethod?: string;
88
+ /**
89
+ * If the button/input is a submit button (type="submit"), this boolean attribute specifies that the form is not to be validated when it is submitted. If this attribute is specified, it overrides the novalidate attribute of the button's form owner.
90
+ */
91
+ formNoValidate?: boolean;
92
+ /**
93
+ * If the button/input is a submit button (type="submit"), this attribute specifies the browsing context (for example, tab, window, or inline frame) in which to display the response that is received after submitting the form. If this attribute is specified, it overrides the target attribute of the button's form owner.
94
+ */
95
+ formTarget?: string;
96
+ /**
97
+ * Name of the element. For example used by the server to identify the fields in form submits.
98
+ */
99
+ name?: string;
100
+ /**
101
+ * Defines a default value which will be displayed in the element on page load.
102
+ */
103
+ value?: string | string[] | number;
104
+ /**
105
+ * Keyboard shortcut to activate or add focus to the element.
106
+ */
107
+ accessKey?: string;
108
+ /**
109
+ * Indicates whether the element's content is editable.
110
+ */
111
+ contentEditable?: boolean | 'true' | 'false' | 'inherit';
112
+ /**
113
+ * Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left).
114
+ */
115
+ dir?: string;
116
+ /**
117
+ * Defines whether the element can be dragged.
118
+ */
119
+ draggable?: boolean;
120
+ /**
121
+ * Prevents rendering of given element, while keeping child elements, e.g. script elements, active.
122
+ */
123
+ hidden?: boolean;
124
+ /**
125
+ * Defines the language used in the element.
126
+ */
127
+ lang?: string;
128
+ /**
129
+ * Defines the role of an element in the context of accessibility.
130
+ */
131
+ role?: string;
132
+ /**
133
+ * Indicates whether spell checking is allowed for the element.
134
+ */
135
+ spellCheck?: boolean;
136
+ /**
137
+ * Defines CSS styles which will override styles previously set.
138
+ */
139
+ style?: React.CSSProperties;
140
+ /**
141
+ * Overrides the browser's default tab order and follows the one specified instead.
142
+ */
143
+ tabIndex?: number;
144
+ /**
145
+ * Text to be displayed in a tooltip when hovering over the element.
146
+ */
147
+ title?: string;
148
+ /**
149
+ * Number of times the button lost focus.
150
+ */
151
+ n_blur?: number;
152
+ /**
153
+ * Last time the button lost focus.
154
+ */
155
+ n_blur_timestamp?: number;
156
+ /**
157
+ * Number of times the button has been clicked.
158
+ */
159
+ n_clicks?: number;
160
+ /**
161
+ * Last time the button was clicked.
162
+ */
163
+ n_clicks_timestamp?: number;
164
+ };
165
+
166
+ export enum HTMLInputTypes {
167
+ // Only allowing the input types with wide browser compatibility
168
+ 'text' = 'text',
169
+ 'number' = 'number',
170
+ 'password' = 'password',
171
+ 'email' = 'email',
172
+ 'range' = 'range',
173
+ 'search' = 'search',
174
+ 'tel' = 'tel',
175
+ 'url' = 'url',
176
+ 'hidden' = 'hidden',
177
+ }
178
+
179
+ export interface InputProps extends BaseDccProps<InputProps> {
180
+ /**
181
+ * The value of the input
182
+ */
183
+ value?: string | number;
184
+ /**
185
+ * The type of control to render.
186
+ */
187
+ type?: HTMLInputTypes;
188
+ /**
189
+ * If true, changes to input will be sent back to the Dash server only on enter or when losing focus.
190
+ * If it's false, it will send the value back on every change.
191
+ * If a number, it will not send anything back to the Dash server until the user has stopped
192
+ * typing for that number of seconds.
193
+ */
194
+ debounce?: boolean | number;
195
+ /**
196
+ * A hint to the user of what can be entered in the control . The placeholder text must not contain carriage returns or line-feeds. Note: Do not use the placeholder attribute instead of a <label> element, their purposes are different. The <label> attribute describes the role of the form element (i.e. it indicates what kind of information is expected), and the placeholder attribute is a hint about the format that the content should take. There are cases in which the placeholder attribute is never displayed to the user, so the form must be understandable without it.
197
+ */
198
+ placeholder?: string | number;
199
+ /**
200
+ * Number of times the `Enter` key was pressed while the input had focus.
201
+ */
202
+ n_submit?: number;
203
+ /**
204
+ * Last time that `Enter` was pressed.
205
+ */
206
+ n_submit_timestamp?: number;
207
+ /**
208
+ * Provides a hint to the browser as to the type of data that might be
209
+ * entered by the user while editing the element or its contents.
210
+ */
211
+ inputMode?: /**
212
+ * Alphanumeric, non-prose content such as usernames and passwords.
213
+ */
214
+ | 'verbatim'
215
+ /**
216
+ * Latin-script input in the user's preferred language with typing aids such as text prediction enabled. For human-to-computer communication such as search boxes.
217
+ */
218
+ | 'latin'
219
+ /**
220
+ * As latin, but for human names.
221
+ */
222
+ | 'latin-name'
223
+ /**
224
+ * As latin, but with more aggressive typing aids. For human-to-human communication such as instant messaging or email.
225
+ */
226
+ | 'latin-prose'
227
+ /**
228
+ * As latin-prose, but for the user's secondary languages.
229
+ */
230
+ | 'full-width-latin'
231
+ /**
232
+ * Kana or romaji input, typically hiragana input, using full-width characters, with support for converting to kanji. Intended for Japanese text input.
233
+ */
234
+ | 'kana'
235
+ /**
236
+ * Katakana input, using full-width characters, with support for converting to kanji. Intended for Japanese text input.
237
+ */
238
+ | 'katakana'
239
+ /**
240
+ * Numeric input, including keys for the digits 0 to 9, the user's preferred thousands separator character, and the character for indicating negative numbers. Intended for numeric codes (e.g. credit card numbers). For actual numbers, prefer using type="number"
241
+ */
242
+ | 'numeric'
243
+ /**
244
+ * Telephone input, including asterisk and pound key. Use type="tel" if possible instead.
245
+ */
246
+ | 'tel'
247
+ /**
248
+ * Email input. Use type="email" if possible instead.
249
+ */
250
+ | 'email'
251
+ /**
252
+ * URL input. Use type="url" if possible instead.
253
+ */
254
+ | 'url';
255
+ /**
256
+ * This attribute indicates whether the value of the control can be automatically completed by the browser.
257
+ */
258
+ autoComplete?: string;
259
+ /**
260
+ * This attribute indicates that the user cannot modify the value of the control. The value of the attribute is irrelevant. If you need read-write access to the input value, do not add the "readonly" attribute. It is ignored if the value of the type attribute is hidden, range, color, checkbox, radio, file, or a button type (such as button or submit).
261
+ * readOnly is an HTML boolean attribute - it is enabled by a boolean or
262
+ * 'readOnly'. Alternative capitalizations `readonly` & `READONLY`
263
+ * are also acccepted.
264
+ */
265
+ readOnly?: boolean | 'readOnly' | 'readonly' | 'READONLY';
266
+ /**
267
+ * This attribute specifies that the user must fill in a value before submitting a form. It cannot be used when the type attribute is hidden, image, or a button type (submit, reset, or button). The :optional and :required CSS pseudo-classes will be applied to the field as appropriate.
268
+ * required is an HTML boolean attribute - it is enabled by a boolean or
269
+ * 'required'. Alternative capitalizations `REQUIRED`
270
+ * are also acccepted.
271
+ */
272
+ required?: boolean | 'required' | 'REQUIRED';
273
+ /**
274
+ * The element should be automatically focused after the page loaded.
275
+ * autoFocus is an HTML boolean attribute - it is enabled by a boolean or
276
+ * 'autoFocus'. Alternative capitalizations `autofocus` & `AUTOFOCUS`
277
+ * are also acccepted.
278
+ */
279
+ autoFocus?: boolean | 'autoFocus' | 'autofocus' | 'AUTOFOCUS';
280
+ /**
281
+ * If true, the input is disabled and can't be clicked on.
282
+ * disabled is an HTML boolean attribute - it is enabled by a boolean or
283
+ * 'disabled'. Alternative capitalizations `DISABLED`
284
+ */
285
+ disabled?: boolean | 'disabled' | 'DISABLED';
286
+ /**
287
+ * Identifies a list of pre-defined options to suggest to the user.
288
+ * The value must be the id of a <datalist> element in the same document.
289
+ * The browser displays only options that are valid values for this
290
+ * input element.
291
+ * This attribute is ignored when the type attribute's value is
292
+ * hidden, checkbox, radio, file, or a button type.
293
+ */
294
+ list?: string;
295
+ /**
296
+ * This Boolean attribute indicates whether the user can enter more than one value. This attribute applies when the type attribute is set to email or file, otherwise it is ignored.
297
+ */
298
+ multiple?: boolean;
299
+ /**
300
+ * Setting the value of this attribute to true indicates that the element needs to have its spelling and grammar checked. The value default indicates that the element is to act according to a default behavior, possibly based on the parent element's own spellcheck value. The value false indicates that the element should not be checked.
301
+ */
302
+ spellCheck?: boolean | 'true' | 'false';
303
+ /**
304
+ * The name of the control, which is submitted with the form data.
305
+ */
306
+ name?: string;
307
+ /**
308
+ * The minimum (numeric or date-time) value for this item, which must not be greater than its maximum (max attribute) value.
309
+ */
310
+ min?: string | number;
311
+ /**
312
+ * The maximum (numeric or date-time) value for this item, which must not be less than its minimum (min attribute) value.
313
+ */
314
+ max?: string | number;
315
+ /**
316
+ * Works with the min and max attributes to limit the increments at which a numeric or date-time value can be set. It can be the string any or a positive floating point number. If this attribute is not set to any, the control accepts only values at multiples of the step value greater than the minimum.
317
+ */
318
+ step?: string | number;
319
+ /**
320
+ * If the value of the type attribute is text, email, search, password, tel, or url, this attribute specifies the minimum number of characters (in Unicode code points) that the user can enter. For other control types, it is ignored.
321
+ */
322
+ minLength?: string | number;
323
+ /**
324
+ * If the value of the type attribute is text, email, search, password, tel, or url, this attribute specifies the maximum number of characters (in UTF-16 code units) that the user can enter. For other control types, it is ignored. It can exceed the value of the size attribute. If it is not specified, the user can enter an unlimited number of characters. Specifying a negative number results in the default behavior (i.e. the user can enter an unlimited number of characters). The constraint is evaluated only when the value of the attribute has been changed.
325
+ */
326
+ maxLength?: string | number;
327
+ /**
328
+ * A regular expression that the control's value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is text, search, tel, url, email, or password, otherwise it is ignored. The regular expression language is the same as JavaScript RegExp algorithm, with the 'u' parameter that makes it treat the pattern as a sequence of unicode code points. The pattern is not surrounded by forward slashes.
329
+ */
330
+ pattern?: string;
331
+ /**
332
+ * The offset into the element's text content of the first selected character. If there's no selection, this value indicates the offset to the character following the current text input cursor position (that is, the position the next character typed would occupy).
333
+ */
334
+ selectionStart?: string;
335
+ /**
336
+ * The offset into the element's text content of the last selected character. If there's no selection, this value indicates the offset to the character following the current text input cursor position (that is, the position the next character typed would occupy).
337
+ */
338
+ selectionEnd?: string;
339
+ /**
340
+ * The direction in which selection occurred. This is "forward" if the selection was made from left-to-right in an LTR locale or right-to-left in an RTL locale, or "backward" if the selection was made in the opposite direction. On platforms on which it's possible this value isn't known, the value can be "none"; for example, on macOS, the default direction is "none", then as the user begins to modify the selection using the keyboard, this will change to reflect the direction in which the selection is expanding.
341
+ */
342
+ selectionDirection?: string;
343
+ /**
344
+ * Number of times the input lost focus.
345
+ */
346
+ n_blur?: number;
347
+ /**
348
+ * Last time the input lost focus.
349
+ */
350
+ n_blur_timestamp?: number;
351
+ /**
352
+ * The initial size of the control. This value is in pixels unless the value of the type attribute is text or password, in which case it is an integer number of characters. Starting in, this attribute applies only when the type attribute is set to text, search, tel, url, email, or password, otherwise it is ignored. In addition, the size must be greater than zero. If you do not specify a size, a default value of 20 is used.' simply states "the user agent should ensure that at least that many characters are visible", but different characters can have different widths in certain fonts. In some browsers, a certain string with x characters will not be entirely visible even if size is defined to at least x.
353
+ */
354
+ size?: string;
355
+ /**
356
+ * The input's inline styles
357
+ */
358
+ style?: React.CSSProperties;
359
+ }
360
+
69
361
  export type SliderMarks = {
70
362
  [key: number]: string | {label: string; style?: React.CSSProperties};
71
363
  };
@@ -122,7 +414,7 @@ export type SliderTooltip = {
122
414
  transform?: string;
123
415
  };
124
416
 
125
- export interface SliderProps extends BaseComponentProps<SliderProps> {
417
+ export interface SliderProps extends BaseDccProps<SliderProps> {
126
418
  /**
127
419
  * Minimum allowed value of the slider
128
420
  */
@@ -209,7 +501,7 @@ export interface SliderProps extends BaseComponentProps<SliderProps> {
209
501
  verticalHeight?: number;
210
502
  }
211
503
 
212
- export interface RangeSliderProps extends BaseComponentProps<RangeSliderProps> {
504
+ export interface RangeSliderProps extends BaseDccProps<RangeSliderProps> {
213
505
  /**
214
506
  * Minimum allowed value of the slider
215
507
  */
@@ -356,7 +648,7 @@ export type OptionsArray = (OptionValue | DetailedOption)[];
356
648
  */
357
649
  export type OptionsDict = Record<string, string>;
358
650
 
359
- export interface DropdownProps extends BaseComponentProps<DropdownProps> {
651
+ export interface DropdownProps extends BaseDccProps<DropdownProps> {
360
652
  /**
361
653
  * An array of options {label: [string|number], value: [string|number]},
362
654
  * an optional disabled field can be used for each option
@@ -439,7 +731,7 @@ export interface DropdownProps extends BaseComponentProps<DropdownProps> {
439
731
  };
440
732
  }
441
733
 
442
- export interface ChecklistProps extends BaseComponentProps<ChecklistProps> {
734
+ export interface ChecklistProps extends BaseDccProps<ChecklistProps> {
443
735
  /**
444
736
  * An array of options
445
737
  */
@@ -484,7 +776,7 @@ export interface ChecklistProps extends BaseComponentProps<ChecklistProps> {
484
776
  labelClassName?: string;
485
777
  }
486
778
 
487
- export interface RadioItemsProps extends BaseComponentProps<RadioItemsProps> {
779
+ export interface RadioItemsProps extends BaseDccProps<RadioItemsProps> {
488
780
  /**
489
781
  * An array of options
490
782
  */
@@ -529,7 +821,7 @@ export interface RadioItemsProps extends BaseComponentProps<RadioItemsProps> {
529
821
  labelClassName?: string;
530
822
  }
531
823
 
532
- export interface TextAreaProps extends BaseComponentProps<TextAreaProps> {
824
+ export interface TextAreaProps extends BaseDccProps<TextAreaProps> {
533
825
  /**
534
826
  * The value of the textarea
535
827
  */
@@ -753,7 +1045,7 @@ export interface TooltipProps {
753
1045
  setProps: (props: Partial<TooltipProps>) => void;
754
1046
  }
755
1047
 
756
- export interface LoadingProps extends BaseComponentProps<LoadingProps> {
1048
+ export interface LoadingProps extends BaseDccProps<LoadingProps> {
757
1049
  /**
758
1050
  * Array that holds components to render
759
1051
  */
@@ -836,3 +1128,343 @@ export interface LoadingProps extends BaseComponentProps<LoadingProps> {
836
1128
  */
837
1129
  custom_spinner?: React.ReactNode;
838
1130
  }
1131
+
1132
+ export interface TabsProps extends BaseDccProps<TabsProps> {
1133
+ /**
1134
+ * The value of the currently selected Tab
1135
+ */
1136
+ value?: string;
1137
+
1138
+ /**
1139
+ * Appends a class to the Tab content container holding the children of the Tab that is selected.
1140
+ */
1141
+ content_className?: string;
1142
+
1143
+ /**
1144
+ * Appends a class to the top-level parent container holding both the Tabs container and the content container.
1145
+ */
1146
+ parent_className?: string;
1147
+
1148
+ /**
1149
+ * Appends (inline) styles to the Tabs container holding the individual Tab components.
1150
+ */
1151
+ style?: React.CSSProperties;
1152
+
1153
+ /**
1154
+ * Appends (inline) styles to the top-level parent container holding both the Tabs container and the content container.
1155
+ */
1156
+ parent_style?: React.CSSProperties;
1157
+
1158
+ /**
1159
+ * Appends (inline) styles to the tab content container holding the children of the Tab that is selected.
1160
+ */
1161
+ content_style?: React.CSSProperties;
1162
+
1163
+ /**
1164
+ * Renders the tabs vertically (on the side)
1165
+ */
1166
+ vertical?: boolean;
1167
+
1168
+ /**
1169
+ * Breakpoint at which tabs are rendered full width (can be 0 if you don't want full width tabs on mobile)
1170
+ */
1171
+ mobile_breakpoint?: number;
1172
+
1173
+ /**
1174
+ * Array that holds Tab components
1175
+ */
1176
+ children?: DashComponent;
1177
+
1178
+ /**
1179
+ * Holds the colors used by the Tabs and Tab components. If you set these, you should specify colors for all properties, so:
1180
+ * colors: {
1181
+ * border: '#d6d6d6',
1182
+ * primary: '#1975FA',
1183
+ * background: '#f9f9f9'
1184
+ * }
1185
+ */
1186
+ colors?: {
1187
+ border: string;
1188
+ primary: string;
1189
+ background: string;
1190
+ };
1191
+ }
1192
+
1193
+ // Note a quirk in how this extends the BaseDccProps: `setProps` is shared
1194
+ // with `TabsProps` (plural!) due to how tabs are implemented. This is
1195
+ // intentional.
1196
+ export interface TabProps extends BaseDccProps<TabsProps> {
1197
+ /**
1198
+ * The tab's label
1199
+ */
1200
+ label?: string | DashComponent;
1201
+
1202
+ /**
1203
+ * The content of the tab - will only be displayed if this tab is selected
1204
+ */
1205
+ children?: DashComponent;
1206
+
1207
+ /**
1208
+ * Value for determining which Tab is currently selected
1209
+ */
1210
+ value?: string;
1211
+
1212
+ /**
1213
+ * Determines if tab is disabled or not - defaults to false
1214
+ */
1215
+ disabled?: boolean;
1216
+
1217
+ /**
1218
+ * Overrides the default (inline) styles when disabled
1219
+ */
1220
+ disabled_style?: React.CSSProperties;
1221
+
1222
+ /**
1223
+ * Appends a class to the Tab component when it is disabled.
1224
+ */
1225
+ disabled_className?: string;
1226
+
1227
+ /**
1228
+ * Appends a class to the Tab component.
1229
+ */
1230
+ className?: string;
1231
+
1232
+ /**
1233
+ * Appends a class to the Tab component when it is selected.
1234
+ */
1235
+ selected_className?: string;
1236
+
1237
+ /**
1238
+ * Overrides the default (inline) styles for the Tab component.
1239
+ */
1240
+ style?: React.CSSProperties;
1241
+
1242
+ /**
1243
+ * Overrides the default (inline) styles for the Tab component when it is selected.
1244
+ */
1245
+ selected_style?: React.CSSProperties;
1246
+
1247
+ /**
1248
+ * A custom width for this tab, in the format of `50px` or `50%`; numbers
1249
+ * are treated as pixel values. By default, there is no width and this Tab
1250
+ * is evenly spaced along with all the other tabs to occupy the available
1251
+ * space. Setting this value will "fix" this tab width to the given size.
1252
+ * while the other "non-fixed" tabs will continue to automatically
1253
+ * occupying the remaining available space.
1254
+ * This property has no effect when tabs are displayed vertically.
1255
+ */
1256
+ width?: string | number;
1257
+ }
1258
+
1259
+ export enum DayOfWeek {
1260
+ Sunday = 0,
1261
+ Monday = 1,
1262
+ Tuesday = 2,
1263
+ Wednesday = 3,
1264
+ Thursday = 4,
1265
+ Friday = 5,
1266
+ Saturday = 6,
1267
+ }
1268
+
1269
+ export enum CalendarDirection {
1270
+ LeftToRight = 'ltr',
1271
+ RightToLeft = 'rtl',
1272
+ }
1273
+
1274
+ export interface DatePickerSingleProps
1275
+ extends BaseDccProps<DatePickerSingleProps> {
1276
+ /**
1277
+ * Specifies the starting date for the component, best practice is to pass
1278
+ * value via datetime object
1279
+ */
1280
+ date?: `${string}-${string}-${string}`;
1281
+
1282
+ /**
1283
+ * Specifies the lowest selectable date for the component.
1284
+ * Accepts datetime.datetime objects or strings
1285
+ * in the format 'YYYY-MM-DD'
1286
+ */
1287
+ min_date_allowed?: string;
1288
+
1289
+ /**
1290
+ * Specifies the highest selectable date for the component.
1291
+ * Accepts datetime.datetime objects or strings
1292
+ * in the format 'YYYY-MM-DD'
1293
+ */
1294
+ max_date_allowed?: string;
1295
+
1296
+ /**
1297
+ * Specifies additional days between min_date_allowed and max_date_allowed
1298
+ * that should be disabled. Accepted datetime.datetime objects or strings
1299
+ * in the format 'YYYY-MM-DD'
1300
+ */
1301
+ disabled_days?: string[];
1302
+
1303
+ /**
1304
+ * Text that will be displayed in the input
1305
+ * box of the date picker when no date is selected.
1306
+ */
1307
+ placeholder?: string;
1308
+
1309
+ /**
1310
+ * Specifies the month that is initially presented when the user
1311
+ * opens the calendar. Accepts datetime.datetime objects or strings
1312
+ * in the format 'YYYY-MM-DD'
1313
+ *
1314
+ */
1315
+ initial_visible_month?: string;
1316
+
1317
+ /**
1318
+ * Whether or not the dropdown is "clearable", that is, whether or
1319
+ * not a small "x" appears on the right of the dropdown that removes
1320
+ * the selected value.
1321
+ */
1322
+ clearable?: boolean;
1323
+
1324
+ /**
1325
+ * If True, the calendar will automatically open when cleared
1326
+ */
1327
+ reopen_calendar_on_clear?: boolean;
1328
+
1329
+ /**
1330
+ * Specifies the format that the selected dates will be displayed
1331
+ * valid formats are variations of "MM YY DD". For example:
1332
+ * "MM YY DD" renders as '05 10 97' for May 10th 1997
1333
+ * "MMMM, YY" renders as 'May, 1997' for May 10th 1997
1334
+ * "M, D, YYYY" renders as '07, 10, 1997' for September 10th 1997
1335
+ * "MMMM" renders as 'May' for May 10 1997
1336
+ */
1337
+ display_format?: string;
1338
+
1339
+ /**
1340
+ * Specifies the format that the month will be displayed in the calendar,
1341
+ * valid formats are variations of "MM YY". For example:
1342
+ * "MM YY" renders as '05 97' for May 1997
1343
+ * "MMMM, YYYY" renders as 'May, 1997' for May 1997
1344
+ * "MMM, YY" renders as 'Sep, 97' for September 1997
1345
+ */
1346
+ month_format?: string;
1347
+
1348
+ /**
1349
+ * Specifies what day is the first day of the week, values must be
1350
+ * from [0, ..., 6] with 0 denoting Sunday and 6 denoting Saturday
1351
+ */
1352
+ first_day_of_week?: DayOfWeek;
1353
+
1354
+ /**
1355
+ * If True the calendar will display days that rollover into
1356
+ * the next month
1357
+ */
1358
+ show_outside_days?: boolean;
1359
+
1360
+ /**
1361
+ * If True the calendar will not close when the user has selected a value
1362
+ * and will wait until the user clicks off the calendar
1363
+ */
1364
+ stay_open_on_select?: boolean;
1365
+
1366
+ /**
1367
+ * Orientation of calendar, either vertical or horizontal.
1368
+ * Valid options are 'vertical' or 'horizontal'.
1369
+ */
1370
+ calendar_orientation?: 'vertical' | 'horizontal';
1371
+
1372
+ /**
1373
+ * Number of calendar months that are shown when calendar is opened
1374
+ */
1375
+ number_of_months_shown?: number;
1376
+
1377
+ /**
1378
+ * If True, calendar will open in a screen overlay portal,
1379
+ * not supported on vertical calendar
1380
+ */
1381
+ with_portal?: boolean;
1382
+
1383
+ /**
1384
+ * If True, calendar will open in a full screen overlay portal, will
1385
+ * take precedent over 'withPortal' if both are set to True,
1386
+ * not supported on vertical calendar
1387
+ */
1388
+ with_full_screen_portal?: boolean;
1389
+
1390
+ /**
1391
+ * Size of rendered calendar days, higher number
1392
+ * means bigger day size and larger calendar overall
1393
+ */
1394
+ day_size?: number;
1395
+
1396
+ /**
1397
+ * Determines whether the calendar and days operate
1398
+ * from left to right or from right to left
1399
+ */
1400
+ is_RTL?: boolean;
1401
+
1402
+ /**
1403
+ * If True, no dates can be selected.
1404
+ */
1405
+ disabled?: boolean;
1406
+
1407
+ /**
1408
+ * CSS styles appended to wrapper div
1409
+ */
1410
+ style?: React.CSSProperties;
1411
+ }
1412
+
1413
+ export interface DatePickerRangeProps
1414
+ extends Omit<DatePickerSingleProps, 'date'> {
1415
+ /**
1416
+ * Specifies the starting date for the component.
1417
+ * Accepts datetime.datetime objects or strings
1418
+ * in the format 'YYYY-MM-DD'
1419
+ */
1420
+ start_date?: `${string}-${string}-${string}`;
1421
+
1422
+ /**
1423
+ * Specifies the ending date for the component.
1424
+ * Accepts datetime.datetime objects or strings
1425
+ * in the format 'YYYY-MM-DD'
1426
+ */
1427
+ end_date?: `${string}-${string}-${string}`;
1428
+
1429
+ /**
1430
+ * Specifies a minimum number of nights that must be selected between
1431
+ * the startDate and the endDate
1432
+ */
1433
+ minimum_nights?: number;
1434
+
1435
+ /**
1436
+ * Determines when the component should update
1437
+ * its value. If `bothdates`, then the DatePicker
1438
+ * will only trigger its value when the user has
1439
+ * finished picking both dates. If `singledate`, then
1440
+ * the DatePicker will update its value
1441
+ * as one date is picked.
1442
+ */
1443
+ updatemode?: 'singledate' | 'bothdates';
1444
+
1445
+ /**
1446
+ * Text that will be displayed in the first input
1447
+ * box of the date picker when no date is selected. Default value is 'Start Date'
1448
+ */
1449
+ start_date_placeholder_text?: string;
1450
+
1451
+ /**
1452
+ * Text that will be displayed in the second input
1453
+ * box of the date picker when no date is selected. Default value is 'End Date'
1454
+ */
1455
+ end_date_placeholder_text?: string;
1456
+
1457
+ /**
1458
+ * The HTML element ID of the start date input field.
1459
+ * Not used by Dash, only by CSS.
1460
+ */
1461
+ start_date_id?: string;
1462
+
1463
+ /**
1464
+ * The HTML element ID of the end date input field.
1465
+ * Not used by Dash, only by CSS.
1466
+ */
1467
+ end_date_id?: string;
1468
+
1469
+ setProps: (props: Partial<DatePickerRangeProps>) => void;
1470
+ }