@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/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.11.0-next.0.zip)
45
+ - [Download the latest release](https://github.com/coreui/coreui-react-pro/archive/v4.11.0-next.1.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`
package/dist/index.es.js CHANGED
@@ -6921,7 +6921,7 @@ var isToday = function (date) {
6921
6921
  };
6922
6922
 
6923
6923
  var Calendar = function (props) {
6924
- 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;
6924
+ 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;
6925
6925
  var _a = useState(calendarDate), date = _a[0], setDate = _a[1];
6926
6926
  var _b = useState([]), listOfMonths = _b[0], setListOfMonths = _b[1];
6927
6927
  useEffect(function () {
@@ -6959,6 +6959,7 @@ var Calendar = function (props) {
6959
6959
  disabled: isDateDisabled(date, minDate, maxDate, disabledDates)
6960
6960
  },
6961
6961
  _b[month] = true,
6962
+ _b.clickable = month !== 'current' && selectAdjacementDays,
6962
6963
  _b.last = isLastDayOfMonth(date),
6963
6964
  _b['range-hover'] = month === 'current' &&
6964
6965
  (hoverDate && selectEndDate
@@ -6968,7 +6969,10 @@ var Calendar = function (props) {
6968
6969
  _b.selected = isDateSelected(date, startDate, endDate),
6969
6970
  _b.start = isStartDate(date, startDate, endDate),
6970
6971
  _b.end = isEndDate(date, startDate, endDate),
6971
- _b)), key: idx, tabIndex: 0, title: date.toLocaleDateString(locale) }, ((month === 'current' || selectAdjacementDays) && {
6972
+ _b)), key: idx, tabIndex: (month === 'current' || selectAdjacementDays) &&
6973
+ !isDateDisabled(date, minDate, maxDate, disabledDates)
6974
+ ? 0
6975
+ : -1, title: date.toLocaleDateString(locale) }, ((month === 'current' || selectAdjacementDays) && {
6972
6976
  onBlur: function () { return onCellMouseLeave(); },
6973
6977
  onClick: function () { return onCellClick(date); },
6974
6978
  onFocus: function () { return onCellMouseEnter(date); },
@@ -6987,16 +6991,18 @@ var Calendar = function (props) {
6987
6991
  view === 'months' &&
6988
6992
  listOfMonths.map(function (row, index) {
6989
6993
  return (React__default$1.createElement("tr", { key: index }, row.map(function (month, idx) {
6990
- return (React__default$1.createElement("td", { key: idx, className: "calendar-cell month", onClick: function () { return onMonthClick(index * 3 + idx - addMonths, 'days'); } },
6994
+ return (React__default$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 },
6991
6995
  React__default$1.createElement("div", { className: "calendar-cell-inner" }, month)));
6992
6996
  })));
6993
6997
  }),
6994
6998
  view === 'years' &&
6995
6999
  listOfYears.map(function (row, index) {
6996
7000
  return (React__default$1.createElement("tr", { key: index }, row.map(function (year, idx) {
6997
- return (React__default$1.createElement("td", { key: idx, className: "calendar-cell year", onClick: function () {
6998
- return onYearClick(new Date(year, date.getMonth() - addMonths, date.getDate()), 'months');
6999
- } },
7001
+ return (React__default$1.createElement("td", { className: "calendar-cell year", key: idx, onClick: function () {
7002
+ return onYearClick(new Date(year, date.getMonth() - addMonths, date.getDate()));
7003
+ }, onKeyDown: function (event) {
7004
+ return onYearKeyDown(event, new Date(year, date.getMonth() - addMonths, date.getDate()));
7005
+ }, tabIndex: 0 },
7000
7006
  React__default$1.createElement("div", { className: "calendar-cell-inner" }, new Date(year, 0, 1).toLocaleDateString(locale, { year: 'numeric' }))));
7001
7007
  })));
7002
7008
  }))));
@@ -7143,6 +7149,16 @@ var CCalendar = forwardRef(function (_a, ref) {
7143
7149
  return;
7144
7150
  }
7145
7151
  };
7152
+ var handleMonthClick = function (month) {
7153
+ setCalendarPage(0, 0, month);
7154
+ setView('days');
7155
+ };
7156
+ var handleMonthKeyDown = function (event, month) {
7157
+ if (event.code === 'Space' || event.key === 'Enter') {
7158
+ setCalendarPage(0, 0, month);
7159
+ setView('days');
7160
+ }
7161
+ };
7146
7162
  var handleNavigationOnClick = function (direction, double) {
7147
7163
  if (double === void 0) { double = false; }
7148
7164
  if (direction === 'prev') {
@@ -7170,16 +7186,20 @@ var CCalendar = forwardRef(function (_a, ref) {
7170
7186
  return;
7171
7187
  }
7172
7188
  };
7189
+ var handleYearClick = function (date) {
7190
+ setCalendarDate(date);
7191
+ setView('months');
7192
+ };
7193
+ var handleYearKeyDown = function (event, date) {
7194
+ if (event.code === 'Space' || event.key === 'Enter') {
7195
+ setCalendarDate(date);
7196
+ setView('months');
7197
+ }
7198
+ };
7173
7199
  return (React__default$1.createElement("div", { className: classNames$1('calendars', className) }, _calendarDate &&
7174
7200
  Array.from({ length: calendars }, function (_, index) { return (React__default$1.createElement("div", { className: classNames$1('calendar', view), key: index, ref: ref },
7175
7201
  React__default$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 }),
7176
- React__default$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) {
7177
- setCalendarPage(0, 0, month);
7178
- setView(view);
7179
- }, onYearClick: function (date, view) {
7180
- setCalendarDate(date);
7181
- setView(view);
7182
- }, selectEndDate: _selectEndDate, selectAdjacementDays: selectAdjacementDays, showAdjacementDays: showAdjacementDays, startDate: _startDate, view: view, weekdayFormat: weekdayFormat }))); })));
7202
+ React__default$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 }))); })));
7183
7203
  });
7184
7204
  CCalendar.propTypes = {
7185
7205
  className: propTypesExports.string,
@@ -11559,6 +11579,7 @@ var CMultiSelect = forwardRef(function (_a, ref) {
11559
11579
  };
11560
11580
  var handleSearchKeyDown = function (event) {
11561
11581
  if (event.key === 'Enter' && searchValue && allowCreateOptions) {
11582
+ event.preventDefault();
11562
11583
  if (userOption) {
11563
11584
  setSelected(__spreadArray(__spreadArray([], selected, true), userOption, true));
11564
11585
  setUserOptions(__spreadArray(__spreadArray([], userOptions, true), userOption, true));