@coreui/react-pro 4.11.0-next.0 → 4.11.0-next.1

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
@@ -6941,7 +6941,7 @@ var isToday = function (date) {
6941
6941
  };
6942
6942
 
6943
6943
  var Calendar = function (props) {
6944
- var addMonths = props.addMonths, calendarDate = props.calendarDate, dayFormat = props.dayFormat, disabledDates = props.disabledDates, endDate = props.endDate, firstDayOfWeek = props.firstDayOfWeek, hoverDate = props.hoverDate, locale = props.locale, maxDate = props.maxDate, minDate = props.minDate, onCellClick = props.onCellClick, onCellKeyDown = props.onCellKeyDown, onCellMouseEnter = props.onCellMouseEnter, onCellMouseLeave = props.onCellMouseLeave, onMonthClick = props.onMonthClick, onYearClick = props.onYearClick, selectAdjacementDays = props.selectAdjacementDays, selectEndDate = props.selectEndDate, showAdjacementDays = props.showAdjacementDays, startDate = props.startDate, view = props.view, weekdayFormat = props.weekdayFormat;
6944
+ var addMonths = props.addMonths, calendarDate = props.calendarDate, dayFormat = props.dayFormat, disabledDates = props.disabledDates, endDate = props.endDate, firstDayOfWeek = props.firstDayOfWeek, hoverDate = props.hoverDate, locale = props.locale, maxDate = props.maxDate, minDate = props.minDate, onCellClick = props.onCellClick, onCellKeyDown = props.onCellKeyDown, onCellMouseEnter = props.onCellMouseEnter, onCellMouseLeave = props.onCellMouseLeave, onMonthClick = props.onMonthClick, onMonthKeyDown = props.onMonthKeyDown, onYearClick = props.onYearClick, onYearKeyDown = props.onYearKeyDown, selectAdjacementDays = props.selectAdjacementDays, selectEndDate = props.selectEndDate, showAdjacementDays = props.showAdjacementDays, startDate = props.startDate, view = props.view, weekdayFormat = props.weekdayFormat;
6945
6945
  var _a = React$1.useState(calendarDate), date = _a[0], setDate = _a[1];
6946
6946
  var _b = React$1.useState([]), listOfMonths = _b[0], setListOfMonths = _b[1];
6947
6947
  React$1.useEffect(function () {
@@ -6979,6 +6979,7 @@ var Calendar = function (props) {
6979
6979
  disabled: isDateDisabled(date, minDate, maxDate, disabledDates)
6980
6980
  },
6981
6981
  _b[month] = true,
6982
+ _b.clickable = month !== 'current' && selectAdjacementDays,
6982
6983
  _b.last = isLastDayOfMonth(date),
6983
6984
  _b['range-hover'] = month === 'current' &&
6984
6985
  (hoverDate && selectEndDate
@@ -6988,7 +6989,10 @@ var Calendar = function (props) {
6988
6989
  _b.selected = isDateSelected(date, startDate, endDate),
6989
6990
  _b.start = isStartDate(date, startDate, endDate),
6990
6991
  _b.end = isEndDate(date, startDate, endDate),
6991
- _b)), key: idx, tabIndex: 0, title: date.toLocaleDateString(locale) }, ((month === 'current' || selectAdjacementDays) && {
6992
+ _b)), key: idx, tabIndex: (month === 'current' || selectAdjacementDays) &&
6993
+ !isDateDisabled(date, minDate, maxDate, disabledDates)
6994
+ ? 0
6995
+ : -1, title: date.toLocaleDateString(locale) }, ((month === 'current' || selectAdjacementDays) && {
6992
6996
  onBlur: function () { return onCellMouseLeave(); },
6993
6997
  onClick: function () { return onCellClick(date); },
6994
6998
  onFocus: function () { return onCellMouseEnter(date); },
@@ -7007,16 +7011,18 @@ var Calendar = function (props) {
7007
7011
  view === 'months' &&
7008
7012
  listOfMonths.map(function (row, index) {
7009
7013
  return (React$1.createElement("tr", { key: index }, row.map(function (month, idx) {
7010
- return (React$1.createElement("td", { key: idx, className: "calendar-cell month", onClick: function () { return onMonthClick(index * 3 + idx - addMonths, 'days'); } },
7014
+ return (React$1.createElement("td", { className: "calendar-cell month", key: idx, onClick: function () { return onMonthClick(index * 3 + idx - addMonths); }, onKeyDown: function (event) { return onMonthKeyDown(event, index * 3 + idx - addMonths); }, tabIndex: 0 },
7011
7015
  React$1.createElement("div", { className: "calendar-cell-inner" }, month)));
7012
7016
  })));
7013
7017
  }),
7014
7018
  view === 'years' &&
7015
7019
  listOfYears.map(function (row, index) {
7016
7020
  return (React$1.createElement("tr", { key: index }, row.map(function (year, idx) {
7017
- return (React$1.createElement("td", { key: idx, className: "calendar-cell year", onClick: function () {
7018
- return onYearClick(new Date(year, date.getMonth() - addMonths, date.getDate()), 'months');
7019
- } },
7021
+ return (React$1.createElement("td", { className: "calendar-cell year", key: idx, onClick: function () {
7022
+ return onYearClick(new Date(year, date.getMonth() - addMonths, date.getDate()));
7023
+ }, onKeyDown: function (event) {
7024
+ return onYearKeyDown(event, new Date(year, date.getMonth() - addMonths, date.getDate()));
7025
+ }, tabIndex: 0 },
7020
7026
  React$1.createElement("div", { className: "calendar-cell-inner" }, new Date(year, 0, 1).toLocaleDateString(locale, { year: 'numeric' }))));
7021
7027
  })));
7022
7028
  }))));
@@ -7163,6 +7169,16 @@ var CCalendar = React$1.forwardRef(function (_a, ref) {
7163
7169
  return;
7164
7170
  }
7165
7171
  };
7172
+ var handleMonthClick = function (month) {
7173
+ setCalendarPage(0, 0, month);
7174
+ setView('days');
7175
+ };
7176
+ var handleMonthKeyDown = function (event, month) {
7177
+ if (event.code === 'Space' || event.key === 'Enter') {
7178
+ setCalendarPage(0, 0, month);
7179
+ setView('days');
7180
+ }
7181
+ };
7166
7182
  var handleNavigationOnClick = function (direction, double) {
7167
7183
  if (double === void 0) { double = false; }
7168
7184
  if (direction === 'prev') {
@@ -7190,16 +7206,20 @@ var CCalendar = React$1.forwardRef(function (_a, ref) {
7190
7206
  return;
7191
7207
  }
7192
7208
  };
7209
+ var handleYearClick = function (date) {
7210
+ setCalendarDate(date);
7211
+ setView('months');
7212
+ };
7213
+ var handleYearKeyDown = function (event, date) {
7214
+ if (event.code === 'Space' || event.key === 'Enter') {
7215
+ setCalendarDate(date);
7216
+ setView('months');
7217
+ }
7218
+ };
7193
7219
  return (React$1.createElement("div", { className: classNames$1('calendars', className) }, _calendarDate &&
7194
7220
  Array.from({ length: calendars }, function (_, index) { return (React$1.createElement("div", { className: classNames$1('calendar', view), key: index, ref: ref },
7195
7221
  React$1.createElement(Navigation, { addMonths: index, calendarDate: _calendarDate, locale: locale, navigation: navigation, navNextDoubleIcon: navNextDoubleIcon, navNextIcon: navNextIcon, navPrevDoubleIcon: navPrevDoubleIcon, navPrevIcon: navPrevIcon, navYearFirst: navYearFirst, onMonthClick: function () { return setView('months'); }, onNavigationClick: handleNavigationOnClick, onYearClick: function () { return setView('years'); }, view: view }),
7196
- React$1.createElement(Calendar, { addMonths: index, calendarDate: _calendarDate, dayFormat: dayFormat, disabledDates: disabledDates, endDate: _endDate, firstDayOfWeek: firstDayOfWeek, hoverDate: _hoverDate, locale: locale, maxDate: _maxDate, minDate: _minDate, onCellClick: function (date) { return handleCellOnClick(date, index); }, onCellKeyDown: function (event, date) { return handleCellKeyDown(event, date, index); }, onCellMouseEnter: handleCellMouseEnter, onCellMouseLeave: handleCellMouseLeave, onMonthClick: function (month, view) {
7197
- setCalendarPage(0, 0, month);
7198
- setView(view);
7199
- }, onYearClick: function (date, view) {
7200
- setCalendarDate(date);
7201
- setView(view);
7202
- }, selectEndDate: _selectEndDate, selectAdjacementDays: selectAdjacementDays, showAdjacementDays: showAdjacementDays, startDate: _startDate, view: view, weekdayFormat: weekdayFormat }))); })));
7222
+ React$1.createElement(Calendar, { addMonths: index, calendarDate: _calendarDate, dayFormat: dayFormat, disabledDates: disabledDates, endDate: _endDate, firstDayOfWeek: firstDayOfWeek, hoverDate: _hoverDate, locale: locale, maxDate: _maxDate, minDate: _minDate, onCellClick: function (date) { return handleCellOnClick(date, index); }, onCellKeyDown: function (event, date) { return handleCellKeyDown(event, date, index); }, onCellMouseEnter: handleCellMouseEnter, onCellMouseLeave: handleCellMouseLeave, onMonthClick: handleMonthClick, onMonthKeyDown: handleMonthKeyDown, onYearClick: handleYearClick, onYearKeyDown: handleYearKeyDown, selectEndDate: _selectEndDate, selectAdjacementDays: selectAdjacementDays, showAdjacementDays: showAdjacementDays, startDate: _startDate, view: view, weekdayFormat: weekdayFormat }))); })));
7203
7223
  });
7204
7224
  CCalendar.propTypes = {
7205
7225
  className: propTypesExports.string,
@@ -11579,6 +11599,7 @@ var CMultiSelect = React$1.forwardRef(function (_a, ref) {
11579
11599
  };
11580
11600
  var handleSearchKeyDown = function (event) {
11581
11601
  if (event.key === 'Enter' && searchValue && allowCreateOptions) {
11602
+ event.preventDefault();
11582
11603
  if (userOption) {
11583
11604
  setSelected(__spreadArray(__spreadArray([], selected, true), userOption, true));
11584
11605
  setUserOptions(__spreadArray(__spreadArray([], userOptions, true), userOption, true));