@councilbox/councilbox-ui 2.0.54 → 2.0.56
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.
- package/Accordion.js +3 -0
- package/Alert.js +3 -0
- package/Avatar.js +3 -0
- package/AvatarGroup.js +3 -0
- package/Block.js +3 -0
- package/Button.js +3 -0
- package/ButtonBasic.js +3 -0
- package/Checkbox.js +3 -0
- package/DatePicker.js +3 -0
- package/DateRangePicker.js +3 -0
- package/DateTimePicker.js +3 -0
- package/DragDrop.js +3 -0
- package/DrawerPanel.js +3 -0
- package/DropDown.js +3 -0
- package/EnhancedTable.js +3 -0
- package/FabButton.js +3 -0
- package/Grid.js +3 -0
- package/Header.js +3 -0
- package/IconButton.js +3 -0
- package/IconButtonSquare.js +3 -0
- package/IconFont.js +3 -0
- package/InputAutocomplete.js +3 -0
- package/InputPassword.js +3 -0
- package/InputText.js +3 -0
- package/InputTextArea.js +3 -0
- package/LoadingSection.js +3 -0
- package/MenuItem.js +3 -0
- package/MenuLateralLeft.js +3 -0
- package/MenuLateralRight.js +3 -0
- package/Modal.js +3 -0
- package/Radio.js +3 -0
- package/RichTextInput.js +3 -0
- package/Scrollbar.js +3 -0
- package/ScrollbarOld.js +3 -0
- package/SelectInput.js +3 -0
- package/Slider.js +3 -0
- package/Spacing.js +3 -0
- package/Stars.js +3 -0
- package/Stepper.js +3 -0
- package/Table.js +3 -0
- package/TableBody.js +3 -0
- package/TableCell.js +3 -0
- package/TableContainer.js +3 -0
- package/TableHead.js +3 -0
- package/TableRow.js +3 -0
- package/TableSortLabel.js +3 -0
- package/Tabs.js +3 -0
- package/Tag.js +3 -0
- package/TextInput.js +3 -0
- package/ThemeProvider.js +3 -0
- package/TimePicker.js +3 -0
- package/Timeline.js +3 -0
- package/ToastProvider.js +3 -0
- package/Toggle.js +3 -0
- package/Tooltip.js +3 -0
- package/Typography.js +3 -0
- package/dist/HOCs/useDynamicStyles.js +25 -24
- package/dist/HOCs/usePopoverPosition.js +2 -0
- package/dist/build-index.js +70 -0
- package/dist/components/1.Introduction.stories.mdx +4 -1
- package/dist/components/2.Changelog.stories.mdx +25 -2
- package/dist/components/Button/Button.js +15 -0
- package/dist/components/ButtonBasic/ButtonBasic.js +15 -0
- package/dist/components/Checkbox/Checkbox.js +2 -2
- package/dist/components/DatePicker/Calendar.js +243 -0
- package/dist/components/DatePicker/DatePicker.css +197 -0
- package/dist/components/DatePicker/DatePicker.js +465 -0
- package/dist/components/DatePicker/DatePicker.stories.js +180 -0
- package/dist/components/DatePicker/dateUtils.js +525 -0
- package/dist/components/DateRangePicker/DateRangePicker.css +41 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +530 -0
- package/dist/components/DateRangePicker/DateRangePicker.stories.js +147 -0
- package/dist/components/DateRangePicker/RangeCalendar.js +188 -0
- package/dist/components/DateTimePicker/DateTimePicker.css +4 -0
- package/dist/components/DateTimePicker/DateTimePicker.js +541 -0
- package/dist/components/DateTimePicker/DateTimePicker.stories.js +144 -0
- package/dist/components/DateTimePicker/TimeColumns.css +46 -0
- package/dist/components/DateTimePicker/TimeColumns.js +175 -0
- package/dist/components/DragDrop/DragDrop.js +21 -5
- package/dist/components/DropDown/DesignDropDown.stories.js +8 -0
- package/dist/components/DropDown/DropDown.js +14 -4
- package/dist/components/Header/Header.js +134 -25
- package/dist/components/IconButton/IconButton.js +3 -2
- package/dist/components/IconButtonSquare/IconButtonSquare.js +3 -3
- package/dist/components/InputAutocomplete/InputAutocomplete.js +17 -2
- package/dist/components/InputPassword/InputPassword.js +14 -1
- package/dist/components/InputText/InputText.css +10 -5
- package/dist/components/InputText/InputText.js +4 -4
- package/dist/components/InputTextArea/InputTextArea.js +14 -0
- package/dist/components/LoadingSection/LoadingSection.js +16 -4
- package/dist/components/MenuItem/MenuItem.js +78 -61
- package/dist/components/MenuLateralLeft/MenuLateralLeft.js +16 -2
- package/dist/components/MenuLateralRight/MenuLateralRight.js +34 -4
- package/dist/components/Modal/Modal.js +16 -1
- package/dist/components/RadioButton/Radio.js +15 -0
- package/dist/components/RichTextInput/DesignRichTextInput.stories.js +119 -0
- package/dist/components/RichTextInput/RichTextInput.css +352 -0
- package/dist/components/RichTextInput/RichTextInput.js +1057 -0
- package/dist/components/RichTextInput/RichTextInput.stories.js +33 -0
- package/dist/components/Ripple/DesignRipple.js +17 -0
- package/dist/components/Scrollbar/Scrollbar.css +60 -19
- package/dist/components/Scrollbar/Scrollbar.js +384 -62
- package/dist/components/ScrollbarOld/DesignScrollbarOld.js +24 -0
- package/dist/components/ScrollbarOld/ScrollbarOld.css +38 -0
- package/dist/components/ScrollbarOld/ScrollbarOld.js +104 -0
- package/dist/components/ScrollbarOld/ScrollbarOld.stories.js +37 -0
- package/dist/components/SelectInput/SelectInput.js +112 -86
- package/dist/components/Slider/Slider.js +15 -0
- package/dist/components/Stars/Stars.js +13 -0
- package/dist/components/Stepper/Stepper.js +15 -2
- package/dist/components/Table/TableSortLabel.js +11 -0
- package/dist/components/Tabs/DesignTabs.js +1 -1
- package/dist/components/Tabs/Tabs.js +13 -2
- package/dist/components/Tag/Tag.js +16 -0
- package/dist/components/TextInput/TextInput.js +13 -0
- package/dist/components/TimePicker/TimePicker.css +3 -0
- package/dist/components/TimePicker/TimePicker.js +441 -0
- package/dist/components/TimePicker/TimePicker.stories.js +132 -0
- package/dist/components/Toast/DesignToast.stories.js +174 -0
- package/dist/components/Toast/Toast.css +154 -0
- package/dist/components/Toast/Toast.js +178 -0
- package/dist/components/Toast/Toast.stories.js +33 -0
- package/dist/components/Toast/ToastProvider.js +33 -0
- package/dist/components/Toast/ToastRoot.js +89 -0
- package/dist/components/Toast/toastStore.js +138 -0
- package/dist/components/Toast/useToast.js +42 -0
- package/dist/components/Toggle/Toggle.js +20 -14
- package/dist/components/Tooltip/Tooltip.js +24 -2
- package/dist/styles/styleFont.css +1 -1
- package/dist/styles/zIndexConsts.css +2 -0
- package/package.json +63 -3
- package/toast.js +7 -0
- package/useCouncilboxTheme.js +7 -0
- package/useToast.js +7 -0
- package/dist/components/Accordion/AccordionOld.css +0 -16
- package/dist/components/Accordion/AccordionOld.js +0 -91
- package/dist/components/Avatar/AvatarOld.js +0 -124
- package/dist/components/ButtonBasic/ButtonBasicOld.css +0 -41
- package/dist/components/ButtonBasic/ButtonBasicOld.js +0 -211
- package/dist/components/Checkbox/CheckboxOld.css +0 -31
- package/dist/components/Checkbox/CheckboxOld.js +0 -96
- package/dist/components/DrawerPanel/DrawerPanelOld.css +0 -56
- package/dist/components/DrawerPanel/DrawerPanelOld.js +0 -211
- package/dist/components/DropDown/DropDownOld.css +0 -3
- package/dist/components/DropDown/DropDownOld.js +0 -154
- package/dist/components/Grid/GridItemOld.js +0 -38
- package/dist/components/Grid/GridOld.css +0 -0
- package/dist/components/Grid/GridOld.js +0 -46
- package/dist/components/IconButton/IconButtonOld.css +0 -0
- package/dist/components/IconButton/IconButtonOld.js +0 -122
- package/dist/components/IconButtonSquare/IconButtonSquareOld.css +0 -43
- package/dist/components/IconButtonSquare/IconButtonSquareOld.js +0 -115
- package/dist/components/InputAutocomplete/InputAutocompleteOld.css +0 -5
- package/dist/components/InputAutocomplete/InputAutocompleteOld.js +0 -159
- package/dist/components/InputText/InputTextOld.css +0 -10
- package/dist/components/InputText/InputTextOld.js +0 -314
- package/dist/components/MenuItem/MenuItemOld.js +0 -123
- package/dist/components/Modal/ModalOld.css +0 -3
- package/dist/components/Modal/ModalOld.js +0 -213
- package/dist/components/RadioButton/RadioOld.css +0 -31
- package/dist/components/RadioButton/RadioOld.js +0 -126
- package/dist/components/SelectInput/SelectInputOld.css +0 -17
- package/dist/components/SelectInput/SelectInputOld.js +0 -296
- package/dist/components/Table/TableOld.css +0 -79
- package/dist/components/Table/TableOld.js +0 -133
- package/dist/components/Tabs/TabsOld.js +0 -78
- package/dist/components/Typography/TypographyOld.js +0 -119
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _reactDom = require("react-dom");
|
|
11
|
+
require("../../styles/main.css");
|
|
12
|
+
require("../DatePicker/DatePicker.css");
|
|
13
|
+
require("./DateRangePicker.css");
|
|
14
|
+
var _InputText = _interopRequireDefault(require("../InputText/InputText"));
|
|
15
|
+
var _IconButton = _interopRequireDefault(require("../IconButton/IconButton"));
|
|
16
|
+
var _Modal = _interopRequireDefault(require("../Modal/Modal"));
|
|
17
|
+
var _RangeCalendar = _interopRequireDefault(require("./RangeCalendar"));
|
|
18
|
+
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
19
|
+
var _usePopoverPosition2 = _interopRequireDefault(require("../../HOCs/usePopoverPosition"));
|
|
20
|
+
var _useFallbackId = _interopRequireDefault(require("../../utils/useFallbackId"));
|
|
21
|
+
var _useA11yGuard2 = require("../../HOCs/useA11yGuard");
|
|
22
|
+
var _dateUtils = require("../DatePicker/dateUtils");
|
|
23
|
+
var _excluded = ["value", "defaultValue", "onChange", "format", "locale", "months", "weekDays", "localeText", "label", "helper", "helperText", "error", "required", "disabled", "readOnly", "fullWidth", "variant", "id", "name", "className", "sx", "style", "minDate", "maxDate", "disablePast", "disableFuture", "shouldDisableDate", "numberOfMonths", "open", "onOpen", "onClose", "clearable", "closeOnSelect", "placeholder", "autoFocus", "isMobile", "showInModal", "cancelButtonText", "saveButtonText", "InputProps", "prefixClass", "aria-label"];
|
|
24
|
+
/* eslint-disable no-tabs */
|
|
25
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
26
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
27
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
29
|
+
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; }
|
|
30
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
31
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
32
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
33
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
34
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
35
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
|
|
36
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
37
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
38
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) { o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } } return i; }
|
|
39
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) { if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } } return t; }
|
|
40
|
+
var normalizeRange = function normalizeRange(range) {
|
|
41
|
+
return [(0, _dateUtils.toJsDate)(range === null || range === void 0 ? void 0 : range[0]), (0, _dateUtils.toJsDate)(range === null || range === void 0 ? void 0 : range[1])];
|
|
42
|
+
};
|
|
43
|
+
var OUT_MARGIN = 8;
|
|
44
|
+
var EMPTY_RANGE = [null, null];
|
|
45
|
+
var RANGE_SEPARATOR = ' – ';
|
|
46
|
+
// A dash/en-dash surrounded by at least one space is treated as the range
|
|
47
|
+
// separator; a bare "-" glued to digits (e.g. inside "yyyy-MM-dd") is left alone.
|
|
48
|
+
var SEPARATOR_REGEX = /\s+[-–—]\s+/;
|
|
49
|
+
var splitRangeText = function splitRangeText(text) {
|
|
50
|
+
var match = text.match(SEPARATOR_REGEX);
|
|
51
|
+
if (!match) return [text.trim(), ''];
|
|
52
|
+
return [text.slice(0, match.index).trim(), text.slice(match.index + match[0].length).trim()];
|
|
53
|
+
};
|
|
54
|
+
var DateRangePicker = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
55
|
+
var value = _ref.value,
|
|
56
|
+
_ref$defaultValue = _ref.defaultValue,
|
|
57
|
+
defaultValue = _ref$defaultValue === void 0 ? EMPTY_RANGE : _ref$defaultValue,
|
|
58
|
+
onChange = _ref.onChange,
|
|
59
|
+
format = _ref.format,
|
|
60
|
+
_ref$locale = _ref.locale,
|
|
61
|
+
locale = _ref$locale === void 0 ? _dateUtils.DEFAULT_LOCALE : _ref$locale,
|
|
62
|
+
months = _ref.months,
|
|
63
|
+
weekDays = _ref.weekDays,
|
|
64
|
+
localeText = _ref.localeText,
|
|
65
|
+
label = _ref.label,
|
|
66
|
+
helper = _ref.helper,
|
|
67
|
+
helperText = _ref.helperText,
|
|
68
|
+
error = _ref.error,
|
|
69
|
+
required = _ref.required,
|
|
70
|
+
disabled = _ref.disabled,
|
|
71
|
+
readOnly = _ref.readOnly,
|
|
72
|
+
fullWidth = _ref.fullWidth,
|
|
73
|
+
_ref$variant = _ref.variant,
|
|
74
|
+
variant = _ref$variant === void 0 ? 'outlined' : _ref$variant,
|
|
75
|
+
id = _ref.id,
|
|
76
|
+
name = _ref.name,
|
|
77
|
+
className = _ref.className,
|
|
78
|
+
sx = _ref.sx,
|
|
79
|
+
style = _ref.style,
|
|
80
|
+
minDate = _ref.minDate,
|
|
81
|
+
maxDate = _ref.maxDate,
|
|
82
|
+
disablePast = _ref.disablePast,
|
|
83
|
+
disableFuture = _ref.disableFuture,
|
|
84
|
+
shouldDisableDate = _ref.shouldDisableDate,
|
|
85
|
+
numberOfMonths = _ref.numberOfMonths,
|
|
86
|
+
openProp = _ref.open,
|
|
87
|
+
onOpen = _ref.onOpen,
|
|
88
|
+
onClose = _ref.onClose,
|
|
89
|
+
_ref$clearable = _ref.clearable,
|
|
90
|
+
clearable = _ref$clearable === void 0 ? true : _ref$clearable,
|
|
91
|
+
_ref$closeOnSelect = _ref.closeOnSelect,
|
|
92
|
+
closeOnSelect = _ref$closeOnSelect === void 0 ? true : _ref$closeOnSelect,
|
|
93
|
+
placeholder = _ref.placeholder,
|
|
94
|
+
autoFocus = _ref.autoFocus,
|
|
95
|
+
_ref$isMobile = _ref.isMobile,
|
|
96
|
+
isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile,
|
|
97
|
+
_ref$showInModal = _ref.showInModal,
|
|
98
|
+
showInModal = _ref$showInModal === void 0 ? false : _ref$showInModal,
|
|
99
|
+
_ref$cancelButtonText = _ref.cancelButtonText,
|
|
100
|
+
cancelButtonText = _ref$cancelButtonText === void 0 ? 'Cancel' : _ref$cancelButtonText,
|
|
101
|
+
_ref$saveButtonText = _ref.saveButtonText,
|
|
102
|
+
saveButtonText = _ref$saveButtonText === void 0 ? 'Save' : _ref$saveButtonText,
|
|
103
|
+
_ref$InputProps = _ref.InputProps,
|
|
104
|
+
InputProps = _ref$InputProps === void 0 ? {} : _ref$InputProps,
|
|
105
|
+
propPrefixClass = _ref.prefixClass,
|
|
106
|
+
ariaLabel = _ref['aria-label'],
|
|
107
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
108
|
+
var _useDynamicStyles = (0, _useDynamicStyles2["default"])(sx),
|
|
109
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
110
|
+
dynamicPrefixClass = _useDynamicStyles.prefixClass;
|
|
111
|
+
var prefixClass = propPrefixClass || dynamicPrefixClass;
|
|
112
|
+
// isMobile forces a real phone-sized modal; showInModal lets a desktop consumer
|
|
113
|
+
// opt into the same Modal presentation (e.g. a compact dialog) without the mobile styling.
|
|
114
|
+
var isModalMode = isMobile || showInModal;
|
|
115
|
+
var _useA11yGuard = (0, _useA11yGuard2.useA11yGuard)(),
|
|
116
|
+
requireAccessibleText = _useA11yGuard.requireAccessibleText;
|
|
117
|
+
requireAccessibleText(label || ariaLabel, {
|
|
118
|
+
component: 'DateRangePicker',
|
|
119
|
+
prop: '"label" o "aria-label"',
|
|
120
|
+
hint: 'Un selector de rango de fechas debe contar con una etiqueta visible (label) o un "aria-label" para ser identificado por los lectores de pantalla.',
|
|
121
|
+
receivedProps: {
|
|
122
|
+
label: label,
|
|
123
|
+
ariaLabel: ariaLabel,
|
|
124
|
+
placeholder: placeholder,
|
|
125
|
+
id: id,
|
|
126
|
+
disabled: disabled
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
var localeFormat = _react["default"].useMemo(function () {
|
|
130
|
+
return (0, _dateUtils.getLocaleDateFormat)(locale);
|
|
131
|
+
}, [locale]);
|
|
132
|
+
var resolvedFormat = format || localeFormat;
|
|
133
|
+
var texts = _react["default"].useMemo(function () {
|
|
134
|
+
return (0, _dateUtils.getUIText)(locale, localeText);
|
|
135
|
+
}, [locale, localeText]);
|
|
136
|
+
// Keyed on getDateValueKey (a stable primitive) rather than the raw prop:
|
|
137
|
+
// a real moment/dayjs instance returns a NEW Date from .toDate() on every
|
|
138
|
+
// call, so memoizing on the value itself would never stabilize and would
|
|
139
|
+
// re-render in an infinite loop whenever one of these props is one.
|
|
140
|
+
var minDateJs = _react["default"].useMemo(function () {
|
|
141
|
+
return (0, _dateUtils.toJsDate)(minDate);
|
|
142
|
+
}, [(0, _dateUtils.getDateValueKey)(minDate)]);
|
|
143
|
+
var maxDateJs = _react["default"].useMemo(function () {
|
|
144
|
+
return (0, _dateUtils.toJsDate)(maxDate);
|
|
145
|
+
}, [(0, _dateUtils.getDateValueKey)(maxDate)]);
|
|
146
|
+
var isControlledValue = value !== undefined;
|
|
147
|
+
var _React$useState = _react["default"].useState(function () {
|
|
148
|
+
return normalizeRange(defaultValue);
|
|
149
|
+
}),
|
|
150
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
151
|
+
internalValue = _React$useState2[0],
|
|
152
|
+
setInternalValue = _React$useState2[1];
|
|
153
|
+
var selectedValue = _react["default"].useMemo(function () {
|
|
154
|
+
return isControlledValue ? normalizeRange(value) : internalValue;
|
|
155
|
+
}, [isControlledValue, (0, _dateUtils.getDateValueKey)(value === null || value === void 0 ? void 0 : value[0]), (0, _dateUtils.getDateValueKey)(value === null || value === void 0 ? void 0 : value[1]), internalValue]);
|
|
156
|
+
var _selectedValue = _slicedToArray(selectedValue, 2),
|
|
157
|
+
startValue = _selectedValue[0],
|
|
158
|
+
endValue = _selectedValue[1];
|
|
159
|
+
var isControlledOpen = openProp !== undefined && openProp !== null;
|
|
160
|
+
var _React$useState3 = _react["default"].useState(false),
|
|
161
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
162
|
+
internalOpen = _React$useState4[0],
|
|
163
|
+
setInternalOpen = _React$useState4[1];
|
|
164
|
+
var isOpen = isControlledOpen ? openProp : internalOpen;
|
|
165
|
+
var _React$useState5 = _react["default"].useState(null),
|
|
166
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
167
|
+
hoverDate = _React$useState6[0],
|
|
168
|
+
setHoverDate = _React$useState6[1];
|
|
169
|
+
// Modal mode defers commit until "Save" is pressed, so the in-progress range is staged here first.
|
|
170
|
+
var _React$useState7 = _react["default"].useState(selectedValue),
|
|
171
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
172
|
+
mobileDraftRange = _React$useState8[0],
|
|
173
|
+
setMobileDraftRange = _React$useState8[1];
|
|
174
|
+
var _mobileDraftRange = _slicedToArray(mobileDraftRange, 2),
|
|
175
|
+
draftStartValue = _mobileDraftRange[0],
|
|
176
|
+
draftEndValue = _mobileDraftRange[1];
|
|
177
|
+
var composeText = function composeText(start, end) {
|
|
178
|
+
var startFormatted = (0, _dateUtils.isValidDate)(start) ? (0, _dateUtils.formatDate)(start, resolvedFormat, locale) : '';
|
|
179
|
+
var endFormatted = (0, _dateUtils.isValidDate)(end) ? (0, _dateUtils.formatDate)(end, resolvedFormat, locale) : '';
|
|
180
|
+
if (!startFormatted && !endFormatted) return '';
|
|
181
|
+
return "".concat(startFormatted).concat(RANGE_SEPARATOR).concat(endFormatted);
|
|
182
|
+
};
|
|
183
|
+
var _React$useState9 = _react["default"].useState(composeText(startValue, endValue)),
|
|
184
|
+
_React$useState0 = _slicedToArray(_React$useState9, 2),
|
|
185
|
+
inputText = _React$useState0[0],
|
|
186
|
+
setInputText = _React$useState0[1];
|
|
187
|
+
var _React$useState1 = _react["default"].useState((0, _dateUtils.isValidDate)(startValue) ? startValue : new Date()),
|
|
188
|
+
_React$useState10 = _slicedToArray(_React$useState1, 2),
|
|
189
|
+
viewDate = _React$useState10[0],
|
|
190
|
+
setViewDate = _React$useState10[1];
|
|
191
|
+
var containerRef = _react["default"].useRef(null);
|
|
192
|
+
var popoverRef = _react["default"].useRef(null);
|
|
193
|
+
var portalRef = _react["default"].useRef(null);
|
|
194
|
+
var inputRef = _react["default"].useRef(null);
|
|
195
|
+
var fallbackId = (0, _useFallbackId["default"])('cbx-dateRangePicker');
|
|
196
|
+
var pickerId = id || fallbackId;
|
|
197
|
+
var _usePopoverPosition = (0, _usePopoverPosition2["default"])({
|
|
198
|
+
anchorRef: containerRef,
|
|
199
|
+
popoverRef: popoverRef,
|
|
200
|
+
isOpen: isOpen,
|
|
201
|
+
anchorOrigin: {
|
|
202
|
+
vertical: 'bottom',
|
|
203
|
+
horizontal: 'left'
|
|
204
|
+
},
|
|
205
|
+
transformOrigin: {
|
|
206
|
+
vertical: 'top',
|
|
207
|
+
horizontal: 'left'
|
|
208
|
+
},
|
|
209
|
+
outMargin: OUT_MARGIN
|
|
210
|
+
}),
|
|
211
|
+
popoverStyles = _usePopoverPosition.popoverStyles,
|
|
212
|
+
adjustPosition = _usePopoverPosition.adjustPosition;
|
|
213
|
+
_react["default"].useEffect(function () {
|
|
214
|
+
setInputText(composeText(startValue, endValue));
|
|
215
|
+
}, [startValue, endValue, resolvedFormat, locale]);
|
|
216
|
+
_react["default"].useEffect(function () {
|
|
217
|
+
var _inputRef$current;
|
|
218
|
+
if (autoFocus) (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
219
|
+
}, []);
|
|
220
|
+
var updateValue = function updateValue(newRange) {
|
|
221
|
+
if (!isControlledValue) setInternalValue(newRange);
|
|
222
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newRange);
|
|
223
|
+
};
|
|
224
|
+
var updateOpen = function updateOpen(next) {
|
|
225
|
+
if (!isControlledOpen) setInternalOpen(next);
|
|
226
|
+
if (next) onOpen === null || onOpen === void 0 ? void 0 : onOpen();else onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
227
|
+
};
|
|
228
|
+
var openPicker = function openPicker() {
|
|
229
|
+
if (disabled || readOnly) return;
|
|
230
|
+
setViewDate((0, _dateUtils.isValidDate)(startValue) ? startValue : new Date());
|
|
231
|
+
setMobileDraftRange([(0, _dateUtils.isValidDate)(startValue) ? startValue : null, (0, _dateUtils.isValidDate)(endValue) ? endValue : null]);
|
|
232
|
+
updateOpen(true);
|
|
233
|
+
setTimeout(adjustPosition, 0);
|
|
234
|
+
};
|
|
235
|
+
var closePicker = function closePicker() {
|
|
236
|
+
updateOpen(false);
|
|
237
|
+
setHoverDate(null);
|
|
238
|
+
};
|
|
239
|
+
var handleMobileSave = function handleMobileSave() {
|
|
240
|
+
updateValue(mobileDraftRange);
|
|
241
|
+
closePicker();
|
|
242
|
+
};
|
|
243
|
+
var handleMobileCancel = function handleMobileCancel() {
|
|
244
|
+
setMobileDraftRange([(0, _dateUtils.isValidDate)(startValue) ? startValue : null, (0, _dateUtils.isValidDate)(endValue) ? endValue : null]);
|
|
245
|
+
closePicker();
|
|
246
|
+
};
|
|
247
|
+
_react["default"].useEffect(function () {
|
|
248
|
+
if (!isOpen) return undefined;
|
|
249
|
+
var handleEscape = function handleEscape(event) {
|
|
250
|
+
if (event.key === 'Escape') closePicker();
|
|
251
|
+
};
|
|
252
|
+
document.addEventListener('keydown', handleEscape);
|
|
253
|
+
return function () {
|
|
254
|
+
return document.removeEventListener('keydown', handleEscape);
|
|
255
|
+
};
|
|
256
|
+
}, [isOpen]);
|
|
257
|
+
var handleContainerClick = function handleContainerClick(event) {
|
|
258
|
+
if (portalRef.current && portalRef.current.contains(event.target)) return;
|
|
259
|
+
openPicker();
|
|
260
|
+
};
|
|
261
|
+
var computeNextRange = function computeNextRange(day, curStart, curEnd) {
|
|
262
|
+
var nextStart = curStart;
|
|
263
|
+
var nextEnd = curEnd;
|
|
264
|
+
if (!(0, _dateUtils.isValidDate)(curStart) || (0, _dateUtils.isValidDate)(curStart) && (0, _dateUtils.isValidDate)(curEnd)) {
|
|
265
|
+
nextStart = day;
|
|
266
|
+
nextEnd = null;
|
|
267
|
+
} else if ((0, _dateUtils.isBeforeDay)(day, curStart)) {
|
|
268
|
+
nextEnd = curStart;
|
|
269
|
+
nextStart = day;
|
|
270
|
+
} else {
|
|
271
|
+
nextEnd = day;
|
|
272
|
+
}
|
|
273
|
+
return [nextStart, nextEnd];
|
|
274
|
+
};
|
|
275
|
+
var handleDaySelect = function handleDaySelect(day) {
|
|
276
|
+
if (isModalMode) {
|
|
277
|
+
setMobileDraftRange(computeNextRange(day, draftStartValue, draftEndValue));
|
|
278
|
+
setHoverDate(null);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
var _computeNextRange = computeNextRange(day, startValue, endValue),
|
|
282
|
+
_computeNextRange2 = _slicedToArray(_computeNextRange, 2),
|
|
283
|
+
nextStart = _computeNextRange2[0],
|
|
284
|
+
nextEnd = _computeNextRange2[1];
|
|
285
|
+
updateValue([nextStart, nextEnd]);
|
|
286
|
+
setHoverDate(null);
|
|
287
|
+
if ((0, _dateUtils.isValidDate)(nextStart) && (0, _dateUtils.isValidDate)(nextEnd) && closeOnSelect) {
|
|
288
|
+
closePicker();
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
var isDisabledDate = function isDisabledDate(date) {
|
|
292
|
+
return (0, _dateUtils.isDateDisabled)(date, {
|
|
293
|
+
minDate: minDateJs,
|
|
294
|
+
maxDate: maxDateJs,
|
|
295
|
+
disablePast: disablePast,
|
|
296
|
+
disableFuture: disableFuture,
|
|
297
|
+
shouldDisableDate: shouldDisableDate
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
var handleInputChange = function handleInputChange(event) {
|
|
301
|
+
var text = event.target.value;
|
|
302
|
+
setInputText(text);
|
|
303
|
+
if (!text) {
|
|
304
|
+
updateValue([null, null]);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
var _splitRangeText = splitRangeText(text),
|
|
308
|
+
_splitRangeText2 = _slicedToArray(_splitRangeText, 2),
|
|
309
|
+
startStr = _splitRangeText2[0],
|
|
310
|
+
endStr = _splitRangeText2[1];
|
|
311
|
+
var parsedStart = startStr ? (0, _dateUtils.parseDate)(startStr, resolvedFormat, locale) : null;
|
|
312
|
+
var parsedEnd = endStr ? (0, _dateUtils.parseDate)(endStr, resolvedFormat, locale) : null;
|
|
313
|
+
var startOk = !startStr || parsedStart && !isDisabledDate(parsedStart);
|
|
314
|
+
var endOk = !endStr || parsedEnd && !isDisabledDate(parsedEnd);
|
|
315
|
+
if (startOk && endOk && (parsedStart || parsedEnd)) {
|
|
316
|
+
updateValue([parsedStart || null, parsedEnd || null]);
|
|
317
|
+
if (parsedStart) setViewDate(parsedStart);
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
var handleInputBlur = function handleInputBlur(event) {
|
|
321
|
+
var _props$onBlur;
|
|
322
|
+
setInputText(composeText(startValue, endValue));
|
|
323
|
+
(_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 ? void 0 : _props$onBlur.call(props, event);
|
|
324
|
+
};
|
|
325
|
+
var handleInputKeyDown = function handleInputKeyDown(event) {
|
|
326
|
+
var _props$onKeyDown;
|
|
327
|
+
if (event.key === 'Escape' && isOpen) {
|
|
328
|
+
closePicker();
|
|
329
|
+
} else if (event.key === 'ArrowDown' && !isOpen) {
|
|
330
|
+
event.preventDefault();
|
|
331
|
+
openPicker();
|
|
332
|
+
}
|
|
333
|
+
(_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 ? void 0 : _props$onKeyDown.call(props, event);
|
|
334
|
+
};
|
|
335
|
+
var handleClear = function handleClear(event) {
|
|
336
|
+
var _inputRef$current2;
|
|
337
|
+
event.stopPropagation();
|
|
338
|
+
event.preventDefault();
|
|
339
|
+
updateValue([null, null]);
|
|
340
|
+
setInputText('');
|
|
341
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus();
|
|
342
|
+
};
|
|
343
|
+
var setRefs = function setRefs(node) {
|
|
344
|
+
inputRef.current = node;
|
|
345
|
+
if (typeof ref === 'function') ref(node);else if (ref) ref.current = node;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
// Two side-by-side months don't fit the compact modal width, so force a single month there.
|
|
349
|
+
var effectiveNumberOfMonths = isModalMode ? 1 : numberOfMonths;
|
|
350
|
+
|
|
351
|
+
// Shared between the anchored popover and the Modal below -
|
|
352
|
+
// same range calendar, just a different container (and draft-vs-committed range) depending on isModalMode.
|
|
353
|
+
var calendarStartValue = isModalMode ? draftStartValue : startValue;
|
|
354
|
+
var calendarEndValue = isModalMode ? draftEndValue : endValue;
|
|
355
|
+
var rangeCalendarElement = /*#__PURE__*/_react["default"].createElement(_RangeCalendar["default"], {
|
|
356
|
+
viewDate: viewDate,
|
|
357
|
+
onViewDateChange: setViewDate,
|
|
358
|
+
startValue: (0, _dateUtils.isValidDate)(calendarStartValue) ? calendarStartValue : null,
|
|
359
|
+
endValue: (0, _dateUtils.isValidDate)(calendarEndValue) ? calendarEndValue : null,
|
|
360
|
+
hoverDate: hoverDate,
|
|
361
|
+
onHoverDate: setHoverDate,
|
|
362
|
+
onSelect: handleDaySelect,
|
|
363
|
+
minDate: minDateJs,
|
|
364
|
+
maxDate: maxDateJs,
|
|
365
|
+
disablePast: disablePast,
|
|
366
|
+
disableFuture: disableFuture,
|
|
367
|
+
shouldDisableDate: shouldDisableDate,
|
|
368
|
+
numberOfMonths: effectiveNumberOfMonths,
|
|
369
|
+
locale: locale,
|
|
370
|
+
months: months,
|
|
371
|
+
weekDays: weekDays,
|
|
372
|
+
localeText: localeText,
|
|
373
|
+
prefixClass: prefixClass,
|
|
374
|
+
id: "".concat(pickerId, "-calendar")
|
|
375
|
+
});
|
|
376
|
+
var composedAriaLabel = (0, _dateUtils.isValidDate)(startValue) || (0, _dateUtils.isValidDate)(endValue) ? [label || texts.rangeLabel, (0, _dateUtils.isValidDate)(startValue) ? "".concat(texts.startLabel, ": ").concat((0, _dateUtils.formatDate)(startValue, resolvedFormat, locale)) : null, (0, _dateUtils.isValidDate)(endValue) ? "".concat(texts.endLabel, ": ").concat((0, _dateUtils.formatDate)(endValue, resolvedFormat, locale)) : null].filter(Boolean).join('. ') : ariaLabel;
|
|
377
|
+
return (
|
|
378
|
+
/*#__PURE__*/
|
|
379
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
380
|
+
_react["default"].createElement("div", {
|
|
381
|
+
className: prefixClass("cbx-datePicker-container ".concat(className || '')),
|
|
382
|
+
style: _objectSpread(_objectSpread({
|
|
383
|
+
width: fullWidth ? '100%' : undefined
|
|
384
|
+
}, style), stylesInLine),
|
|
385
|
+
ref: containerRef,
|
|
386
|
+
onClick: handleContainerClick
|
|
387
|
+
}, /*#__PURE__*/_react["default"].createElement(_InputText["default"], _extends({
|
|
388
|
+
id: pickerId,
|
|
389
|
+
name: name,
|
|
390
|
+
label: label || texts.rangeLabel,
|
|
391
|
+
value: inputText,
|
|
392
|
+
placeholder: placeholder || "".concat(resolvedFormat.toLowerCase()).concat(RANGE_SEPARATOR).concat(resolvedFormat.toLowerCase()),
|
|
393
|
+
onChange: handleInputChange,
|
|
394
|
+
onBlur: handleInputBlur,
|
|
395
|
+
onKeyDown: handleInputKeyDown,
|
|
396
|
+
onClick: openPicker,
|
|
397
|
+
disabled: disabled,
|
|
398
|
+
readOnly: readOnly,
|
|
399
|
+
required: required,
|
|
400
|
+
error: error,
|
|
401
|
+
helper: helper,
|
|
402
|
+
helperText: helperText,
|
|
403
|
+
fullWidth: fullWidth,
|
|
404
|
+
variant: variant,
|
|
405
|
+
style: fullWidth ? undefined : {
|
|
406
|
+
minWidth: '19.5rem'
|
|
407
|
+
},
|
|
408
|
+
ref: setRefs,
|
|
409
|
+
"aria-haspopup": "dialog",
|
|
410
|
+
"aria-expanded": isOpen,
|
|
411
|
+
"aria-label": composedAriaLabel,
|
|
412
|
+
InputProps: _objectSpread({
|
|
413
|
+
endAdornment: /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, clearable && inputText && !disabled && !readOnly && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
414
|
+
prefixClass: prefixClass,
|
|
415
|
+
className: "cbx-datePicker-clear-button",
|
|
416
|
+
onClick: handleClear,
|
|
417
|
+
icon: /*#__PURE__*/_react["default"].createElement("i", {
|
|
418
|
+
className: "ri-close-fill"
|
|
419
|
+
}),
|
|
420
|
+
tabIndex: -1,
|
|
421
|
+
"aria-label": texts.clearText
|
|
422
|
+
}), /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
423
|
+
prefixClass: prefixClass,
|
|
424
|
+
className: "cbx-datePicker-toggle-button",
|
|
425
|
+
onClick: function onClick(event) {
|
|
426
|
+
event.stopPropagation();
|
|
427
|
+
if (isOpen) closePicker();else openPicker();
|
|
428
|
+
},
|
|
429
|
+
icon: /*#__PURE__*/_react["default"].createElement("i", {
|
|
430
|
+
className: "ri-calendar-line"
|
|
431
|
+
}),
|
|
432
|
+
disabled: disabled,
|
|
433
|
+
"aria-label": texts.openCalendarText
|
|
434
|
+
}))
|
|
435
|
+
}, InputProps)
|
|
436
|
+
}, props)), isOpen && (isModalMode ? /*#__PURE__*/_react["default"].createElement(_Modal["default"], {
|
|
437
|
+
id: "".concat(pickerId, "-modal"),
|
|
438
|
+
open: isOpen,
|
|
439
|
+
requestClose: handleMobileCancel,
|
|
440
|
+
title: label || texts.rangeLabel,
|
|
441
|
+
bodyText: rangeCalendarElement,
|
|
442
|
+
buttonCancel: cancelButtonText,
|
|
443
|
+
cancelAction: handleMobileCancel,
|
|
444
|
+
buttonAccept: saveButtonText,
|
|
445
|
+
acceptAction: handleMobileSave,
|
|
446
|
+
fullWidth: isMobile,
|
|
447
|
+
sx: isMobile ? undefined : {
|
|
448
|
+
'.cbx-Modal-body': {
|
|
449
|
+
maxWidth: '21rem !important',
|
|
450
|
+
minWidth: '21rem !important'
|
|
451
|
+
},
|
|
452
|
+
'.cbx-Modal-content': {
|
|
453
|
+
maxWidth: '22.5rem !important',
|
|
454
|
+
minWidth: '22.5rem !important'
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}) : /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react["default"].createElement("div", {
|
|
458
|
+
className: prefixClass('cbx-datePicker-presentation'),
|
|
459
|
+
role: "presentation",
|
|
460
|
+
ref: portalRef
|
|
461
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
462
|
+
className: prefixClass('cbx-datePicker-backdrop'),
|
|
463
|
+
onClick: closePicker,
|
|
464
|
+
role: "presentation"
|
|
465
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
466
|
+
className: prefixClass("cbx-datePicker-popover ".concat(popoverStyles ? 'cbx-datePicker-popover-open' : '')),
|
|
467
|
+
style: popoverStyles || {},
|
|
468
|
+
ref: popoverRef,
|
|
469
|
+
role: "dialog",
|
|
470
|
+
"aria-modal": "true",
|
|
471
|
+
"aria-label": label || texts.rangeLabel
|
|
472
|
+
}, rangeCalendarElement)), document.body)))
|
|
473
|
+
);
|
|
474
|
+
});
|
|
475
|
+
var dateLikePropType = _propTypes["default"].oneOfType([_propTypes["default"].instanceOf(Date), _propTypes["default"].string, _propTypes["default"].number, _propTypes["default"].object]);
|
|
476
|
+
DateRangePicker.propTypes = {
|
|
477
|
+
value: _propTypes["default"].arrayOf(dateLikePropType),
|
|
478
|
+
defaultValue: _propTypes["default"].arrayOf(dateLikePropType),
|
|
479
|
+
onChange: _propTypes["default"].func,
|
|
480
|
+
format: _propTypes["default"].string,
|
|
481
|
+
locale: _propTypes["default"].string,
|
|
482
|
+
months: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
483
|
+
weekDays: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
484
|
+
localeText: _propTypes["default"].object,
|
|
485
|
+
label: _propTypes["default"].string,
|
|
486
|
+
helper: _propTypes["default"].string,
|
|
487
|
+
helperText: _propTypes["default"].string,
|
|
488
|
+
error: _propTypes["default"].oneOfType([_propTypes["default"].node, _propTypes["default"].bool]),
|
|
489
|
+
required: _propTypes["default"].bool,
|
|
490
|
+
disabled: _propTypes["default"].bool,
|
|
491
|
+
readOnly: _propTypes["default"].bool,
|
|
492
|
+
fullWidth: _propTypes["default"].bool,
|
|
493
|
+
variant: _propTypes["default"].oneOf(['outlined', 'filled', 'standard']),
|
|
494
|
+
id: _propTypes["default"].string,
|
|
495
|
+
name: _propTypes["default"].string,
|
|
496
|
+
className: _propTypes["default"].string,
|
|
497
|
+
minDate: dateLikePropType,
|
|
498
|
+
maxDate: dateLikePropType,
|
|
499
|
+
disablePast: _propTypes["default"].bool,
|
|
500
|
+
disableFuture: _propTypes["default"].bool,
|
|
501
|
+
shouldDisableDate: _propTypes["default"].func,
|
|
502
|
+
numberOfMonths: _propTypes["default"].number,
|
|
503
|
+
open: _propTypes["default"].bool,
|
|
504
|
+
onOpen: _propTypes["default"].func,
|
|
505
|
+
onClose: _propTypes["default"].func,
|
|
506
|
+
clearable: _propTypes["default"].bool,
|
|
507
|
+
closeOnSelect: _propTypes["default"].bool,
|
|
508
|
+
placeholder: _propTypes["default"].string,
|
|
509
|
+
autoFocus: _propTypes["default"].bool,
|
|
510
|
+
isMobile: _propTypes["default"].bool,
|
|
511
|
+
showInModal: _propTypes["default"].bool,
|
|
512
|
+
cancelButtonText: _propTypes["default"].string,
|
|
513
|
+
saveButtonText: _propTypes["default"].string
|
|
514
|
+
};
|
|
515
|
+
DateRangePicker.defaultProps = {
|
|
516
|
+
locale: _dateUtils.DEFAULT_LOCALE,
|
|
517
|
+
label: '',
|
|
518
|
+
disabled: false,
|
|
519
|
+
fullWidth: false,
|
|
520
|
+
variant: 'outlined',
|
|
521
|
+
clearable: true,
|
|
522
|
+
closeOnSelect: true,
|
|
523
|
+
numberOfMonths: 2,
|
|
524
|
+
isMobile: false,
|
|
525
|
+
showInModal: false,
|
|
526
|
+
cancelButtonText: 'Cancel',
|
|
527
|
+
saveButtonText: 'Save'
|
|
528
|
+
};
|
|
529
|
+
var _default = DateRangePicker;
|
|
530
|
+
exports["default"] = _default;
|