@coreui/react-pro 4.13.1 → 4.14.0

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/dist/index.js CHANGED
@@ -2479,6 +2479,22 @@ CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends$1({},
2479
2479
  }) : {};
2480
2480
  var CSSTransition$1 = CSSTransition;
2481
2481
 
2482
+ var useDebouncedCallback = function (callback, delay) {
2483
+ var timeout = React$1.useRef();
2484
+ return React$1.useCallback(function () {
2485
+ var args = [];
2486
+ for (var _i = 0; _i < arguments.length; _i++) {
2487
+ args[_i] = arguments[_i];
2488
+ }
2489
+ var handler = function () {
2490
+ clearTimeout(timeout.current);
2491
+ callback.apply(void 0, args);
2492
+ };
2493
+ clearTimeout(timeout.current);
2494
+ timeout.current = setTimeout(handler, delay);
2495
+ }, [callback, delay]);
2496
+ };
2497
+
2482
2498
  // code borrowed from https://github.com/reach/reach-ui
2483
2499
  // problem described https://github.com/facebook/react/issues/13029
2484
2500
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -2522,6 +2538,19 @@ function isFunction(value) {
2522
2538
  return !!(value && {}.toString.call(value) == '[object Function]');
2523
2539
  }
2524
2540
 
2541
+ var useIsVisible = function (ref) {
2542
+ var _a = React$1.useState(false), isIntersecting = _a[0], setIntersecting = _a[1];
2543
+ React$1.useEffect(function () {
2544
+ var observer = new IntersectionObserver(function (_a) {
2545
+ var entry = _a[0];
2546
+ return setIntersecting(entry.isIntersecting);
2547
+ });
2548
+ ref.current && observer.observe(ref.current);
2549
+ return function () { return observer.disconnect(); };
2550
+ }, []);
2551
+ return isIntersecting;
2552
+ };
2553
+
2525
2554
  var top = 'top';
2526
2555
  var bottom = 'bottom';
2527
2556
  var right = 'right';
@@ -9145,17 +9174,20 @@ var CTimePickerRollCol = React$1.forwardRef(function (_a, ref) {
9145
9174
  var init = React$1.useRef(true);
9146
9175
  var colRef = React$1.useRef(null);
9147
9176
  var forkedRef = useForkedRef(ref, colRef);
9177
+ var isVisible = useIsVisible(colRef);
9148
9178
  React$1.useEffect(function () {
9149
9179
  var _a, _b;
9150
9180
  var nodeEl = (_a = colRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('.selected');
9151
- if (nodeEl && nodeEl instanceof HTMLElement) {
9181
+ if (isVisible && nodeEl && nodeEl instanceof HTMLElement) {
9152
9182
  (_b = colRef.current) === null || _b === void 0 ? void 0 : _b.scrollTo({
9153
9183
  top: nodeEl.offsetTop,
9154
9184
  behavior: init.current ? 'auto' : 'smooth',
9155
9185
  });
9156
9186
  }
9157
- init.current = false;
9158
- }, [selected]);
9187
+ if (isVisible) {
9188
+ init.current = false;
9189
+ }
9190
+ }, [isVisible, selected]);
9159
9191
  var handleKeyDown = function (event, value) {
9160
9192
  if (event.code === 'Space' || event.key === 'Enter') {
9161
9193
  event.preventDefault();
@@ -9265,7 +9297,7 @@ var CTimePicker = React$1.forwardRef(function (_a, ref) {
9265
9297
  hour12: false,
9266
9298
  }), localizedTimePartials = _0[0], setLocalizedTimePartials = _0[1];
9267
9299
  React$1.useEffect(function () {
9268
- setDate(convertTimeToDate(time));
9300
+ setDate(time ? convertTimeToDate(time) : null);
9269
9301
  }, [time]);
9270
9302
  React$1.useEffect(function () {
9271
9303
  setIsValid(valid !== null && valid !== void 0 ? valid : (invalid === true ? false : undefined));
@@ -9369,14 +9401,6 @@ var CTimePicker = React$1.forwardRef(function (_a, ref) {
9369
9401
  React$1.createElement("option", { value: "am" }, "AM"),
9370
9402
  React$1.createElement("option", { value: "pm" }, "PM")))));
9371
9403
  };
9372
- var TimePickerRoll = function () { return (React$1.createElement(React$1.Fragment, null,
9373
- React$1.createElement(CTimePickerRollCol, { elements: localizedTimePartials && localizedTimePartials.listOfHours, onClick: function (index) { return handleTimeChange('hours', index.toString()); }, selected: getSelectedHour(date, locale, ampm) }),
9374
- React$1.createElement(CTimePickerRollCol, { elements: localizedTimePartials && localizedTimePartials.listOfMinutes, onClick: function (index) { return handleTimeChange('minutes', index.toString()); }, selected: getSelectedMinutes(date) }),
9375
- seconds && (React$1.createElement(CTimePickerRollCol, { elements: localizedTimePartials && localizedTimePartials.listOfSeconds, onClick: function (index) { return handleTimeChange('seconds', index.toString()); }, selected: getSelectedSeconds(date) })),
9376
- localizedTimePartials && localizedTimePartials.hour12 && (React$1.createElement(CTimePickerRollCol, { elements: [
9377
- { value: 'am', label: 'AM' },
9378
- { value: 'pm', label: 'PM' },
9379
- ], onClick: function (value) { return handleTimeChange('toggle', value); }, selected: _ampm })))); };
9380
9404
  return (React$1.createElement(CFormControlWrapper, { describedby: rest['aria-describedby'], feedback: feedback, feedbackInvalid: feedbackInvalid, feedbackValid: feedbackValid, id: id, invalid: isValid === false ? true : false, label: label, text: text, tooltipFeedback: tooltipFeedback, valid: isValid },
9381
9405
  React$1.createElement(CPicker, __assign$1({ className: classNames$1('time-picker', (_b = {},
9382
9406
  _b["time-picker-".concat(size)] = size,
@@ -9400,7 +9424,14 @@ var CTimePicker = React$1.forwardRef(function (_a, ref) {
9400
9424
  }, toggler: InputGroup(), visible: _visible }, rest, { ref: ref }),
9401
9425
  React$1.createElement("div", { className: classNames$1('time-picker-body', (_c = {},
9402
9426
  _c['time-picker-roll'] = variant === 'roll',
9403
- _c)) }, variant === 'select' ? React$1.createElement(TimePickerSelect, null) : TimePickerRoll()))));
9427
+ _c)) }, variant === 'select' ? (React$1.createElement(TimePickerSelect, null)) : (React$1.createElement(React$1.Fragment, null,
9428
+ React$1.createElement(CTimePickerRollCol, { elements: localizedTimePartials && localizedTimePartials.listOfHours, onClick: function (index) { return handleTimeChange('hours', index.toString()); }, selected: getSelectedHour(date, locale, ampm) }),
9429
+ React$1.createElement(CTimePickerRollCol, { elements: localizedTimePartials && localizedTimePartials.listOfMinutes, onClick: function (index) { return handleTimeChange('minutes', index.toString()); }, selected: getSelectedMinutes(date) }),
9430
+ seconds && (React$1.createElement(CTimePickerRollCol, { elements: localizedTimePartials && localizedTimePartials.listOfSeconds, onClick: function (index) { return handleTimeChange('seconds', index.toString()); }, selected: getSelectedSeconds(date) })),
9431
+ localizedTimePartials && localizedTimePartials.hour12 && (React$1.createElement(CTimePickerRollCol, { elements: [
9432
+ { value: 'am', label: 'AM' },
9433
+ { value: 'pm', label: 'PM' },
9434
+ ], onClick: function (value) { return handleTimeChange('toggle', value); }, selected: _ampm }))))))));
9404
9435
  });
9405
9436
  CTimePicker.propTypes = __assign$1(__assign$1(__assign$1({}, CFormControlWrapper.propTypes), CPicker.propTypes), { ampm: PropTypes$1.oneOfType([PropTypes$1.oneOf(['auto']), PropTypes$1.bool]), cancelButton: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.node]), cancelButtonColor: (_a$1 = CButton.propTypes) === null || _a$1 === void 0 ? void 0 : _a$1.color, cancelButtonSize: (_b$1 = CButton.propTypes) === null || _b$1 === void 0 ? void 0 : _b$1.size, cancelButtonVariant: (_c$1 = CButton.propTypes) === null || _c$1 === void 0 ? void 0 : _c$1.variant, className: PropTypes$1.string, confirmButton: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.node]), confirmButtonColor: (_d$1 = CButton.propTypes) === null || _d$1 === void 0 ? void 0 : _d$1.color, confirmButtonSize: (_e$1 = CButton.propTypes) === null || _e$1 === void 0 ? void 0 : _e$1.size, confirmButtonVariant: (_f$1 = CButton.propTypes) === null || _f$1 === void 0 ? void 0 : _f$1.variant, locale: PropTypes$1.string, onTimeChange: PropTypes$1.func, required: PropTypes$1.bool, seconds: PropTypes$1.bool, time: PropTypes$1.oneOfType([PropTypes$1.instanceOf(Date), PropTypes$1.string]), variant: PropTypes$1.oneOf(['roll', 'select']) });
9406
9437
  CTimePicker.displayName = 'CTimePicker';
@@ -9441,36 +9472,32 @@ var getLocalDateFromString = function (string, locale, time) {
9441
9472
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
9442
9473
  var CDateRangePicker = React$1.forwardRef(function (_a, ref) {
9443
9474
  var _b;
9444
- var _c = _a.calendars, calendars = _c === void 0 ? 2 : _c, calendarDate = _a.calendarDate, _d = _a.cancelButton, cancelButton = _d === void 0 ? 'Cancel' : _d, _e = _a.cancelButtonColor, cancelButtonColor = _e === void 0 ? 'primary' : _e, _f = _a.cancelButtonSize, cancelButtonSize = _f === void 0 ? 'sm' : _f, _g = _a.cancelButtonVariant, cancelButtonVariant = _g === void 0 ? 'ghost' : _g, className = _a.className, _h = _a.cleaner, cleaner = _h === void 0 ? true : _h, _j = _a.closeOnSelect, closeOnSelect = _j === void 0 ? true : _j, _k = _a.confirmButton, confirmButton = _k === void 0 ? 'OK' : _k, _l = _a.confirmButtonColor, confirmButtonColor = _l === void 0 ? 'primary' : _l, _m = _a.confirmButtonSize, confirmButtonSize = _m === void 0 ? 'sm' : _m, confirmButtonVariant = _a.confirmButtonVariant, _o = _a.indicator, indicator = _o === void 0 ? true : _o, dayFormat = _a.dayFormat, disabled = _a.disabled, disabledDates = _a.disabledDates, endDate = _a.endDate, feedback = _a.feedback, feedbackInvalid = _a.feedbackInvalid, feedbackValid = _a.feedbackValid, firstDayOfWeek = _a.firstDayOfWeek, format$1 = _a.format, footer = _a.footer, id = _a.id, inputReadOnly = _a.inputReadOnly, invalid = _a.invalid, label = _a.label, _p = _a.locale, locale = _p === void 0 ? 'default' : _p, maxDate = _a.maxDate, minDate = _a.minDate, navigation = _a.navigation, navYearFirst = _a.navYearFirst, onEndDateChange = _a.onEndDateChange, onHide = _a.onHide, onStartDateChange = _a.onStartDateChange, onShow = _a.onShow, _q = _a.placeholder, placeholder = _q === void 0 ? ['Start date', 'End date'] : _q, _r = _a.range, range = _r === void 0 ? true : _r, ranges = _a.ranges, _s = _a.rangesButtonsColor, rangesButtonsColor = _s === void 0 ? 'secondary' : _s, rangesButtonsSize = _a.rangesButtonsSize, _t = _a.rangesButtonsVariant, rangesButtonsVariant = _t === void 0 ? 'ghost' : _t, required = _a.required, _u = _a.separator, separator = _u === void 0 ? true : _u, selectAdjacementDays = _a.selectAdjacementDays, showAdjacementDays = _a.showAdjacementDays, size = _a.size, startDate = _a.startDate, text = _a.text, timepicker = _a.timepicker, toggler = _a.toggler, _v = _a.todayButton, todayButton = _v === void 0 ? 'Today' : _v, _w = _a.todayButtonColor, todayButtonColor = _w === void 0 ? 'primary' : _w, _x = _a.todayButtonSize, todayButtonSize = _x === void 0 ? 'sm' : _x, todayButtonVariant = _a.todayButtonVariant, tooltipFeedback = _a.tooltipFeedback, valid = _a.valid, visible = _a.visible, weekdayFormat = _a.weekdayFormat, rest = __rest$1(_a, ["calendars", "calendarDate", "cancelButton", "cancelButtonColor", "cancelButtonSize", "cancelButtonVariant", "className", "cleaner", "closeOnSelect", "confirmButton", "confirmButtonColor", "confirmButtonSize", "confirmButtonVariant", "indicator", "dayFormat", "disabled", "disabledDates", "endDate", "feedback", "feedbackInvalid", "feedbackValid", "firstDayOfWeek", "format", "footer", "id", "inputReadOnly", "invalid", "label", "locale", "maxDate", "minDate", "navigation", "navYearFirst", "onEndDateChange", "onHide", "onStartDateChange", "onShow", "placeholder", "range", "ranges", "rangesButtonsColor", "rangesButtonsSize", "rangesButtonsVariant", "required", "separator", "selectAdjacementDays", "showAdjacementDays", "size", "startDate", "text", "timepicker", "toggler", "todayButton", "todayButtonColor", "todayButtonSize", "todayButtonVariant", "tooltipFeedback", "valid", "visible", "weekdayFormat"]);
9475
+ var _c = _a.calendars, calendars = _c === void 0 ? 2 : _c, calendarDate = _a.calendarDate, _d = _a.cancelButton, cancelButton = _d === void 0 ? 'Cancel' : _d, _e = _a.cancelButtonColor, cancelButtonColor = _e === void 0 ? 'primary' : _e, _f = _a.cancelButtonSize, cancelButtonSize = _f === void 0 ? 'sm' : _f, _g = _a.cancelButtonVariant, cancelButtonVariant = _g === void 0 ? 'ghost' : _g, className = _a.className, _h = _a.cleaner, cleaner = _h === void 0 ? true : _h, _j = _a.closeOnSelect, closeOnSelect = _j === void 0 ? true : _j, _k = _a.confirmButton, confirmButton = _k === void 0 ? 'OK' : _k, _l = _a.confirmButtonColor, confirmButtonColor = _l === void 0 ? 'primary' : _l, _m = _a.confirmButtonSize, confirmButtonSize = _m === void 0 ? 'sm' : _m, confirmButtonVariant = _a.confirmButtonVariant, dayFormat = _a.dayFormat, disabled = _a.disabled, disabledDates = _a.disabledDates, endDate = _a.endDate, feedback = _a.feedback, feedbackInvalid = _a.feedbackInvalid, feedbackValid = _a.feedbackValid, firstDayOfWeek = _a.firstDayOfWeek, format$1 = _a.format, footer = _a.footer, id = _a.id, _o = _a.indicator, indicator = _o === void 0 ? true : _o, inputDateFormat = _a.inputDateFormat, inputDateParse = _a.inputDateParse, _p = _a.inputOnChangeDelay, inputOnChangeDelay = _p === void 0 ? 750 : _p, inputReadOnly = _a.inputReadOnly, invalid = _a.invalid, label = _a.label, _q = _a.locale, locale = _q === void 0 ? 'default' : _q, maxDate = _a.maxDate, minDate = _a.minDate, navigation = _a.navigation, navYearFirst = _a.navYearFirst, onEndDateChange = _a.onEndDateChange, onHide = _a.onHide, onStartDateChange = _a.onStartDateChange, onShow = _a.onShow, _r = _a.placeholder, placeholder = _r === void 0 ? ['Start date', 'End date'] : _r, _s = _a.range, range = _s === void 0 ? true : _s, ranges = _a.ranges, _t = _a.rangesButtonsColor, rangesButtonsColor = _t === void 0 ? 'secondary' : _t, rangesButtonsSize = _a.rangesButtonsSize, _u = _a.rangesButtonsVariant, rangesButtonsVariant = _u === void 0 ? 'ghost' : _u, required = _a.required, _v = _a.separator, separator = _v === void 0 ? true : _v, selectAdjacementDays = _a.selectAdjacementDays, showAdjacementDays = _a.showAdjacementDays, size = _a.size, startDate = _a.startDate, text = _a.text, timepicker = _a.timepicker, toggler = _a.toggler, _w = _a.todayButton, todayButton = _w === void 0 ? 'Today' : _w, _x = _a.todayButtonColor, todayButtonColor = _x === void 0 ? 'primary' : _x, _y = _a.todayButtonSize, todayButtonSize = _y === void 0 ? 'sm' : _y, todayButtonVariant = _a.todayButtonVariant, tooltipFeedback = _a.tooltipFeedback, valid = _a.valid, visible = _a.visible, weekdayFormat = _a.weekdayFormat, rest = __rest$1(_a, ["calendars", "calendarDate", "cancelButton", "cancelButtonColor", "cancelButtonSize", "cancelButtonVariant", "className", "cleaner", "closeOnSelect", "confirmButton", "confirmButtonColor", "confirmButtonSize", "confirmButtonVariant", "dayFormat", "disabled", "disabledDates", "endDate", "feedback", "feedbackInvalid", "feedbackValid", "firstDayOfWeek", "format", "footer", "id", "indicator", "inputDateFormat", "inputDateParse", "inputOnChangeDelay", "inputReadOnly", "invalid", "label", "locale", "maxDate", "minDate", "navigation", "navYearFirst", "onEndDateChange", "onHide", "onStartDateChange", "onShow", "placeholder", "range", "ranges", "rangesButtonsColor", "rangesButtonsSize", "rangesButtonsVariant", "required", "separator", "selectAdjacementDays", "showAdjacementDays", "size", "startDate", "text", "timepicker", "toggler", "todayButton", "todayButtonColor", "todayButtonSize", "todayButtonVariant", "tooltipFeedback", "valid", "visible", "weekdayFormat"]);
9445
9476
  var inputEndRef = React$1.useRef(null);
9446
9477
  var inputStartRef = React$1.useRef(null);
9447
9478
  var formRef = React$1.useRef();
9448
- var _y = React$1.useState(calendarDate ? new Date(calendarDate) : new Date()), _calendarDate = _y[0], setCalendarDate = _y[1];
9449
- var _z = React$1.useState(endDate ? new Date(endDate) : null), _endDate = _z[0], setEndDate = _z[1];
9450
- var _0 = React$1.useState(maxDate ? new Date(maxDate) : null), _maxDate = _0[0], setMaxDate = _0[1];
9451
- var _1 = React$1.useState(minDate ? new Date(minDate) : null), _minDate = _1[0], setMinDate = _1[1];
9452
- var _2 = React$1.useState(startDate ? new Date(startDate) : null), _startDate = _2[0], setStartDate = _2[1];
9453
- var _3 = React$1.useState(visible), _visible = _3[0], setVisible = _3[1];
9454
- var _4 = React$1.useState(startDate ? new Date(startDate) : null), initialStartDate = _4[0], setInitialStartDate = _4[1];
9455
- var _5 = React$1.useState(endDate ? new Date(endDate) : null), initialEndDate = _5[0], setInitialEndDate = _5[1];
9456
- var _6 = React$1.useState(null), inputStartHoverValue = _6[0], setInputStartHoverValue = _6[1];
9457
- var _7 = React$1.useState(null), inputEndHoverValue = _7[0], setInputEndHoverValue = _7[1];
9458
- var _8 = React$1.useState(valid !== null && valid !== void 0 ? valid : (invalid === true ? false : undefined)), isValid = _8[0], setIsValid = _8[1];
9459
- var _9 = React$1.useState(false), selectEndDate = _9[0], setSelectEndDate = _9[1];
9479
+ var _z = React$1.useState(calendarDate ? new Date(calendarDate) : new Date()), _calendarDate = _z[0], setCalendarDate = _z[1];
9480
+ var _0 = React$1.useState(endDate ? new Date(endDate) : null), _endDate = _0[0], setEndDate = _0[1];
9481
+ var _1 = React$1.useState(maxDate ? new Date(maxDate) : null), _maxDate = _1[0], setMaxDate = _1[1];
9482
+ var _2 = React$1.useState(minDate ? new Date(minDate) : null), _minDate = _2[0], setMinDate = _2[1];
9483
+ var _3 = React$1.useState(startDate ? new Date(startDate) : null), _startDate = _3[0], setStartDate = _3[1];
9484
+ var _4 = React$1.useState(visible), _visible = _4[0], setVisible = _4[1];
9485
+ var _5 = React$1.useState(startDate ? new Date(startDate) : null), initialStartDate = _5[0], setInitialStartDate = _5[1];
9486
+ var _6 = React$1.useState(endDate ? new Date(endDate) : null), initialEndDate = _6[0], setInitialEndDate = _6[1];
9487
+ var _7 = React$1.useState(null), inputStartHoverValue = _7[0], setInputStartHoverValue = _7[1];
9488
+ var _8 = React$1.useState(null), inputEndHoverValue = _8[0], setInputEndHoverValue = _8[1];
9489
+ var _9 = React$1.useState(valid !== null && valid !== void 0 ? valid : (invalid === true ? false : undefined)), isValid = _9[0], setIsValid = _9[1];
9490
+ var _10 = React$1.useState(false), selectEndDate = _10[0], setSelectEndDate = _10[1];
9460
9491
  React$1.useEffect(function () {
9461
9492
  setIsValid(valid !== null && valid !== void 0 ? valid : (invalid === true ? false : undefined));
9462
9493
  }, [valid, invalid]);
9463
9494
  React$1.useEffect(function () {
9464
- if (startDate) {
9465
- setStartDate(new Date(startDate));
9466
- setCalendarDate(new Date(startDate));
9467
- }
9495
+ setStartDate(startDate ? new Date(startDate) : null);
9496
+ setCalendarDate(startDate ? new Date(startDate) : new Date());
9468
9497
  }, [startDate]);
9469
9498
  React$1.useEffect(function () {
9470
- if (endDate) {
9471
- setEndDate(new Date(endDate));
9472
- setCalendarDate(new Date(endDate));
9473
- }
9499
+ setEndDate(endDate ? new Date(endDate) : null);
9500
+ setCalendarDate(endDate ? new Date(endDate) : new Date());
9474
9501
  }, [endDate]);
9475
9502
  React$1.useEffect(function () {
9476
9503
  maxDate && setMaxDate(new Date(maxDate));
@@ -9506,11 +9533,13 @@ var CDateRangePicker = React$1.forwardRef(function (_a, ref) {
9506
9533
  }
9507
9534
  }, [formRef, _startDate, _endDate]);
9508
9535
  var formatDate = function (date) {
9509
- return format$1
9510
- ? format(date, format$1)
9511
- : timepicker
9512
- ? date.toLocaleString(locale)
9513
- : date.toLocaleDateString(locale);
9536
+ return inputDateFormat
9537
+ ? inputDateFormat(date)
9538
+ : format$1
9539
+ ? format(date, format$1)
9540
+ : timepicker
9541
+ ? date.toLocaleString(locale)
9542
+ : date.toLocaleDateString(locale);
9514
9543
  };
9515
9544
  var setInputValue = function (el, date) {
9516
9545
  if (!el) {
@@ -9566,6 +9595,15 @@ var CDateRangePicker = React$1.forwardRef(function (_a, ref) {
9566
9595
  setVisible(false);
9567
9596
  }
9568
9597
  };
9598
+ var handleOnChange = useDebouncedCallback(function (value, input) {
9599
+ var date = inputDateParse
9600
+ ? inputDateParse(value)
9601
+ : getLocalDateFromString(value, locale, timepicker);
9602
+ if (date instanceof Date && date.getTime()) {
9603
+ setCalendarDate(date);
9604
+ input === 'start' ? setStartDate(date) : setEndDate(date);
9605
+ }
9606
+ }, inputOnChangeDelay);
9569
9607
  var InputGroup = function () {
9570
9608
  var _a;
9571
9609
  return (React$1.createElement("div", { className: classNames$1('input-group', 'picker-input-group', (_a = {},
@@ -9574,22 +9612,14 @@ var CDateRangePicker = React$1.forwardRef(function (_a, ref) {
9574
9612
  React$1.createElement("input", __assign$1({ autoComplete: "off", className: classNames$1('form-control date-picker-input', {
9575
9613
  hover: inputStartHoverValue,
9576
9614
  }), disabled: disabled }, (id && { name: range ? "".concat(id, "-start-date") : "".concat(id, "-date") }), { placeholder: Array.isArray(placeholder) ? placeholder[0] : placeholder, readOnly: inputReadOnly || typeof format$1 === 'string', required: required, onChange: function (event) {
9577
- var date = getLocalDateFromString(event.target.value, locale, timepicker);
9578
- if (date instanceof Date && date.getTime()) {
9579
- setCalendarDate(date);
9580
- setStartDate(date);
9581
- }
9615
+ handleOnChange(event.target.value, 'start');
9582
9616
  }, onClick: function () { return setSelectEndDate(false); }, ref: inputStartRef })),
9583
9617
  range && separator !== false && (React$1.createElement("span", { className: "input-group-text" },
9584
9618
  React$1.createElement("span", { className: "picker-input-group-icon date-picker-arrow-icon" }))),
9585
9619
  range && (React$1.createElement("input", __assign$1({ autoComplete: "off", className: classNames$1('form-control date-picker-input', {
9586
9620
  hover: inputEndHoverValue,
9587
9621
  }), disabled: disabled }, (id && { name: "".concat(id, "-end-date") }), { placeholder: placeholder[1], readOnly: inputReadOnly || typeof format$1 === 'string', required: required, onChange: function (event) {
9588
- var date = getLocalDateFromString(event.target.value, locale, timepicker);
9589
- if (date instanceof Date && date.getTime()) {
9590
- setCalendarDate(date);
9591
- setEndDate(date);
9592
- }
9622
+ handleOnChange(event.target.value, 'end');
9593
9623
  }, onClick: function () { return setSelectEndDate(true); }, ref: inputEndRef }))),
9594
9624
  (indicator || cleaner) && (React$1.createElement("span", { className: "input-group-text" },
9595
9625
  indicator && (React$1.createElement("span", { className: "picker-input-group-indicator" }, typeof indicator === 'boolean' ? (React$1.createElement("span", { className: "picker-input-group-icon date-picker-input-icon" })) : (indicator))),
@@ -9645,7 +9675,7 @@ var CDateRangePicker = React$1.forwardRef(function (_a, ref) {
9645
9675
  }, time: index === 0 ? _startDate : _endDate, variant: "select" })); }))))))));
9646
9676
  });
9647
9677
  CDateRangePicker.displayName = 'CDateRangePicker';
9648
- CDateRangePicker.propTypes = __assign$1(__assign$1(__assign$1(__assign$1({}, CCalendar.propTypes), CFormControlWrapper.propTypes), CPicker.propTypes), { cancelButton: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.node]), cancelButtonColor: (_a = CButton.propTypes) === null || _a === void 0 ? void 0 : _a.color, cancelButtonSize: (_b = CButton.propTypes) === null || _b === void 0 ? void 0 : _b.size, cancelButtonVariant: (_c = CButton.propTypes) === null || _c === void 0 ? void 0 : _c.variant, calendars: PropTypes$1.number, className: PropTypes$1.string, cleaner: PropTypes$1.bool, closeOnSelect: PropTypes$1.bool, confirmButton: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.node]), confirmButtonColor: (_d = CButton.propTypes) === null || _d === void 0 ? void 0 : _d.color, confirmButtonSize: (_e = CButton.propTypes) === null || _e === void 0 ? void 0 : _e.size, confirmButtonVariant: (_f = CButton.propTypes) === null || _f === void 0 ? void 0 : _f.variant, id: PropTypes$1.string, indicator: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.node]), inputReadOnly: PropTypes$1.bool, placeholder: PropTypes$1.oneOfType([
9678
+ CDateRangePicker.propTypes = __assign$1(__assign$1(__assign$1(__assign$1({}, CCalendar.propTypes), CFormControlWrapper.propTypes), CPicker.propTypes), { cancelButton: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.node]), cancelButtonColor: (_a = CButton.propTypes) === null || _a === void 0 ? void 0 : _a.color, cancelButtonSize: (_b = CButton.propTypes) === null || _b === void 0 ? void 0 : _b.size, cancelButtonVariant: (_c = CButton.propTypes) === null || _c === void 0 ? void 0 : _c.variant, calendars: PropTypes$1.number, className: PropTypes$1.string, cleaner: PropTypes$1.bool, closeOnSelect: PropTypes$1.bool, confirmButton: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.node]), confirmButtonColor: (_d = CButton.propTypes) === null || _d === void 0 ? void 0 : _d.color, confirmButtonSize: (_e = CButton.propTypes) === null || _e === void 0 ? void 0 : _e.size, confirmButtonVariant: (_f = CButton.propTypes) === null || _f === void 0 ? void 0 : _f.variant, id: PropTypes$1.string, indicator: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.node]), inputDateFormat: PropTypes$1.func, inputDateParse: PropTypes$1.func, inputOnChangeDelay: PropTypes$1.number, inputReadOnly: PropTypes$1.bool, placeholder: PropTypes$1.oneOfType([
9649
9679
  PropTypes$1.string,
9650
9680
  PropTypes$1.arrayOf(PropTypes$1.string.isRequired),
9651
9681
  ]), range: PropTypes$1.bool, ranges: PropTypes$1.object, rangesButtonsColor: (_g = CButton.propTypes) === null || _g === void 0 ? void 0 : _g.color, rangesButtonsSize: (_h = CButton.propTypes) === null || _h === void 0 ? void 0 : _h.size, rangesButtonsVariant: (_j = CButton.propTypes) === null || _j === void 0 ? void 0 : _j.variant, required: PropTypes$1.bool, separator: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.node]), size: PropTypes$1.oneOf(['sm', 'lg']), timepicker: PropTypes$1.bool, todayButton: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.node]), todayButtonColor: (_k = CButton.propTypes) === null || _k === void 0 ? void 0 : _k.color, todayButtonSize: (_l = CButton.propTypes) === null || _l === void 0 ? void 0 : _l.size, todayButtonVariant: (_m = CButton.propTypes) === null || _m === void 0 ? void 0 : _m.variant });
@@ -11639,10 +11669,11 @@ CProgress.propTypes = {
11639
11669
  };
11640
11670
  CProgress.displayName = 'CProgress';
11641
11671
 
11642
- var CPopover = function (_a) {
11672
+ var CPopover = React$1.forwardRef(function (_a, ref) {
11643
11673
  var children = _a.children, _b = _a.animation, animation = _b === void 0 ? true : _b, className = _a.className, content = _a.content, _c = _a.delay, delay = _c === void 0 ? 0 : _c, _d = _a.fallbackPlacements, fallbackPlacements = _d === void 0 ? ['top', 'right', 'bottom', 'left'] : _d, _e = _a.offset, offset = _e === void 0 ? [0, 8] : _e, onHide = _a.onHide, onShow = _a.onShow, _f = _a.placement, placement = _f === void 0 ? 'top' : _f, title = _a.title, _g = _a.trigger, trigger = _g === void 0 ? 'click' : _g, visible = _a.visible, rest = __rest$1(_a, ["children", "animation", "className", "content", "delay", "fallbackPlacements", "offset", "onHide", "onShow", "placement", "title", "trigger", "visible"]);
11644
11674
  var popoverRef = React$1.useRef(null);
11645
11675
  var togglerRef = React$1.useRef(null);
11676
+ var forkedRef = useForkedRef(ref, popoverRef);
11646
11677
  var _h = usePopper(), initPopper = _h.initPopper, destroyPopper = _h.destroyPopper;
11647
11678
  var _j = React$1.useState(visible), _visible = _j[0], setVisible = _j[1];
11648
11679
  var _delay = typeof delay === 'number' ? { show: delay, hide: delay } : delay;
@@ -11700,15 +11731,17 @@ var CPopover = function (_a) {
11700
11731
  typeof window !== 'undefined' &&
11701
11732
  ReactDOM.createPortal(React$1.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: popoverRef, onEnter: onShow, onExit: onHide, timeout: {
11702
11733
  enter: 0,
11703
- exit: popoverRef.current ? getTransitionDurationFromElement(popoverRef.current) + 50 : 200,
11734
+ exit: popoverRef.current
11735
+ ? getTransitionDurationFromElement(popoverRef.current) + 50
11736
+ : 200,
11704
11737
  }, unmountOnExit: true }, function (state) { return (React$1.createElement("div", __assign$1({ className: classNames$1('popover', 'bs-popover-auto', {
11705
11738
  fade: animation,
11706
11739
  show: state === 'entered',
11707
- }, className), ref: popoverRef, role: "tooltip" }, rest),
11740
+ }, className), ref: forkedRef, role: "tooltip" }, rest),
11708
11741
  React$1.createElement("div", { className: "popover-arrow" }),
11709
11742
  React$1.createElement("div", { className: "popover-header" }, title),
11710
11743
  React$1.createElement("div", { className: "popover-body" }, content))); }), document.body)));
11711
- };
11744
+ });
11712
11745
  CPopover.propTypes = {
11713
11746
  animation: PropTypes$1.bool,
11714
11747
  children: PropTypes$1.node,
@@ -14343,10 +14376,11 @@ CToaster.propTypes = {
14343
14376
  };
14344
14377
  CToaster.displayName = 'CToaster';
14345
14378
 
14346
- var CTooltip = function (_a) {
14379
+ var CTooltip = React$1.forwardRef(function (_a, ref) {
14347
14380
  var children = _a.children, _b = _a.animation, animation = _b === void 0 ? true : _b, className = _a.className, content = _a.content, _c = _a.delay, delay = _c === void 0 ? 0 : _c, _d = _a.fallbackPlacements, fallbackPlacements = _d === void 0 ? ['top', 'right', 'bottom', 'left'] : _d, _e = _a.offset, offset = _e === void 0 ? [0, 6] : _e, onHide = _a.onHide, onShow = _a.onShow, _f = _a.placement, placement = _f === void 0 ? 'top' : _f, _g = _a.trigger, trigger = _g === void 0 ? ['hover', 'focus'] : _g, visible = _a.visible, rest = __rest$1(_a, ["children", "animation", "className", "content", "delay", "fallbackPlacements", "offset", "onHide", "onShow", "placement", "trigger", "visible"]);
14348
14381
  var tooltipRef = React$1.useRef(null);
14349
14382
  var togglerRef = React$1.useRef(null);
14383
+ var forkedRef = useForkedRef(ref, tooltipRef);
14350
14384
  var _h = usePopper(), initPopper = _h.initPopper, destroyPopper = _h.destroyPopper;
14351
14385
  var _j = React$1.useState(visible), _visible = _j[0], setVisible = _j[1];
14352
14386
  var _delay = typeof delay === 'number' ? { show: delay, hide: delay } : delay;
@@ -14402,16 +14436,18 @@ var CTooltip = function (_a) {
14402
14436
  onMouseLeave: function () { return toggleVisible(false); },
14403
14437
  }))),
14404
14438
  typeof window !== 'undefined' &&
14405
- ReactDOM.createPortal(React$1.createElement(Transition$1, { in: _visible, mountOnEnter: true, onEnter: onShow, onExit: onHide, timeout: {
14439
+ ReactDOM.createPortal(React$1.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: tooltipRef, onEnter: onShow, onExit: onHide, timeout: {
14406
14440
  enter: 0,
14407
- exit: tooltipRef.current ? getTransitionDurationFromElement(tooltipRef.current) + 50 : 200,
14441
+ exit: tooltipRef.current
14442
+ ? getTransitionDurationFromElement(tooltipRef.current) + 50
14443
+ : 200,
14408
14444
  }, unmountOnExit: true }, function (state) { return (React$1.createElement("div", __assign$1({ className: classNames$1('tooltip', 'bs-tooltip-auto', {
14409
14445
  fade: animation,
14410
14446
  show: state === 'entered',
14411
- }, className), ref: tooltipRef, role: "tooltip" }, rest),
14447
+ }, className), ref: forkedRef, role: "tooltip" }, rest),
14412
14448
  React$1.createElement("div", { className: "tooltip-arrow" }),
14413
14449
  React$1.createElement("div", { className: "tooltip-inner" }, content))); }), document.body)));
14414
- };
14450
+ });
14415
14451
  CTooltip.propTypes = {
14416
14452
  animation: PropTypes$1.bool,
14417
14453
  children: PropTypes$1.node,
@@ -14696,7 +14732,9 @@ exports.CWidgetStatsC = CWidgetStatsC;
14696
14732
  exports.CWidgetStatsD = CWidgetStatsD;
14697
14733
  exports.CWidgetStatsE = CWidgetStatsE;
14698
14734
  exports.CWidgetStatsF = CWidgetStatsF;
14735
+ exports.useDebouncedCallback = useDebouncedCallback;
14699
14736
  exports.useForkedRef = useForkedRef;
14737
+ exports.useIsVisible = useIsVisible;
14700
14738
  exports.usePopper = usePopper;
14701
14739
  exports.useStateWithCallback = useStateWithCallback;
14702
14740
  //# sourceMappingURL=index.js.map