@carbon/react 1.69.0 → 1.70.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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +812 -812
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/es/components/ComboBox/ComboBox.js +16 -8
- package/es/components/ComposedModal/ComposedModal.js +6 -2
- package/es/components/ContextMenu/index.d.ts +8 -0
- package/es/components/ContextMenu/useContextMenu.d.ts +21 -0
- package/es/components/ContextMenu/useContextMenu.js +9 -8
- package/es/components/DataTable/DataTable.d.ts +3 -2
- package/es/components/DataTable/Table.d.ts +9 -1
- package/es/components/DataTable/Table.js +7 -2
- package/es/components/DatePicker/DatePicker.js +0 -8
- package/es/components/DatePicker/plugins/appendToPlugin.js +2 -2
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
- package/es/components/DatePicker/plugins/rangePlugin.js +2 -2
- package/es/components/Dropdown/Dropdown.d.ts +2 -2
- package/es/components/FeatureFlags/index.d.ts +3 -1
- package/es/components/FeatureFlags/index.js +5 -2
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +5 -5
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +15 -0
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +6 -8
- package/es/components/FluidDropdown/FluidDropdown.d.ts +101 -0
- package/es/components/FluidDropdown/FluidDropdown.js +1 -2
- package/es/components/FluidDropdown/index.d.ts +13 -0
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +5 -5
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +5 -5
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +2 -13
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +22 -5
- package/es/components/Notification/Notification.js +2 -6
- package/es/components/NumberInput/NumberInput.Skeleton.d.ts +9 -1
- package/es/components/NumberInput/NumberInput.Skeleton.js +7 -2
- package/es/components/OverflowMenu/OverflowMenu.js +1 -1
- package/es/components/Pagination/Pagination.js +1 -1
- package/es/components/Pagination/experimental/PageSelector.js +1 -1
- package/es/components/Popover/index.js +4 -2
- package/es/components/SkeletonText/SkeletonText.js +1 -1
- package/es/components/Tabs/Tabs.js +1 -1
- package/es/components/TreeView/TreeNode.js +1 -1
- package/es/components/TreeView/TreeView.js +1 -1
- package/es/components/UIShell/HeaderMenu.js +1 -1
- package/es/components/UIShell/HeaderPanel.js +1 -1
- package/es/components/UIShell/SideNav.js +1 -1
- package/es/components/UIShell/SideNavItems.js +1 -1
- package/es/components/UIShell/SideNavMenu.js +1 -1
- package/es/components/UIShell/Switcher.js +1 -1
- package/es/feature-flags.js +2 -1
- package/es/index.js +3 -3
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/ComboBox/ComboBox.js +17 -8
- package/lib/components/ComposedModal/ComposedModal.js +6 -2
- package/lib/components/ContextMenu/index.d.ts +8 -0
- package/lib/components/ContextMenu/useContextMenu.d.ts +21 -0
- package/lib/components/ContextMenu/useContextMenu.js +9 -8
- package/lib/components/DataTable/DataTable.d.ts +3 -2
- package/lib/components/DataTable/Table.d.ts +9 -1
- package/lib/components/DataTable/Table.js +7 -2
- package/lib/components/DatePicker/DatePicker.js +0 -8
- package/lib/components/DatePicker/plugins/appendToPlugin.js +2 -2
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
- package/lib/components/DatePicker/plugins/rangePlugin.js +2 -2
- package/lib/components/Dropdown/Dropdown.d.ts +2 -2
- package/lib/components/FeatureFlags/index.d.ts +3 -1
- package/lib/components/FeatureFlags/index.js +5 -2
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +5 -5
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.d.ts +15 -0
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +6 -8
- package/lib/components/FluidDropdown/FluidDropdown.d.ts +101 -0
- package/lib/components/FluidDropdown/FluidDropdown.js +1 -2
- package/lib/components/FluidDropdown/index.d.ts +13 -0
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +5 -5
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +5 -5
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.d.ts +2 -13
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +24 -5
- package/lib/components/Notification/Notification.js +2 -6
- package/lib/components/NumberInput/NumberInput.Skeleton.d.ts +9 -1
- package/lib/components/NumberInput/NumberInput.Skeleton.js +7 -2
- package/lib/components/OverflowMenu/OverflowMenu.js +1 -1
- package/lib/components/Pagination/Pagination.js +1 -1
- package/lib/components/Pagination/experimental/PageSelector.js +1 -1
- package/lib/components/Popover/index.js +4 -2
- package/lib/components/SkeletonText/SkeletonText.js +1 -1
- package/lib/components/Tabs/Tabs.js +1 -1
- package/lib/components/TreeView/TreeNode.js +1 -1
- package/lib/components/TreeView/TreeView.js +1 -1
- package/lib/components/UIShell/HeaderMenu.js +1 -1
- package/lib/components/UIShell/HeaderPanel.js +1 -1
- package/lib/components/UIShell/SideNav.js +1 -1
- package/lib/components/UIShell/SideNavItems.js +1 -1
- package/lib/components/UIShell/SideNavMenu.js +1 -1
- package/lib/components/UIShell/Switcher.js +1 -1
- package/lib/feature-flags.js +2 -1
- package/lib/index.js +6 -6
- package/package.json +6 -5
- package/telemetry.yml +765 -710
|
@@ -5,14 +5,31 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
9
|
-
import 'react';
|
|
10
|
-
import 'classnames';
|
|
10
|
+
import React__default from 'react';
|
|
11
|
+
import cx from 'classnames';
|
|
11
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
|
+
import { FormContext } from '../FluidForm/FormContext.js';
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
const FluidTextAreaSkeleton = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
className,
|
|
18
|
+
...other
|
|
19
|
+
} = _ref;
|
|
20
|
+
const prefix = usePrefix();
|
|
21
|
+
return /*#__PURE__*/React__default.createElement(FormContext.Provider, {
|
|
22
|
+
value: {
|
|
23
|
+
isFluid: true
|
|
24
|
+
}
|
|
25
|
+
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
26
|
+
className: cx(`${prefix}--form-item ${prefix}--text-area--fluid__skeleton`, className)
|
|
27
|
+
}, other), /*#__PURE__*/React__default.createElement("span", {
|
|
28
|
+
className: `${prefix}--label ${prefix}--skeleton`
|
|
29
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
30
|
+
className: `${prefix}--skeleton ${prefix}--text-area`
|
|
31
|
+
})));
|
|
32
|
+
};
|
|
16
33
|
FluidTextAreaSkeleton.propTypes = {
|
|
17
34
|
/**
|
|
18
35
|
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
@@ -278,9 +278,7 @@ function ToastNotification(_ref4) {
|
|
|
278
278
|
}, caption), children), !hideCloseButton && /*#__PURE__*/React__default.createElement(NotificationButton, {
|
|
279
279
|
notificationType: "toast",
|
|
280
280
|
onClick: handleCloseButtonClick,
|
|
281
|
-
"aria-
|
|
282
|
-
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
283
|
-
tabIndex: -1
|
|
281
|
+
"aria-label": deprecatedAriaLabel || ariaLabel
|
|
284
282
|
}));
|
|
285
283
|
}
|
|
286
284
|
ToastNotification.propTypes = {
|
|
@@ -415,9 +413,7 @@ function InlineNotification(_ref5) {
|
|
|
415
413
|
}, subtitle), children)), !hideCloseButton && /*#__PURE__*/React__default.createElement(NotificationButton, {
|
|
416
414
|
notificationType: "inline",
|
|
417
415
|
onClick: handleCloseButtonClick,
|
|
418
|
-
"aria-
|
|
419
|
-
"aria-label": ariaLabel,
|
|
420
|
-
tabIndex: -1
|
|
416
|
+
"aria-label": ariaLabel
|
|
421
417
|
}));
|
|
422
418
|
}
|
|
423
419
|
InlineNotification.propTypes = {
|
|
@@ -15,8 +15,12 @@ export interface NumberInputSkeletonProps extends HTMLAttributes<HTMLDivElement>
|
|
|
15
15
|
* Specify whether the label should be hidden, or not
|
|
16
16
|
*/
|
|
17
17
|
hideLabel?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Specify the size of the Number Input.
|
|
20
|
+
*/
|
|
21
|
+
size?: 'sm' | 'md' | 'lg';
|
|
18
22
|
}
|
|
19
|
-
declare function NumberInputSkeleton({ hideLabel, className, ...rest }: NumberInputSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare function NumberInputSkeleton({ hideLabel, className, size, ...rest }: NumberInputSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
20
24
|
declare namespace NumberInputSkeleton {
|
|
21
25
|
var propTypes: {
|
|
22
26
|
/**
|
|
@@ -27,6 +31,10 @@ declare namespace NumberInputSkeleton {
|
|
|
27
31
|
* Specify whether the label should be hidden, or not
|
|
28
32
|
*/
|
|
29
33
|
hideLabel: PropTypes.Requireable<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* Specify the size of the Number Input.
|
|
36
|
+
*/
|
|
37
|
+
size: PropTypes.Requireable<string>;
|
|
30
38
|
};
|
|
31
39
|
}
|
|
32
40
|
export default NumberInputSkeleton;
|
|
@@ -15,6 +15,7 @@ function NumberInputSkeleton(_ref) {
|
|
|
15
15
|
let {
|
|
16
16
|
hideLabel,
|
|
17
17
|
className,
|
|
18
|
+
size = 'md',
|
|
18
19
|
...rest
|
|
19
20
|
} = _ref;
|
|
20
21
|
const prefix = usePrefix();
|
|
@@ -23,7 +24,7 @@ function NumberInputSkeleton(_ref) {
|
|
|
23
24
|
}, rest), !hideLabel && /*#__PURE__*/React__default.createElement("span", {
|
|
24
25
|
className: `${prefix}--label ${prefix}--skeleton`
|
|
25
26
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
26
|
-
className: `${prefix}--number ${prefix}--skeleton`
|
|
27
|
+
className: `${prefix}--number ${prefix}--skeleton ${prefix}--number--${size}`
|
|
27
28
|
}));
|
|
28
29
|
}
|
|
29
30
|
NumberInputSkeleton.propTypes = {
|
|
@@ -34,7 +35,11 @@ NumberInputSkeleton.propTypes = {
|
|
|
34
35
|
/**
|
|
35
36
|
* Specify whether the label should be hidden, or not
|
|
36
37
|
*/
|
|
37
|
-
hideLabel: PropTypes.bool
|
|
38
|
+
hideLabel: PropTypes.bool,
|
|
39
|
+
/**
|
|
40
|
+
* Specify the size of the Number Input.
|
|
41
|
+
*/
|
|
42
|
+
size: PropTypes.oneOf(['sm', 'md', 'lg'])
|
|
38
43
|
};
|
|
39
44
|
|
|
40
45
|
export { NumberInputSkeleton as default };
|
|
@@ -206,7 +206,7 @@ class OverflowMenu extends React__default.Component {
|
|
|
206
206
|
direction
|
|
207
207
|
} = _ref;
|
|
208
208
|
const enabledIndices = React__default.Children.toArray(this.props.children).reduce((acc, curr, i) => {
|
|
209
|
-
if (
|
|
209
|
+
if (/*#__PURE__*/React__default.isValidElement(curr) && !curr.props.disabled) {
|
|
210
210
|
acc.push(i);
|
|
211
211
|
}
|
|
212
212
|
return acc;
|
|
@@ -29,7 +29,7 @@ function renderSelectItems(total) {
|
|
|
29
29
|
let counter = 1;
|
|
30
30
|
const itemArr = [];
|
|
31
31
|
while (counter <= total) {
|
|
32
|
-
itemArr.push(
|
|
32
|
+
itemArr.push(/*#__PURE__*/React__default.createElement(SelectItem, {
|
|
33
33
|
key: counter,
|
|
34
34
|
value: counter,
|
|
35
35
|
text: String(counter)
|
|
@@ -30,7 +30,7 @@ function PageSelector(_ref) {
|
|
|
30
30
|
const renderPages = total => {
|
|
31
31
|
const pages = [];
|
|
32
32
|
for (let counter = 1; counter <= total; counter += 1) {
|
|
33
|
-
pages.push(
|
|
33
|
+
pages.push(/*#__PURE__*/React__default.createElement(SelectItem, {
|
|
34
34
|
key: counter,
|
|
35
35
|
value: counter,
|
|
36
36
|
text: String(counter)
|
|
@@ -128,6 +128,8 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
|
|
|
128
128
|
strategy: 'fixed',
|
|
129
129
|
// Middleware order matters, arrow should be last
|
|
130
130
|
middleware: [offset(!isTabTip ? popoverDimensions?.current?.offset : 0), autoAlign && flip({
|
|
131
|
+
fallbackPlacements: align.includes('bottom') ? ['bottom', 'bottom-start', 'bottom-end', 'right', 'right-start', 'right-end', 'left', 'left-start', 'left-end', 'top', 'top-start', 'top-end'] : ['top', 'top-start', 'top-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end'],
|
|
132
|
+
fallbackStrategy: 'initialPlacement',
|
|
131
133
|
fallbackAxisSideDirection: 'start'
|
|
132
134
|
}), arrow({
|
|
133
135
|
element: caretRef
|
|
@@ -211,7 +213,7 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
|
|
|
211
213
|
const isTriggerElement = item?.type === 'button';
|
|
212
214
|
const isTriggerComponent = enableFloatingStyles && displayName && ['ToggletipButton'].includes(displayName);
|
|
213
215
|
const isAllowedTriggerComponent = enableFloatingStyles && !['ToggletipContent', 'PopoverContent'].includes(displayName);
|
|
214
|
-
if (
|
|
216
|
+
if (/*#__PURE__*/React__default.isValidElement(item) && (isTriggerElement || isTriggerComponent || isAllowedTriggerComponent)) {
|
|
215
217
|
const className = item?.props?.className;
|
|
216
218
|
const ref = (item?.props).ref;
|
|
217
219
|
const tabTipClasses = cx(`${prefix}--popover--tab-tip__button`, className);
|
|
@@ -334,7 +336,7 @@ Popover.propTypes = {
|
|
|
334
336
|
*/
|
|
335
337
|
open: PropTypes.bool.isRequired
|
|
336
338
|
};
|
|
337
|
-
function PopoverContentRenderFunction(
|
|
339
|
+
function PopoverContentRenderFunction(// eslint-disable-next-line react/prop-types
|
|
338
340
|
_ref2, forwardRef) {
|
|
339
341
|
let {
|
|
340
342
|
className,
|
|
@@ -56,7 +56,7 @@ const SkeletonText = _ref => {
|
|
|
56
56
|
}, [lineCountNumber, paragraph, refs, width, widthNum, widthPercent, widthPx]);
|
|
57
57
|
const lines = [];
|
|
58
58
|
for (let i = 0; i < lineCountNumber; i++) {
|
|
59
|
-
lines.push(
|
|
59
|
+
lines.push(/*#__PURE__*/React__default.createElement("p", _extends({
|
|
60
60
|
className: skeletonTextClasses,
|
|
61
61
|
key: i,
|
|
62
62
|
ref: el => refs.current = [...refs.current, el]
|
|
@@ -1184,7 +1184,7 @@ function TabPanels(_ref13) {
|
|
|
1184
1184
|
}
|
|
1185
1185
|
});
|
|
1186
1186
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, React__default.Children.map(children, (child, index) => {
|
|
1187
|
-
return /*#__PURE__*/React__default.createElement(TabPanelContext.Provider, {
|
|
1187
|
+
return !isElement(child) ? null : /*#__PURE__*/React__default.createElement(TabPanelContext.Provider, {
|
|
1188
1188
|
value: index
|
|
1189
1189
|
}, /*#__PURE__*/React__default.cloneElement(child, {
|
|
1190
1190
|
ref: element => {
|
|
@@ -63,7 +63,7 @@ const TreeNode = /*#__PURE__*/React__default.forwardRef((_ref, forwardedRef) =>
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
const nodesWithProps = React__default.Children.map(children, node => {
|
|
66
|
-
if (
|
|
66
|
+
if (/*#__PURE__*/React__default.isValidElement(node)) {
|
|
67
67
|
return /*#__PURE__*/React__default.cloneElement(node, {
|
|
68
68
|
active,
|
|
69
69
|
depth: depth + 1,
|
|
@@ -121,7 +121,7 @@ const TreeView = _ref => {
|
|
|
121
121
|
sharedNodeProps.tabIndex = 0;
|
|
122
122
|
focusTarget = true;
|
|
123
123
|
}
|
|
124
|
-
if (
|
|
124
|
+
if (/*#__PURE__*/React__default.isValidElement(node)) {
|
|
125
125
|
return /*#__PURE__*/React__default.cloneElement(node, sharedNodeProps);
|
|
126
126
|
}
|
|
127
127
|
});
|
|
@@ -124,7 +124,7 @@ class HeaderMenu extends React__default.Component {
|
|
|
124
124
|
* sequence when they might not want to go through all the items.
|
|
125
125
|
*/
|
|
126
126
|
_defineProperty(this, "_renderMenuItem", (item, index) => {
|
|
127
|
-
if (
|
|
127
|
+
if (/*#__PURE__*/React__default.isValidElement(item)) {
|
|
128
128
|
return /*#__PURE__*/React__default.cloneElement(item, {
|
|
129
129
|
ref: this.handleItemRef(index)
|
|
130
130
|
});
|
|
@@ -62,7 +62,7 @@ const HeaderPanel = /*#__PURE__*/React__default.forwardRef(function HeaderPanel(
|
|
|
62
62
|
const focusedElement = document.activeElement;
|
|
63
63
|
setLastClickedElement(focusedElement);
|
|
64
64
|
const childJsxElement = children;
|
|
65
|
-
if (childJsxElement
|
|
65
|
+
if (childJsxElement?.type?.displayName === 'Switcher' && !focusedElement?.closest(`.${prefix}--header-panel--expanded`) && !focusedElement?.closest(`.${prefix}--header__action`) && !headerPanelReference?.current?.classList.contains(`${prefix}--switcher`) && expanded) {
|
|
66
66
|
setExpandedState(false);
|
|
67
67
|
onHeaderPanelFocus();
|
|
68
68
|
}
|
|
@@ -96,7 +96,7 @@ function SideNavRenderFunction(_ref, ref) {
|
|
|
96
96
|
childrenToRender = React__default.Children.map(children, child => {
|
|
97
97
|
// if we are controlled, check for if we have hovered over or the expanded state, else just use the expanded state (uncontrolled)
|
|
98
98
|
const currentExpansionState = controlled ? expandedViaHoverState || expanded : expanded;
|
|
99
|
-
if (
|
|
99
|
+
if (/*#__PURE__*/isValidElement(child)) {
|
|
100
100
|
const childJsxElement = child;
|
|
101
101
|
// avoid spreading `isSideNavExpanded` to non-Carbon UI Shell children
|
|
102
102
|
return /*#__PURE__*/React__default.cloneElement(childJsxElement, {
|
|
@@ -20,7 +20,7 @@ const SideNavItems = _ref => {
|
|
|
20
20
|
const prefix = usePrefix();
|
|
21
21
|
const className = cx([`${prefix}--side-nav__items`], customClassName);
|
|
22
22
|
const childrenWithExpandedState = React__default.Children.map(children, child => {
|
|
23
|
-
if (
|
|
23
|
+
if (/*#__PURE__*/React__default.isValidElement(child)) {
|
|
24
24
|
// avoid spreading `isSideNavExpanded` to non-Carbon UI Shell children
|
|
25
25
|
const childDisplayName = child.type?.displayName;
|
|
26
26
|
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
@@ -148,7 +148,7 @@ function hasActiveDescendant(children) {
|
|
|
148
148
|
|
|
149
149
|
// We use React.isValidElement(child) to check if the child is a valid React element before accessing its props
|
|
150
150
|
|
|
151
|
-
if (
|
|
151
|
+
if (/*#__PURE__*/React__default.isValidElement(children)) {
|
|
152
152
|
const props = children.props;
|
|
153
153
|
if (props.isActive === true || props['aria-current']) {
|
|
154
154
|
return true;
|
|
@@ -62,7 +62,7 @@ const Switcher = /*#__PURE__*/forwardRef(function Switcher(props, forwardRef) {
|
|
|
62
62
|
};
|
|
63
63
|
const childrenWithProps = React__default.Children.toArray(children).map((child, index) => {
|
|
64
64
|
// only setup click handlers if onChange event is passed
|
|
65
|
-
if (
|
|
65
|
+
if (/*#__PURE__*/React__default.isValidElement(child) && child.type && getDisplayName(child.type) === 'Switcher') {
|
|
66
66
|
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
67
67
|
handleSwitcherItemFocus,
|
|
68
68
|
index,
|
package/es/feature-flags.js
CHANGED
|
@@ -13,5 +13,6 @@ FeatureFlags.merge({
|
|
|
13
13
|
'enable-v11-release': true,
|
|
14
14
|
'enable-experimental-tile-contrast': false,
|
|
15
15
|
'enable-v12-tile-radio-icons': false,
|
|
16
|
-
'enable-v12-structured-list-visible-icons': false
|
|
16
|
+
'enable-v12-structured-list-visible-icons': false,
|
|
17
|
+
'enable-v12-dynamic-floating-styles': false
|
|
17
18
|
});
|
package/es/index.js
CHANGED
|
@@ -29,6 +29,7 @@ export { ModalHeader } from './components/ComposedModal/ModalHeader.js';
|
|
|
29
29
|
export { ModalFooter } from './components/ComposedModal/ModalFooter.js';
|
|
30
30
|
import './components/ContainedList/index.js';
|
|
31
31
|
export { default as ContentSwitcher } from './components/ContentSwitcher/index.js';
|
|
32
|
+
export { default as useContextMenu } from './components/ContextMenu/useContextMenu.js';
|
|
32
33
|
export { default as Copy } from './components/Copy/Copy.js';
|
|
33
34
|
export { default as CopyButton } from './components/CopyButton/CopyButton.js';
|
|
34
35
|
export { default as DangerButton } from './components/DangerButton/DangerButton.js';
|
|
@@ -165,6 +166,8 @@ export { default as unstable__FluidComboBoxSkeleton } from './components/FluidCo
|
|
|
165
166
|
export { default as unstable__FluidDatePicker } from './components/FluidDatePicker/FluidDatePicker.js';
|
|
166
167
|
export { default as unstable__FluidDatePickerSkeleton } from './components/FluidDatePicker/FluidDatePicker.Skeleton.js';
|
|
167
168
|
export { default as unstable__FluidDatePickerInput } from './components/FluidDatePickerInput/FluidDatePickerInput.js';
|
|
169
|
+
export { default as unstable__FluidDropdown } from './components/FluidDropdown/FluidDropdown.js';
|
|
170
|
+
export { default as unstable__FluidDropdownSkeleton } from './components/FluidDropdown/FluidDropdown.Skeleton.js';
|
|
168
171
|
export { default as unstable__FluidMultiSelect } from './components/FluidMultiSelect/FluidMultiSelect.js';
|
|
169
172
|
export { default as unstable__FluidMultiSelectSkeleton } from './components/FluidMultiSelect/FluidMultiSelect.Skeleton.js';
|
|
170
173
|
export { default as unstable__FluidSelect } from './components/FluidSelect/FluidSelect.js';
|
|
@@ -202,12 +205,9 @@ export { default as unstable_PageSelector } from './components/Pagination/experi
|
|
|
202
205
|
export { default as unstable_Pagination } from './components/Pagination/experimental/Pagination.js';
|
|
203
206
|
export { default as ContainedListItem } from './components/ContainedList/ContainedListItem/ContainedListItem.js';
|
|
204
207
|
export { default as ContainedList } from './components/ContainedList/ContainedList.js';
|
|
205
|
-
export { default as useContextMenu } from './components/ContextMenu/useContextMenu.js';
|
|
206
208
|
export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.js';
|
|
207
209
|
export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
|
|
208
210
|
export { default as TextInput } from './components/TextInput/TextInput.js';
|
|
209
|
-
export { default as unstable__FluidDropdown } from './components/FluidDropdown/FluidDropdown.js';
|
|
210
|
-
export { default as unstable__FluidDropdownSkeleton } from './components/FluidDropdown/FluidDropdown.Skeleton.js';
|
|
211
211
|
export { LayoutDirection as unstable_LayoutDirection } from './components/LayoutDirection/LayoutDirection.js';
|
|
212
212
|
export { useLayoutDirection as unstable_useLayoutDirection } from './components/LayoutDirection/useLayoutDirection.js';
|
|
213
213
|
export { Text as unstable_Text } from './components/Text/Text.js';
|
|
@@ -58,7 +58,7 @@ const CheckboxGroup = _ref => {
|
|
|
58
58
|
|
|
59
59
|
// Slug is always size `mini`
|
|
60
60
|
let normalizedSlug;
|
|
61
|
-
if (
|
|
61
|
+
if (/*#__PURE__*/React__default["default"].isValidElement(slug) && slug['type']?.displayName === 'AILabel') {
|
|
62
62
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
|
63
63
|
size: 'mini',
|
|
64
64
|
kind: 'default'
|
|
@@ -16,6 +16,7 @@ var PropTypes = require('prop-types');
|
|
|
16
16
|
var React = require('react');
|
|
17
17
|
require('../Text/index.js');
|
|
18
18
|
var iconsReact = require('@carbon/icons-react');
|
|
19
|
+
var isEqual = require('react-fast-compare');
|
|
19
20
|
var index$1 = require('../ListBox/index.js');
|
|
20
21
|
var ListBoxSelection = require('../ListBox/next/ListBoxSelection.js');
|
|
21
22
|
var ListBoxTrigger = require('../ListBox/next/ListBoxTrigger.js');
|
|
@@ -38,6 +39,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
38
39
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
39
40
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
40
41
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
42
|
+
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
41
43
|
|
|
42
44
|
const {
|
|
43
45
|
InputBlur,
|
|
@@ -235,11 +237,15 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
235
237
|
selectedItem: selectedItemProp,
|
|
236
238
|
prevSelectedItem: prevSelectedItemProp.current
|
|
237
239
|
});
|
|
238
|
-
|
|
239
|
-
onChange
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
|
|
241
|
+
// selectedItem has been updated externally, need to update state and call onChange
|
|
242
|
+
if (inputValue !== currentInputValue) {
|
|
243
|
+
setInputValue(currentInputValue);
|
|
244
|
+
onChange({
|
|
245
|
+
selectedItem: selectedItemProp,
|
|
246
|
+
inputValue: currentInputValue
|
|
247
|
+
});
|
|
248
|
+
}
|
|
243
249
|
prevSelectedItemProp.current = selectedItemProp;
|
|
244
250
|
}
|
|
245
251
|
}, [selectedItemProp]);
|
|
@@ -453,9 +459,12 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
453
459
|
let {
|
|
454
460
|
selectedItem
|
|
455
461
|
} = _ref5;
|
|
456
|
-
onChange
|
|
457
|
-
|
|
458
|
-
|
|
462
|
+
// only call onChange if new selection is updated from previous
|
|
463
|
+
if (!isEqual__default["default"](selectedItem, selectedItemProp)) {
|
|
464
|
+
onChange({
|
|
465
|
+
selectedItem
|
|
466
|
+
});
|
|
467
|
+
}
|
|
459
468
|
},
|
|
460
469
|
onHighlightedIndexChange: _ref6 => {
|
|
461
470
|
let {
|
|
@@ -221,7 +221,8 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
221
221
|
const el = child;
|
|
222
222
|
return /*#__PURE__*/React__default["default"].cloneElement(el, {
|
|
223
223
|
closeModal,
|
|
224
|
-
inputref: button
|
|
224
|
+
inputref: button,
|
|
225
|
+
danger
|
|
225
226
|
});
|
|
226
227
|
}
|
|
227
228
|
default:
|
|
@@ -238,7 +239,7 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
238
239
|
React.useEffect(() => {
|
|
239
240
|
const initialFocus = focusContainerElement => {
|
|
240
241
|
const containerElement = focusContainerElement || innerModal.current;
|
|
241
|
-
const primaryFocusElement = containerElement ? containerElement.querySelector(selectorPrimaryFocus) : null;
|
|
242
|
+
const primaryFocusElement = containerElement ? containerElement.querySelector(danger ? `.${prefix}--btn--secondary` : selectorPrimaryFocus) : null;
|
|
242
243
|
if (primaryFocusElement) {
|
|
243
244
|
return primaryFocusElement;
|
|
244
245
|
}
|
|
@@ -246,8 +247,11 @@ const ComposedModal = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
246
247
|
};
|
|
247
248
|
const focusButton = focusContainerElement => {
|
|
248
249
|
const target = initialFocus(focusContainerElement);
|
|
250
|
+
const closeButton = focusContainerElement.querySelector(`.${prefix}--modal-close`);
|
|
249
251
|
if (target) {
|
|
250
252
|
target.focus();
|
|
253
|
+
} else if (!target && closeButton) {
|
|
254
|
+
closeButton?.focus();
|
|
251
255
|
}
|
|
252
256
|
};
|
|
253
257
|
if (open && isOpen) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2020, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
type TriggerType = Element | Document | Window | React.RefObject<Element>;
|
|
9
|
+
interface ContextMenuProps {
|
|
10
|
+
open: boolean;
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
mode: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @param {TriggerType} [trigger=document] The element or ref which should trigger the Menu on right-click
|
|
18
|
+
* @returns {ContextMenuProps} Props object to pass onto Menu component
|
|
19
|
+
*/
|
|
20
|
+
declare function useContextMenu(trigger?: TriggerType): ContextMenuProps;
|
|
21
|
+
export default useContextMenu;
|
|
@@ -12,8 +12,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
12
12
|
var React = require('react');
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* @param {
|
|
16
|
-
* @returns {
|
|
15
|
+
* @param {TriggerType} [trigger=document] The element or ref which should trigger the Menu on right-click
|
|
16
|
+
* @returns {ContextMenuProps} Props object to pass onto Menu component
|
|
17
17
|
*/
|
|
18
18
|
function useContextMenu() {
|
|
19
19
|
let trigger = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
|
@@ -22,8 +22,8 @@ function useContextMenu() {
|
|
|
22
22
|
function openContextMenu(e) {
|
|
23
23
|
e.preventDefault();
|
|
24
24
|
const {
|
|
25
|
-
x,
|
|
26
|
-
y
|
|
25
|
+
clientX: x,
|
|
26
|
+
clientY: y
|
|
27
27
|
} = e;
|
|
28
28
|
setPosition([x, y]);
|
|
29
29
|
setOpen(true);
|
|
@@ -32,11 +32,12 @@ function useContextMenu() {
|
|
|
32
32
|
setOpen(false);
|
|
33
33
|
}
|
|
34
34
|
React.useEffect(() => {
|
|
35
|
-
const el = trigger
|
|
36
|
-
if (el
|
|
37
|
-
|
|
35
|
+
const el = trigger instanceof Element || trigger instanceof Document || trigger instanceof Window ? trigger : trigger.current;
|
|
36
|
+
if (el) {
|
|
37
|
+
const eventListener = e => openContextMenu(e);
|
|
38
|
+
el.addEventListener('contextmenu', eventListener);
|
|
38
39
|
return () => {
|
|
39
|
-
el.removeEventListener('contextmenu',
|
|
40
|
+
el.removeEventListener('contextmenu', eventListener);
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
43
|
}, [trigger]);
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
|
+
import type { MouseEvent } from 'react';
|
|
9
10
|
import type { DataTableSortState } from './state/sortStates';
|
|
10
11
|
import Table from './Table';
|
|
11
12
|
import TableActionList from './TableActionList';
|
|
@@ -131,13 +132,13 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
|
|
|
131
132
|
}) => {
|
|
132
133
|
ariaLabel: string;
|
|
133
134
|
'aria-label': string;
|
|
134
|
-
checked?: boolean;
|
|
135
|
+
checked?: boolean | undefined;
|
|
135
136
|
disabled?: boolean | undefined;
|
|
136
137
|
id: string;
|
|
137
138
|
indeterminate?: boolean;
|
|
138
139
|
name: string;
|
|
139
140
|
onSelect: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
140
|
-
radio?: boolean;
|
|
141
|
+
radio?: boolean | undefined;
|
|
141
142
|
[key: string]: unknown;
|
|
142
143
|
};
|
|
143
144
|
getToolbarProps: (getToolbarPropsArgs?: {
|
|
@@ -33,9 +33,13 @@ interface TableProps {
|
|
|
33
33
|
* `true` to add useZebraStyles striping.
|
|
34
34
|
*/
|
|
35
35
|
useZebraStyles?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Specify the table tabIndex
|
|
38
|
+
*/
|
|
39
|
+
tabIndex?: number;
|
|
36
40
|
}
|
|
37
41
|
export declare const Table: {
|
|
38
|
-
({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, ...other }: PropsWithChildren<TableProps>): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, tabIndex, ...other }: PropsWithChildren<TableProps>): import("react/jsx-runtime").JSX.Element;
|
|
39
43
|
propTypes: {
|
|
40
44
|
/**
|
|
41
45
|
* Pass in the children that will be rendered within the Table
|
|
@@ -70,6 +74,10 @@ export declare const Table: {
|
|
|
70
74
|
* `true` to add useZebraStyles striping.
|
|
71
75
|
*/
|
|
72
76
|
useZebraStyles: PropTypes.Requireable<boolean>;
|
|
77
|
+
/**
|
|
78
|
+
* Specify the table tabIndex
|
|
79
|
+
*/
|
|
80
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
73
81
|
};
|
|
74
82
|
};
|
|
75
83
|
export default Table;
|
|
@@ -65,6 +65,7 @@ const Table = _ref => {
|
|
|
65
65
|
stickyHeader,
|
|
66
66
|
overflowMenuOnHover = true,
|
|
67
67
|
experimentalAutoAlign = false,
|
|
68
|
+
tabIndex,
|
|
68
69
|
...other
|
|
69
70
|
} = _ref;
|
|
70
71
|
const {
|
|
@@ -140,7 +141,7 @@ const Table = _ref => {
|
|
|
140
141
|
className: `${prefix}--data-table-content`
|
|
141
142
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
142
143
|
,
|
|
143
|
-
tabIndex: isScrollable ? 0 : undefined
|
|
144
|
+
tabIndex: tabIndex ?? (isScrollable ? 0 : undefined)
|
|
144
145
|
}, /*#__PURE__*/React__default["default"].createElement("table", _rollupPluginBabelHelpers["extends"]({
|
|
145
146
|
"aria-labelledby": titleId,
|
|
146
147
|
"aria-describedby": descriptionId
|
|
@@ -185,7 +186,11 @@ Table.propTypes = {
|
|
|
185
186
|
/**
|
|
186
187
|
* `true` to add useZebraStyles striping.
|
|
187
188
|
*/
|
|
188
|
-
useZebraStyles: PropTypes__default["default"].bool
|
|
189
|
+
useZebraStyles: PropTypes__default["default"].bool,
|
|
190
|
+
/**
|
|
191
|
+
* Specify the table tabIndex
|
|
192
|
+
*/
|
|
193
|
+
tabIndex: PropTypes__default["default"].number
|
|
189
194
|
};
|
|
190
195
|
|
|
191
196
|
exports.Table = Table;
|
|
@@ -542,9 +542,6 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
|
|
|
542
542
|
const closeCalendar = event => {
|
|
543
543
|
calendarRef.current.close();
|
|
544
544
|
// Remove focus from endDate calendar input
|
|
545
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
546
|
-
document.activeElement.blur();
|
|
547
|
-
}
|
|
548
545
|
onCalendarClose(calendarRef.current.selectedDates, '', calendarRef.current, {
|
|
549
546
|
type: 'clickOutside'
|
|
550
547
|
});
|
|
@@ -570,12 +567,7 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
|
|
|
570
567
|
if (!calendarRef.current || !startInputField.current) return;
|
|
571
568
|
const handleKeyDown = event => {
|
|
572
569
|
if (match.match(event, keys.Tab) && !event.shiftKey && document.activeElement === endInputField.current && calendarRef.current.isOpen) {
|
|
573
|
-
event.preventDefault();
|
|
574
570
|
calendarRef.current.close();
|
|
575
|
-
// Remove focus from endDate calendar input
|
|
576
|
-
document.activeElement instanceof HTMLElement &&
|
|
577
|
-
// this is to fix the TS warning
|
|
578
|
-
document?.activeElement?.blur();
|
|
579
571
|
onCalendarClose(calendarRef.current.selectedDates, '', calendarRef.current, event);
|
|
580
572
|
}
|
|
581
573
|
};
|
|
@@ -13,7 +13,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
13
13
|
* @param {object} config Plugin configuration.
|
|
14
14
|
* @returns {Plugin} A Flatpickr plugin to put adjust the position of calendar dropdown.
|
|
15
15
|
*/
|
|
16
|
-
var carbonFlatpickrAppendToPlugin =
|
|
16
|
+
var carbonFlatpickrAppendToPlugin = config => fp => {
|
|
17
17
|
/**
|
|
18
18
|
* Adjusts the floating menu position after Flatpicker sets it.
|
|
19
19
|
*/
|
|
@@ -55,6 +55,6 @@ var carbonFlatpickrAppendToPlugin = (config => fp => {
|
|
|
55
55
|
onReady: register,
|
|
56
56
|
onPreCalendarPosition: handlePreCalendarPosition
|
|
57
57
|
};
|
|
58
|
-
}
|
|
58
|
+
};
|
|
59
59
|
|
|
60
60
|
exports["default"] = carbonFlatpickrAppendToPlugin;
|
|
@@ -16,7 +16,7 @@ var keys = require('../../../internal/keyboard/keys.js');
|
|
|
16
16
|
* @param {object} config Plugin configuration.
|
|
17
17
|
* @returns {Plugin} A Flatpickr plugin to fix Flatpickr's behavior of certain events.
|
|
18
18
|
*/
|
|
19
|
-
var carbonFlatpickrFixEventsPlugin =
|
|
19
|
+
var carbonFlatpickrFixEventsPlugin = config => fp => {
|
|
20
20
|
const {
|
|
21
21
|
inputFrom,
|
|
22
22
|
inputTo,
|
|
@@ -154,6 +154,6 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
|
|
|
154
154
|
onReady: [register, init],
|
|
155
155
|
onDestroy: [release]
|
|
156
156
|
};
|
|
157
|
-
}
|
|
157
|
+
};
|
|
158
158
|
|
|
159
159
|
exports["default"] = carbonFlatpickrFixEventsPlugin;
|
|
@@ -22,7 +22,7 @@ var rangePlugin__default = /*#__PURE__*/_interopDefaultLegacy(rangePlugin);
|
|
|
22
22
|
* Workaround for: https://github.com/flatpickr/flatpickr/issues/1944
|
|
23
23
|
* * A logic to ensure `fp.setDate()` call won't end up with "startDate to endDate" set to the first `<input>`
|
|
24
24
|
*/
|
|
25
|
-
var carbonFlatpickrRangePlugin =
|
|
25
|
+
var carbonFlatpickrRangePlugin = config => {
|
|
26
26
|
const factory = rangePlugin__default["default"](Object.assign({
|
|
27
27
|
position: 'left'
|
|
28
28
|
}, config));
|
|
@@ -57,6 +57,6 @@ var carbonFlatpickrRangePlugin = (config => {
|
|
|
57
57
|
onPreCalendarPosition() {}
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
|
-
}
|
|
60
|
+
};
|
|
61
61
|
|
|
62
62
|
exports["default"] = carbonFlatpickrRangePlugin;
|