@carbon/react 1.74.0 → 1.75.0-rc.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 +757 -757
- package/es/components/AILabel/index.d.ts +1 -2
- package/es/components/AILabel/index.js +1 -1
- package/es/components/AISkeleton/AISkeletonIcon.d.ts +1 -1
- package/es/components/AISkeleton/AISkeletonText.d.ts +1 -1
- package/es/components/Accordion/Accordion.Skeleton.d.ts +1 -1
- package/es/components/Accordion/AccordionItem.d.ts +2 -2
- package/es/components/AspectRatio/AspectRatio.d.ts +1 -1
- package/es/components/Button/Button.d.ts +3 -3
- package/es/components/Button/Button.js +1 -1
- package/es/components/ClassPrefix/index.d.ts +1 -1
- package/es/components/ComboBox/ComboBox.d.ts +4 -4
- package/es/components/ComboBox/ComboBox.js +0 -1
- package/es/components/ComboButton/index.d.ts +1 -1
- package/es/components/ComposedModal/ModalFooter.d.ts +1 -2
- package/es/components/ComposedModal/ModalFooter.js +2 -2
- package/es/components/ComposedModal/ModalHeader.d.ts +1 -2
- package/es/components/ContainedList/ContainedList.d.ts +1 -1
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +2 -3
- package/es/components/ContextMenu/useContextMenu.d.ts +1 -1
- package/es/components/Copy/Copy.d.ts +1 -1
- package/es/components/DataTable/TableCell.d.ts +1 -1
- package/es/components/DataTable/TableExpandHeader.d.ts +3 -3
- package/es/components/DataTable/TableExpandRow.d.ts +1 -1
- package/es/components/DataTable/TableExpandedRow.d.ts +1 -1
- package/es/components/DataTable/TableHeader.d.ts +1 -1
- package/es/components/DataTable/TableSelectAll.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.js +11 -3
- package/es/components/ErrorBoundary/ErrorBoundary.d.ts +2 -3
- package/es/components/FeatureFlags/index.d.ts +1 -1
- package/es/components/FileUploader/FileUploader.d.ts +8 -7
- package/es/components/FileUploader/FileUploader.js +9 -2
- package/es/components/Form/Form.d.ts +1 -1
- package/es/components/FormItem/FormItem.d.ts +1 -1
- package/es/components/Heading/index.d.ts +1 -1
- package/es/components/IconButton/index.d.ts +1 -1
- package/es/components/IdPrefix/index.d.ts +1 -1
- package/es/components/Layer/index.d.ts +1 -2
- package/es/components/LayoutDirection/LayoutDirection.d.ts +1 -1
- package/es/components/Link/Link.d.ts +5 -4
- package/es/components/Link/Link.js +1 -1
- package/es/components/ListItem/ListItem.d.ts +1 -1
- package/es/components/Menu/Menu.d.ts +1 -1
- package/es/components/Modal/Modal.js +1 -1
- package/es/components/ModalWrapper/ModalWrapper.d.ts +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +4 -1
- package/es/components/MultiSelect/MultiSelect.js +10 -1
- package/es/components/OrderedList/OrderedList.d.ts +1 -1
- package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/es/components/PaginationNav/PaginationNav.d.ts +52 -1
- package/es/components/Popover/index.d.ts +6 -2
- package/es/components/Portal/index.d.ts +1 -1
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.d.ts +1 -1
- package/es/components/SkeletonIcon/SkeletonIcon.d.ts +1 -1
- package/es/components/SkeletonText/SkeletonText.d.ts +1 -1
- package/es/components/Tabs/Tabs.d.ts +2 -2
- package/es/components/Tabs/Tabs.js +1 -1
- package/es/components/Tag/DismissibleTag.js +1 -1
- package/es/components/Tag/OperationalTag.js +1 -1
- package/es/components/Tag/SelectableTag.d.ts +2 -2
- package/es/components/Tag/SelectableTag.js +1 -1
- package/es/components/Tag/Tag.d.ts +7 -3
- package/es/components/Tag/Tag.js +1 -1
- package/es/components/Text/Text.d.ts +6 -4
- package/es/components/Text/Text.js +1 -1
- package/es/components/Theme/index.d.ts +1 -1
- package/es/components/Toggle/Toggle.Skeleton.d.ts +1 -1
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.d.ts +1 -1
- package/es/components/Toggletip/index.d.ts +4 -4
- package/es/components/UIShell/Content.d.ts +1 -1
- package/es/components/UIShell/Header.d.ts +1 -1
- package/es/components/UIShell/HeaderGlobalAction.d.ts +1 -1
- package/es/components/UIShell/HeaderMenu.d.ts +1 -1
- package/es/components/UIShell/HeaderPanel.d.ts +1 -1
- package/es/components/UIShell/SideNavHeader.d.ts +1 -1
- package/es/components/UIShell/SideNavIcon.d.ts +1 -1
- package/es/components/UIShell/SideNavItem.d.ts +1 -1
- package/es/components/UIShell/SideNavItems.d.ts +1 -1
- package/es/components/UIShell/SideNavMenu.d.ts +1 -1
- package/es/components/UIShell/SideNavMenuItem.d.ts +1 -1
- package/es/components/UIShell/SideNavSwitcher.d.ts +1 -1
- package/es/components/UIShell/Switcher.d.ts +1 -1
- package/es/components/UIShell/SwitcherDivider.d.ts +1 -1
- package/es/components/UIShell/SwitcherItem.d.ts +4 -4
- package/es/index.d.ts +239 -0
- package/es/internal/PolymorphicProps.d.ts +11 -0
- package/lib/components/AILabel/index.d.ts +1 -2
- package/lib/components/AILabel/index.js +1 -1
- package/lib/components/AISkeleton/AISkeletonIcon.d.ts +1 -1
- package/lib/components/AISkeleton/AISkeletonText.d.ts +1 -1
- package/lib/components/Accordion/Accordion.Skeleton.d.ts +1 -1
- package/lib/components/Accordion/AccordionItem.d.ts +2 -2
- package/lib/components/AspectRatio/AspectRatio.d.ts +1 -1
- package/lib/components/Button/Button.d.ts +3 -3
- package/lib/components/Button/Button.js +1 -1
- package/lib/components/ClassPrefix/index.d.ts +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts +4 -4
- package/lib/components/ComboBox/ComboBox.js +0 -1
- package/lib/components/ComboButton/index.d.ts +1 -1
- package/lib/components/ComposedModal/ModalFooter.d.ts +1 -2
- package/lib/components/ComposedModal/ModalFooter.js +2 -2
- package/lib/components/ComposedModal/ModalHeader.d.ts +1 -2
- package/lib/components/ContainedList/ContainedList.d.ts +1 -1
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +2 -3
- package/lib/components/ContextMenu/useContextMenu.d.ts +1 -1
- package/lib/components/Copy/Copy.d.ts +1 -1
- package/lib/components/DataTable/TableCell.d.ts +1 -1
- package/lib/components/DataTable/TableExpandHeader.d.ts +3 -3
- package/lib/components/DataTable/TableExpandRow.d.ts +1 -1
- package/lib/components/DataTable/TableExpandedRow.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.d.ts +1 -1
- package/lib/components/DataTable/TableSelectAll.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.js +11 -3
- package/lib/components/ErrorBoundary/ErrorBoundary.d.ts +2 -3
- package/lib/components/FeatureFlags/index.d.ts +1 -1
- package/lib/components/FileUploader/FileUploader.d.ts +8 -7
- package/lib/components/FileUploader/FileUploader.js +9 -2
- package/lib/components/Form/Form.d.ts +1 -1
- package/lib/components/FormItem/FormItem.d.ts +1 -1
- package/lib/components/Heading/index.d.ts +1 -1
- package/lib/components/IconButton/index.d.ts +1 -1
- package/lib/components/IdPrefix/index.d.ts +1 -1
- package/lib/components/Layer/index.d.ts +1 -2
- package/lib/components/LayoutDirection/LayoutDirection.d.ts +1 -1
- package/lib/components/Link/Link.d.ts +5 -4
- package/lib/components/Link/Link.js +1 -1
- package/lib/components/ListItem/ListItem.d.ts +1 -1
- package/lib/components/Menu/Menu.d.ts +1 -1
- package/lib/components/Modal/Modal.js +1 -1
- package/lib/components/ModalWrapper/ModalWrapper.d.ts +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +4 -1
- package/lib/components/MultiSelect/MultiSelect.js +10 -1
- package/lib/components/OrderedList/OrderedList.d.ts +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/lib/components/PaginationNav/PaginationNav.d.ts +52 -1
- package/lib/components/Popover/index.d.ts +6 -2
- package/lib/components/Portal/index.d.ts +1 -1
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.d.ts +1 -1
- package/lib/components/SkeletonIcon/SkeletonIcon.d.ts +1 -1
- package/lib/components/SkeletonText/SkeletonText.d.ts +1 -1
- package/lib/components/Tabs/Tabs.d.ts +2 -2
- package/lib/components/Tabs/Tabs.js +1 -1
- package/lib/components/Tag/DismissibleTag.js +1 -1
- package/lib/components/Tag/OperationalTag.js +1 -1
- package/lib/components/Tag/SelectableTag.d.ts +2 -2
- package/lib/components/Tag/SelectableTag.js +1 -1
- package/lib/components/Tag/Tag.d.ts +7 -3
- package/lib/components/Tag/Tag.js +1 -1
- package/lib/components/Text/Text.d.ts +6 -4
- package/lib/components/Text/Text.js +1 -1
- package/lib/components/Theme/index.d.ts +1 -1
- package/lib/components/Toggle/Toggle.Skeleton.d.ts +1 -1
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.d.ts +1 -1
- package/lib/components/Toggletip/index.d.ts +4 -4
- package/lib/components/UIShell/Content.d.ts +1 -1
- package/lib/components/UIShell/Header.d.ts +1 -1
- package/lib/components/UIShell/HeaderGlobalAction.d.ts +1 -1
- package/lib/components/UIShell/HeaderMenu.d.ts +1 -1
- package/lib/components/UIShell/HeaderPanel.d.ts +1 -1
- package/lib/components/UIShell/SideNavHeader.d.ts +1 -1
- package/lib/components/UIShell/SideNavIcon.d.ts +1 -1
- package/lib/components/UIShell/SideNavItem.d.ts +1 -1
- package/lib/components/UIShell/SideNavItems.d.ts +1 -1
- package/lib/components/UIShell/SideNavMenu.d.ts +1 -1
- package/lib/components/UIShell/SideNavMenuItem.d.ts +1 -1
- package/lib/components/UIShell/SideNavSwitcher.d.ts +1 -1
- package/lib/components/UIShell/Switcher.d.ts +1 -1
- package/lib/components/UIShell/SwitcherDivider.d.ts +1 -1
- package/lib/components/UIShell/SwitcherItem.d.ts +4 -4
- package/lib/index.d.ts +239 -0
- package/lib/internal/PolymorphicProps.d.ts +11 -0
- package/package.json +5 -4
|
@@ -228,6 +228,7 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
228
228
|
[`${prefix}--dropdown--invalid`]: invalid,
|
|
229
229
|
[`${prefix}--dropdown--warning`]: showWarning,
|
|
230
230
|
[`${prefix}--dropdown--open`]: isOpen,
|
|
231
|
+
[`${prefix}--dropdown--focus`]: isFocused,
|
|
231
232
|
[`${prefix}--dropdown--inline`]: inline,
|
|
232
233
|
[`${prefix}--dropdown--disabled`]: disabled,
|
|
233
234
|
[`${prefix}--dropdown--light`]: light,
|
|
@@ -249,7 +250,6 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
249
250
|
[`${prefix}--dropdown__wrapper--inline--invalid`]: inline && invalid,
|
|
250
251
|
[`${prefix}--list-box__wrapper--inline--invalid`]: inline && invalid,
|
|
251
252
|
[`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
|
|
252
|
-
[`${prefix}--list-box__wrapper--fluid--focus`]: isFluid && isFocused && !isOpen,
|
|
253
253
|
[`${prefix}--list-box__wrapper--slug`]: slug,
|
|
254
254
|
[`${prefix}--list-box__wrapper--decorator`]: decorator
|
|
255
255
|
});
|
|
@@ -265,7 +265,7 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
265
265
|
className: helperClasses
|
|
266
266
|
}, helperText) : null;
|
|
267
267
|
const handleFocus = evt => {
|
|
268
|
-
setIsFocused(evt.type === 'focus' ? true : false);
|
|
268
|
+
setIsFocused(evt.type === 'focus' && !selectedItem ? true : false);
|
|
269
269
|
};
|
|
270
270
|
const mergedRef = mergeRefs["default"](toggleButtonProps.ref, ref);
|
|
271
271
|
const [currTimer, setCurrTimer] = React.useState();
|
|
@@ -282,7 +282,15 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
282
282
|
setIsTyping(false);
|
|
283
283
|
}, 3000));
|
|
284
284
|
}
|
|
285
|
-
if (
|
|
285
|
+
if (['ArrowDown'].includes(evt.key)) {
|
|
286
|
+
setIsFocused(false);
|
|
287
|
+
}
|
|
288
|
+
if (['Enter'].includes(evt.key) && !selectedItem && !isOpen) {
|
|
289
|
+
setIsFocused(true);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// For Dropdowns the arrow up key is only allowed if the Dropdown is open
|
|
293
|
+
if (toggleButtonProps.onKeyDown && (evt.key !== 'ArrowUp' || isOpen && evt.key === 'ArrowUp')) {
|
|
286
294
|
toggleButtonProps.onKeyDown(evt);
|
|
287
295
|
}
|
|
288
296
|
}, [isTyping, currTimer, toggleButtonProps]);
|
|
@@ -24,11 +24,11 @@ import { ErrorBoundaryContext } from './ErrorBoundaryContext';
|
|
|
24
24
|
* Reference:
|
|
25
25
|
* https://reactjs.org/docs/error-boundaries.html#introducing-error-boundaries
|
|
26
26
|
*/
|
|
27
|
-
interface ErrorBoundaryProps {
|
|
27
|
+
export interface ErrorBoundaryProps {
|
|
28
28
|
children?: ReactNode;
|
|
29
29
|
fallback?: ReactNode;
|
|
30
30
|
}
|
|
31
|
-
interface ErrorBoundaryState {
|
|
31
|
+
export interface ErrorBoundaryState {
|
|
32
32
|
hasError: boolean;
|
|
33
33
|
}
|
|
34
34
|
export default class ErrorBoundary extends React.Component<ErrorBoundaryProps> {
|
|
@@ -44,4 +44,3 @@ export default class ErrorBoundary extends React.Component<ErrorBoundaryProps> {
|
|
|
44
44
|
componentDidUpdate(prevProps: ErrorBoundaryProps): void;
|
|
45
45
|
render(): React.ReactNode;
|
|
46
46
|
}
|
|
47
|
-
export {};
|
|
@@ -4,7 +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
|
|
7
|
+
import React from 'react';
|
|
8
8
|
import { ReactAttr } from '../../types/common';
|
|
9
9
|
export interface FileUploaderProps extends ReactAttr<HTMLSpanElement> {
|
|
10
10
|
/**
|
|
@@ -73,10 +73,11 @@ export interface FileUploaderProps extends ReactAttr<HTMLSpanElement> {
|
|
|
73
73
|
*/
|
|
74
74
|
size?: 'sm' | 'small' | 'md' | 'field' | 'lg';
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
76
|
+
export interface FileUploaderHandle {
|
|
77
|
+
/**
|
|
78
|
+
* Clear internal state
|
|
79
|
+
*/
|
|
80
|
+
clearFiles: () => void;
|
|
81
|
+
}
|
|
82
|
+
declare const FileUploader: React.ForwardRefExoticComponent<FileUploaderProps & React.RefAttributes<FileUploaderHandle>>;
|
|
82
83
|
export default FileUploader;
|
|
@@ -15,7 +15,7 @@ var PropTypes = require('prop-types');
|
|
|
15
15
|
var React = require('react');
|
|
16
16
|
var Filename = require('./Filename.js');
|
|
17
17
|
var FileUploaderButton = require('./FileUploaderButton.js');
|
|
18
|
-
var
|
|
18
|
+
var Button = require('../Button/Button.js');
|
|
19
19
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
20
20
|
require('../Text/index.js');
|
|
21
21
|
var useId = require('../../internal/useId.js');
|
|
@@ -82,6 +82,13 @@ const FileUploader = /*#__PURE__*/React__default["default"].forwardRef((_ref, re
|
|
|
82
82
|
onClick?.(evt);
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
|
+
React.useImperativeHandle(ref, () => ({
|
|
86
|
+
clearFiles() {
|
|
87
|
+
updateState({
|
|
88
|
+
fileNames: []
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}));
|
|
85
92
|
const uploaderButton = /*#__PURE__*/React__default["default"].createRef();
|
|
86
93
|
const classes = cx__default["default"]({
|
|
87
94
|
[`${prefix}--form-item`]: true,
|
|
@@ -153,7 +160,7 @@ FileUploader.propTypes = {
|
|
|
153
160
|
/**
|
|
154
161
|
* Specify the type of the `<FileUploaderButton>`
|
|
155
162
|
*/
|
|
156
|
-
buttonKind: PropTypes__default["default"].oneOf(
|
|
163
|
+
buttonKind: PropTypes__default["default"].oneOf(Button.ButtonKinds),
|
|
157
164
|
/**
|
|
158
165
|
* Provide the label text to be read by screen readers when interacting with
|
|
159
166
|
* the `<FileUploaderButton>`
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { type ComponentProps } from 'react';
|
|
9
|
-
type FormProps = ComponentProps<'form'>;
|
|
9
|
+
export type FormProps = ComponentProps<'form'>;
|
|
10
10
|
declare function Form({ className, children, ...other }: FormProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
declare namespace Form {
|
|
12
12
|
var propTypes: {
|
|
@@ -10,7 +10,7 @@ type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
|
10
10
|
type SectionBaseProps = {
|
|
11
11
|
level?: HeadingLevel;
|
|
12
12
|
};
|
|
13
|
-
type SectionProps<E extends ElementType> = PolymorphicProps<E, SectionBaseProps>;
|
|
13
|
+
export type SectionProps<E extends ElementType> = PolymorphicProps<E, SectionBaseProps>;
|
|
14
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 {};
|
|
@@ -11,7 +11,7 @@ export type IconButtonKind = (typeof IconButtonKinds)[number];
|
|
|
11
11
|
export type DeprecatedIconButtonAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
|
|
12
12
|
export type NewIconButtonAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
|
|
13
13
|
export type IconButtonAlignment = DeprecatedIconButtonAlignment | NewIconButtonAlignment;
|
|
14
|
-
interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
14
|
+
export interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
15
15
|
/**
|
|
16
16
|
* Specify how the trigger should align with the tooltip
|
|
17
17
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
9
|
-
type IdPrefixProps = {
|
|
9
|
+
export type IdPrefixProps = {
|
|
10
10
|
children?: ReactNode;
|
|
11
11
|
/**
|
|
12
12
|
* The value used to prefix the auto-generated id placed on some DOM elements
|
|
@@ -15,7 +15,7 @@ import { PolymorphicProps } from '../../types/common';
|
|
|
15
15
|
export declare function useLayer(): {
|
|
16
16
|
level: 0 | 1 | 2;
|
|
17
17
|
};
|
|
18
|
-
interface LayerBaseProps {
|
|
18
|
+
export interface LayerBaseProps {
|
|
19
19
|
/**
|
|
20
20
|
* Provide child elements to be rendered inside of `Theme`
|
|
21
21
|
*/
|
|
@@ -35,4 +35,3 @@ export interface LayerComponent {
|
|
|
35
35
|
<T extends React.ElementType>(props: LayerProps<T>, context?: any): React.ReactElement<any, any> | null;
|
|
36
36
|
}
|
|
37
37
|
export declare const Layer: LayerComponent;
|
|
38
|
-
export {};
|
|
@@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import { ElementType, ReactNode } from 'react';
|
|
9
9
|
import { LayoutDirectionContext } from './LayoutDirectionContext';
|
|
10
10
|
type Direction = 'ltr' | 'rtl';
|
|
11
|
-
interface LayoutDirectionProps {
|
|
11
|
+
export interface LayoutDirectionProps {
|
|
12
12
|
/**
|
|
13
13
|
* Customize the element type used to render the outermost node
|
|
14
14
|
*/
|
|
@@ -4,8 +4,8 @@
|
|
|
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 React, { AnchorHTMLAttributes, AriaAttributes, ComponentType,
|
|
8
|
-
import {
|
|
7
|
+
import React, { AnchorHTMLAttributes, AriaAttributes, ComponentType, HTMLAttributeAnchorTarget } from 'react';
|
|
8
|
+
import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
|
|
9
9
|
export interface LinkBaseProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
10
10
|
/**
|
|
11
11
|
* @description Indicates the element that represents the
|
|
@@ -48,6 +48,7 @@ export interface LinkBaseProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
48
48
|
*/
|
|
49
49
|
visited?: boolean;
|
|
50
50
|
}
|
|
51
|
-
export type LinkProps<
|
|
52
|
-
|
|
51
|
+
export type LinkProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, LinkBaseProps>;
|
|
52
|
+
type LinkComponent = <T extends React.ElementType = 'a'>(props: LinkProps<T>) => React.ReactElement | any;
|
|
53
|
+
declare const Link: LinkComponent;
|
|
53
54
|
export default Link;
|
|
@@ -21,7 +21,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
21
21
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
23
|
|
|
24
|
-
const Link = /*#__PURE__*/React__default["default"].forwardRef(
|
|
24
|
+
const Link = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
25
25
|
let {
|
|
26
26
|
as: BaseComponent,
|
|
27
27
|
children,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { type ComponentProps } from 'react';
|
|
9
|
-
type ListItemProps = ComponentProps<'li'>;
|
|
9
|
+
export type ListItemProps = Omit<ComponentProps<'li'>, 'ref'>;
|
|
10
10
|
declare function ListItem({ className, children, ...other }: ListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
declare namespace ListItem {
|
|
12
12
|
var propTypes: {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { ReactNode, RefObject } from 'react';
|
|
8
|
-
interface MenuProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
8
|
+
export interface MenuProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
9
9
|
/**
|
|
10
10
|
* The ref of the containing element, used for positioning and alignment of the menu
|
|
11
11
|
*/
|
|
@@ -81,7 +81,7 @@ const Modal = /*#__PURE__*/React__default["default"].forwardRef(function Modal(_
|
|
|
81
81
|
} = _ref;
|
|
82
82
|
const prefix = usePrefix.usePrefix();
|
|
83
83
|
const button = React.useRef(null);
|
|
84
|
-
const secondaryButton = React.useRef();
|
|
84
|
+
const secondaryButton = React.useRef(null);
|
|
85
85
|
const contentRef = React.useRef(null);
|
|
86
86
|
const innerModal = React.useRef(null);
|
|
87
87
|
const startTrap = React.useRef(null);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React, { ReactNode } from 'react';
|
|
9
9
|
import { ButtonKinds } from '../Button';
|
|
10
|
-
interface ModalWrapperProps {
|
|
10
|
+
export interface ModalWrapperProps {
|
|
11
11
|
buttonTriggerClassName?: string;
|
|
12
12
|
buttonTriggerText?: ReactNode;
|
|
13
13
|
children?: ReactNode;
|
|
@@ -209,7 +209,6 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
209
209
|
[`${prefix}--list-box__wrapper--inline--invalid`]: inline && invalid,
|
|
210
210
|
[`${prefix}--list-box--up`]: direction === 'top',
|
|
211
211
|
[`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
|
|
212
|
-
[`${prefix}--list-box__wrapper--fluid--focus`]: isFluid && isFocused,
|
|
213
212
|
[`${prefix}--list-box__wrapper--slug`]: slug,
|
|
214
213
|
[`${prefix}--list-box__wrapper--decorator`]: decorator,
|
|
215
214
|
[`${prefix}--autoalign`]: autoAlign
|
|
@@ -356,6 +355,10 @@ const FilterableMultiSelect = /*#__PURE__*/React__default["default"].forwardRef(
|
|
|
356
355
|
case InputKeyDownArrowDown:
|
|
357
356
|
if (InputKeyDownArrowDown === type && !isOpen) {
|
|
358
357
|
setIsOpen(true);
|
|
358
|
+
return {
|
|
359
|
+
...changes,
|
|
360
|
+
highlightedIndex: 0
|
|
361
|
+
};
|
|
359
362
|
}
|
|
360
363
|
if (highlightedIndex > -1) {
|
|
361
364
|
const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
|
|
@@ -242,6 +242,16 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
|
|
|
242
242
|
setItemsCleared(false);
|
|
243
243
|
setIsOpenWrapper(true);
|
|
244
244
|
}
|
|
245
|
+
if (match.match(e, keys.ArrowDown) && selectedItems.length === 0) {
|
|
246
|
+
setInputFocused(false);
|
|
247
|
+
setIsFocused(false);
|
|
248
|
+
}
|
|
249
|
+
if (match.match(e, keys.Escape) && isOpen) {
|
|
250
|
+
setInputFocused(true);
|
|
251
|
+
}
|
|
252
|
+
if (match.match(e, keys.Enter) && isOpen) {
|
|
253
|
+
setInputFocused(true);
|
|
254
|
+
}
|
|
245
255
|
}
|
|
246
256
|
}
|
|
247
257
|
});
|
|
@@ -273,7 +283,6 @@ const MultiSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
|
|
|
273
283
|
[`${prefix}--multi-select__wrapper--inline--invalid`]: inline && invalid,
|
|
274
284
|
[`${prefix}--list-box__wrapper--inline--invalid`]: inline && invalid,
|
|
275
285
|
[`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
|
|
276
|
-
[`${prefix}--list-box__wrapper--fluid--focus`]: !isOpen && isFluid && isFocused,
|
|
277
286
|
[`${prefix}--list-box__wrapper--slug`]: slug,
|
|
278
287
|
[`${prefix}--list-box__wrapper--decorator`]: decorator
|
|
279
288
|
});
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { type ComponentProps } from 'react';
|
|
9
|
-
interface OrderedListProps extends ComponentProps<'ol'> {
|
|
9
|
+
export interface OrderedListProps extends ComponentProps<'ol'> {
|
|
10
10
|
nested?: boolean | undefined;
|
|
11
11
|
native?: boolean | undefined;
|
|
12
12
|
isExpressive?: boolean | undefined;
|
|
@@ -17,7 +17,58 @@ declare const translationIds: {
|
|
|
17
17
|
* Message ids that will be passed to translateWithId().
|
|
18
18
|
*/
|
|
19
19
|
type TranslationKey = keyof typeof translationIds;
|
|
20
|
-
interface
|
|
20
|
+
export interface DirectionButtonProps {
|
|
21
|
+
/**
|
|
22
|
+
* The direction this button represents ("forward" or "backward").
|
|
23
|
+
*/
|
|
24
|
+
direction?: 'forward' | 'backward';
|
|
25
|
+
/**
|
|
26
|
+
* Whether or not the button should be disabled.
|
|
27
|
+
*/
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The label shown in the button's tooltip.
|
|
31
|
+
*/
|
|
32
|
+
label?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The callback function called when the button is clicked.
|
|
35
|
+
*/
|
|
36
|
+
onClick?: React.MouseEventHandler;
|
|
37
|
+
}
|
|
38
|
+
export interface PaginationItemProps extends TranslateWithId<'carbon.pagination-nav.item' | 'carbon.pagination-nav.active'> {
|
|
39
|
+
/**
|
|
40
|
+
* Whether or not this is the currently active page.
|
|
41
|
+
*/
|
|
42
|
+
isActive?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The callback function called when the item is clicked.
|
|
45
|
+
*/
|
|
46
|
+
onClick?: React.MouseEventHandler;
|
|
47
|
+
/**
|
|
48
|
+
* The page number this item represents.
|
|
49
|
+
*/
|
|
50
|
+
page?: number;
|
|
51
|
+
}
|
|
52
|
+
export interface PaginationOverflowProps extends TranslateWithId<'carbon.pagination-nav.item' | 'carbon.pagination-nav.active'> {
|
|
53
|
+
/**
|
|
54
|
+
* How many items to display in this overflow.
|
|
55
|
+
*/
|
|
56
|
+
count?: number;
|
|
57
|
+
/**
|
|
58
|
+
* From which index on this overflow should start displaying pages.
|
|
59
|
+
*/
|
|
60
|
+
fromIndex?: number;
|
|
61
|
+
/**
|
|
62
|
+
* The callback function called when the user selects a page from the overflow.
|
|
63
|
+
*/
|
|
64
|
+
onSelect?: (id: number) => void;
|
|
65
|
+
/**
|
|
66
|
+
* If true, the '...' pagination overflow will not render page links between the first and last rendered buttons.
|
|
67
|
+
* Set this to true if you are having performance problems with large data sets.
|
|
68
|
+
*/
|
|
69
|
+
disableOverflow?: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface PaginationNavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange'>, TranslateWithId<TranslationKey> {
|
|
21
72
|
/**
|
|
22
73
|
* Additional CSS class names.
|
|
23
74
|
*/
|
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
import React, { type ForwardedRef, type WeakValidationMap, type ElementType } from 'react';
|
|
8
8
|
import { type PolymorphicProps } from '../../types/common';
|
|
9
9
|
import { type Boundary } from '@floating-ui/react';
|
|
10
|
+
export interface PopoverContext {
|
|
11
|
+
setFloating: React.Ref<HTMLSpanElement>;
|
|
12
|
+
caretRef: React.Ref<HTMLSpanElement>;
|
|
13
|
+
autoAlign: boolean | null;
|
|
14
|
+
}
|
|
10
15
|
/**
|
|
11
16
|
* Deprecated popover alignment values.
|
|
12
17
|
* @deprecated Use NewPopoverAlignment instead.
|
|
@@ -14,7 +19,7 @@ import { type Boundary } from '@floating-ui/react';
|
|
|
14
19
|
export type DeprecatedPopoverAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
|
|
15
20
|
export type NewPopoverAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
|
|
16
21
|
export type PopoverAlignment = DeprecatedPopoverAlignment | NewPopoverAlignment;
|
|
17
|
-
interface PopoverBaseProps {
|
|
22
|
+
export interface PopoverBaseProps {
|
|
18
23
|
/**
|
|
19
24
|
* Specify how the popover should align with the trigger element.
|
|
20
25
|
*/
|
|
@@ -73,4 +78,3 @@ export interface PopoverComponent {
|
|
|
73
78
|
export declare const Popover: PopoverComponent;
|
|
74
79
|
export type PopoverContentProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
75
80
|
export declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLSpanElement>>;
|
|
76
|
-
export {};
|
|
@@ -147,7 +147,7 @@ export interface TabListProps extends DivAttributes {
|
|
|
147
147
|
* Provide an accessible label to be read when a user interacts with this
|
|
148
148
|
* component
|
|
149
149
|
*/
|
|
150
|
-
'aria-label'
|
|
150
|
+
'aria-label'?: string;
|
|
151
151
|
/**
|
|
152
152
|
* Provide child elements to be rendered inside `ContentTabs`.
|
|
153
153
|
* These elements should render a `ContentTab`
|
|
@@ -205,7 +205,7 @@ declare namespace TabList {
|
|
|
205
205
|
* Provide an accessible label to be read when a user interacts with this
|
|
206
206
|
* component
|
|
207
207
|
*/
|
|
208
|
-
'aria-label': PropTypes.
|
|
208
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
209
209
|
/**
|
|
210
210
|
* Provide child elements to be rendered inside `ContentTabs`.
|
|
211
211
|
* These elements should render a `ContentTab`
|
|
@@ -531,7 +531,7 @@ TabList.propTypes = {
|
|
|
531
531
|
* Provide an accessible label to be read when a user interacts with this
|
|
532
532
|
* component
|
|
533
533
|
*/
|
|
534
|
-
'aria-label': PropTypes__default["default"].string
|
|
534
|
+
'aria-label': PropTypes__default["default"].string,
|
|
535
535
|
/**
|
|
536
536
|
* Provide child elements to be rendered inside `ContentTabs`.
|
|
537
537
|
* These elements should render a `ContentTab`
|
|
@@ -48,7 +48,7 @@ const DismissibleTag = _ref => {
|
|
|
48
48
|
...other
|
|
49
49
|
} = _ref;
|
|
50
50
|
const prefix = usePrefix.usePrefix();
|
|
51
|
-
const tagLabelRef = React.useRef();
|
|
51
|
+
const tagLabelRef = React.useRef(null);
|
|
52
52
|
const tagId = id || `tag-${useId.useId()}`;
|
|
53
53
|
const tagClasses = cx__default["default"](`${prefix}--tag--filter`, className);
|
|
54
54
|
const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
|
|
@@ -52,7 +52,7 @@ const OperationalTag = _ref => {
|
|
|
52
52
|
...other
|
|
53
53
|
} = _ref;
|
|
54
54
|
const prefix = usePrefix.usePrefix();
|
|
55
|
-
const tagRef = React.useRef();
|
|
55
|
+
const tagRef = React.useRef(null);
|
|
56
56
|
const tagId = id || `tag-${useId.useId()}`;
|
|
57
57
|
const tagClasses = cx__default["default"](`${prefix}--tag--operational`, className);
|
|
58
58
|
const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import React from 'react';
|
|
8
|
+
import React, { MouseEvent } from 'react';
|
|
9
9
|
import { PolymorphicProps } from '../../types/common';
|
|
10
10
|
import { SIZES } from './Tag';
|
|
11
11
|
export interface SelectableTagBaseProps {
|
|
@@ -33,7 +33,7 @@ export interface SelectableTagBaseProps {
|
|
|
33
33
|
/**
|
|
34
34
|
* Provide an optional function to be called when the tag is clicked.
|
|
35
35
|
*/
|
|
36
|
-
onClick?: (e:
|
|
36
|
+
onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
37
37
|
/**
|
|
38
38
|
* Specify the state of the selectable tag.
|
|
39
39
|
*/
|
|
@@ -42,7 +42,7 @@ const SelectableTag = _ref => {
|
|
|
42
42
|
...other
|
|
43
43
|
} = _ref;
|
|
44
44
|
const prefix = usePrefix.usePrefix();
|
|
45
|
-
const tagRef = React.useRef();
|
|
45
|
+
const tagRef = React.useRef(null);
|
|
46
46
|
const tagId = id || `tag-${useId.useId()}`;
|
|
47
47
|
const [selectedTag, setSelectedTag] = React.useState(selected);
|
|
48
48
|
const tagClasses = cx__default["default"](`${prefix}--tag--selectable`, className, {
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { ReactNode } from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
|
|
9
|
+
import { SelectableTagBaseProps } from './SelectableTag';
|
|
10
|
+
import { OperationalTagBaseProps } from './OperationalTag';
|
|
11
|
+
import { DismissibleTagBaseProps } from './DismissibleTag';
|
|
9
12
|
export declare const TYPES: {
|
|
10
13
|
red: string;
|
|
11
14
|
magenta: string;
|
|
@@ -78,7 +81,8 @@ export interface TagBaseProps {
|
|
|
78
81
|
*/
|
|
79
82
|
type?: keyof typeof TYPES;
|
|
80
83
|
}
|
|
81
|
-
export type TagProps<T extends React.ElementType> =
|
|
82
|
-
|
|
84
|
+
export type TagProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, TagBaseProps>;
|
|
85
|
+
type TagComponent = <T extends React.ElementType = 'div'>(props: TagProps<T> | OperationalTagBaseProps | SelectableTagBaseProps | DismissibleTagBaseProps) => React.ReactElement | any;
|
|
86
|
+
declare const Tag: TagComponent;
|
|
83
87
|
export declare const types: string[];
|
|
84
88
|
export default Tag;
|
|
@@ -50,7 +50,7 @@ const SIZES = {
|
|
|
50
50
|
md: 'md',
|
|
51
51
|
lg: 'lg'
|
|
52
52
|
};
|
|
53
|
-
const Tag = /*#__PURE__*/React__default["default"].forwardRef(
|
|
53
|
+
const Tag = /*#__PURE__*/React__default["default"].forwardRef((_ref, forwardRef) => {
|
|
54
54
|
let {
|
|
55
55
|
children,
|
|
56
56
|
className,
|
|
@@ -4,12 +4,14 @@
|
|
|
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 React from 'react';
|
|
8
|
-
import { PolymorphicProps } from '../../types/common';
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
9
8
|
import { TextDir } from './TextDirection';
|
|
9
|
+
import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
|
|
10
10
|
export interface TextBaseProps {
|
|
11
11
|
dir?: TextDir | undefined;
|
|
12
|
+
children?: ReactNode;
|
|
12
13
|
}
|
|
13
|
-
export type TextProps<T extends React.ElementType> =
|
|
14
|
-
|
|
14
|
+
export type TextProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, TextBaseProps>;
|
|
15
|
+
type TextComponent = <T extends React.ElementType = 'span'>(props: TextProps<T>) => React.ReactElement | any;
|
|
16
|
+
declare const Text: TextComponent;
|
|
15
17
|
export { Text };
|
|
@@ -19,7 +19,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
19
19
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
20
20
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
21
|
|
|
22
|
-
const Text = /*#__PURE__*/React__default["default"].forwardRef(
|
|
22
|
+
const Text = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
23
23
|
let {
|
|
24
24
|
as,
|
|
25
25
|
children,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React, { ElementType } from 'react';
|
|
9
9
|
import { PolymorphicProps } from '../../types/common';
|
|
10
|
-
interface GlobalThemeProps {
|
|
10
|
+
export interface GlobalThemeProps {
|
|
11
11
|
theme?: 'white' | 'g10' | 'g90' | 'g100';
|
|
12
12
|
children?: React.ReactNode;
|
|
13
13
|
}
|