rsuite 5.10.0 → 5.11.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.
@@ -35,6 +35,8 @@ export interface DateRangePickerProps extends PickerBaseProps, FormControlBasePr
35
35
  onClean?: (event: React.MouseEvent) => void;
36
36
  /** Custom render value */
37
37
  renderValue?: (value: DateRange, format: string) => React.ReactNode;
38
+ /** Custom render for calendar title */
39
+ renderTitle?: (date: Date) => React.ReactNode;
38
40
  }
39
41
  export interface DateRangePicker extends PickerComponent<DateRangePickerProps> {
40
42
  /** Allow the maximum number of days specified, other dates are disabled */
@@ -67,7 +67,8 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
67
67
  onOk = props.onOk,
68
68
  onOpen = props.onOpen,
69
69
  onSelect = props.onSelect,
70
- rest = _objectWithoutPropertiesLoose(props, ["as", "classPrefix", "className", "appearance", "cleanable", "character", "defaultCalendarValue", "defaultValue", "disabled", "disabledDate", "format", "hoverRange", "isoWeek", "limitEndYear", "locale", "menuClassName", "menuStyle", "oneTap", "placeholder", "placement", "ranges", "renderValue", "showOneCalendar", "showWeekNumbers", "showMeridian", "style", "toggleAs", "caretAs", "value", "onChange", "onClean", "onClose", "onEnter", "onEntered", "onExited", "onOk", "onOpen", "onSelect"]);
70
+ renderTitle = props.renderTitle,
71
+ rest = _objectWithoutPropertiesLoose(props, ["as", "classPrefix", "className", "appearance", "cleanable", "character", "defaultCalendarValue", "defaultValue", "disabled", "disabledDate", "format", "hoverRange", "isoWeek", "limitEndYear", "locale", "menuClassName", "menuStyle", "oneTap", "placeholder", "placement", "ranges", "renderValue", "showOneCalendar", "showWeekNumbers", "showMeridian", "style", "toggleAs", "caretAs", "value", "onChange", "onClean", "onClose", "onEnter", "onEntered", "onExited", "onOk", "onOpen", "onSelect", "renderTitle"]);
71
72
 
72
73
  var _useClassNames = useClassNames(classPrefix),
73
74
  merge = _useClassNames.merge,
@@ -535,7 +536,8 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
535
536
  onChangeCalendarTime: handleChangeCalendarTime,
536
537
  onMouseMove: handleMouseMove,
537
538
  onSelect: handleSelectDate,
538
- onToggleMeridian: handleToggleMeridian
539
+ onToggleMeridian: handleToggleMeridian,
540
+ renderTitle: renderTitle
539
541
  };
540
542
  return /*#__PURE__*/React.createElement(PickerOverlay, {
541
543
  className: classes,
@@ -5,7 +5,10 @@ import MenuContext, { MenuActionTypes, MoveFocusTo } from './MenuContext';
5
5
  import { KEY_VALUES, useCustom } from '../utils';
6
6
  import { isFocusEntering, isFocusLeaving } from '../utils/events';
7
7
  import useMenu from './useMenu';
8
+ import { isFocusableElement } from '../utils/dom';
8
9
  export default function Menubar(_ref) {
10
+ var _items$activeItemInde3;
11
+
9
12
  var _ref$vertical = _ref.vertical,
10
13
  vertical = _ref$vertical === void 0 ? false : _ref$vertical,
11
14
  children = _ref.children,
@@ -20,7 +23,8 @@ export default function Menubar(_ref) {
20
23
  var menubarElementRef = useRef(null);
21
24
  var onFocus = useCallback(function (event) {
22
25
  // Focus moves inside Menubar
23
- if (isFocusEntering(event)) {
26
+ if (isFocusEntering(event) && // Skip if focus is moving to a focusable element within this menu
27
+ !(event.target !== event.currentTarget && isFocusableElement(event.target))) {
24
28
  if (activeItemIndex === null) {
25
29
  dispatch({
26
30
  type: MenuActionTypes.MoveFocus,
@@ -43,7 +47,9 @@ export default function Menubar(_ref) {
43
47
  rtl = _useCustom.rtl;
44
48
 
45
49
  var onKeyDown = useCallback(function (event) {
46
- var activeItemElement = isNil(activeItemIndex) ? null : items[activeItemIndex].element;
50
+ var _items$activeItemInde, _items$activeItemInde2;
51
+
52
+ var activeItemElement = isNil(activeItemIndex) ? null : (_items$activeItemInde = (_items$activeItemInde2 = items[activeItemIndex]) === null || _items$activeItemInde2 === void 0 ? void 0 : _items$activeItemInde2.element) !== null && _items$activeItemInde !== void 0 ? _items$activeItemInde : null;
47
53
 
48
54
  switch (true) {
49
55
  case !vertical && !rtl && event.key === KEY_VALUES.RIGHT:
@@ -123,7 +129,7 @@ export default function Menubar(_ref) {
123
129
  onBlur: onBlur,
124
130
  onKeyDown: onKeyDown,
125
131
  onClick: onClick,
126
- 'aria-activedescendant': isNil(activeItemIndex) ? undefined : items[activeItemIndex].element.id,
132
+ 'aria-activedescendant': isNil(activeItemIndex) ? undefined : (_items$activeItemInde3 = items[activeItemIndex]) === null || _items$activeItemInde3 === void 0 ? void 0 : _items$activeItemInde3.element.id,
127
133
  'aria-orientation': vertical ? 'vertical' : undefined // implicitly set 'horizontal'
128
134
 
129
135
  }, menubarElementRef));
@@ -1 +1 @@
1
- export declare function isFocusableElement(element: HTMLElement): boolean;
1
+ export declare function isFocusableElement(element: Element): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "5.10.0",
3
+ "version": "5.11.0",
4
4
  "description": "A suite of react components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",