@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/README.md +1 -1
- package/dist/components/date-range-picker/CDateRangePicker.d.ts +18 -0
- package/dist/components/popover/CPopover.d.ts +2 -2
- package/dist/components/tooltip/CTooltip.d.ts +2 -2
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/useDebouncedCallback.d.ts +1 -0
- package/dist/hooks/useIsVisible.d.ts +2 -0
- package/dist/index.es.js +97 -61
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +97 -59
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/date-range-picker/CDateRangePicker.tsx +45 -21
- package/src/components/popover/CPopover.tsx +126 -117
- package/src/components/time-picker/CTimePicker.tsx +34 -34
- package/src/components/time-picker/CTimePickerRollCol.tsx +7 -4
- package/src/components/tooltip/CTooltip.tsx +131 -114
- package/src/hooks/index.ts +3 -1
- package/src/hooks/useDebouncedCallback.ts +18 -0
- package/src/hooks/useIsVisible.ts +14 -0
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
Several quick start options are available:
|
|
44
44
|
|
|
45
|
-
- [Download the latest release](https://github.com/coreui/coreui-react-pro/archive/v4.
|
|
45
|
+
- [Download the latest release](https://github.com/coreui/coreui-react-pro/archive/v4.14.0.zip)
|
|
46
46
|
- Clone the repo: `git clone https://github.com/coreui/coreui-react.git`
|
|
47
47
|
- Install with [npm](https://www.npmjs.com/): `npm install @coreui/react`
|
|
48
48
|
- Install with [yarn](https://yarnpkg.com/): `yarn add @coreui/react`
|
|
@@ -87,6 +87,24 @@ export interface CDateRangePickerProps extends Omit<CFormControlWrapperProps, 'f
|
|
|
87
87
|
* Toggle visibility or set the content of the input indicator.
|
|
88
88
|
*/
|
|
89
89
|
indicator?: ReactNode | boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Custom function to format the selected date into a string according to a custom format.
|
|
92
|
+
*
|
|
93
|
+
* @since v4.14.0
|
|
94
|
+
*/
|
|
95
|
+
inputDateFormat?: (date: Date) => string;
|
|
96
|
+
/**
|
|
97
|
+
* Custom function to parse the input value into a valid Date object.
|
|
98
|
+
*
|
|
99
|
+
* @since v4.14.0
|
|
100
|
+
*/
|
|
101
|
+
inputDateParse?: (date: string | Date) => Date;
|
|
102
|
+
/**
|
|
103
|
+
* Defines the delay (in milliseconds) for the input field's onChange event.
|
|
104
|
+
*
|
|
105
|
+
* @since v4.14.0
|
|
106
|
+
*/
|
|
107
|
+
inputOnChangeDelay?: number;
|
|
90
108
|
/**
|
|
91
109
|
* Toggle the readonly state for the component.
|
|
92
110
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import React, { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import type { Placements, Triggers } from '../../types';
|
|
3
3
|
export interface CPopoverProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'content'> {
|
|
4
4
|
/**
|
|
@@ -61,4 +61,4 @@ export interface CPopoverProps extends Omit<HTMLAttributes<HTMLDivElement>, 'tit
|
|
|
61
61
|
*/
|
|
62
62
|
visible?: boolean;
|
|
63
63
|
}
|
|
64
|
-
export declare const CPopover:
|
|
64
|
+
export declare const CPopover: React.ForwardRefExoticComponent<CPopoverProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import React, { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import type { Placements, Triggers } from '../../types';
|
|
3
3
|
export interface CTooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content'> {
|
|
4
4
|
/**
|
|
@@ -57,4 +57,4 @@ export interface CTooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'con
|
|
|
57
57
|
*/
|
|
58
58
|
visible?: boolean;
|
|
59
59
|
}
|
|
60
|
-
export declare const CTooltip:
|
|
60
|
+
export declare const CTooltip: React.ForwardRefExoticComponent<CTooltipProps & React.RefAttributes<HTMLDivElement>>;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { useDebouncedCallback } from './useDebouncedCallback';
|
|
1
2
|
import { useForkedRef } from './useForkedRef';
|
|
3
|
+
import { useIsVisible } from './useIsVisible';
|
|
2
4
|
import { usePopper } from './usePopper';
|
|
3
5
|
import { useStateWithCallback } from './useStateWithCallback';
|
|
4
|
-
export { useForkedRef, usePopper, useStateWithCallback };
|
|
6
|
+
export { useDebouncedCallback, useForkedRef, useIsVisible, usePopper, useStateWithCallback };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useDebouncedCallback: <F extends Function>(callback: F, delay: number) => (...args: any[]) => void;
|
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React$1, { createContext, forwardRef, useState, useRef, useContext, useEffect, useMemo, Children, useLayoutEffect } from 'react';
|
|
1
|
+
import React$1, { createContext, forwardRef, useState, useRef, useContext, useEffect, useCallback, useMemo, Children, useLayoutEffect } from 'react';
|
|
2
2
|
import ReactDOM, { createPortal } from 'react-dom';
|
|
3
3
|
|
|
4
4
|
/******************************************************************************
|
|
@@ -2477,6 +2477,22 @@ CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends$1({},
|
|
|
2477
2477
|
}) : {};
|
|
2478
2478
|
var CSSTransition$1 = CSSTransition;
|
|
2479
2479
|
|
|
2480
|
+
var useDebouncedCallback = function (callback, delay) {
|
|
2481
|
+
var timeout = useRef();
|
|
2482
|
+
return useCallback(function () {
|
|
2483
|
+
var args = [];
|
|
2484
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2485
|
+
args[_i] = arguments[_i];
|
|
2486
|
+
}
|
|
2487
|
+
var handler = function () {
|
|
2488
|
+
clearTimeout(timeout.current);
|
|
2489
|
+
callback.apply(void 0, args);
|
|
2490
|
+
};
|
|
2491
|
+
clearTimeout(timeout.current);
|
|
2492
|
+
timeout.current = setTimeout(handler, delay);
|
|
2493
|
+
}, [callback, delay]);
|
|
2494
|
+
};
|
|
2495
|
+
|
|
2480
2496
|
// code borrowed from https://github.com/reach/reach-ui
|
|
2481
2497
|
// problem described https://github.com/facebook/react/issues/13029
|
|
2482
2498
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -2520,6 +2536,19 @@ function isFunction(value) {
|
|
|
2520
2536
|
return !!(value && {}.toString.call(value) == '[object Function]');
|
|
2521
2537
|
}
|
|
2522
2538
|
|
|
2539
|
+
var useIsVisible = function (ref) {
|
|
2540
|
+
var _a = useState(false), isIntersecting = _a[0], setIntersecting = _a[1];
|
|
2541
|
+
useEffect(function () {
|
|
2542
|
+
var observer = new IntersectionObserver(function (_a) {
|
|
2543
|
+
var entry = _a[0];
|
|
2544
|
+
return setIntersecting(entry.isIntersecting);
|
|
2545
|
+
});
|
|
2546
|
+
ref.current && observer.observe(ref.current);
|
|
2547
|
+
return function () { return observer.disconnect(); };
|
|
2548
|
+
}, []);
|
|
2549
|
+
return isIntersecting;
|
|
2550
|
+
};
|
|
2551
|
+
|
|
2523
2552
|
var top = 'top';
|
|
2524
2553
|
var bottom = 'bottom';
|
|
2525
2554
|
var right = 'right';
|
|
@@ -9143,17 +9172,20 @@ var CTimePickerRollCol = forwardRef(function (_a, ref) {
|
|
|
9143
9172
|
var init = useRef(true);
|
|
9144
9173
|
var colRef = useRef(null);
|
|
9145
9174
|
var forkedRef = useForkedRef(ref, colRef);
|
|
9175
|
+
var isVisible = useIsVisible(colRef);
|
|
9146
9176
|
useEffect(function () {
|
|
9147
9177
|
var _a, _b;
|
|
9148
9178
|
var nodeEl = (_a = colRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('.selected');
|
|
9149
|
-
if (nodeEl && nodeEl instanceof HTMLElement) {
|
|
9179
|
+
if (isVisible && nodeEl && nodeEl instanceof HTMLElement) {
|
|
9150
9180
|
(_b = colRef.current) === null || _b === void 0 ? void 0 : _b.scrollTo({
|
|
9151
9181
|
top: nodeEl.offsetTop,
|
|
9152
9182
|
behavior: init.current ? 'auto' : 'smooth',
|
|
9153
9183
|
});
|
|
9154
9184
|
}
|
|
9155
|
-
|
|
9156
|
-
|
|
9185
|
+
if (isVisible) {
|
|
9186
|
+
init.current = false;
|
|
9187
|
+
}
|
|
9188
|
+
}, [isVisible, selected]);
|
|
9157
9189
|
var handleKeyDown = function (event, value) {
|
|
9158
9190
|
if (event.code === 'Space' || event.key === 'Enter') {
|
|
9159
9191
|
event.preventDefault();
|
|
@@ -9263,7 +9295,7 @@ var CTimePicker = forwardRef(function (_a, ref) {
|
|
|
9263
9295
|
hour12: false,
|
|
9264
9296
|
}), localizedTimePartials = _0[0], setLocalizedTimePartials = _0[1];
|
|
9265
9297
|
useEffect(function () {
|
|
9266
|
-
setDate(convertTimeToDate(time));
|
|
9298
|
+
setDate(time ? convertTimeToDate(time) : null);
|
|
9267
9299
|
}, [time]);
|
|
9268
9300
|
useEffect(function () {
|
|
9269
9301
|
setIsValid(valid !== null && valid !== void 0 ? valid : (invalid === true ? false : undefined));
|
|
@@ -9367,14 +9399,6 @@ var CTimePicker = forwardRef(function (_a, ref) {
|
|
|
9367
9399
|
React$1.createElement("option", { value: "am" }, "AM"),
|
|
9368
9400
|
React$1.createElement("option", { value: "pm" }, "PM")))));
|
|
9369
9401
|
};
|
|
9370
|
-
var TimePickerRoll = function () { return (React$1.createElement(React$1.Fragment, null,
|
|
9371
|
-
React$1.createElement(CTimePickerRollCol, { elements: localizedTimePartials && localizedTimePartials.listOfHours, onClick: function (index) { return handleTimeChange('hours', index.toString()); }, selected: getSelectedHour(date, locale, ampm) }),
|
|
9372
|
-
React$1.createElement(CTimePickerRollCol, { elements: localizedTimePartials && localizedTimePartials.listOfMinutes, onClick: function (index) { return handleTimeChange('minutes', index.toString()); }, selected: getSelectedMinutes(date) }),
|
|
9373
|
-
seconds && (React$1.createElement(CTimePickerRollCol, { elements: localizedTimePartials && localizedTimePartials.listOfSeconds, onClick: function (index) { return handleTimeChange('seconds', index.toString()); }, selected: getSelectedSeconds(date) })),
|
|
9374
|
-
localizedTimePartials && localizedTimePartials.hour12 && (React$1.createElement(CTimePickerRollCol, { elements: [
|
|
9375
|
-
{ value: 'am', label: 'AM' },
|
|
9376
|
-
{ value: 'pm', label: 'PM' },
|
|
9377
|
-
], onClick: function (value) { return handleTimeChange('toggle', value); }, selected: _ampm })))); };
|
|
9378
9402
|
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 },
|
|
9379
9403
|
React$1.createElement(CPicker, __assign$1({ className: classNames$1('time-picker', (_b = {},
|
|
9380
9404
|
_b["time-picker-".concat(size)] = size,
|
|
@@ -9398,7 +9422,14 @@ var CTimePicker = forwardRef(function (_a, ref) {
|
|
|
9398
9422
|
}, toggler: InputGroup(), visible: _visible }, rest, { ref: ref }),
|
|
9399
9423
|
React$1.createElement("div", { className: classNames$1('time-picker-body', (_c = {},
|
|
9400
9424
|
_c['time-picker-roll'] = variant === 'roll',
|
|
9401
|
-
_c)) }, variant === 'select' ? React$1.createElement(TimePickerSelect, null) :
|
|
9425
|
+
_c)) }, variant === 'select' ? (React$1.createElement(TimePickerSelect, null)) : (React$1.createElement(React$1.Fragment, null,
|
|
9426
|
+
React$1.createElement(CTimePickerRollCol, { elements: localizedTimePartials && localizedTimePartials.listOfHours, onClick: function (index) { return handleTimeChange('hours', index.toString()); }, selected: getSelectedHour(date, locale, ampm) }),
|
|
9427
|
+
React$1.createElement(CTimePickerRollCol, { elements: localizedTimePartials && localizedTimePartials.listOfMinutes, onClick: function (index) { return handleTimeChange('minutes', index.toString()); }, selected: getSelectedMinutes(date) }),
|
|
9428
|
+
seconds && (React$1.createElement(CTimePickerRollCol, { elements: localizedTimePartials && localizedTimePartials.listOfSeconds, onClick: function (index) { return handleTimeChange('seconds', index.toString()); }, selected: getSelectedSeconds(date) })),
|
|
9429
|
+
localizedTimePartials && localizedTimePartials.hour12 && (React$1.createElement(CTimePickerRollCol, { elements: [
|
|
9430
|
+
{ value: 'am', label: 'AM' },
|
|
9431
|
+
{ value: 'pm', label: 'PM' },
|
|
9432
|
+
], onClick: function (value) { return handleTimeChange('toggle', value); }, selected: _ampm }))))))));
|
|
9402
9433
|
});
|
|
9403
9434
|
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']) });
|
|
9404
9435
|
CTimePicker.displayName = 'CTimePicker';
|
|
@@ -9439,36 +9470,32 @@ var getLocalDateFromString = function (string, locale, time) {
|
|
|
9439
9470
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
9440
9471
|
var CDateRangePicker = forwardRef(function (_a, ref) {
|
|
9441
9472
|
var _b;
|
|
9442
|
-
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,
|
|
9473
|
+
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"]);
|
|
9443
9474
|
var inputEndRef = useRef(null);
|
|
9444
9475
|
var inputStartRef = useRef(null);
|
|
9445
9476
|
var formRef = useRef();
|
|
9446
|
-
var
|
|
9447
|
-
var
|
|
9448
|
-
var
|
|
9449
|
-
var
|
|
9450
|
-
var
|
|
9451
|
-
var
|
|
9452
|
-
var
|
|
9453
|
-
var
|
|
9454
|
-
var
|
|
9455
|
-
var
|
|
9456
|
-
var
|
|
9457
|
-
var
|
|
9477
|
+
var _z = useState(calendarDate ? new Date(calendarDate) : new Date()), _calendarDate = _z[0], setCalendarDate = _z[1];
|
|
9478
|
+
var _0 = useState(endDate ? new Date(endDate) : null), _endDate = _0[0], setEndDate = _0[1];
|
|
9479
|
+
var _1 = useState(maxDate ? new Date(maxDate) : null), _maxDate = _1[0], setMaxDate = _1[1];
|
|
9480
|
+
var _2 = useState(minDate ? new Date(minDate) : null), _minDate = _2[0], setMinDate = _2[1];
|
|
9481
|
+
var _3 = useState(startDate ? new Date(startDate) : null), _startDate = _3[0], setStartDate = _3[1];
|
|
9482
|
+
var _4 = useState(visible), _visible = _4[0], setVisible = _4[1];
|
|
9483
|
+
var _5 = useState(startDate ? new Date(startDate) : null), initialStartDate = _5[0], setInitialStartDate = _5[1];
|
|
9484
|
+
var _6 = useState(endDate ? new Date(endDate) : null), initialEndDate = _6[0], setInitialEndDate = _6[1];
|
|
9485
|
+
var _7 = useState(null), inputStartHoverValue = _7[0], setInputStartHoverValue = _7[1];
|
|
9486
|
+
var _8 = useState(null), inputEndHoverValue = _8[0], setInputEndHoverValue = _8[1];
|
|
9487
|
+
var _9 = useState(valid !== null && valid !== void 0 ? valid : (invalid === true ? false : undefined)), isValid = _9[0], setIsValid = _9[1];
|
|
9488
|
+
var _10 = useState(false), selectEndDate = _10[0], setSelectEndDate = _10[1];
|
|
9458
9489
|
useEffect(function () {
|
|
9459
9490
|
setIsValid(valid !== null && valid !== void 0 ? valid : (invalid === true ? false : undefined));
|
|
9460
9491
|
}, [valid, invalid]);
|
|
9461
9492
|
useEffect(function () {
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
setCalendarDate(new Date(startDate));
|
|
9465
|
-
}
|
|
9493
|
+
setStartDate(startDate ? new Date(startDate) : null);
|
|
9494
|
+
setCalendarDate(startDate ? new Date(startDate) : new Date());
|
|
9466
9495
|
}, [startDate]);
|
|
9467
9496
|
useEffect(function () {
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
setCalendarDate(new Date(endDate));
|
|
9471
|
-
}
|
|
9497
|
+
setEndDate(endDate ? new Date(endDate) : null);
|
|
9498
|
+
setCalendarDate(endDate ? new Date(endDate) : new Date());
|
|
9472
9499
|
}, [endDate]);
|
|
9473
9500
|
useEffect(function () {
|
|
9474
9501
|
maxDate && setMaxDate(new Date(maxDate));
|
|
@@ -9504,11 +9531,13 @@ var CDateRangePicker = forwardRef(function (_a, ref) {
|
|
|
9504
9531
|
}
|
|
9505
9532
|
}, [formRef, _startDate, _endDate]);
|
|
9506
9533
|
var formatDate = function (date) {
|
|
9507
|
-
return
|
|
9508
|
-
?
|
|
9509
|
-
:
|
|
9510
|
-
? date
|
|
9511
|
-
:
|
|
9534
|
+
return inputDateFormat
|
|
9535
|
+
? inputDateFormat(date)
|
|
9536
|
+
: format$1
|
|
9537
|
+
? format(date, format$1)
|
|
9538
|
+
: timepicker
|
|
9539
|
+
? date.toLocaleString(locale)
|
|
9540
|
+
: date.toLocaleDateString(locale);
|
|
9512
9541
|
};
|
|
9513
9542
|
var setInputValue = function (el, date) {
|
|
9514
9543
|
if (!el) {
|
|
@@ -9564,6 +9593,15 @@ var CDateRangePicker = forwardRef(function (_a, ref) {
|
|
|
9564
9593
|
setVisible(false);
|
|
9565
9594
|
}
|
|
9566
9595
|
};
|
|
9596
|
+
var handleOnChange = useDebouncedCallback(function (value, input) {
|
|
9597
|
+
var date = inputDateParse
|
|
9598
|
+
? inputDateParse(value)
|
|
9599
|
+
: getLocalDateFromString(value, locale, timepicker);
|
|
9600
|
+
if (date instanceof Date && date.getTime()) {
|
|
9601
|
+
setCalendarDate(date);
|
|
9602
|
+
input === 'start' ? setStartDate(date) : setEndDate(date);
|
|
9603
|
+
}
|
|
9604
|
+
}, inputOnChangeDelay);
|
|
9567
9605
|
var InputGroup = function () {
|
|
9568
9606
|
var _a;
|
|
9569
9607
|
return (React$1.createElement("div", { className: classNames$1('input-group', 'picker-input-group', (_a = {},
|
|
@@ -9572,22 +9610,14 @@ var CDateRangePicker = forwardRef(function (_a, ref) {
|
|
|
9572
9610
|
React$1.createElement("input", __assign$1({ autoComplete: "off", className: classNames$1('form-control date-picker-input', {
|
|
9573
9611
|
hover: inputStartHoverValue,
|
|
9574
9612
|
}), 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) {
|
|
9575
|
-
|
|
9576
|
-
if (date instanceof Date && date.getTime()) {
|
|
9577
|
-
setCalendarDate(date);
|
|
9578
|
-
setStartDate(date);
|
|
9579
|
-
}
|
|
9613
|
+
handleOnChange(event.target.value, 'start');
|
|
9580
9614
|
}, onClick: function () { return setSelectEndDate(false); }, ref: inputStartRef })),
|
|
9581
9615
|
range && separator !== false && (React$1.createElement("span", { className: "input-group-text" },
|
|
9582
9616
|
React$1.createElement("span", { className: "picker-input-group-icon date-picker-arrow-icon" }))),
|
|
9583
9617
|
range && (React$1.createElement("input", __assign$1({ autoComplete: "off", className: classNames$1('form-control date-picker-input', {
|
|
9584
9618
|
hover: inputEndHoverValue,
|
|
9585
9619
|
}), disabled: disabled }, (id && { name: "".concat(id, "-end-date") }), { placeholder: placeholder[1], readOnly: inputReadOnly || typeof format$1 === 'string', required: required, onChange: function (event) {
|
|
9586
|
-
|
|
9587
|
-
if (date instanceof Date && date.getTime()) {
|
|
9588
|
-
setCalendarDate(date);
|
|
9589
|
-
setEndDate(date);
|
|
9590
|
-
}
|
|
9620
|
+
handleOnChange(event.target.value, 'end');
|
|
9591
9621
|
}, onClick: function () { return setSelectEndDate(true); }, ref: inputEndRef }))),
|
|
9592
9622
|
(indicator || cleaner) && (React$1.createElement("span", { className: "input-group-text" },
|
|
9593
9623
|
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))),
|
|
@@ -9643,7 +9673,7 @@ var CDateRangePicker = forwardRef(function (_a, ref) {
|
|
|
9643
9673
|
}, time: index === 0 ? _startDate : _endDate, variant: "select" })); }))))))));
|
|
9644
9674
|
});
|
|
9645
9675
|
CDateRangePicker.displayName = 'CDateRangePicker';
|
|
9646
|
-
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([
|
|
9676
|
+
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([
|
|
9647
9677
|
PropTypes$1.string,
|
|
9648
9678
|
PropTypes$1.arrayOf(PropTypes$1.string.isRequired),
|
|
9649
9679
|
]), 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 });
|
|
@@ -11637,10 +11667,11 @@ CProgress.propTypes = {
|
|
|
11637
11667
|
};
|
|
11638
11668
|
CProgress.displayName = 'CProgress';
|
|
11639
11669
|
|
|
11640
|
-
var CPopover = function (_a) {
|
|
11670
|
+
var CPopover = forwardRef(function (_a, ref) {
|
|
11641
11671
|
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"]);
|
|
11642
11672
|
var popoverRef = useRef(null);
|
|
11643
11673
|
var togglerRef = useRef(null);
|
|
11674
|
+
var forkedRef = useForkedRef(ref, popoverRef);
|
|
11644
11675
|
var _h = usePopper(), initPopper = _h.initPopper, destroyPopper = _h.destroyPopper;
|
|
11645
11676
|
var _j = useState(visible), _visible = _j[0], setVisible = _j[1];
|
|
11646
11677
|
var _delay = typeof delay === 'number' ? { show: delay, hide: delay } : delay;
|
|
@@ -11698,15 +11729,17 @@ var CPopover = function (_a) {
|
|
|
11698
11729
|
typeof window !== 'undefined' &&
|
|
11699
11730
|
createPortal(React$1.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: popoverRef, onEnter: onShow, onExit: onHide, timeout: {
|
|
11700
11731
|
enter: 0,
|
|
11701
|
-
exit: popoverRef.current
|
|
11732
|
+
exit: popoverRef.current
|
|
11733
|
+
? getTransitionDurationFromElement(popoverRef.current) + 50
|
|
11734
|
+
: 200,
|
|
11702
11735
|
}, unmountOnExit: true }, function (state) { return (React$1.createElement("div", __assign$1({ className: classNames$1('popover', 'bs-popover-auto', {
|
|
11703
11736
|
fade: animation,
|
|
11704
11737
|
show: state === 'entered',
|
|
11705
|
-
}, className), ref:
|
|
11738
|
+
}, className), ref: forkedRef, role: "tooltip" }, rest),
|
|
11706
11739
|
React$1.createElement("div", { className: "popover-arrow" }),
|
|
11707
11740
|
React$1.createElement("div", { className: "popover-header" }, title),
|
|
11708
11741
|
React$1.createElement("div", { className: "popover-body" }, content))); }), document.body)));
|
|
11709
|
-
};
|
|
11742
|
+
});
|
|
11710
11743
|
CPopover.propTypes = {
|
|
11711
11744
|
animation: PropTypes$1.bool,
|
|
11712
11745
|
children: PropTypes$1.node,
|
|
@@ -14341,10 +14374,11 @@ CToaster.propTypes = {
|
|
|
14341
14374
|
};
|
|
14342
14375
|
CToaster.displayName = 'CToaster';
|
|
14343
14376
|
|
|
14344
|
-
var CTooltip = function (_a) {
|
|
14377
|
+
var CTooltip = forwardRef(function (_a, ref) {
|
|
14345
14378
|
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"]);
|
|
14346
14379
|
var tooltipRef = useRef(null);
|
|
14347
14380
|
var togglerRef = useRef(null);
|
|
14381
|
+
var forkedRef = useForkedRef(ref, tooltipRef);
|
|
14348
14382
|
var _h = usePopper(), initPopper = _h.initPopper, destroyPopper = _h.destroyPopper;
|
|
14349
14383
|
var _j = useState(visible), _visible = _j[0], setVisible = _j[1];
|
|
14350
14384
|
var _delay = typeof delay === 'number' ? { show: delay, hide: delay } : delay;
|
|
@@ -14400,16 +14434,18 @@ var CTooltip = function (_a) {
|
|
|
14400
14434
|
onMouseLeave: function () { return toggleVisible(false); },
|
|
14401
14435
|
}))),
|
|
14402
14436
|
typeof window !== 'undefined' &&
|
|
14403
|
-
createPortal(React$1.createElement(Transition$1, { in: _visible, mountOnEnter: true, onEnter: onShow, onExit: onHide, timeout: {
|
|
14437
|
+
createPortal(React$1.createElement(Transition$1, { in: _visible, mountOnEnter: true, nodeRef: tooltipRef, onEnter: onShow, onExit: onHide, timeout: {
|
|
14404
14438
|
enter: 0,
|
|
14405
|
-
exit: tooltipRef.current
|
|
14439
|
+
exit: tooltipRef.current
|
|
14440
|
+
? getTransitionDurationFromElement(tooltipRef.current) + 50
|
|
14441
|
+
: 200,
|
|
14406
14442
|
}, unmountOnExit: true }, function (state) { return (React$1.createElement("div", __assign$1({ className: classNames$1('tooltip', 'bs-tooltip-auto', {
|
|
14407
14443
|
fade: animation,
|
|
14408
14444
|
show: state === 'entered',
|
|
14409
|
-
}, className), ref:
|
|
14445
|
+
}, className), ref: forkedRef, role: "tooltip" }, rest),
|
|
14410
14446
|
React$1.createElement("div", { className: "tooltip-arrow" }),
|
|
14411
14447
|
React$1.createElement("div", { className: "tooltip-inner" }, content))); }), document.body)));
|
|
14412
|
-
};
|
|
14448
|
+
});
|
|
14413
14449
|
CTooltip.propTypes = {
|
|
14414
14450
|
animation: PropTypes$1.bool,
|
|
14415
14451
|
children: PropTypes$1.node,
|
|
@@ -14557,5 +14593,5 @@ CWidgetStatsF.propTypes = {
|
|
|
14557
14593
|
};
|
|
14558
14594
|
CWidgetStatsF.displayName = 'CWidgetStatsF';
|
|
14559
14595
|
|
|
14560
|
-
export { CAccordion, CAccordionBody, CAccordionButton, CAccordionHeader, CAccordionItem, CAlert, CAlertHeading, CAlertLink, CAvatar, CBackdrop, CBadge, CBreadcrumb, CBreadcrumbItem, CButton, CButtonGroup, CButtonToolbar, CCallout, CCard, CCardBody, CCardFooter, CCardGroup, CCardHeader, CCardImage, CCardImageOverlay, CCardLink, CCardSubtitle, CCardText, CCardTitle, CCarousel, CCarouselCaption, CCarouselItem, CCloseButton, CCol, CCollapse, CConditionalPortal, CContainer, CDatePicker, CDateRangePicker, CDropdown, CDropdownDivider, CDropdownHeader, CDropdownItem, CDropdownItemPlain, CDropdownMenu, CDropdownToggle, CElementCover, CFooter, CForm, CFormCheck, CFormControlValidation, CFormControlWrapper, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CHeader, CHeaderBrand, CHeaderDivider, CHeaderNav, CHeaderText, CHeaderToggler, CImage, CInputGroup, CInputGroupText, CLink, CListGroup, CListGroupItem, CLoadingButton, CModal, CModalBody, CModalContent, CModalDialog, CModalFooter, CModalHeader, CModalTitle, CMultiSelect, CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavTitle, CNavbar, CNavbarBrand, CNavbarNav, CNavbarText, CNavbarToggler, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasTitle, CPagination, CPaginationItem, CPlaceholder, CPopover, CProgress, CProgressBar, CProgressStacked, CRow, CSidebar, CSidebarBrand, CSidebarFooter, CSidebarHeader, CSidebarNav, CSidebarToggler, CSmartPagination, CSmartTable, CSpinner, CTabContent, CTabPane, CTable, CTableBody, CTableCaption, CTableDataCell, CTableFoot, CTableHead, CTableHeaderCell, CTableRow, CTimePicker, CToast, CToastBody, CToastClose, CToastHeader, CToaster, CTooltip, CVirtualScroller, CWidgetStatsA, CWidgetStatsB, CWidgetStatsC, CWidgetStatsD, CWidgetStatsE, CWidgetStatsF, useForkedRef, usePopper, useStateWithCallback };
|
|
14596
|
+
export { CAccordion, CAccordionBody, CAccordionButton, CAccordionHeader, CAccordionItem, CAlert, CAlertHeading, CAlertLink, CAvatar, CBackdrop, CBadge, CBreadcrumb, CBreadcrumbItem, CButton, CButtonGroup, CButtonToolbar, CCallout, CCard, CCardBody, CCardFooter, CCardGroup, CCardHeader, CCardImage, CCardImageOverlay, CCardLink, CCardSubtitle, CCardText, CCardTitle, CCarousel, CCarouselCaption, CCarouselItem, CCloseButton, CCol, CCollapse, CConditionalPortal, CContainer, CDatePicker, CDateRangePicker, CDropdown, CDropdownDivider, CDropdownHeader, CDropdownItem, CDropdownItemPlain, CDropdownMenu, CDropdownToggle, CElementCover, CFooter, CForm, CFormCheck, CFormControlValidation, CFormControlWrapper, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CHeader, CHeaderBrand, CHeaderDivider, CHeaderNav, CHeaderText, CHeaderToggler, CImage, CInputGroup, CInputGroupText, CLink, CListGroup, CListGroupItem, CLoadingButton, CModal, CModalBody, CModalContent, CModalDialog, CModalFooter, CModalHeader, CModalTitle, CMultiSelect, CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavTitle, CNavbar, CNavbarBrand, CNavbarNav, CNavbarText, CNavbarToggler, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasTitle, CPagination, CPaginationItem, CPlaceholder, CPopover, CProgress, CProgressBar, CProgressStacked, CRow, CSidebar, CSidebarBrand, CSidebarFooter, CSidebarHeader, CSidebarNav, CSidebarToggler, CSmartPagination, CSmartTable, CSpinner, CTabContent, CTabPane, CTable, CTableBody, CTableCaption, CTableDataCell, CTableFoot, CTableHead, CTableHeaderCell, CTableRow, CTimePicker, CToast, CToastBody, CToastClose, CToastHeader, CToaster, CTooltip, CVirtualScroller, CWidgetStatsA, CWidgetStatsB, CWidgetStatsC, CWidgetStatsD, CWidgetStatsE, CWidgetStatsF, useDebouncedCallback, useForkedRef, useIsVisible, usePopper, useStateWithCallback };
|
|
14561
14597
|
//# sourceMappingURL=index.es.js.map
|