@carbon/react 1.74.0 → 1.75.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 +794 -794
- 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 +14 -13
|
@@ -197,7 +197,6 @@ const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Fi
|
|
|
197
197
|
[`${prefix}--list-box__wrapper--inline--invalid`]: inline && invalid,
|
|
198
198
|
[`${prefix}--list-box--up`]: direction === 'top',
|
|
199
199
|
[`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
|
|
200
|
-
[`${prefix}--list-box__wrapper--fluid--focus`]: isFluid && isFocused,
|
|
201
200
|
[`${prefix}--list-box__wrapper--slug`]: slug,
|
|
202
201
|
[`${prefix}--list-box__wrapper--decorator`]: decorator,
|
|
203
202
|
[`${prefix}--autoalign`]: autoAlign
|
|
@@ -344,6 +343,10 @@ const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Fi
|
|
|
344
343
|
case InputKeyDownArrowDown:
|
|
345
344
|
if (InputKeyDownArrowDown === type && !isOpen) {
|
|
346
345
|
setIsOpen(true);
|
|
346
|
+
return {
|
|
347
|
+
...changes,
|
|
348
|
+
highlightedIndex: 0
|
|
349
|
+
};
|
|
347
350
|
}
|
|
348
351
|
if (highlightedIndex > -1) {
|
|
349
352
|
const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
|
|
@@ -231,6 +231,16 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
231
231
|
setItemsCleared(false);
|
|
232
232
|
setIsOpenWrapper(true);
|
|
233
233
|
}
|
|
234
|
+
if (match(e, ArrowDown) && selectedItems.length === 0) {
|
|
235
|
+
setInputFocused(false);
|
|
236
|
+
setIsFocused(false);
|
|
237
|
+
}
|
|
238
|
+
if (match(e, Escape) && isOpen) {
|
|
239
|
+
setInputFocused(true);
|
|
240
|
+
}
|
|
241
|
+
if (match(e, Enter) && isOpen) {
|
|
242
|
+
setInputFocused(true);
|
|
243
|
+
}
|
|
234
244
|
}
|
|
235
245
|
}
|
|
236
246
|
});
|
|
@@ -262,7 +272,6 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
262
272
|
[`${prefix}--multi-select__wrapper--inline--invalid`]: inline && invalid,
|
|
263
273
|
[`${prefix}--list-box__wrapper--inline--invalid`]: inline && invalid,
|
|
264
274
|
[`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
|
|
265
|
-
[`${prefix}--list-box__wrapper--fluid--focus`]: !isOpen && isFluid && isFocused,
|
|
266
275
|
[`${prefix}--list-box__wrapper--slug`]: slug,
|
|
267
276
|
[`${prefix}--list-box__wrapper--decorator`]: decorator
|
|
268
277
|
});
|
|
@@ -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`
|
|
@@ -521,7 +521,7 @@ TabList.propTypes = {
|
|
|
521
521
|
* Provide an accessible label to be read when a user interacts with this
|
|
522
522
|
* component
|
|
523
523
|
*/
|
|
524
|
-
'aria-label': PropTypes.string
|
|
524
|
+
'aria-label': PropTypes.string,
|
|
525
525
|
/**
|
|
526
526
|
* Provide child elements to be rendered inside `ContentTabs`.
|
|
527
527
|
* These elements should render a `ContentTab`
|
|
@@ -38,7 +38,7 @@ const DismissibleTag = _ref => {
|
|
|
38
38
|
...other
|
|
39
39
|
} = _ref;
|
|
40
40
|
const prefix = usePrefix();
|
|
41
|
-
const tagLabelRef = useRef();
|
|
41
|
+
const tagLabelRef = useRef(null);
|
|
42
42
|
const tagId = id || `tag-${useId()}`;
|
|
43
43
|
const tagClasses = cx(`${prefix}--tag--filter`, className);
|
|
44
44
|
const [isEllipsisApplied, setIsEllipsisApplied] = useState(false);
|
|
@@ -42,7 +42,7 @@ const OperationalTag = _ref => {
|
|
|
42
42
|
...other
|
|
43
43
|
} = _ref;
|
|
44
44
|
const prefix = usePrefix();
|
|
45
|
-
const tagRef = useRef();
|
|
45
|
+
const tagRef = useRef(null);
|
|
46
46
|
const tagId = id || `tag-${useId()}`;
|
|
47
47
|
const tagClasses = cx(`${prefix}--tag--operational`, className);
|
|
48
48
|
const [isEllipsisApplied, setIsEllipsisApplied] = 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
|
*/
|
|
@@ -32,7 +32,7 @@ const SelectableTag = _ref => {
|
|
|
32
32
|
...other
|
|
33
33
|
} = _ref;
|
|
34
34
|
const prefix = usePrefix();
|
|
35
|
-
const tagRef = useRef();
|
|
35
|
+
const tagRef = useRef(null);
|
|
36
36
|
const tagId = id || `tag-${useId()}`;
|
|
37
37
|
const [selectedTag, setSelectedTag] = useState(selected);
|
|
38
38
|
const tagClasses = cx(`${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;
|
package/es/components/Tag/Tag.js
CHANGED
|
@@ -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 };
|
|
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React__default, { useContext } from 'react';
|
|
11
11
|
import { TextDirectionContext } from './TextDirectionContext.js';
|
|
12
12
|
|
|
13
|
-
const Text = /*#__PURE__*/React__default.forwardRef(
|
|
13
|
+
const Text = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
14
14
|
let {
|
|
15
15
|
as,
|
|
16
16
|
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
|
}
|
|
@@ -35,7 +35,7 @@ export declare namespace ToggletipLabel {
|
|
|
35
35
|
className: PropTypes.Requireable<string>;
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
interface ToggletipProps<E extends ElementType> {
|
|
38
|
+
export interface ToggletipProps<E extends ElementType> {
|
|
39
39
|
align?: PopoverAlignment;
|
|
40
40
|
alignmentAxisOffset?: number;
|
|
41
41
|
as?: E;
|
|
@@ -84,7 +84,7 @@ export declare namespace Toggletip {
|
|
|
84
84
|
defaultOpen: PropTypes.Requireable<boolean>;
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
interface ToggletipButtonBaseProps {
|
|
87
|
+
export interface ToggletipButtonBaseProps {
|
|
88
88
|
children?: ReactNode;
|
|
89
89
|
className?: string;
|
|
90
90
|
label?: string;
|
|
@@ -95,7 +95,7 @@ export type ToggleTipButtonProps<T extends React.ElementType> = PolymorphicProps
|
|
|
95
95
|
* clicks and keyboard interactions.
|
|
96
96
|
*/
|
|
97
97
|
export declare const ToggletipButton: React.ForwardRefExoticComponent<Omit<ToggleTipButtonProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>>;
|
|
98
|
-
interface ToggletipContentProps {
|
|
98
|
+
export interface ToggletipContentProps {
|
|
99
99
|
children?: ReactNode;
|
|
100
100
|
className?: string;
|
|
101
101
|
}
|
|
@@ -106,7 +106,7 @@ interface ToggletipContentProps {
|
|
|
106
106
|
*/
|
|
107
107
|
declare const ToggletipContent: React.ForwardRefExoticComponent<ToggletipContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
108
108
|
export { ToggletipContent };
|
|
109
|
-
interface ToggleTipActionsProps {
|
|
109
|
+
export interface ToggleTipActionsProps {
|
|
110
110
|
children?: ReactNode;
|
|
111
111
|
className?: string;
|
|
112
112
|
}
|
|
@@ -82,7 +82,7 @@ declare const Content: {
|
|
|
82
82
|
"aria-colindextext"?: string | undefined;
|
|
83
83
|
"aria-colspan"?: number | undefined;
|
|
84
84
|
"aria-controls"?: string | undefined;
|
|
85
|
-
"aria-current"?: boolean | "true" | "false" | "time" | "
|
|
85
|
+
"aria-current"?: boolean | "true" | "false" | "time" | "step" | "date" | "page" | "location" | undefined;
|
|
86
86
|
"aria-describedby"?: string | undefined;
|
|
87
87
|
"aria-description"?: string | undefined;
|
|
88
88
|
"aria-details"?: string | undefined;
|
|
@@ -12,7 +12,7 @@ import PropTypes from 'prop-types';
|
|
|
12
12
|
* with managing focus. It also passes along refs to each child so that it can
|
|
13
13
|
* help manage focus state of its children.
|
|
14
14
|
*/
|
|
15
|
-
interface HeaderMenuProps {
|
|
15
|
+
export interface HeaderMenuProps {
|
|
16
16
|
/**
|
|
17
17
|
* Required props for the accessibility label of the menu
|
|
18
18
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { ReactNode } from 'react';
|
|
8
|
-
interface HeaderPanelProps {
|
|
8
|
+
export interface HeaderPanelProps {
|
|
9
9
|
/**
|
|
10
10
|
* Specify whether focus and blur listeners are added. They are by default.
|
|
11
11
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, { ElementType, ComponentProps } from 'react';
|
|
8
8
|
import Link from './Link';
|
|
9
|
-
interface SideNavMenuItemProps extends ComponentProps<typeof Link> {
|
|
9
|
+
export interface SideNavMenuItemProps extends ComponentProps<typeof Link> {
|
|
10
10
|
/**
|
|
11
11
|
* Specify the children to be rendered inside of the `SideNavMenuItem`
|
|
12
12
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { type ChangeEventHandler } from 'react';
|
|
8
|
-
interface SideNavSwitcherProps {
|
|
8
|
+
export interface SideNavSwitcherProps {
|
|
9
9
|
/**
|
|
10
10
|
* Provide an optional class to be applied to the containing node
|
|
11
11
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { HTMLAttributeAnchorTarget } from 'react';
|
|
2
|
-
interface BaseSwitcherItemProps {
|
|
2
|
+
export interface BaseSwitcherItemProps {
|
|
3
3
|
/**
|
|
4
4
|
* Specify the text content for the link
|
|
5
5
|
*/
|
|
@@ -52,14 +52,14 @@ interface BaseSwitcherItemProps {
|
|
|
52
52
|
*/
|
|
53
53
|
rel?: string;
|
|
54
54
|
}
|
|
55
|
-
interface SwitcherItemWithAriaLabel extends BaseSwitcherItemProps {
|
|
55
|
+
export interface SwitcherItemWithAriaLabel extends BaseSwitcherItemProps {
|
|
56
56
|
'aria-label': string;
|
|
57
57
|
'aria-labelledby'?: never;
|
|
58
58
|
}
|
|
59
|
-
interface SwitcherItemWithAriaLabelledBy extends BaseSwitcherItemProps {
|
|
59
|
+
export interface SwitcherItemWithAriaLabelledBy extends BaseSwitcherItemProps {
|
|
60
60
|
'aria-label'?: never;
|
|
61
61
|
'aria-labelledby': string;
|
|
62
62
|
}
|
|
63
|
-
type SwitcherItemProps = SwitcherItemWithAriaLabel | SwitcherItemWithAriaLabelledBy;
|
|
63
|
+
export type SwitcherItemProps = SwitcherItemWithAriaLabel | SwitcherItemWithAriaLabelledBy;
|
|
64
64
|
declare const SwitcherItem: React.ForwardRefExoticComponent<SwitcherItemProps & React.RefAttributes<React.ElementType<any, keyof React.JSX.IntrinsicElements>>>;
|
|
65
65
|
export default SwitcherItem;
|