@carbon/react 1.3.0-rc.1 → 1.4.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.
- package/es/components/Checkbox/Checkbox.Skeleton.js +5 -3
- package/es/components/ComposedModal/next/ComposedModal.js +11 -11
- package/es/components/DatePicker/DatePicker.js +264 -334
- package/es/components/DatePickerInput/DatePickerInput.js +141 -168
- package/es/components/FileUploader/FileUploader.js +3 -3
- package/es/components/FileUploader/FileUploaderButton.js +4 -4
- package/es/components/FileUploader/FileUploaderDropContainer.js +3 -3
- package/es/components/FormGroup/FormGroup.js +1 -2
- package/es/components/IconButton/index.js +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +10 -0
- package/es/components/MultiSelect/next/FilterableMultiSelect.js +11 -0
- package/es/components/RadioButton/RadioButton.js +1 -1
- package/es/components/Slider/Slider.js +11 -0
- package/es/components/StructuredList/next/StructuredList.js +19 -3
- package/es/components/TabContent/TabContent.js +2 -1
- package/es/components/Tabs/next/Tabs.js +31 -25
- package/es/components/UIShell/SideNav.js +1 -1
- package/es/index.js +3 -3
- package/lib/components/Checkbox/Checkbox.Skeleton.js +5 -3
- package/lib/components/ComposedModal/next/ComposedModal.js +11 -11
- package/lib/components/DatePicker/DatePicker.js +261 -331
- package/lib/components/DatePickerInput/DatePickerInput.js +138 -165
- package/lib/components/FileUploader/FileUploader.js +3 -3
- package/lib/components/FileUploader/FileUploaderButton.js +4 -4
- package/lib/components/FileUploader/FileUploaderDropContainer.js +3 -3
- package/lib/components/FormGroup/FormGroup.js +1 -2
- package/lib/components/IconButton/index.js +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +10 -0
- package/lib/components/MultiSelect/next/FilterableMultiSelect.js +11 -0
- package/lib/components/RadioButton/RadioButton.js +1 -1
- package/lib/components/Slider/Slider.js +11 -0
- package/lib/components/StructuredList/next/StructuredList.js +19 -3
- package/lib/components/TabContent/TabContent.js +2 -1
- package/lib/components/Tabs/next/Tabs.js +31 -25
- package/lib/components/UIShell/SideNav.js +1 -1
- package/lib/index.js +100 -100
- package/package.json +4 -4
- package/es/components/DatePicker/index.js +0 -15
- package/es/components/DatePicker/next/DatePicker.js +0 -562
- package/es/components/DatePickerInput/index.js +0 -15
- package/es/components/DatePickerInput/next/DatePickerInput.js +0 -244
- package/lib/components/DatePicker/index.js +0 -39
- package/lib/components/DatePicker/next/DatePicker.js +0 -573
- package/lib/components/DatePickerInput/index.js +0 -39
- package/lib/components/DatePickerInput/next/DatePickerInput.js +0 -254
|
@@ -159,7 +159,7 @@ function TabList(_ref2) {
|
|
|
159
159
|
isScrollable = _useState4[0],
|
|
160
160
|
setIsScrollable = _useState4[1];
|
|
161
161
|
|
|
162
|
-
var _useState5 = useState(
|
|
162
|
+
var _useState5 = useState(null),
|
|
163
163
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
164
164
|
scrollLeft = _useState6[0],
|
|
165
165
|
setScrollLeft = _useState6[1];
|
|
@@ -178,7 +178,7 @@ function TabList(_ref2) {
|
|
|
178
178
|
var isNextButtonVisible = ref.current ? scrollLeft + buttonWidth + ref.current.clientWidth < ref.current.scrollWidth : false;
|
|
179
179
|
var previousButtonClasses = cx("".concat(prefix, "--tab--overflow-nav-button"), "".concat(prefix, "--tab--overflow-nav-button--previous"), _defineProperty({}, "".concat(prefix, "--tab--overflow-nav-button--hidden"), !isPreviousButtonVisible));
|
|
180
180
|
var nextButtonClasses = cx("".concat(prefix, "--tab--overflow-nav-button"), "".concat(prefix, "--tab--overflow-nav-button--next"), _defineProperty({}, "".concat(prefix, "--tab--overflow-nav-button--hidden"), !isNextButtonVisible));
|
|
181
|
-
var tabs = [];
|
|
181
|
+
var tabs = useRef([]);
|
|
182
182
|
var debouncedOnScroll = useCallback(function () {
|
|
183
183
|
return debounce(function (event) {
|
|
184
184
|
setScrollLeft(event.target.scrollLeft);
|
|
@@ -188,11 +188,11 @@ function TabList(_ref2) {
|
|
|
188
188
|
function onKeyDown(event) {
|
|
189
189
|
if (matches(event, [ArrowRight, ArrowLeft, Home, End])) {
|
|
190
190
|
event.preventDefault();
|
|
191
|
-
var activeTabs = tabs.filter(function (tab) {
|
|
192
|
-
return !tab.
|
|
191
|
+
var activeTabs = tabs.current.filter(function (tab) {
|
|
192
|
+
return !tab.disabled;
|
|
193
193
|
});
|
|
194
|
-
var currentIndex = activeTabs.indexOf(tabs[activation === 'automatic' ? selectedIndex : activeIndex]);
|
|
195
|
-
var nextIndex = tabs.indexOf(activeTabs[getNextIndex(event, activeTabs.length, currentIndex)]);
|
|
194
|
+
var currentIndex = activeTabs.indexOf(tabs.current[activation === 'automatic' ? selectedIndex : activeIndex]);
|
|
195
|
+
var nextIndex = tabs.current.indexOf(activeTabs[getNextIndex(event, activeTabs.length, currentIndex)]);
|
|
196
196
|
|
|
197
197
|
if (activation === 'automatic') {
|
|
198
198
|
setSelectedIndex(nextIndex);
|
|
@@ -200,29 +200,29 @@ function TabList(_ref2) {
|
|
|
200
200
|
setActiveIndex(nextIndex);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
tabs[nextIndex].
|
|
203
|
+
tabs.current[nextIndex].focus();
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
useEffectOnce(function () {
|
|
208
|
-
var tab = tabs[selectedIndex];
|
|
208
|
+
var tab = tabs.current[selectedIndex];
|
|
209
209
|
|
|
210
210
|
if (scrollIntoView && tab) {
|
|
211
|
-
tab.
|
|
211
|
+
tab.scrollIntoView({
|
|
212
212
|
block: 'nearest',
|
|
213
213
|
inline: 'nearest'
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
216
|
});
|
|
217
217
|
useEffectOnce(function () {
|
|
218
|
-
if (tabs[selectedIndex].
|
|
219
|
-
var activeTabs = tabs.filter(function (tab) {
|
|
220
|
-
return !tab.
|
|
218
|
+
if (tabs.current[selectedIndex].disabled) {
|
|
219
|
+
var activeTabs = tabs.current.filter(function (tab) {
|
|
220
|
+
return !tab.disabled;
|
|
221
221
|
});
|
|
222
222
|
|
|
223
223
|
if (activeTabs.length > 0) {
|
|
224
224
|
var tab = activeTabs[0];
|
|
225
|
-
setSelectedIndex(tabs.indexOf(tab));
|
|
225
|
+
setSelectedIndex(tabs.current.indexOf(tab));
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
});
|
|
@@ -246,19 +246,25 @@ function TabList(_ref2) {
|
|
|
246
246
|
}, []); // updates scroll location for all scroll behavior.
|
|
247
247
|
|
|
248
248
|
useIsomorphicEffect(function () {
|
|
249
|
-
|
|
249
|
+
if (scrollLeft !== null) {
|
|
250
|
+
ref.current.scrollLeft = scrollLeft;
|
|
251
|
+
}
|
|
250
252
|
}, [scrollLeft]);
|
|
251
253
|
useIsomorphicEffect(function () {
|
|
252
|
-
|
|
254
|
+
if (!isScrollable) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
var tab = activation === 'manual' ? tabs.current[activeIndex] : tabs.current[selectedIndex];
|
|
253
259
|
|
|
254
260
|
if (tab) {
|
|
255
261
|
// The width of the "scroll buttons"
|
|
256
262
|
// The start and end position of the selected tab
|
|
257
|
-
var _tab$
|
|
258
|
-
tabWidth = _tab$
|
|
263
|
+
var _tab$getBoundingClien = tab.getBoundingClientRect(),
|
|
264
|
+
tabWidth = _tab$getBoundingClien.width;
|
|
259
265
|
|
|
260
|
-
var start = tab.
|
|
261
|
-
var end = tab.
|
|
266
|
+
var start = tab.offsetLeft;
|
|
267
|
+
var end = tab.offsetLeft + tabWidth; // The start and end of the visible area for the tabs
|
|
262
268
|
|
|
263
269
|
var visibleStart = ref.current.scrollLeft + buttonWidth;
|
|
264
270
|
var visibleEnd = ref.current.scrollLeft + ref.current.clientWidth - buttonWidth; // The beginning of the tab is clipped and not visible
|
|
@@ -272,13 +278,13 @@ function TabList(_ref2) {
|
|
|
272
278
|
setScrollLeft(end + buttonWidth - ref.current.clientWidth);
|
|
273
279
|
}
|
|
274
280
|
}
|
|
275
|
-
}, [activation, activeIndex, selectedIndex]);
|
|
281
|
+
}, [activation, activeIndex, selectedIndex, isScrollable]);
|
|
276
282
|
usePressable(previousButton, {
|
|
277
283
|
onPress: function onPress(_ref3) {
|
|
278
284
|
var longPress = _ref3.longPress;
|
|
279
285
|
|
|
280
286
|
if (!longPress) {
|
|
281
|
-
setScrollLeft(Math.max(scrollLeft - ref.current.scrollWidth / tabs.length * 1.5, 0));
|
|
287
|
+
setScrollLeft(Math.max(scrollLeft - ref.current.scrollWidth / tabs.current.length * 1.5, 0));
|
|
282
288
|
}
|
|
283
289
|
},
|
|
284
290
|
onLongPress: function onLongPress() {
|
|
@@ -290,7 +296,7 @@ function TabList(_ref2) {
|
|
|
290
296
|
var longPress = _ref4.longPress;
|
|
291
297
|
|
|
292
298
|
if (!longPress) {
|
|
293
|
-
setScrollLeft(Math.min(scrollLeft + ref.current.scrollWidth / tabs.length * 1.5, ref.current.scrollWidth - ref.current.clientWidth));
|
|
299
|
+
setScrollLeft(Math.min(scrollLeft + ref.current.scrollWidth / tabs.current.length * 1.5, ref.current.scrollWidth - ref.current.clientWidth));
|
|
294
300
|
}
|
|
295
301
|
},
|
|
296
302
|
onLongPress: function onLongPress() {
|
|
@@ -313,12 +319,12 @@ function TabList(_ref2) {
|
|
|
313
319
|
onScroll: debouncedOnScroll,
|
|
314
320
|
onKeyDown: onKeyDown
|
|
315
321
|
}), React__default.Children.map(children, function (child, index) {
|
|
316
|
-
var ref = /*#__PURE__*/React__default.createRef();
|
|
317
|
-
tabs.push(ref);
|
|
318
322
|
return /*#__PURE__*/React__default.createElement(TabContext.Provider, {
|
|
319
323
|
value: index
|
|
320
324
|
}, /*#__PURE__*/React__default.cloneElement(child, {
|
|
321
|
-
ref: ref
|
|
325
|
+
ref: function ref(node) {
|
|
326
|
+
tabs.current[index] = node;
|
|
327
|
+
}
|
|
322
328
|
}));
|
|
323
329
|
})), /*#__PURE__*/React__default.createElement("button", _extends({
|
|
324
330
|
"aria-hidden": "true",
|
|
@@ -121,7 +121,7 @@ var SideNav = /*#__PURE__*/React__default.forwardRef(function SideNav(props, ref
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
var isSideNavCollapsed = useMatchMedia("(max-width: 1055px)");
|
|
124
|
-
var ariaHidden = expanded === false && isSideNavCollapsed;
|
|
124
|
+
var ariaHidden = isRail ? false : expanded === false && isSideNavCollapsed;
|
|
125
125
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isFixedNav ? null :
|
|
126
126
|
/*#__PURE__*/
|
|
127
127
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
package/es/index.js
CHANGED
|
@@ -24,8 +24,9 @@ export { default as Copy } from './components/Copy/Copy.js';
|
|
|
24
24
|
export { default as CopyButton } from './components/CopyButton/CopyButton.js';
|
|
25
25
|
export { default as DangerButton } from './components/DangerButton/DangerButton.js';
|
|
26
26
|
export { default as DataTable } from './components/DataTable/index.js';
|
|
27
|
-
export { default as
|
|
28
|
-
export { default as
|
|
27
|
+
export { default as DatePickerSkeleton } from './components/DatePicker/DatePicker.Skeleton.js';
|
|
28
|
+
export { default as DatePicker } from './components/DatePicker/DatePicker.js';
|
|
29
|
+
export { default as DatePickerInput } from './components/DatePickerInput/DatePickerInput.js';
|
|
29
30
|
export { default as DropdownSkeleton } from './components/Dropdown/Dropdown.Skeleton.js';
|
|
30
31
|
export { default as Dropdown } from './components/Dropdown/Dropdown.js';
|
|
31
32
|
export { default as FileUploader } from './components/FileUploader/index.js';
|
|
@@ -97,7 +98,6 @@ export { default as TextInputSkeleton } from './components/TextInput/TextInput.S
|
|
|
97
98
|
export { default as ToggleSkeleton } from './components/Toggle/Toggle.Skeleton.js';
|
|
98
99
|
export { default as ToggleSmallSkeleton } from './components/ToggleSmall/ToggleSmall.Skeleton.js';
|
|
99
100
|
export { default as IconSkeleton } from './components/Icon/Icon.Skeleton.js';
|
|
100
|
-
export { default as DatePickerSkeleton } from './components/DatePicker/DatePicker.Skeleton.js';
|
|
101
101
|
export { HeaderNavigation, SideNavMenu } from './components/UIShell/index.js';
|
|
102
102
|
export { FeatureFlags as unstable_FeatureFlags, useFeatureFlag as unstable_useFeatureFlag, useFeatureFlags as unstable_useFeatureFlags } from './components/FeatureFlags/index.js';
|
|
103
103
|
export { Heading, Section } from './components/Heading/index.js';
|
|
@@ -29,10 +29,12 @@ var CheckboxSkeleton = function CheckboxSkeleton(_ref) {
|
|
|
29
29
|
|
|
30
30
|
var prefix = usePrefix.usePrefix();
|
|
31
31
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
32
|
-
className: cx__default["default"]("".concat(prefix, "--form-item"), "".concat(prefix, "--checkbox-wrapper"), "".concat(prefix, "--checkbox-
|
|
33
|
-
}, rest), /*#__PURE__*/React__default["default"].createElement("
|
|
32
|
+
className: cx__default["default"]("".concat(prefix, "--form-item"), "".concat(prefix, "--checkbox-wrapper"), "".concat(prefix, "--checkbox-skeleton"), className)
|
|
33
|
+
}, rest), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
34
|
+
className: "".concat(prefix, "--checkbox-label")
|
|
35
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
34
36
|
className: "".concat(prefix, "--checkbox-label-text ").concat(prefix, "--skeleton")
|
|
35
|
-
}));
|
|
37
|
+
})));
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
CheckboxSkeleton.propTypes = {
|
|
@@ -205,24 +205,24 @@ var ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function C
|
|
|
205
205
|
onClick: handleClick,
|
|
206
206
|
onKeyDown: handleKeyDown,
|
|
207
207
|
className: modalClass
|
|
208
|
-
}), /*#__PURE__*/React__default["default"].createElement("
|
|
209
|
-
ref: startSentinel,
|
|
210
|
-
tabIndex: "0",
|
|
211
|
-
role: "link",
|
|
212
|
-
className: "".concat(prefix, "--visually-hidden")
|
|
213
|
-
}, "Focus sentinel"), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
214
|
-
ref: innerModal,
|
|
208
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
215
209
|
className: containerClass,
|
|
216
210
|
role: "dialog",
|
|
217
211
|
"aria-modal": "true",
|
|
218
212
|
"aria-label": ariaLabel ? ariaLabel : generatedAriaLabel,
|
|
219
213
|
"aria-labelledby": ariaLabelledBy
|
|
220
|
-
},
|
|
214
|
+
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
215
|
+
type: "button",
|
|
216
|
+
ref: startSentinel,
|
|
217
|
+
className: "".concat(prefix, "--visually-hidden")
|
|
218
|
+
}, "Focus sentinel"), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
219
|
+
ref: innerModal,
|
|
220
|
+
className: "".concat(prefix, "--modal-container-body")
|
|
221
|
+
}, childrenWithProps), /*#__PURE__*/React__default["default"].createElement("button", {
|
|
222
|
+
type: "button",
|
|
221
223
|
ref: endSentinel,
|
|
222
|
-
tabIndex: "0",
|
|
223
|
-
role: "link",
|
|
224
224
|
className: "".concat(prefix, "--visually-hidden")
|
|
225
|
-
}, "Focus sentinel"));
|
|
225
|
+
}, "Focus sentinel")));
|
|
226
226
|
});
|
|
227
227
|
ComposedModal.propTypes = (_ComposedModal$propTy = {}, _rollupPluginBabelHelpers.defineProperty(_ComposedModal$propTy, 'aria-label', PropTypes__default["default"].string), _rollupPluginBabelHelpers.defineProperty(_ComposedModal$propTy, 'aria-labelledby', PropTypes__default["default"].string), _rollupPluginBabelHelpers.defineProperty(_ComposedModal$propTy, "children", PropTypes__default["default"].node), _rollupPluginBabelHelpers.defineProperty(_ComposedModal$propTy, "className", PropTypes__default["default"].string), _rollupPluginBabelHelpers.defineProperty(_ComposedModal$propTy, "containerClassName", PropTypes__default["default"].string), _rollupPluginBabelHelpers.defineProperty(_ComposedModal$propTy, "danger", PropTypes__default["default"].bool), _rollupPluginBabelHelpers.defineProperty(_ComposedModal$propTy, "onClose", PropTypes__default["default"].func), _rollupPluginBabelHelpers.defineProperty(_ComposedModal$propTy, "onKeyDown", PropTypes__default["default"].func), _rollupPluginBabelHelpers.defineProperty(_ComposedModal$propTy, "open", PropTypes__default["default"].bool), _rollupPluginBabelHelpers.defineProperty(_ComposedModal$propTy, "preventCloseOnClickOutside", PropTypes__default["default"].bool), _rollupPluginBabelHelpers.defineProperty(_ComposedModal$propTy, "selectorPrimaryFocus", PropTypes__default["default"].string), _rollupPluginBabelHelpers.defineProperty(_ComposedModal$propTy, "selectorsFloatingMenus", PropTypes__default["default"].string), _rollupPluginBabelHelpers.defineProperty(_ComposedModal$propTy, "size", PropTypes__default["default"].oneOf(['xs', 'sm', 'md', 'lg'])), _ComposedModal$propTy);
|
|
228
228
|
ComposedModal.defaultProps = {
|