grommet 2.33.0 → 2.33.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/components/DataTableColumns/DataTableColumns.js +2 -2
- package/components/SelectMultiple/SelectMultipleContainer.js +5 -5
- package/components/Tabs/Tabs.js +2 -1
- package/es6/components/DataTableColumns/DataTableColumns.js +2 -2
- package/es6/components/SelectMultiple/SelectMultipleContainer.js +5 -5
- package/es6/components/Tabs/Tabs.js +2 -1
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/package.json +1 -4
|
@@ -114,8 +114,8 @@ var Content = function Content(_ref) {
|
|
|
114
114
|
if (nextSearch) {
|
|
115
115
|
var lowerSearch = nextSearch.toLowerCase();
|
|
116
116
|
nextFilteredOptions = options.filter(function (o) {
|
|
117
|
-
var _ref2, _ref3, _o$
|
|
118
|
-
return (_ref2 = (_ref3 = (_o$
|
|
117
|
+
var _ref2, _ref3, _o$label;
|
|
118
|
+
return (_ref2 = (_ref3 = (_o$label = o.label) != null ? _o$label : o.property) != null ? _ref3 : o) == null ? void 0 : _ref2.toLowerCase().includes(lowerSearch);
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
setSearch(nextSearch);
|
|
@@ -101,7 +101,7 @@ var SelectMultipleContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
101
101
|
}, []);
|
|
102
102
|
(0, _react.useEffect)(function () {
|
|
103
103
|
var optionsNode = optionsRef.current;
|
|
104
|
-
if (optionsNode.children) {
|
|
104
|
+
if (optionsNode != null && optionsNode.children) {
|
|
105
105
|
var optionNode = optionsNode.children[activeIndex];
|
|
106
106
|
if (optionNode) optionNode.focus();
|
|
107
107
|
}
|
|
@@ -149,7 +149,7 @@ var SelectMultipleContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
149
149
|
var onNextOption = (0, _react.useCallback)(function (event) {
|
|
150
150
|
event.preventDefault();
|
|
151
151
|
var nextActiveIndex = activeIndex + 1;
|
|
152
|
-
if (nextActiveIndex !== options.length) {
|
|
152
|
+
if (nextActiveIndex !== (options == null ? void 0 : options.length)) {
|
|
153
153
|
setActiveIndex(nextActiveIndex);
|
|
154
154
|
setKeyboardNavigation(true);
|
|
155
155
|
}
|
|
@@ -196,7 +196,7 @@ var SelectMultipleContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
196
196
|
};
|
|
197
197
|
}, [keyboardNavigation]);
|
|
198
198
|
var onSelectOption = (0, _react.useCallback)(function (event) {
|
|
199
|
-
if (!isDisabled(activeIndex) && activeIndex >= 0 && activeIndex < options.length) {
|
|
199
|
+
if (!isDisabled(activeIndex) && activeIndex >= 0 && activeIndex < (options == null ? void 0 : options.length)) {
|
|
200
200
|
event.preventDefault(); // prevent submitting forms
|
|
201
201
|
selectOption(activeIndex)(event);
|
|
202
202
|
}
|
|
@@ -225,7 +225,7 @@ var SelectMultipleContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
225
225
|
if (value.length === limit) {
|
|
226
226
|
var newDisabled = [].concat(disabledProp);
|
|
227
227
|
// disable everything that is not selected
|
|
228
|
-
for (var i = 0; i < options.length; i += 1) {
|
|
228
|
+
for (var i = 0; i < (options == null ? void 0 : options.length); i += 1) {
|
|
229
229
|
if (!isSelected(i) && !originallyDisabled(i)) {
|
|
230
230
|
newDisabled.push(options[i]);
|
|
231
231
|
}
|
|
@@ -318,7 +318,7 @@ var SelectMultipleContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
318
318
|
setActiveIndex(-1);
|
|
319
319
|
onSearch(nextSearch);
|
|
320
320
|
}
|
|
321
|
-
}))), helpContent, options.length > 0 ? /*#__PURE__*/_react["default"].createElement(_StyledSelect.OptionsContainer, {
|
|
321
|
+
}))), helpContent, (options == null ? void 0 : options.length) > 0 ? /*#__PURE__*/_react["default"].createElement(_StyledSelect.OptionsContainer, {
|
|
322
322
|
role: "listbox",
|
|
323
323
|
tabIndex: "0",
|
|
324
324
|
ref: optionsRef,
|
package/components/Tabs/Tabs.js
CHANGED
|
@@ -182,8 +182,9 @@ var Tabs = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
184
|
(0, _react.useEffect)(function () {
|
|
185
|
+
var _tabRefs$activeIndex;
|
|
185
186
|
// if the active tab isn't visible scroll to it
|
|
186
|
-
if (overflow && tabRefs && tabRefs[activeIndex].current && !isVisible(activeIndex)) scrollTo(activeIndex, true);
|
|
187
|
+
if (overflow && tabRefs && (_tabRefs$activeIndex = tabRefs[activeIndex]) != null && _tabRefs$activeIndex.current && !isVisible(activeIndex)) scrollTo(activeIndex, true);
|
|
187
188
|
}, [overflow, activeIndex, tabRefs, isVisible, scrollTo]);
|
|
188
189
|
(0, _react.useEffect)(function () {
|
|
189
190
|
// scroll focus item into view if it is not already visible
|
|
@@ -108,8 +108,8 @@ var Content = function Content(_ref) {
|
|
|
108
108
|
if (nextSearch) {
|
|
109
109
|
var lowerSearch = nextSearch.toLowerCase();
|
|
110
110
|
nextFilteredOptions = options.filter(function (o) {
|
|
111
|
-
var _ref2, _ref3, _o$
|
|
112
|
-
return (_ref2 = (_ref3 = (_o$
|
|
111
|
+
var _ref2, _ref3, _o$label;
|
|
112
|
+
return (_ref2 = (_ref3 = (_o$label = o.label) != null ? _o$label : o.property) != null ? _ref3 : o) == null ? void 0 : _ref2.toLowerCase().includes(lowerSearch);
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
setSearch(nextSearch);
|
|
@@ -95,7 +95,7 @@ var SelectMultipleContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
95
95
|
}, []);
|
|
96
96
|
useEffect(function () {
|
|
97
97
|
var optionsNode = optionsRef.current;
|
|
98
|
-
if (optionsNode.children) {
|
|
98
|
+
if (optionsNode != null && optionsNode.children) {
|
|
99
99
|
var optionNode = optionsNode.children[activeIndex];
|
|
100
100
|
if (optionNode) optionNode.focus();
|
|
101
101
|
}
|
|
@@ -143,7 +143,7 @@ var SelectMultipleContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
143
143
|
var onNextOption = useCallback(function (event) {
|
|
144
144
|
event.preventDefault();
|
|
145
145
|
var nextActiveIndex = activeIndex + 1;
|
|
146
|
-
if (nextActiveIndex !== options.length) {
|
|
146
|
+
if (nextActiveIndex !== (options == null ? void 0 : options.length)) {
|
|
147
147
|
setActiveIndex(nextActiveIndex);
|
|
148
148
|
setKeyboardNavigation(true);
|
|
149
149
|
}
|
|
@@ -190,7 +190,7 @@ var SelectMultipleContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
190
190
|
};
|
|
191
191
|
}, [keyboardNavigation]);
|
|
192
192
|
var onSelectOption = useCallback(function (event) {
|
|
193
|
-
if (!isDisabled(activeIndex) && activeIndex >= 0 && activeIndex < options.length) {
|
|
193
|
+
if (!isDisabled(activeIndex) && activeIndex >= 0 && activeIndex < (options == null ? void 0 : options.length)) {
|
|
194
194
|
event.preventDefault(); // prevent submitting forms
|
|
195
195
|
selectOption(activeIndex)(event);
|
|
196
196
|
}
|
|
@@ -219,7 +219,7 @@ var SelectMultipleContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
219
219
|
if (value.length === limit) {
|
|
220
220
|
var newDisabled = [].concat(disabledProp);
|
|
221
221
|
// disable everything that is not selected
|
|
222
|
-
for (var i = 0; i < options.length; i += 1) {
|
|
222
|
+
for (var i = 0; i < (options == null ? void 0 : options.length); i += 1) {
|
|
223
223
|
if (!isSelected(i) && !originallyDisabled(i)) {
|
|
224
224
|
newDisabled.push(options[i]);
|
|
225
225
|
}
|
|
@@ -312,7 +312,7 @@ var SelectMultipleContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
312
312
|
setActiveIndex(-1);
|
|
313
313
|
onSearch(nextSearch);
|
|
314
314
|
}
|
|
315
|
-
}))), helpContent, options.length > 0 ? /*#__PURE__*/React.createElement(OptionsContainer, {
|
|
315
|
+
}))), helpContent, (options == null ? void 0 : options.length) > 0 ? /*#__PURE__*/React.createElement(OptionsContainer, {
|
|
316
316
|
role: "listbox",
|
|
317
317
|
tabIndex: "0",
|
|
318
318
|
ref: optionsRef,
|
|
@@ -176,8 +176,9 @@ var Tabs = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
176
176
|
}
|
|
177
177
|
};
|
|
178
178
|
useEffect(function () {
|
|
179
|
+
var _tabRefs$activeIndex;
|
|
179
180
|
// if the active tab isn't visible scroll to it
|
|
180
|
-
if (overflow && tabRefs && tabRefs[activeIndex].current && !isVisible(activeIndex)) scrollTo(activeIndex, true);
|
|
181
|
+
if (overflow && tabRefs && (_tabRefs$activeIndex = tabRefs[activeIndex]) != null && _tabRefs$activeIndex.current && !isVisible(activeIndex)) scrollTo(activeIndex, true);
|
|
181
182
|
}, [overflow, activeIndex, tabRefs, isVisible, scrollTo]);
|
|
182
183
|
useEffect(function () {
|
|
183
184
|
// scroll focus item into view if it is not already visible
|