@carbon/react 1.59.0 → 1.60.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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +813 -813
- package/es/_virtual/_rollupPluginBabelHelpers.js +23 -34
- package/es/components/Button/ButtonBase.d.ts +1 -1
- package/es/components/CheckboxGroup/CheckboxGroup.d.ts +27 -0
- package/es/components/CheckboxGroup/CheckboxGroup.js +5 -5
- package/es/components/ComboBox/ComboBox.d.ts +6 -0
- package/es/components/ComboBox/ComboBox.js +36 -3
- package/es/components/ComboButton/index.d.ts +1 -1
- package/es/components/ComposedModal/ModalHeader.js +0 -1
- package/es/components/DataTable/DataTable.d.ts +3 -0
- package/es/components/DataTable/DataTable.js +4 -1
- package/es/components/DataTable/TableSelectAll.d.ts +14 -3
- package/es/components/DataTable/TableSelectAll.js +10 -3
- package/es/components/DataTable/TableSelectRow.d.ts +16 -4
- package/es/components/DataTable/TableSelectRow.js +11 -4
- package/es/components/DatePicker/DatePicker.d.ts +1 -1
- package/es/components/DatePicker/DatePicker.js +0 -1
- package/es/components/DatePicker/index.d.ts +2 -2
- package/es/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/es/components/DatePickerInput/index.d.ts +2 -2
- package/es/components/FileUploader/FileUploaderItem.js +7 -4
- package/es/components/Heading/index.d.ts +1 -1
- package/es/components/Link/Link.d.ts +1 -1
- package/es/components/ListBox/ListBoxMenu.js +0 -1
- package/es/components/Menu/Menu.d.ts +2 -1
- package/es/components/Menu/Menu.js +18 -12
- package/es/components/MenuButton/index.d.ts +2 -1
- package/es/components/MenuButton/index.js +50 -29
- package/es/components/MultiSelect/FilterableMultiSelect.js +3 -5
- package/es/components/MultiSelect/MultiSelect.js +0 -1
- package/es/components/NumberInput/NumberInput.js +1 -0
- package/es/components/Pagination/Pagination.js +2 -0
- package/es/components/PaginationNav/PaginationNav.js +2 -0
- package/es/components/Popover/index.js +0 -1
- package/es/components/PrimaryButton/PrimaryButton.d.ts +1 -1
- package/es/components/RadioButton/RadioButton.d.ts +2 -2
- package/es/components/RadioButton/index.d.ts +2 -1
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -3
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +8 -10
- package/es/components/RadioButtonGroup/index.d.ts +2 -1
- package/es/components/SecondaryButton/SecondaryButton.d.ts +1 -1
- package/es/components/Tabs/Tabs.js +7 -4
- package/es/components/Tag/DismissibleTag.d.ts +1 -1
- package/es/components/Tag/OperationalTag.d.ts +1 -1
- package/es/components/Tag/SelectableTag.d.ts +1 -1
- package/es/components/Tag/Tag.d.ts +1 -1
- package/es/components/Text/index.d.ts +2 -2
- package/es/components/TextArea/TextArea.js +1 -0
- package/es/components/Toggletip/index.d.ts +1 -1
- package/es/components/Tooltip/DefinitionTooltip.js +22 -1
- package/es/components/UIShell/Content.d.ts +4 -7
- package/es/components/UIShell/Link.d.ts +1 -1
- package/es/components/UIShell/Link.js +1 -0
- package/es/components/UIShell/SideNav.js +1 -0
- package/es/components/UIShell/SwitcherItem.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/internal/Selection.js +20 -17
- package/es/internal/useId.js +1 -1
- package/lib/_virtual/_rollupPluginBabelHelpers.js +23 -34
- package/lib/components/Button/ButtonBase.d.ts +1 -1
- package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +27 -0
- package/lib/components/CheckboxGroup/CheckboxGroup.js +5 -5
- package/lib/components/ComboBox/ComboBox.d.ts +6 -0
- package/lib/components/ComboBox/ComboBox.js +35 -2
- package/lib/components/ComboButton/index.d.ts +1 -1
- package/lib/components/ComposedModal/ModalHeader.js +0 -1
- package/lib/components/DataTable/DataTable.d.ts +3 -0
- package/lib/components/DataTable/DataTable.js +4 -1
- package/lib/components/DataTable/TableSelectAll.d.ts +14 -3
- package/lib/components/DataTable/TableSelectAll.js +10 -3
- package/lib/components/DataTable/TableSelectRow.d.ts +16 -4
- package/lib/components/DataTable/TableSelectRow.js +11 -4
- package/lib/components/DatePicker/DatePicker.d.ts +1 -1
- package/lib/components/DatePicker/DatePicker.js +0 -1
- package/lib/components/DatePicker/index.d.ts +2 -2
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/lib/components/DatePickerInput/index.d.ts +2 -2
- package/lib/components/FileUploader/FileUploaderItem.js +7 -4
- package/lib/components/Heading/index.d.ts +1 -1
- package/lib/components/Link/Link.d.ts +1 -1
- package/lib/components/ListBox/ListBoxMenu.js +0 -1
- package/lib/components/Menu/Menu.d.ts +2 -1
- package/lib/components/Menu/Menu.js +18 -12
- package/lib/components/MenuButton/index.d.ts +2 -1
- package/lib/components/MenuButton/index.js +46 -25
- package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -5
- package/lib/components/MultiSelect/MultiSelect.js +0 -1
- package/lib/components/NumberInput/NumberInput.js +1 -0
- package/lib/components/Pagination/Pagination.js +2 -0
- package/lib/components/PaginationNav/PaginationNav.js +2 -0
- package/lib/components/Popover/index.js +0 -1
- package/lib/components/PrimaryButton/PrimaryButton.d.ts +1 -1
- package/lib/components/RadioButton/RadioButton.d.ts +2 -2
- package/lib/components/RadioButton/index.d.ts +2 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -3
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +8 -10
- package/lib/components/RadioButtonGroup/index.d.ts +2 -1
- package/lib/components/SecondaryButton/SecondaryButton.d.ts +1 -1
- package/lib/components/Tabs/Tabs.js +7 -4
- package/lib/components/Tag/DismissibleTag.d.ts +1 -1
- package/lib/components/Tag/OperationalTag.d.ts +1 -1
- package/lib/components/Tag/SelectableTag.d.ts +1 -1
- package/lib/components/Tag/Tag.d.ts +1 -1
- package/lib/components/Text/index.d.ts +2 -2
- package/lib/components/TextArea/TextArea.js +1 -0
- package/lib/components/Toggletip/index.d.ts +1 -1
- package/lib/components/Tooltip/DefinitionTooltip.js +22 -1
- package/lib/components/UIShell/Content.d.ts +4 -7
- package/lib/components/UIShell/Link.d.ts +1 -1
- package/lib/components/UIShell/Link.js +1 -0
- package/lib/components/UIShell/SideNav.js +1 -0
- package/lib/components/UIShell/SwitcherItem.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/internal/Selection.js +19 -16
- package/package.json +10 -9
|
@@ -55,6 +55,9 @@ function FileUploaderItem(_ref) {
|
|
|
55
55
|
[`${prefix}--file__selected-file--sm`]: size === 'sm'
|
|
56
56
|
});
|
|
57
57
|
const isInvalid = invalid ? `${prefix}--file-filename-container-wrap-invalid` : `${prefix}--file-filename-container-wrap`;
|
|
58
|
+
const filterSpaceName = name => {
|
|
59
|
+
return name?.replace(/\s+/g, '');
|
|
60
|
+
};
|
|
58
61
|
const isEllipsisActive = element => {
|
|
59
62
|
setIsEllipsisApplied(element.offsetWidth < element.scrollWidth);
|
|
60
63
|
return element.offsetWidth < element.scrollWidth;
|
|
@@ -78,12 +81,12 @@ function FileUploaderItem(_ref) {
|
|
|
78
81
|
as: "p",
|
|
79
82
|
title: name,
|
|
80
83
|
className: `${prefix}--file-filename-button`,
|
|
81
|
-
id: name
|
|
84
|
+
id: filterSpaceName(name)
|
|
82
85
|
}, name)))) : /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
83
86
|
as: "p",
|
|
84
87
|
title: name,
|
|
85
88
|
className: `${prefix}--file-filename`,
|
|
86
|
-
id: name
|
|
89
|
+
id: filterSpaceName(name)
|
|
87
90
|
}, name), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
88
91
|
className: `${prefix}--file-container-item`
|
|
89
92
|
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
@@ -93,7 +96,7 @@ function FileUploaderItem(_ref) {
|
|
|
93
96
|
iconDescription: iconDescription,
|
|
94
97
|
status: status,
|
|
95
98
|
invalid: invalid,
|
|
96
|
-
"aria-describedby": `${name}-id-error
|
|
99
|
+
"aria-describedby": invalid && errorSubject ? `${filterSpaceName(name)}-id-error` : undefined,
|
|
97
100
|
onKeyDown: evt => {
|
|
98
101
|
if (match.matches(evt, [keys.Enter, keys.Space])) {
|
|
99
102
|
if (status === 'edit') {
|
|
@@ -114,7 +117,7 @@ function FileUploaderItem(_ref) {
|
|
|
114
117
|
}))), invalid && errorSubject && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
115
118
|
className: `${prefix}--form-requirement`,
|
|
116
119
|
role: "alert",
|
|
117
|
-
id: `${name}-id-error`
|
|
120
|
+
id: `${filterSpaceName(name)}-id-error`
|
|
118
121
|
}, /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
119
122
|
as: "div",
|
|
120
123
|
className: `${prefix}--form-requirement__title`
|
|
@@ -11,6 +11,6 @@ type SectionBaseProps = {
|
|
|
11
11
|
level?: HeadingLevel;
|
|
12
12
|
};
|
|
13
13
|
type SectionProps<E extends ElementType> = PolymorphicProps<E, SectionBaseProps>;
|
|
14
|
-
export declare const Section: React.ForwardRefExoticComponent<Omit<SectionProps<React.ElementType<any>>, "ref"> & React.RefAttributes<unknown>>;
|
|
14
|
+
export declare const Section: React.ForwardRefExoticComponent<Omit<SectionProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
|
|
15
15
|
export declare const Heading: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
16
16
|
export {};
|
|
@@ -49,5 +49,5 @@ export interface LinkBaseProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
49
49
|
visited?: boolean;
|
|
50
50
|
}
|
|
51
51
|
export type LinkProps<E extends ElementType> = PolymorphicProps<E, LinkBaseProps>;
|
|
52
|
-
declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps<React.ElementType<any>>, "ref"> & React.RefAttributes<unknown>>;
|
|
52
|
+
declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
|
|
53
53
|
export default Link;
|
|
@@ -53,7 +53,7 @@ interface MenuProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
|
53
53
|
/**
|
|
54
54
|
* Specify a DOM node where the Menu should be rendered in. Defaults to document.body.
|
|
55
55
|
*/
|
|
56
|
-
target?:
|
|
56
|
+
target?: Element;
|
|
57
57
|
/**
|
|
58
58
|
* Specify the x position of the Menu. Either pass a single number or an array with two numbers describing your activator's boundaries ([x1, x2])
|
|
59
59
|
*/
|
|
@@ -62,6 +62,7 @@ interface MenuProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
|
62
62
|
* Specify the y position of the Menu. Either pass a single number or an array with two numbers describing your activator's boundaries ([y1, y2])
|
|
63
63
|
*/
|
|
64
64
|
y?: number | [number, number];
|
|
65
|
+
legacyAutoalign?: boolean;
|
|
65
66
|
}
|
|
66
67
|
declare const Menu: React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<HTMLUListElement>>;
|
|
67
68
|
export { Menu };
|
|
@@ -18,6 +18,7 @@ var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
|
18
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
19
|
var warning = require('../../internal/warning.js');
|
|
20
20
|
var MenuContext = require('./MenuContext.js');
|
|
21
|
+
var environment = require('../../internal/environment.js');
|
|
21
22
|
var useLayoutDirection = require('../LayoutDirection/useLayoutDirection.js');
|
|
22
23
|
var match = require('../../internal/keyboard/match.js');
|
|
23
24
|
var keys = require('../../internal/keyboard/keys.js');
|
|
@@ -42,9 +43,9 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(_ref, forwardRef) {
|
|
|
42
43
|
onOpen,
|
|
43
44
|
open,
|
|
44
45
|
size = 'sm',
|
|
45
|
-
|
|
46
|
+
legacyAutoalign = 'true',
|
|
46
47
|
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
|
|
47
|
-
target = document.body,
|
|
48
|
+
target = environment.canUseDOM && document.body,
|
|
48
49
|
x = 0,
|
|
49
50
|
y = 0,
|
|
50
51
|
...rest
|
|
@@ -96,16 +97,18 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(_ref, forwardRef) {
|
|
|
96
97
|
function handleOpen() {
|
|
97
98
|
if (menu.current) {
|
|
98
99
|
focusReturn.current = document.activeElement;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
if (legacyAutoalign) {
|
|
101
|
+
const pos = calculatePosition();
|
|
102
|
+
if ((document?.dir === 'rtl' || direction === 'rtl') && !rest?.id?.includes('MenuButton')) {
|
|
103
|
+
menu.current.style.insetInlineStart = `initial`;
|
|
104
|
+
menu.current.style.insetInlineEnd = `${pos[0]}px`;
|
|
105
|
+
} else {
|
|
106
|
+
menu.current.style.insetInlineStart = `${pos[0]}px`;
|
|
107
|
+
menu.current.style.insetInlineEnd = `initial`;
|
|
108
|
+
}
|
|
109
|
+
menu.current.style.insetBlockStart = `${pos[1]}px`;
|
|
110
|
+
setPosition(pos);
|
|
106
111
|
}
|
|
107
|
-
menu.current.style.insetBlockStart = `${pos[1]}px`;
|
|
108
|
-
setPosition(pos);
|
|
109
112
|
menu.current.focus();
|
|
110
113
|
if (onOpen) {
|
|
111
114
|
onOpen();
|
|
@@ -287,7 +290,7 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(_ref, forwardRef) {
|
|
|
287
290
|
// to avoid a flicker effect when opening.
|
|
288
291
|
[`${prefix}--menu--box-shadow-top`]: menuAlignment && menuAlignment.slice(0, 3) === 'top',
|
|
289
292
|
[`${prefix}--menu--open`]: open,
|
|
290
|
-
[`${prefix}--menu--shown`]: position[0] >= 0 && position[1] >= 0,
|
|
293
|
+
[`${prefix}--menu--shown`]: open && !legacyAutoalign || position[0] >= 0 && position[1] >= 0,
|
|
291
294
|
[`${prefix}--menu--with-icons`]: childContext.state.hasIcons
|
|
292
295
|
});
|
|
293
296
|
const rendered = /*#__PURE__*/React__default["default"].createElement(MenuContext.MenuContext.Provider, {
|
|
@@ -301,6 +304,9 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(_ref, forwardRef) {
|
|
|
301
304
|
onKeyDown: handleKeyDown,
|
|
302
305
|
onBlur: handleBlur
|
|
303
306
|
}), children));
|
|
307
|
+
if (!target) {
|
|
308
|
+
return rendered;
|
|
309
|
+
}
|
|
304
310
|
return isRoot ? open && /*#__PURE__*/ReactDOM.createPortal(rendered, target) || null : rendered;
|
|
305
311
|
});
|
|
306
312
|
Menu.propTypes = {
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { ComponentProps, ReactNode } from 'react';
|
|
8
|
+
export type MenuAlignment = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end';
|
|
8
9
|
export interface MenuButtonProps extends ComponentProps<'div'> {
|
|
9
10
|
/**
|
|
10
11
|
* A collection of MenuItems to be rendered as actions for this MenuButton.
|
|
@@ -29,7 +30,7 @@ export interface MenuButtonProps extends ComponentProps<'div'> {
|
|
|
29
30
|
/**
|
|
30
31
|
* Experimental property. Specify how the menu should align with the button element
|
|
31
32
|
*/
|
|
32
|
-
menuAlignment:
|
|
33
|
+
menuAlignment: MenuAlignment;
|
|
33
34
|
/**
|
|
34
35
|
* Specify the size of the button and menu.
|
|
35
36
|
*/
|
|
@@ -20,8 +20,9 @@ var Menu = require('../Menu/Menu.js');
|
|
|
20
20
|
require('../Menu/MenuItem.js');
|
|
21
21
|
var useAttachedMenu = require('../../internal/useAttachedMenu.js');
|
|
22
22
|
var useId = require('../../internal/useId.js');
|
|
23
|
-
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
24
23
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
24
|
+
var react = require('@floating-ui/react');
|
|
25
|
+
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
25
26
|
|
|
26
27
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
27
28
|
|
|
@@ -29,7 +30,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
29
30
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
30
31
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
31
32
|
|
|
32
|
-
const spacing = 0; // top and bottom spacing between the button and the menu. in px
|
|
33
33
|
const validButtonKinds = ['primary', 'tertiary', 'ghost'];
|
|
34
34
|
const defaultButtonKind = 'primary';
|
|
35
35
|
const MenuButton = /*#__PURE__*/React.forwardRef(function MenuButton(_ref, forwardRef) {
|
|
@@ -47,35 +47,57 @@ const MenuButton = /*#__PURE__*/React.forwardRef(function MenuButton(_ref, forwa
|
|
|
47
47
|
const id = useId.useId('MenuButton');
|
|
48
48
|
const prefix = usePrefix.usePrefix();
|
|
49
49
|
const triggerRef = React.useRef(null);
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
const middlewares = [react.flip({
|
|
51
|
+
crossAxis: false
|
|
52
|
+
})];
|
|
53
|
+
if (menuAlignment === 'bottom' || menuAlignment === 'top') {
|
|
54
|
+
middlewares.push(react.size({
|
|
55
|
+
apply(_ref2) {
|
|
56
|
+
let {
|
|
57
|
+
rects,
|
|
58
|
+
elements
|
|
59
|
+
} = _ref2;
|
|
60
|
+
Object.assign(elements.floating.style, {
|
|
61
|
+
width: `${rects.reference.width}px`
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
const {
|
|
67
|
+
refs,
|
|
68
|
+
floatingStyles,
|
|
69
|
+
placement,
|
|
70
|
+
middlewareData
|
|
71
|
+
} = react.useFloating({
|
|
72
|
+
placement: menuAlignment,
|
|
73
|
+
// The floating element is positioned relative to its nearest
|
|
74
|
+
// containing block (usually the viewport). It will in many cases also
|
|
75
|
+
// “break” the floating element out of a clipping ancestor.
|
|
76
|
+
// https://floating-ui.com/docs/misc#clipping
|
|
77
|
+
strategy: 'fixed',
|
|
78
|
+
// Middleware order matters, arrow should be last
|
|
79
|
+
middleware: middlewares,
|
|
80
|
+
whileElementsMounted: react.autoUpdate
|
|
81
|
+
});
|
|
82
|
+
const ref = mergeRefs["default"](forwardRef, triggerRef);
|
|
53
83
|
const {
|
|
54
84
|
open,
|
|
55
|
-
x,
|
|
56
|
-
y,
|
|
57
85
|
handleClick: hookOnClick,
|
|
58
86
|
handleMousedown,
|
|
59
87
|
handleClose
|
|
60
88
|
} = useAttachedMenu.useAttachedMenu(triggerRef);
|
|
89
|
+
React.useLayoutEffect(() => {
|
|
90
|
+
Object.keys(floatingStyles).forEach(style => {
|
|
91
|
+
if (refs.floating.current) {
|
|
92
|
+
refs.floating.current.style[style] = floatingStyles[style];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}, [floatingStyles, refs.floating, middlewareData, placement, open]);
|
|
61
96
|
function handleClick() {
|
|
62
97
|
if (triggerRef.current) {
|
|
63
|
-
const {
|
|
64
|
-
width: w
|
|
65
|
-
} = triggerRef.current.getBoundingClientRect();
|
|
66
|
-
setWidth(w);
|
|
67
98
|
hookOnClick();
|
|
68
99
|
}
|
|
69
100
|
}
|
|
70
|
-
function handleOpen() {
|
|
71
|
-
if (menuRef.current) {
|
|
72
|
-
menuRef.current.style.inlineSize = `${width}px`;
|
|
73
|
-
menuRef.current.style.minInlineSize = `${width}px`;
|
|
74
|
-
if (menuAlignment !== 'bottom' && menuAlignment !== 'top') {
|
|
75
|
-
menuRef.current.style.inlineSize = `fit-content`;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
101
|
const containerClasses = cx__default["default"](`${prefix}--menu-button__container`, className);
|
|
80
102
|
const triggerClasses = cx__default["default"](`${prefix}--menu-button__trigger`, {
|
|
81
103
|
[`${prefix}--menu-button__trigger--open`]: open
|
|
@@ -86,6 +108,7 @@ const MenuButton = /*#__PURE__*/React.forwardRef(function MenuButton(_ref, forwa
|
|
|
86
108
|
"aria-owns": open ? id : undefined,
|
|
87
109
|
className: containerClasses
|
|
88
110
|
}), /*#__PURE__*/React__default["default"].createElement(Button["default"], {
|
|
111
|
+
ref: refs.setReference,
|
|
89
112
|
className: triggerClasses,
|
|
90
113
|
size: size,
|
|
91
114
|
tabIndex: tabIndex,
|
|
@@ -101,16 +124,14 @@ const MenuButton = /*#__PURE__*/React.forwardRef(function MenuButton(_ref, forwa
|
|
|
101
124
|
containerRef: triggerRef,
|
|
102
125
|
menuAlignment: menuAlignment,
|
|
103
126
|
className: menuClasses,
|
|
104
|
-
ref:
|
|
127
|
+
ref: refs.setFloating,
|
|
105
128
|
id: id,
|
|
129
|
+
legacyAutoalign: false,
|
|
106
130
|
label: label,
|
|
107
131
|
mode: "basic",
|
|
108
132
|
size: size,
|
|
109
133
|
open: open,
|
|
110
|
-
onClose: handleClose
|
|
111
|
-
onOpen: handleOpen,
|
|
112
|
-
x: x,
|
|
113
|
-
y: [y[0] - spacing, y[1] + spacing]
|
|
134
|
+
onClose: handleClose
|
|
114
135
|
}, children));
|
|
115
136
|
});
|
|
116
137
|
MenuButton.propTypes = {
|
|
@@ -243,6 +243,8 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
243
243
|
return changes;
|
|
244
244
|
case InputBlur:
|
|
245
245
|
case InputKeyDownEscape:
|
|
246
|
+
setInputFocused(false);
|
|
247
|
+
setInputValue('');
|
|
246
248
|
setIsOpen(false);
|
|
247
249
|
return changes;
|
|
248
250
|
case FunctionToggleMenu:
|
|
@@ -426,11 +428,7 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
426
428
|
$input.setSelectionRange($value.length, $value.length);
|
|
427
429
|
}
|
|
428
430
|
},
|
|
429
|
-
onFocus: () => setInputFocused(true)
|
|
430
|
-
onBlur() {
|
|
431
|
-
setInputFocused(false);
|
|
432
|
-
setInputValue('');
|
|
433
|
-
}
|
|
431
|
+
onFocus: () => setInputFocused(true)
|
|
434
432
|
}));
|
|
435
433
|
const menuProps = getMenuProps({}, {
|
|
436
434
|
suppressRefError: true
|
|
@@ -219,6 +219,7 @@ const NumberInput = /*#__PURE__*/React__default["default"].forwardRef(function N
|
|
|
219
219
|
"data-invalid": normalizedProps.invalid ? true : undefined,
|
|
220
220
|
"aria-invalid": normalizedProps.invalid,
|
|
221
221
|
"aria-describedby": ariaDescribedBy,
|
|
222
|
+
"aria-readonly": readOnly,
|
|
222
223
|
disabled: normalizedProps.disabled,
|
|
223
224
|
ref: ref,
|
|
224
225
|
id: id,
|
|
@@ -251,6 +251,7 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
|
|
|
251
251
|
kind: "ghost",
|
|
252
252
|
className: backButtonClasses,
|
|
253
253
|
label: backwardText,
|
|
254
|
+
"aria-label": backwardText,
|
|
254
255
|
onClick: decrementPage,
|
|
255
256
|
ref: backBtnRef
|
|
256
257
|
}, _CaretLeft || (_CaretLeft = /*#__PURE__*/React__default["default"].createElement(iconsReact.CaretLeft, null))), /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
@@ -259,6 +260,7 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
|
|
|
259
260
|
kind: "ghost",
|
|
260
261
|
className: forwardButtonClasses,
|
|
261
262
|
label: forwardText,
|
|
263
|
+
"aria-label": forwardText,
|
|
262
264
|
onClick: incrementPage,
|
|
263
265
|
ref: forwardBtnRef
|
|
264
266
|
}, _CaretRight || (_CaretRight = /*#__PURE__*/React__default["default"].createElement(iconsReact.CaretRight, null))))));
|
|
@@ -263,6 +263,7 @@ const PaginationNav = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
263
263
|
className: `${prefix}--pagination-nav__list`
|
|
264
264
|
}, /*#__PURE__*/React__default["default"].createElement(DirectionButton, {
|
|
265
265
|
direction: "backward",
|
|
266
|
+
"aria-label": t('carbon.pagination-nav.previous'),
|
|
266
267
|
label: t('carbon.pagination-nav.previous'),
|
|
267
268
|
disabled: backwardButtonDisabled,
|
|
268
269
|
onClick: jumpToPrevious
|
|
@@ -307,6 +308,7 @@ const PaginationNav = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
307
308
|
}
|
|
308
309
|
}), /*#__PURE__*/React__default["default"].createElement(DirectionButton, {
|
|
309
310
|
direction: "forward",
|
|
311
|
+
"aria-label": t('carbon.pagination-nav.next'),
|
|
310
312
|
label: t('carbon.pagination-nav.next'),
|
|
311
313
|
disabled: forwardButtonDisabled,
|
|
312
314
|
onClick: jumpToNext
|
|
@@ -142,7 +142,6 @@ const Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popov
|
|
|
142
142
|
whileElementsMounted: react.autoUpdate
|
|
143
143
|
} : {} // When autoAlign is turned off, floating-ui will not be used
|
|
144
144
|
);
|
|
145
|
-
|
|
146
145
|
const value = React.useMemo(() => {
|
|
147
146
|
return {
|
|
148
147
|
floating,
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { ButtonProps } from '../Button';
|
|
9
|
-
declare const PrimaryButton: <T extends React.ElementType<any>>(props: ButtonProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const PrimaryButton: <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>(props: ButtonProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default PrimaryButton;
|
|
@@ -49,7 +49,7 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
49
49
|
* Provide an optional `onChange` hook that is called each time the value of
|
|
50
50
|
* the underlying `<input>` changes
|
|
51
51
|
*/
|
|
52
|
-
onChange?: (value:
|
|
52
|
+
onChange?: (value: RadioButtonProps['value'], name: RadioButtonProps['name'], event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
53
53
|
/**
|
|
54
54
|
* Provide a handler that is invoked when a user clicks on the control
|
|
55
55
|
*/
|
|
@@ -67,5 +67,5 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
67
67
|
*/
|
|
68
68
|
required?: boolean;
|
|
69
69
|
}
|
|
70
|
-
declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<
|
|
70
|
+
declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<HTMLInputElement>>;
|
|
71
71
|
export default RadioButton;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import RadioButton from './RadioButton';
|
|
7
|
+
import RadioButton, { RadioButtonProps } from './RadioButton';
|
|
8
8
|
export default RadioButton;
|
|
9
9
|
export { RadioButton };
|
|
10
|
+
export type { RadioButtonProps };
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { ReactNode } from 'react';
|
|
8
|
+
import type { RadioButtonProps } from '../RadioButton';
|
|
8
9
|
export declare const RadioButtonGroupContext: React.Context<null>;
|
|
9
10
|
type ExcludedAttributes = 'onChange';
|
|
10
11
|
export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HTMLFieldSetElement>, ExcludedAttributes> {
|
|
@@ -19,7 +20,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
19
20
|
/**
|
|
20
21
|
* Specify the `<RadioButton>` to be selected by default
|
|
21
22
|
*/
|
|
22
|
-
defaultSelected?:
|
|
23
|
+
defaultSelected?: RadioButtonProps['value'];
|
|
23
24
|
/**
|
|
24
25
|
* Specify whether the group is disabled
|
|
25
26
|
*/
|
|
@@ -53,7 +54,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
53
54
|
* Provide an optional `onChange` hook that is called whenever the value of
|
|
54
55
|
* the group changes
|
|
55
56
|
*/
|
|
56
|
-
onChange?: (selection:
|
|
57
|
+
onChange?: (selection: RadioButtonProps['value'], name: RadioButtonGroupProps['name'], event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
57
58
|
/**
|
|
58
59
|
* Provide where radio buttons should be placed
|
|
59
60
|
*/
|
|
@@ -77,7 +78,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
77
78
|
/**
|
|
78
79
|
* Specify the value that is currently selected in the group
|
|
79
80
|
*/
|
|
80
|
-
valueSelected?:
|
|
81
|
+
valueSelected?: RadioButtonProps['value'];
|
|
81
82
|
/**
|
|
82
83
|
* `true` to specify if input selection in group is required.
|
|
83
84
|
*/
|
|
@@ -65,23 +65,21 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
|
|
|
65
65
|
}
|
|
66
66
|
function getRadioButtons() {
|
|
67
67
|
const mappedChildren = React__default["default"].Children.map(children, radioButton => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
68
|
+
if (!radioButton) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
71
|
const newProps = {
|
|
72
72
|
name: name,
|
|
73
|
-
key: value,
|
|
74
|
-
value: value,
|
|
73
|
+
key: radioButton.props.value,
|
|
74
|
+
value: radioButton.props.value,
|
|
75
75
|
onChange: handleOnChange,
|
|
76
|
-
checked: value === selected,
|
|
76
|
+
checked: radioButton.props.value === selected,
|
|
77
77
|
required: required
|
|
78
78
|
};
|
|
79
|
-
if (!selected && radioButton
|
|
79
|
+
if (!selected && radioButton.props.checked) {
|
|
80
80
|
newProps.checked = true;
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
return /*#__PURE__*/React__default["default"].cloneElement(radioButton, newProps);
|
|
84
|
-
}
|
|
82
|
+
return /*#__PURE__*/React__default["default"].cloneElement(radioButton, newProps);
|
|
85
83
|
});
|
|
86
84
|
return mappedChildren;
|
|
87
85
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import RadioButtonGroup from './RadioButtonGroup';
|
|
7
|
+
import RadioButtonGroup, { RadioButtonGroupProps } from './RadioButtonGroup';
|
|
8
8
|
export default RadioButtonGroup;
|
|
9
9
|
export { RadioButtonGroup };
|
|
10
|
+
export type { RadioButtonGroupProps };
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { ButtonProps } from '../Button';
|
|
9
|
-
declare const SecondaryButton: <T extends React.ElementType<any>>(props: ButtonProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const SecondaryButton: <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>(props: ButtonProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default SecondaryButton;
|
|
@@ -262,13 +262,14 @@ function TabList(_ref2) {
|
|
|
262
262
|
}
|
|
263
263
|
});
|
|
264
264
|
React.useEffect(() => {
|
|
265
|
-
|
|
265
|
+
//adding 1 in calculation for firefox support
|
|
266
|
+
setIsNextButtonVisible(ref.current ? scrollLeft + buttonWidth + ref.current.clientWidth + 1 < ref.current.scrollWidth : false);
|
|
266
267
|
if (dismissable) {
|
|
267
268
|
if (ref.current) {
|
|
268
269
|
setIsScrollable(ref.current.scrollWidth > ref.current.clientWidth);
|
|
269
270
|
}
|
|
270
271
|
}
|
|
271
|
-
}, [scrollLeft, children, dismissable]);
|
|
272
|
+
}, [scrollLeft, children, dismissable, isScrollable]);
|
|
272
273
|
useEffectOnce.useEffectOnce(() => {
|
|
273
274
|
if (tabs.current[selectedIndex]?.disabled) {
|
|
274
275
|
const activeTabs = tabs.current.filter(tab => {
|
|
@@ -282,11 +283,13 @@ function TabList(_ref2) {
|
|
|
282
283
|
});
|
|
283
284
|
useIsomorphicEffect["default"](() => {
|
|
284
285
|
if (ref.current) {
|
|
285
|
-
|
|
286
|
+
//adding 1 in calculation for firefox support
|
|
287
|
+
setIsScrollable(ref.current.scrollWidth > ref.current.clientWidth + 1);
|
|
286
288
|
}
|
|
287
289
|
function handler() {
|
|
288
290
|
if (ref.current) {
|
|
289
|
-
|
|
291
|
+
//adding 1 in calculation for firefox support
|
|
292
|
+
setIsScrollable(ref.current.scrollWidth > ref.current.clientWidth + 1);
|
|
290
293
|
}
|
|
291
294
|
}
|
|
292
295
|
const debouncedHandler = debounce__default["default"](handler, 200);
|
|
@@ -54,7 +54,7 @@ export interface DismissibleTagBaseProps {
|
|
|
54
54
|
}
|
|
55
55
|
export type DismissibleTagProps<T extends React.ElementType> = PolymorphicProps<T, DismissibleTagBaseProps>;
|
|
56
56
|
declare const DismissibleTag: {
|
|
57
|
-
<T extends React.ElementType<any>>({ className, disabled, id, renderIcon, title, onClose, slug, size, text, type, ...other }: DismissibleTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
<T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, disabled, id, renderIcon, title, onClose, slug, size, text, type, ...other }: DismissibleTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
58
58
|
propTypes: {
|
|
59
59
|
/**
|
|
60
60
|
* Provide a custom className that is applied to the containing <span>
|
|
@@ -59,7 +59,7 @@ export interface OperationalTagBaseProps {
|
|
|
59
59
|
}
|
|
60
60
|
export type OperationalTagProps<T extends React.ElementType> = PolymorphicProps<T, OperationalTagBaseProps>;
|
|
61
61
|
declare const OperationalTag: {
|
|
62
|
-
<T extends React.ElementType<any>>({ className, disabled, id, renderIcon, slug, size, text, type, ...other }: OperationalTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
<T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, disabled, id, renderIcon, slug, size, text, type, ...other }: OperationalTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
63
63
|
propTypes: {
|
|
64
64
|
/**
|
|
65
65
|
* Provide a custom className that is applied to the containing <span>
|
|
@@ -46,7 +46,7 @@ export interface SelectableTagBaseProps {
|
|
|
46
46
|
}
|
|
47
47
|
export type SelectableTagProps<T extends React.ElementType> = PolymorphicProps<T, SelectableTagBaseProps>;
|
|
48
48
|
declare const SelectableTag: {
|
|
49
|
-
<T extends React.ElementType<any>>({ className, disabled, id, renderIcon, selected, slug, size, text, ...other }: SelectableTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
<T extends React.ElementType<any, keyof React.JSX.IntrinsicElements>>({ className, disabled, id, renderIcon, selected, slug, size, text, ...other }: SelectableTagProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
50
50
|
propTypes: {
|
|
51
51
|
/**
|
|
52
52
|
* Provide a custom className that is applied to the containing <span>
|
|
@@ -74,6 +74,6 @@ export interface TagBaseProps {
|
|
|
74
74
|
type?: keyof typeof TYPES;
|
|
75
75
|
}
|
|
76
76
|
export type TagProps<T extends React.ElementType> = PolymorphicProps<T, TagBaseProps>;
|
|
77
|
-
declare const Tag: React.ForwardRefExoticComponent<Omit<TagProps<React.ElementType<any>>, "ref"> & React.RefAttributes<HTMLElement | undefined>>;
|
|
77
|
+
declare const Tag: React.ForwardRefExoticComponent<Omit<TagProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<HTMLElement | undefined>>;
|
|
78
78
|
export declare const types: string[];
|
|
79
79
|
export default Tag;
|
|
@@ -9,10 +9,10 @@ import { Text, TextBaseProps, TextProps } from './Text';
|
|
|
9
9
|
export { TextDirection, Text };
|
|
10
10
|
export type { TextBaseProps, TextProps, TextDirectionProps, GetTextDirection, TextDir, };
|
|
11
11
|
export declare const Label: {
|
|
12
|
-
(props: TextProps<import("react").ElementType<any>>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
(props: TextProps<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements>>): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
displayName: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const Legend: {
|
|
16
|
-
(props: TextProps<import("react").ElementType<any>>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
(props: TextProps<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements>>): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
displayName: string;
|
|
18
18
|
};
|
|
@@ -164,6 +164,7 @@ const TextArea = /*#__PURE__*/React__default["default"].forwardRef((props, forwa
|
|
|
164
164
|
};
|
|
165
165
|
const formItemClasses = cx__default["default"](`${prefix}--form-item`, className);
|
|
166
166
|
const textAreaWrapperClasses = cx__default["default"](`${prefix}--text-area__wrapper`, {
|
|
167
|
+
[`${prefix}--text-area__wrapper--cols`]: other.cols,
|
|
167
168
|
[`${prefix}--text-area__wrapper--readonly`]: other.readOnly,
|
|
168
169
|
[`${prefix}--text-area__wrapper--warn`]: warn,
|
|
169
170
|
[`${prefix}--text-area__wrapper--slug`]: slug
|
|
@@ -89,7 +89,7 @@ export type ToggleTipButtonProps<T extends React.ElementType> = PolymorphicProps
|
|
|
89
89
|
* `ToggletipButton` controls the visibility of the Toggletip through mouse
|
|
90
90
|
* clicks and keyboard interactions.
|
|
91
91
|
*/
|
|
92
|
-
export declare const ToggletipButton: React.ForwardRefExoticComponent<Omit<ToggleTipButtonProps<React.ElementType<any>>, "ref"> & React.RefAttributes<unknown>>;
|
|
92
|
+
export declare const ToggletipButton: React.ForwardRefExoticComponent<Omit<ToggleTipButtonProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
|
|
93
93
|
interface ToggletipContentProps {
|
|
94
94
|
children?: ReactNode;
|
|
95
95
|
className?: string | undefined;
|
|
@@ -84,7 +84,28 @@ DefinitionTooltip.propTypes = {
|
|
|
84
84
|
/**
|
|
85
85
|
* Specify how the trigger should align with the tooltip
|
|
86
86
|
*/
|
|
87
|
-
align: PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
87
|
+
align: PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
88
|
+
// deprecated use top-start instead
|
|
89
|
+
'top-right',
|
|
90
|
+
// deprecated use top-end instead
|
|
91
|
+
|
|
92
|
+
'bottom', 'bottom-left',
|
|
93
|
+
// deprecated use bottom-start instead
|
|
94
|
+
'bottom-right',
|
|
95
|
+
// deprecated use bottom-end instead
|
|
96
|
+
|
|
97
|
+
'left', 'left-bottom',
|
|
98
|
+
// deprecated use left-end instead
|
|
99
|
+
'left-top',
|
|
100
|
+
// deprecated use left-start instead
|
|
101
|
+
|
|
102
|
+
'right', 'right-bottom',
|
|
103
|
+
// deprecated use right-end instead
|
|
104
|
+
'right-top',
|
|
105
|
+
// deprecated use right-start instead
|
|
106
|
+
|
|
107
|
+
// new values to match floating-ui
|
|
108
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
88
109
|
/**
|
|
89
110
|
* The `children` prop will be used as the value that is being defined
|
|
90
111
|
*/
|