rsuite 5.4.0 → 5.4.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/CHANGELOG.md +14 -0
- package/Dropdown/styles/index.less +3 -3
- package/Sidenav/styles/index.less +2 -2
- package/cjs/AvatarGroup/AvatarGroup.js +9 -4
- package/cjs/ButtonGroup/ButtonGroup.js +9 -4
- package/cjs/Calendar/Calendar.js +21 -20
- package/cjs/Calendar/Header.js +1 -3
- package/cjs/Calendar/Table.js +1 -1
- package/cjs/Calendar/TableRow.js +12 -7
- package/cjs/Calendar/View.js +9 -5
- package/cjs/CheckTree/index.js +9 -4
- package/cjs/Container/Container.js +6 -3
- package/cjs/DatePicker/DatePicker.js +3 -1
- package/cjs/DateRangePicker/DateRangePicker.js +3 -3
- package/cjs/Disclosure/Disclosure.js +2 -2
- package/cjs/Dropdown/DropdownMenu.js +9 -6
- package/cjs/FormGroup/FormGroup.js +9 -4
- package/cjs/Menu/MenuItem.js +1 -1
- package/cjs/Nav/Nav.js +10 -15
- package/cjs/Overlay/Modal.js +8 -5
- package/cjs/PanelGroup/PanelGroup.js +8 -5
- package/cjs/Toggle/Toggle.js +2 -1
- package/cjs/Tree/Tree.js +9 -4
- package/dist/rsuite-rtl.css +3 -15
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +3 -15
- package/dist/rsuite.js +20 -20
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/AvatarGroup/AvatarGroup.js +7 -4
- package/esm/ButtonGroup/ButtonGroup.js +7 -4
- package/esm/Calendar/Calendar.js +22 -21
- package/esm/Calendar/Header.js +1 -3
- package/esm/Calendar/Table.js +1 -1
- package/esm/Calendar/TableRow.js +13 -8
- package/esm/Calendar/View.js +10 -6
- package/esm/CheckTree/index.js +7 -4
- package/esm/Container/Container.js +7 -4
- package/esm/DatePicker/DatePicker.js +3 -1
- package/esm/DateRangePicker/DateRangePicker.js +3 -3
- package/esm/Disclosure/Disclosure.js +2 -2
- package/esm/Dropdown/DropdownMenu.js +10 -7
- package/esm/FormGroup/FormGroup.js +7 -4
- package/esm/Menu/MenuItem.js +1 -1
- package/esm/Nav/Nav.js +11 -16
- package/esm/Overlay/Modal.js +9 -6
- package/esm/PanelGroup/PanelGroup.js +9 -6
- package/esm/Toggle/Toggle.js +2 -1
- package/esm/Tree/Tree.js +7 -4
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { useClassNames, useCustom } from '../utils';
|
|
6
6
|
export var AvatarGroupContext = /*#__PURE__*/React.createContext({});
|
|
@@ -26,13 +26,16 @@ var AvatarGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
26
26
|
var classes = merge(className, withClassPrefix({
|
|
27
27
|
stack: stack
|
|
28
28
|
}));
|
|
29
|
+
var contextValue = useMemo(function () {
|
|
30
|
+
return {
|
|
31
|
+
size: size
|
|
32
|
+
};
|
|
33
|
+
}, [size]);
|
|
29
34
|
return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
30
35
|
ref: ref,
|
|
31
36
|
className: classes
|
|
32
37
|
}), /*#__PURE__*/React.createElement(AvatarGroupContext.Provider, {
|
|
33
|
-
value:
|
|
34
|
-
size: size
|
|
35
|
-
}
|
|
38
|
+
value: contextValue
|
|
36
39
|
}, spacing ? React.Children.map(children, function (child) {
|
|
37
40
|
var _extends2;
|
|
38
41
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { useClassNames } from '../utils';
|
|
6
6
|
import ButtonGroupContext from './ButtonGroupContext';
|
|
@@ -28,10 +28,13 @@ var ButtonGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
28
28
|
vertical: vertical,
|
|
29
29
|
justified: justified
|
|
30
30
|
}));
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
var contextValue = useMemo(function () {
|
|
32
|
+
return {
|
|
33
33
|
size: size
|
|
34
|
-
}
|
|
34
|
+
};
|
|
35
|
+
}, [size]);
|
|
36
|
+
return /*#__PURE__*/React.createElement(ButtonGroupContext.Provider, {
|
|
37
|
+
value: contextValue
|
|
35
38
|
}, /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
36
39
|
role: role,
|
|
37
40
|
ref: ref,
|
package/esm/Calendar/Calendar.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
import React, { useCallback } from 'react';
|
|
3
|
+
import React, { useCallback, useMemo } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import pick from 'lodash/pick';
|
|
6
6
|
import MonthDropdown from './MonthDropdown';
|
|
@@ -56,11 +56,11 @@ var Calendar = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
56
56
|
withClassPrefix = _useClassNames.withClassPrefix,
|
|
57
57
|
merge = _useClassNames.merge;
|
|
58
58
|
|
|
59
|
-
var isDisabledDate = function
|
|
59
|
+
var isDisabledDate = useCallback(function (date) {
|
|
60
60
|
var _disabledDate;
|
|
61
61
|
|
|
62
62
|
return (_disabledDate = disabledDate === null || disabledDate === void 0 ? void 0 : disabledDate(date)) !== null && _disabledDate !== void 0 ? _disabledDate : false;
|
|
63
|
-
};
|
|
63
|
+
}, [disabledDate]);
|
|
64
64
|
|
|
65
65
|
var isTimeDisabled = function isTimeDisabled(date) {
|
|
66
66
|
return DateUtils.disabledTime(props, date);
|
|
@@ -92,27 +92,28 @@ var Calendar = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
92
92
|
'show-week-numbers': showWeekNumbers
|
|
93
93
|
}));
|
|
94
94
|
var timeDropdownProps = pick(rest, DateUtils.calendarOnlyProps);
|
|
95
|
-
var contextValue = {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
95
|
+
var contextValue = useMemo(function () {
|
|
96
|
+
return {
|
|
97
|
+
date: calendarDate,
|
|
98
|
+
dateRange: dateRange,
|
|
99
|
+
disabledDate: isDisabledDate,
|
|
100
|
+
format: format,
|
|
101
|
+
hoverRangeValue: hoverRangeValue,
|
|
102
|
+
inSameMonth: inSameMonth !== null && inSameMonth !== void 0 ? inSameMonth : inSameThisMonthDate,
|
|
103
|
+
isoWeek: isoWeek,
|
|
104
|
+
locale: locale,
|
|
105
|
+
onChangePageDate: onChangePageDate,
|
|
106
|
+
onChangePageTime: onChangePageTime,
|
|
107
|
+
onMouseMove: onMouseMove,
|
|
108
|
+
onSelect: onSelect,
|
|
109
|
+
renderCell: renderCell,
|
|
110
|
+
showWeekNumbers: showWeekNumbers,
|
|
111
|
+
inline: inline
|
|
112
|
+
};
|
|
113
|
+
}, [calendarDate, dateRange, format, hoverRangeValue, inSameMonth, inSameThisMonthDate, inline, isDisabledDate, isoWeek, locale, onChangePageDate, onChangePageTime, onMouseMove, onSelect, renderCell, showWeekNumbers]);
|
|
112
114
|
return /*#__PURE__*/React.createElement(CalendarProvider, {
|
|
113
115
|
value: contextValue
|
|
114
116
|
}, /*#__PURE__*/React.createElement(Component, _extends({}, DateUtils.omitHideDisabledProps(rest), {
|
|
115
|
-
role: "table",
|
|
116
117
|
className: calendarClasses,
|
|
117
118
|
ref: ref
|
|
118
119
|
}), /*#__PURE__*/React.createElement(Header, {
|
package/esm/Calendar/Header.js
CHANGED
|
@@ -117,9 +117,7 @@ var Header = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
117
117
|
'has-month': hasMonth,
|
|
118
118
|
'has-time': showTime
|
|
119
119
|
}));
|
|
120
|
-
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
121
|
-
role: "row"
|
|
122
|
-
}, rest, {
|
|
120
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
123
121
|
ref: ref,
|
|
124
122
|
className: classes
|
|
125
123
|
}), hasMonth && monthToolbar, showTime && /*#__PURE__*/React.createElement("div", {
|
package/esm/Calendar/Table.js
CHANGED
|
@@ -21,7 +21,7 @@ var Table = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
21
21
|
|
|
22
22
|
var classes = merge(className, withClassPrefix());
|
|
23
23
|
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
24
|
-
role: "
|
|
24
|
+
role: "grid"
|
|
25
25
|
}, rest, {
|
|
26
26
|
ref: ref,
|
|
27
27
|
className: classes
|
package/esm/Calendar/TableRow.js
CHANGED
|
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
import React, { useCallback } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import partial from 'lodash/partial';
|
|
6
|
-
import { DateUtils, useClassNames, DATERANGE_DISABLED_TARGET } from '../utils';
|
|
6
|
+
import { DateUtils, useClassNames, DATERANGE_DISABLED_TARGET, useCustom } from '../utils';
|
|
7
7
|
import { useCalendarContext } from './CalendarContext';
|
|
8
8
|
var TableRow = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
9
9
|
var _props$as = props.as,
|
|
@@ -20,16 +20,19 @@ var TableRow = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
20
20
|
selected = _useCalendarContext$d === void 0 ? new Date() : _useCalendarContext$d,
|
|
21
21
|
dateRange = _useCalendarContext.dateRange,
|
|
22
22
|
disabledDate = _useCalendarContext.disabledDate,
|
|
23
|
-
formatDate = _useCalendarContext.formatDate,
|
|
24
23
|
hoverRangeValue = _useCalendarContext.hoverRangeValue,
|
|
25
24
|
inSameMonth = _useCalendarContext.inSameMonth,
|
|
26
25
|
isoWeek = _useCalendarContext.isoWeek,
|
|
27
26
|
onMouseMove = _useCalendarContext.onMouseMove,
|
|
28
27
|
onSelect = _useCalendarContext.onSelect,
|
|
29
28
|
renderCell = _useCalendarContext.renderCell,
|
|
30
|
-
|
|
29
|
+
overrideLocale = _useCalendarContext.locale,
|
|
31
30
|
showWeekNumbers = _useCalendarContext.showWeekNumbers;
|
|
32
31
|
|
|
32
|
+
var _useCustom = useCustom('Calendar', overrideLocale),
|
|
33
|
+
locale = _useCustom.locale,
|
|
34
|
+
formatDate = _useCustom.formatDate;
|
|
35
|
+
|
|
33
36
|
var _useClassNames = useClassNames(classPrefix),
|
|
34
37
|
prefix = _useClassNames.prefix,
|
|
35
38
|
merge = _useClassNames.merge;
|
|
@@ -43,7 +46,7 @@ var TableRow = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
43
46
|
}, [onSelect]);
|
|
44
47
|
|
|
45
48
|
var renderDays = function renderDays() {
|
|
46
|
-
var formatStr =
|
|
49
|
+
var formatStr = locale.formattedDayPattern;
|
|
47
50
|
var days = [];
|
|
48
51
|
|
|
49
52
|
var _ref = dateRange || [],
|
|
@@ -64,7 +67,7 @@ var TableRow = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
64
67
|
var unSameMonth = !(inSameMonth !== null && inSameMonth !== void 0 && inSameMonth(thisDate));
|
|
65
68
|
var isStartSelected = !unSameMonth && selectedStartDate && DateUtils.isSameDay(thisDate, selectedStartDate);
|
|
66
69
|
var isEndSelected = !unSameMonth && selectedEndDate && DateUtils.isSameDay(thisDate, selectedEndDate);
|
|
67
|
-
var isSelected = isStartSelected || isEndSelected;
|
|
70
|
+
var isSelected = isRangeSelectionMode ? isStartSelected || isEndSelected : DateUtils.isSameDay(thisDate, selected);
|
|
68
71
|
var inRange = false; // for Selected
|
|
69
72
|
|
|
70
73
|
if (selectedStartDate && selectedEndDate) {
|
|
@@ -91,7 +94,7 @@ var TableRow = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
91
94
|
var _classes = prefix('cell', {
|
|
92
95
|
'cell-un-same-month': unSameMonth,
|
|
93
96
|
'cell-is-today': isToday,
|
|
94
|
-
'cell-selected':
|
|
97
|
+
'cell-selected': isSelected,
|
|
95
98
|
'cell-selected-start': isStartSelected,
|
|
96
99
|
'cell-selected-end': isEndSelected,
|
|
97
100
|
'cell-in-range': !unSameMonth && inRange,
|
|
@@ -100,8 +103,10 @@ var TableRow = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
100
103
|
|
|
101
104
|
var title = formatDate ? formatDate(thisDate, formatStr) : DateUtils.format(thisDate, formatStr);
|
|
102
105
|
days.push( /*#__PURE__*/React.createElement("div", {
|
|
103
|
-
role: "
|
|
106
|
+
role: "gridcell",
|
|
104
107
|
key: title,
|
|
108
|
+
"aria-label": title,
|
|
109
|
+
"aria-selected": isSelected || undefined,
|
|
105
110
|
className: _classes
|
|
106
111
|
}, /*#__PURE__*/React.createElement("div", {
|
|
107
112
|
role: "button",
|
|
@@ -125,7 +130,7 @@ var TableRow = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
125
130
|
className: classes
|
|
126
131
|
}), showWeekNumbers && /*#__PURE__*/React.createElement("div", {
|
|
127
132
|
className: prefix('cell-week-number'),
|
|
128
|
-
role: "
|
|
133
|
+
role: "rowheader"
|
|
129
134
|
}, DateUtils.format(weekendDate, isoWeek ? 'I' : 'w')), renderDays());
|
|
130
135
|
});
|
|
131
136
|
TableRow.displayName = 'TableRow';
|
package/esm/Calendar/View.js
CHANGED
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import { DateUtils, useClassNames } from '../utils';
|
|
5
|
+
import { DateUtils, useClassNames, useCustom } from '../utils';
|
|
6
6
|
import Table from './Table';
|
|
7
7
|
import { useCalendarContext } from './CalendarContext';
|
|
8
8
|
var View = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
@@ -16,7 +16,12 @@ var View = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
16
16
|
var _useCalendarContext = useCalendarContext(),
|
|
17
17
|
_useCalendarContext$d = _useCalendarContext.date,
|
|
18
18
|
date = _useCalendarContext$d === void 0 ? new Date() : _useCalendarContext$d,
|
|
19
|
-
isoWeek = _useCalendarContext.isoWeek
|
|
19
|
+
isoWeek = _useCalendarContext.isoWeek,
|
|
20
|
+
overrideLocale = _useCalendarContext.locale;
|
|
21
|
+
|
|
22
|
+
var _useCustom = useCustom('Calendar', overrideLocale),
|
|
23
|
+
locale = _useCustom.locale,
|
|
24
|
+
formatDate = _useCustom.formatDate;
|
|
20
25
|
|
|
21
26
|
var thisMonthDate = DateUtils.setDate(date, 1);
|
|
22
27
|
|
|
@@ -25,13 +30,12 @@ var View = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
25
30
|
withClassPrefix = _useClassNames.withClassPrefix;
|
|
26
31
|
|
|
27
32
|
var classes = merge(className, withClassPrefix());
|
|
28
|
-
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
29
|
-
role: "row"
|
|
30
|
-
}, rest, {
|
|
33
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
31
34
|
ref: ref,
|
|
32
35
|
className: classes
|
|
33
36
|
}), /*#__PURE__*/React.createElement(Table, {
|
|
34
|
-
rows: DateUtils.getMonthView(thisMonthDate, isoWeek)
|
|
37
|
+
rows: DateUtils.getMonthView(thisMonthDate, isoWeek),
|
|
38
|
+
"aria-label": formatDate(thisMonthDate, locale.formattedMonthPattern)
|
|
35
39
|
}));
|
|
36
40
|
});
|
|
37
41
|
View.displayName = 'View';
|
package/esm/CheckTree/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
3
|
import CheckTreePicker from '../CheckTreePicker';
|
|
4
4
|
import TreeContext from '../Tree/TreeContext';
|
|
5
5
|
var CheckTree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
var contextValue = useMemo(function () {
|
|
7
|
+
return {
|
|
8
8
|
inline: true
|
|
9
|
-
}
|
|
9
|
+
};
|
|
10
|
+
}, []);
|
|
11
|
+
return /*#__PURE__*/React.createElement(TreeContext.Provider, {
|
|
12
|
+
value: contextValue
|
|
10
13
|
}, /*#__PURE__*/React.createElement(CheckTreePicker, _extends({
|
|
11
14
|
ref: ref
|
|
12
15
|
}, props)));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
import React, { useState } from 'react';
|
|
3
|
+
import React, { useState, useMemo } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { useClassNames } from '../utils';
|
|
6
6
|
export var ContainerContext = /*#__PURE__*/React.createContext({});
|
|
@@ -24,10 +24,13 @@ var Container = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
24
24
|
var classes = merge(className, withClassPrefix({
|
|
25
25
|
'has-sidebar': hasSidebar
|
|
26
26
|
}));
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
var contextValue = useMemo(function () {
|
|
28
|
+
return {
|
|
29
29
|
setHasSidebar: setHasSidebar
|
|
30
|
-
}
|
|
30
|
+
};
|
|
31
|
+
}, [setHasSidebar]);
|
|
32
|
+
return /*#__PURE__*/React.createElement(ContainerContext.Provider, {
|
|
33
|
+
value: contextValue
|
|
31
34
|
}, /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
32
35
|
ref: ref,
|
|
33
36
|
className: classes
|
|
@@ -371,6 +371,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
371
371
|
top: top
|
|
372
372
|
};
|
|
373
373
|
return /*#__PURE__*/React.createElement(PickerOverlay, {
|
|
374
|
+
role: "dialog",
|
|
374
375
|
className: classes,
|
|
375
376
|
ref: mergeRefs(overlayRef, speakerRef),
|
|
376
377
|
style: styles,
|
|
@@ -444,7 +445,8 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
444
445
|
active: active,
|
|
445
446
|
placement: placement,
|
|
446
447
|
disabled: disabled,
|
|
447
|
-
caretAs: caretAs
|
|
448
|
+
caretAs: caretAs,
|
|
449
|
+
"aria-haspopup": "dialog"
|
|
448
450
|
}), renderDate())));
|
|
449
451
|
});
|
|
450
452
|
DatePicker.displayName = 'DatePicker';
|
|
@@ -185,7 +185,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
return isPlaintext ? '' : placeholder || rangeFormatStr;
|
|
188
|
-
}, [character, formatDate, formatStr, placeholder, rangeFormatStr, renderValue
|
|
188
|
+
}, [character, formatDate, formatStr, placeholder, rangeFormatStr, renderValue]);
|
|
189
189
|
/**
|
|
190
190
|
* preset hover range
|
|
191
191
|
*/
|
|
@@ -237,7 +237,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
237
237
|
if (closeOverlay !== false) {
|
|
238
238
|
handleCloseDropdown();
|
|
239
239
|
}
|
|
240
|
-
}, [formatStr, handleCloseDropdown, onChange,
|
|
240
|
+
}, [formatStr, handleCloseDropdown, onChange, setValue, value]);
|
|
241
241
|
/**
|
|
242
242
|
* Select the date range. If oneTap is not set, you need to click twice to select the start time and end time.
|
|
243
243
|
* The MouseMove event is called between the first click and the second click to update the selection state.
|
|
@@ -267,7 +267,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
267
267
|
} else if (!isNil(nextHoverDateRange)) {
|
|
268
268
|
setHoverDateRange(nextHoverDateRange);
|
|
269
269
|
}
|
|
270
|
-
}, [getHoverRangeValue
|
|
270
|
+
}, [getHoverRangeValue]);
|
|
271
271
|
/**
|
|
272
272
|
* Callback for selecting a date cell in the calendar grid
|
|
273
273
|
*/
|
|
@@ -56,7 +56,7 @@ function Disclosure(props) {
|
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
|
-
var
|
|
59
|
+
var contextValue = useMemo(function () {
|
|
60
60
|
return [{
|
|
61
61
|
open: open
|
|
62
62
|
}, dispatch, {
|
|
@@ -64,7 +64,7 @@ function Disclosure(props) {
|
|
|
64
64
|
}];
|
|
65
65
|
}, [open, dispatch, onToggle]);
|
|
66
66
|
return /*#__PURE__*/React.createElement(DisclosureContext.Provider, {
|
|
67
|
-
value:
|
|
67
|
+
value: contextValue
|
|
68
68
|
}, children({
|
|
69
69
|
open: open
|
|
70
70
|
}, containerElementRef));
|
|
@@ -4,7 +4,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
4
4
|
|
|
5
5
|
var _templateObject, _templateObject2;
|
|
6
6
|
|
|
7
|
-
import React, { useCallback, useContext } from 'react';
|
|
7
|
+
import React, { useCallback, useContext, useMemo } from 'react';
|
|
8
8
|
import omit from 'lodash/omit';
|
|
9
9
|
import Menu from '../Menu/Menu';
|
|
10
10
|
import MenuItem from '../Menu/MenuItem';
|
|
@@ -69,17 +69,20 @@ var DropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
69
69
|
var _useClassNames3 = useClassNames('dropdown-item'),
|
|
70
70
|
mergeItemClassNames = _useClassNames3.merge,
|
|
71
71
|
withItemClassPrefix = _useClassNames3.withClassPrefix,
|
|
72
|
-
prefixItemClassName = _useClassNames3.prefix;
|
|
72
|
+
prefixItemClassName = _useClassNames3.prefix;
|
|
73
|
+
|
|
74
|
+
var contextValue = useMemo(function () {
|
|
75
|
+
return {
|
|
76
|
+
activeKey: activeKey,
|
|
77
|
+
onSelect: onSelect
|
|
78
|
+
};
|
|
79
|
+
}, [activeKey, onSelect]); // <Dropdown.Menu> is used outside of <Dropdown>
|
|
73
80
|
// renders a vertical `menubar`
|
|
74
81
|
|
|
75
|
-
|
|
76
82
|
if (!dropdown) {
|
|
77
83
|
var classes = merge(props.className, withClassPrefix());
|
|
78
84
|
return /*#__PURE__*/React.createElement(DropdownContext.Provider, {
|
|
79
|
-
value:
|
|
80
|
-
activeKey: activeKey,
|
|
81
|
-
onSelect: onSelect
|
|
82
|
-
}
|
|
85
|
+
value: contextValue
|
|
83
86
|
}, /*#__PURE__*/React.createElement(Menubar, {
|
|
84
87
|
vertical: true,
|
|
85
88
|
onActivateItem: function onActivateItem(event) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { useClassNames } from '../utils';
|
|
6
6
|
export var FormGroupContext = /*#__PURE__*/React.createContext({});
|
|
@@ -18,10 +18,13 @@ var FormGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
18
18
|
merge = _useClassNames.merge;
|
|
19
19
|
|
|
20
20
|
var classes = merge(className, withClassPrefix());
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
var contextValue = useMemo(function () {
|
|
22
|
+
return {
|
|
23
23
|
controlId: controlId
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
|
+
}, [controlId]);
|
|
26
|
+
return /*#__PURE__*/React.createElement(FormGroupContext.Provider, {
|
|
27
|
+
value: contextValue
|
|
25
28
|
}, /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
26
29
|
ref: ref,
|
|
27
30
|
className: classes,
|
package/esm/Menu/MenuItem.js
CHANGED
|
@@ -42,7 +42,7 @@ function MenuItem(props) {
|
|
|
42
42
|
id: menuitemRef.current.id
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
}, [dispatch]); // Gain/release focus on mouseenter/mouseleave in `menu`
|
|
45
|
+
}, [dispatch, hasFocus]); // Gain/release focus on mouseenter/mouseleave in `menu`
|
|
46
46
|
|
|
47
47
|
var handleMouseMove = useCallback(function () {
|
|
48
48
|
if (!isNil(menuitemRef.current) && !hasFocus) {
|
package/esm/Nav/Nav.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
import React, { useContext } from 'react';
|
|
3
|
+
import React, { useContext, useMemo } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import NavItem from './NavItem';
|
|
6
6
|
import Dropdown from '../Dropdown';
|
|
@@ -55,14 +55,17 @@ var Nav = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
55
55
|
onSelectFromSidenav = _ref$onSelect === void 0 ? onSelectProp : _ref$onSelect;
|
|
56
56
|
|
|
57
57
|
var activeKey = activeKeyProp !== null && activeKeyProp !== void 0 ? activeKeyProp : activeKeyFromSidenav;
|
|
58
|
+
var contextValue = useMemo(function () {
|
|
59
|
+
return {
|
|
60
|
+
withinNav: true,
|
|
61
|
+
activeKey: activeKey,
|
|
62
|
+
onSelect: onSelectProp !== null && onSelectProp !== void 0 ? onSelectProp : onSelectFromSidenav
|
|
63
|
+
};
|
|
64
|
+
}, [activeKey, onSelectFromSidenav, onSelectProp]);
|
|
58
65
|
|
|
59
66
|
if (sidenav !== null && sidenav !== void 0 && sidenav.expanded) {
|
|
60
67
|
return /*#__PURE__*/React.createElement(NavContext.Provider, {
|
|
61
|
-
value:
|
|
62
|
-
withinNav: true,
|
|
63
|
-
activeKey: activeKey,
|
|
64
|
-
onSelect: onSelectProp !== null && onSelectProp !== void 0 ? onSelectProp : onSelectFromSidenav
|
|
65
|
-
}
|
|
68
|
+
value: contextValue
|
|
66
69
|
}, /*#__PURE__*/React.createElement("ul", _extends({
|
|
67
70
|
ref: ref,
|
|
68
71
|
className: classes
|
|
@@ -73,11 +76,7 @@ var Nav = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
73
76
|
|
|
74
77
|
if (sidenav) {
|
|
75
78
|
return /*#__PURE__*/React.createElement(NavContext.Provider, {
|
|
76
|
-
value:
|
|
77
|
-
withinNav: true,
|
|
78
|
-
activeKey: activeKey,
|
|
79
|
-
onSelect: onSelectProp !== null && onSelectProp !== void 0 ? onSelectProp : onSelectFromSidenav
|
|
80
|
-
}
|
|
79
|
+
value: contextValue
|
|
81
80
|
}, /*#__PURE__*/React.createElement(Menubar, {
|
|
82
81
|
vertical: !!sidenav
|
|
83
82
|
}, function (menubar, ref) {
|
|
@@ -90,11 +89,7 @@ var Nav = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
90
89
|
}
|
|
91
90
|
|
|
92
91
|
return /*#__PURE__*/React.createElement(NavContext.Provider, {
|
|
93
|
-
value:
|
|
94
|
-
withinNav: true,
|
|
95
|
-
activeKey: activeKey,
|
|
96
|
-
onSelect: onSelectProp !== null && onSelectProp !== void 0 ? onSelectProp : onSelectFromSidenav
|
|
97
|
-
}
|
|
92
|
+
value: contextValue
|
|
98
93
|
}, /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
99
94
|
ref: menubarRef,
|
|
100
95
|
className: classes
|
package/esm/Overlay/Modal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
import React, { useRef, useEffect, useState, useCallback } from 'react';
|
|
3
|
+
import React, { useRef, useEffect, useState, useCallback, useMemo } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import contains from 'dom-lib/contains';
|
|
@@ -202,6 +202,13 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
202
202
|
var handleExited = useCallback(function () {
|
|
203
203
|
setExited(true);
|
|
204
204
|
}, []);
|
|
205
|
+
var contextValue = useMemo(function () {
|
|
206
|
+
return {
|
|
207
|
+
overlayContainer: function overlayContainer() {
|
|
208
|
+
return modal.dialog;
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}, [modal.dialog]);
|
|
205
212
|
|
|
206
213
|
if (!mountModal) {
|
|
207
214
|
return null;
|
|
@@ -251,11 +258,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
251
258
|
onEntered: onEntered
|
|
252
259
|
}), children) : children;
|
|
253
260
|
return /*#__PURE__*/React.createElement(OverlayContext.Provider, {
|
|
254
|
-
value:
|
|
255
|
-
overlayContainer: function overlayContainer() {
|
|
256
|
-
return modal.dialog;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
261
|
+
value: contextValue
|
|
259
262
|
}, /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
260
263
|
ref: mergeRefs(modal.setDialogRef, ref),
|
|
261
264
|
style: style,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
import React, { useCallback } from 'react';
|
|
3
|
+
import React, { useCallback, useMemo } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { useClassNames, useControlled } from '../utils';
|
|
6
6
|
export var PanelGroupContext = /*#__PURE__*/React.createContext({});
|
|
@@ -34,16 +34,19 @@ var PanelGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
34
34
|
setActiveKey(activeKey);
|
|
35
35
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(activeKey, event);
|
|
36
36
|
}, [onSelect, setActiveKey]);
|
|
37
|
+
var contextValue = useMemo(function () {
|
|
38
|
+
return {
|
|
39
|
+
accordion: accordion,
|
|
40
|
+
activeKey: activeKey,
|
|
41
|
+
onGroupSelect: handleSelect
|
|
42
|
+
};
|
|
43
|
+
}, [accordion, activeKey, handleSelect]);
|
|
37
44
|
return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
38
45
|
ref: ref,
|
|
39
46
|
role: accordion ? 'tablist' : undefined,
|
|
40
47
|
className: classes
|
|
41
48
|
}), /*#__PURE__*/React.createElement(PanelGroupContext.Provider, {
|
|
42
|
-
value:
|
|
43
|
-
accordion: accordion,
|
|
44
|
-
activeKey: activeKey,
|
|
45
|
-
onGroupSelect: handleSelect
|
|
46
|
-
}
|
|
49
|
+
value: contextValue
|
|
47
50
|
}, children));
|
|
48
51
|
});
|
|
49
52
|
PanelGroup.displayName = 'PanelGroup';
|
package/esm/Toggle/Toggle.js
CHANGED
|
@@ -66,7 +66,8 @@ var Toggle = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
66
66
|
}, rest), /*#__PURE__*/React.createElement("input", {
|
|
67
67
|
ref: inputRef,
|
|
68
68
|
type: "checkbox",
|
|
69
|
-
checked:
|
|
69
|
+
checked: checkedProp,
|
|
70
|
+
defaultChecked: defaultChecked,
|
|
70
71
|
disabled: disabled,
|
|
71
72
|
readOnly: readOnly,
|
|
72
73
|
onChange: handleInputChange,
|
package/esm/Tree/Tree.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
3
|
import TreePicker from '../TreePicker';
|
|
4
4
|
import TreeContext from './TreeContext';
|
|
5
5
|
|
|
@@ -15,10 +15,13 @@ export var TREE_NODE_DROP_POSITION;
|
|
|
15
15
|
})(TREE_NODE_DROP_POSITION || (TREE_NODE_DROP_POSITION = {}));
|
|
16
16
|
|
|
17
17
|
var Tree = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
var contextValue = useMemo(function () {
|
|
19
|
+
return {
|
|
20
20
|
inline: true
|
|
21
|
-
}
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
return /*#__PURE__*/React.createElement(TreeContext.Provider, {
|
|
24
|
+
value: contextValue
|
|
22
25
|
}, /*#__PURE__*/React.createElement(TreePicker, _extends({
|
|
23
26
|
ref: ref
|
|
24
27
|
}, props)));
|