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
@@ -1,209 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.propTypes = exports.defaultProps = exports.default = void 0;
7
- var _propTypes = _interopRequireDefault(require("prop-types"));
8
- var _react = _interopRequireWildcard(require("react"));
9
- var _datePickerSingle = _interopRequireDefault(require("../utils/LazyLoader/datePickerSingle"));
10
- var _DatePickerPersistence = _interopRequireDefault(require("../utils/DatePickerPersistence"));
11
- 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); }
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
- var RealDateSingleRange = /*#__PURE__*/(0, _react.lazy)(_datePickerSingle.default);
14
-
15
- /**
16
- * DatePickerSingle is a tailor made component designed for selecting
17
- * a single day off of a calendar.
18
- *
19
- * The DatePicker integrates well with the Python datetime module with the
20
- * startDate and endDate being returned in a string format suitable for
21
- * creating datetime objects.
22
- *
23
- * This component is based off of Airbnb's react-dates react component
24
- * which can be found here: https://github.com/airbnb/react-dates
25
- */
26
- class DatePickerSingle extends _react.Component {
27
- render() {
28
- return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
29
- fallback: null
30
- }, /*#__PURE__*/_react.default.createElement(RealDateSingleRange, this.props));
31
- }
32
- }
33
- exports.default = DatePickerSingle;
34
- DatePickerSingle.propTypes = {
35
- /**
36
- * Specifies the starting date for the component, best practice is to pass
37
- * value via datetime object
38
- */
39
- date: _propTypes.default.string,
40
- /**
41
- * Specifies the lowest selectable date for the component.
42
- * Accepts datetime.datetime objects or strings
43
- * in the format 'YYYY-MM-DD'
44
- */
45
- min_date_allowed: _propTypes.default.string,
46
- /**
47
- * Specifies the highest selectable date for the component.
48
- * Accepts datetime.datetime objects or strings
49
- * in the format 'YYYY-MM-DD'
50
- */
51
- max_date_allowed: _propTypes.default.string,
52
- /**
53
- * Specifies additional days between min_date_allowed and max_date_allowed
54
- * that should be disabled. Accepted datetime.datetime objects or strings
55
- * in the format 'YYYY-MM-DD'
56
- */
57
- disabled_days: _propTypes.default.arrayOf(_propTypes.default.string),
58
- /**
59
- * Text that will be displayed in the input
60
- * box of the date picker when no date is selected.
61
- * Default value is 'Start Date'
62
- */
63
- placeholder: _propTypes.default.string,
64
- /**
65
- * Specifies the month that is initially presented when the user
66
- * opens the calendar. Accepts datetime.datetime objects or strings
67
- * in the format 'YYYY-MM-DD'
68
- *
69
- */
70
- initial_visible_month: _propTypes.default.string,
71
- /**
72
- * Whether or not the dropdown is "clearable", that is, whether or
73
- * not a small "x" appears on the right of the dropdown that removes
74
- * the selected value.
75
- */
76
- clearable: _propTypes.default.bool,
77
- /**
78
- * If True, the calendar will automatically open when cleared
79
- */
80
- reopen_calendar_on_clear: _propTypes.default.bool,
81
- /**
82
- * Specifies the format that the selected dates will be displayed
83
- * valid formats are variations of "MM YY DD". For example:
84
- * "MM YY DD" renders as '05 10 97' for May 10th 1997
85
- * "MMMM, YY" renders as 'May, 1997' for May 10th 1997
86
- * "M, D, YYYY" renders as '07, 10, 1997' for September 10th 1997
87
- * "MMMM" renders as 'May' for May 10 1997
88
- */
89
- display_format: _propTypes.default.string,
90
- /**
91
- * Specifies the format that the month will be displayed in the calendar,
92
- * valid formats are variations of "MM YY". For example:
93
- * "MM YY" renders as '05 97' for May 1997
94
- * "MMMM, YYYY" renders as 'May, 1997' for May 1997
95
- * "MMM, YY" renders as 'Sep, 97' for September 1997
96
- */
97
- month_format: _propTypes.default.string,
98
- /**
99
- * Specifies what day is the first day of the week, values must be
100
- * from [0, ..., 6] with 0 denoting Sunday and 6 denoting Saturday
101
- */
102
- first_day_of_week: _propTypes.default.oneOf([0, 1, 2, 3, 4, 5, 6]),
103
- /**
104
- * If True the calendar will display days that rollover into
105
- * the next month
106
- */
107
- show_outside_days: _propTypes.default.bool,
108
- /**
109
- * If True the calendar will not close when the user has selected a value
110
- * and will wait until the user clicks off the calendar
111
- */
112
- stay_open_on_select: _propTypes.default.bool,
113
- /**
114
- * Orientation of calendar, either vertical or horizontal.
115
- * Valid options are 'vertical' or 'horizontal'.
116
- */
117
- calendar_orientation: _propTypes.default.oneOf(['vertical', 'horizontal']),
118
- /**
119
- * Number of calendar months that are shown when calendar is opened
120
- */
121
- number_of_months_shown: _propTypes.default.number,
122
- /**
123
- * If True, calendar will open in a screen overlay portal,
124
- * not supported on vertical calendar
125
- */
126
- with_portal: _propTypes.default.bool,
127
- /**
128
- * If True, calendar will open in a full screen overlay portal, will
129
- * take precedent over 'withPortal' if both are set to True,
130
- * not supported on vertical calendar
131
- */
132
- with_full_screen_portal: _propTypes.default.bool,
133
- /**
134
- * Size of rendered calendar days, higher number
135
- * means bigger day size and larger calendar overall
136
- */
137
- day_size: _propTypes.default.number,
138
- /**
139
- * Determines whether the calendar and days operate
140
- * from left to right or from right to left
141
- */
142
- is_RTL: _propTypes.default.bool,
143
- /**
144
- * If True, no dates can be selected.
145
- */
146
- disabled: _propTypes.default.bool,
147
- /**
148
- * CSS styles appended to wrapper div
149
- */
150
- style: _propTypes.default.object,
151
- /**
152
- * Appends a CSS class to the wrapper div component.
153
- */
154
- className: _propTypes.default.string,
155
- /**
156
- * The ID of this component, used to identify dash components
157
- * in callbacks. The ID needs to be unique across all of the
158
- * components in an app.
159
- */
160
- id: _propTypes.default.string,
161
- /**
162
- * Dash-assigned callback that gets fired when the value changes.
163
- */
164
- setProps: _propTypes.default.func,
165
- /**
166
- * Used to allow user interactions in this component to be persisted when
167
- * the component - or the page - is refreshed. If `persisted` is truthy and
168
- * hasn't changed from its previous value, a `date` that the user has
169
- * changed while using the app will keep that change, as long as
170
- * the new `date` also matches what was given originally.
171
- * Used in conjunction with `persistence_type`.
172
- */
173
- persistence: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.string, _propTypes.default.number]),
174
- /**
175
- * Properties whose user interactions will persist after refreshing the
176
- * component or the page. Since only `date` is allowed this prop can
177
- * normally be ignored.
178
- */
179
- persisted_props: _propTypes.default.arrayOf(_propTypes.default.oneOf(['date'])),
180
- /**
181
- * Where persisted user changes will be stored:
182
- * memory: only kept in memory, reset on page refresh.
183
- * local: window.localStorage, data is kept after the browser quit.
184
- * session: window.sessionStorage, data is cleared once the browser quit.
185
- */
186
- persistence_type: _propTypes.default.oneOf(['local', 'session', 'memory'])
187
- };
188
- DatePickerSingle.persistenceTransforms = {
189
- date: _DatePickerPersistence.default
190
- };
191
- DatePickerSingle.defaultProps = {
192
- calendar_orientation: 'horizontal',
193
- is_RTL: false,
194
- day_size: 39,
195
- with_portal: false,
196
- with_full_screen_portal: false,
197
- show_outside_days: true,
198
- first_day_of_week: 0,
199
- number_of_months_shown: 1,
200
- stay_open_on_select: false,
201
- reopen_calendar_on_clear: false,
202
- clearable: false,
203
- disabled: false,
204
- persisted_props: ['date'],
205
- persistence_type: 'local',
206
- disabled_days: []
207
- };
208
- var propTypes = exports.propTypes = DatePickerSingle.propTypes;
209
- var defaultProps = exports.defaultProps = DatePickerSingle.defaultProps;
@@ -1,228 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React, {Component, lazy, Suspense} from 'react';
3
- import dropdown from '../utils/LazyLoader/dropdown';
4
-
5
- const RealDropdown = lazy(dropdown);
6
-
7
- /**
8
- * Dropdown is an interactive dropdown element for selecting one or more
9
- * items.
10
- * The values and labels of the dropdown items are specified in the `options`
11
- * property and the selected item(s) are specified with the `value` property.
12
- *
13
- * Use a dropdown when you have many options (more than 5) or when you are
14
- * constrained for space. Otherwise, you can use RadioItems or a Checklist,
15
- * which have the benefit of showing the users all of the items at once.
16
- */
17
- export default class Dropdown extends Component {
18
- render() {
19
- return (
20
- <Suspense fallback={null}>
21
- <RealDropdown {...this.props} />
22
- </Suspense>
23
- );
24
- }
25
- }
26
-
27
- Dropdown.propTypes = {
28
- /**
29
- * An array of options {label: [string|number], value: [string|number]},
30
- * an optional disabled field can be used for each option
31
- */
32
- options: PropTypes.oneOfType([
33
- /**
34
- * Array of options where the label and the value are the same thing - [string|number|bool]
35
- */
36
- PropTypes.arrayOf(
37
- PropTypes.oneOfType([
38
- PropTypes.string,
39
- PropTypes.number,
40
- PropTypes.bool,
41
- ])
42
- ),
43
- /**
44
- * Simpler `options` representation in dictionary format. The order is not guaranteed.
45
- * {`value1`: `label1`, `value2`: `label2`, ... }
46
- * which is equal to
47
- * [{label: `label1`, value: `value1`}, {label: `label2`, value: `value2`}, ...]
48
- */
49
- PropTypes.object,
50
- /**
51
- * An array of options {label: [string|number], value: [string|number]},
52
- * an optional disabled field can be used for each option
53
- */
54
- PropTypes.arrayOf(
55
- PropTypes.exact({
56
- /**
57
- * The option's label
58
- */
59
- label: PropTypes.node.isRequired,
60
-
61
- /**
62
- * The value of the option. This value
63
- * corresponds to the items specified in the
64
- * `value` property.
65
- */
66
- value: PropTypes.oneOfType([
67
- PropTypes.string,
68
- PropTypes.number,
69
- PropTypes.bool,
70
- ]).isRequired,
71
-
72
- /**
73
- * If true, this option is disabled and cannot be selected.
74
- */
75
- disabled: PropTypes.bool,
76
-
77
- /**
78
- * The HTML 'title' attribute for the option. Allows for
79
- * information on hover. For more information on this attribute,
80
- * see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title
81
- */
82
- title: PropTypes.string,
83
-
84
- /**
85
- * Optional search value for the option, to use if the label
86
- * is a component or provide a custom search value different
87
- * from the label. If no search value and the label is a
88
- * component, the `value` will be used for search.
89
- */
90
- search: PropTypes.string,
91
- })
92
- ),
93
- ]),
94
-
95
- /**
96
- * The value of the input. If `multi` is false (the default)
97
- * then value is just a string that corresponds to the values
98
- * provided in the `options` property. If `multi` is true, then
99
- * multiple values can be selected at once, and `value` is an
100
- * array of items with values corresponding to those in the
101
- * `options` prop.
102
- */
103
- value: PropTypes.oneOfType([
104
- PropTypes.string,
105
- PropTypes.number,
106
- PropTypes.bool,
107
- PropTypes.arrayOf(
108
- PropTypes.oneOfType([
109
- PropTypes.string,
110
- PropTypes.number,
111
- PropTypes.bool,
112
- ])
113
- ),
114
- ]),
115
-
116
- /**
117
- * If true, the user can select multiple values
118
- */
119
- multi: PropTypes.bool,
120
-
121
- /**
122
- * Whether or not the dropdown is "clearable", that is, whether or
123
- * not a small "x" appears on the right of the dropdown that removes
124
- * the selected value.
125
- */
126
- clearable: PropTypes.bool,
127
-
128
- /**
129
- * Whether to enable the searching feature or not
130
- */
131
- searchable: PropTypes.bool,
132
-
133
- /**
134
- * The value typed in the DropDown for searching.
135
- */
136
- search_value: PropTypes.string,
137
-
138
- /**
139
- * The grey, default text shown when no option is selected
140
- */
141
- placeholder: PropTypes.string,
142
-
143
- /**
144
- * If true, this dropdown is disabled and the selection cannot be changed.
145
- */
146
- disabled: PropTypes.bool,
147
-
148
- /**
149
- * If false, the menu of the dropdown will not close once a value is selected.
150
- */
151
- closeOnSelect: PropTypes.bool,
152
-
153
- /**
154
- * height of each option. Can be increased when label lengths would wrap around
155
- */
156
- optionHeight: PropTypes.number,
157
-
158
- /**
159
- * height of the options dropdown.
160
- */
161
- maxHeight: PropTypes.number,
162
-
163
- /**
164
- * Defines CSS styles which will override styles previously set.
165
- */
166
- style: PropTypes.object,
167
-
168
- /**
169
- * className of the dropdown element
170
- */
171
- className: PropTypes.string,
172
-
173
- /**
174
- * The ID of this component, used to identify dash components
175
- * in callbacks. The ID needs to be unique across all of the
176
- * components in an app.
177
- */
178
- id: PropTypes.string,
179
-
180
- /**
181
- * Dash-assigned callback that gets fired when the input changes
182
- */
183
- setProps: PropTypes.func,
184
-
185
- /**
186
- * Used to allow user interactions in this component to be persisted when
187
- * the component - or the page - is refreshed. If `persisted` is truthy and
188
- * hasn't changed from its previous value, a `value` that the user has
189
- * changed while using the app will keep that change, as long as
190
- * the new `value` also matches what was given originally.
191
- * Used in conjunction with `persistence_type`.
192
- */
193
- persistence: PropTypes.oneOfType([
194
- PropTypes.bool,
195
- PropTypes.string,
196
- PropTypes.number,
197
- ]),
198
-
199
- /**
200
- * Properties whose user interactions will persist after refreshing the
201
- * component or the page. Since only `value` is allowed this prop can
202
- * normally be ignored.
203
- */
204
- persisted_props: PropTypes.arrayOf(PropTypes.oneOf(['value'])),
205
-
206
- /**
207
- * Where persisted user changes will be stored:
208
- * memory: only kept in memory, reset on page refresh.
209
- * local: window.localStorage, data is kept after the browser quit.
210
- * session: window.sessionStorage, data is cleared once the browser quit.
211
- */
212
- persistence_type: PropTypes.oneOf(['local', 'session', 'memory']),
213
- };
214
-
215
- Dropdown.defaultProps = {
216
- clearable: true,
217
- disabled: false,
218
- multi: false,
219
- searchable: true,
220
- optionHeight: 35,
221
- maxHeight: 200,
222
- closeOnSelect: true,
223
- persisted_props: ['value'],
224
- persistence_type: 'local',
225
- };
226
-
227
- export const propTypes = Dropdown.propTypes;
228
- export const defaultProps = Dropdown.defaultProps;
@@ -1,80 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- 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); }
11
- /**
12
- * Part of dcc.Tabs - this is the child Tab component used to render a tabbed page.
13
- * Its children will be set as the content of that tab, which if clicked will become visible.
14
- */
15
-
16
- /* eslint-disable no-unused-vars */
17
- var Tab = _ref => {
18
- var children = _ref.children,
19
- _ref$disabled = _ref.disabled,
20
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
21
- _ref$disabled_style = _ref.disabled_style,
22
- disabled_style = _ref$disabled_style === void 0 ? {
23
- color: '#d6d6d6'
24
- } : _ref$disabled_style;
25
- return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, children);
26
- };
27
- /* eslint-enable no-unused-vars */
28
-
29
- // Default props are defined above for proper docstring generation in React 18.
30
- // The actual default values are set in Tabs.react.js.
31
-
32
- Tab.propTypes = {
33
- /**
34
- * The ID of this component, used to identify dash components
35
- * in callbacks. The ID needs to be unique across all of the
36
- * components in an app.
37
- */
38
- id: _propTypes.default.string,
39
- /**
40
- * The tab's label
41
- */
42
- label: _propTypes.default.string,
43
- /**
44
- * The content of the tab - will only be displayed if this tab is selected
45
- */
46
- children: _propTypes.default.node,
47
- /**
48
- * Value for determining which Tab is currently selected
49
- */
50
- value: _propTypes.default.string,
51
- /**
52
- * Determines if tab is disabled or not - defaults to false
53
- */
54
- disabled: _propTypes.default.bool,
55
- /**
56
- * Overrides the default (inline) styles when disabled
57
- */
58
- disabled_style: _propTypes.default.object,
59
- /**
60
- * Appends a class to the Tab component when it is disabled.
61
- */
62
- disabled_className: _propTypes.default.string,
63
- /**
64
- * Appends a class to the Tab component.
65
- */
66
- className: _propTypes.default.string,
67
- /**
68
- * Appends a class to the Tab component when it is selected.
69
- */
70
- selected_className: _propTypes.default.string,
71
- /**
72
- * Overrides the default (inline) styles for the Tab component.
73
- */
74
- style: _propTypes.default.object,
75
- /**
76
- * Overrides the default (inline) styles for the Tab component when it is selected.
77
- */
78
- selected_style: _propTypes.default.object
79
- };
80
- var _default = exports.default = Tab;
@@ -1,79 +0,0 @@
1
- import React, {Fragment} from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- /**
5
- * Part of dcc.Tabs - this is the child Tab component used to render a tabbed page.
6
- * Its children will be set as the content of that tab, which if clicked will become visible.
7
- */
8
-
9
- /* eslint-disable no-unused-vars */
10
- const Tab = ({
11
- children,
12
- disabled = false,
13
- disabled_style = {color: '#d6d6d6'},
14
- }) => <Fragment>{children}</Fragment>;
15
- /* eslint-enable no-unused-vars */
16
-
17
- // Default props are defined above for proper docstring generation in React 18.
18
- // The actual default values are set in Tabs.react.js.
19
-
20
- Tab.propTypes = {
21
- /**
22
- * The ID of this component, used to identify dash components
23
- * in callbacks. The ID needs to be unique across all of the
24
- * components in an app.
25
- */
26
- id: PropTypes.string,
27
-
28
- /**
29
- * The tab's label
30
- */
31
- label: PropTypes.string,
32
-
33
- /**
34
- * The content of the tab - will only be displayed if this tab is selected
35
- */
36
- children: PropTypes.node,
37
-
38
- /**
39
- * Value for determining which Tab is currently selected
40
- */
41
- value: PropTypes.string,
42
-
43
- /**
44
- * Determines if tab is disabled or not - defaults to false
45
- */
46
- disabled: PropTypes.bool,
47
-
48
- /**
49
- * Overrides the default (inline) styles when disabled
50
- */
51
- disabled_style: PropTypes.object,
52
-
53
- /**
54
- * Appends a class to the Tab component when it is disabled.
55
- */
56
- disabled_className: PropTypes.string,
57
-
58
- /**
59
- * Appends a class to the Tab component.
60
- */
61
- className: PropTypes.string,
62
-
63
- /**
64
- * Appends a class to the Tab component when it is selected.
65
- */
66
- selected_className: PropTypes.string,
67
-
68
- /**
69
- * Overrides the default (inline) styles for the Tab component.
70
- */
71
- style: PropTypes.object,
72
-
73
- /**
74
- * Overrides the default (inline) styles for the Tab component when it is selected.
75
- */
76
- selected_style: PropTypes.object,
77
- };
78
-
79
- export default Tab;