@carbon/react 1.77.0 → 1.78.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 +945 -858
- package/es/components/Accordion/AccordionItem.js +1 -1
- package/es/components/BadgeIndicator/index.d.ts +23 -0
- package/es/components/BadgeIndicator/index.js +45 -0
- package/es/components/Breadcrumb/Breadcrumb.d.ts +5 -0
- package/es/components/Breadcrumb/Breadcrumb.js +8 -2
- package/es/components/Button/Button.d.ts +9 -0
- package/es/components/Button/Button.js +13 -0
- package/es/components/ComboBox/ComboBox.js +13 -9
- package/es/components/Dropdown/Dropdown.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.js +3 -2
- package/es/components/FileUploader/FileUploader.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +1 -1
- package/es/components/IconButton/index.d.ts +7 -1
- package/es/components/IconButton/index.js +18 -2
- package/es/components/IconIndicator/index.d.ts +1 -1
- package/es/components/InlineLoading/InlineLoading.js +2 -5
- package/es/components/Menu/MenuItem.js +1 -1
- package/es/components/Modal/Modal.d.ts +3 -3
- package/es/components/Modal/Modal.js +9 -3
- package/es/components/Modal/next/index.d.ts +1 -5
- package/es/components/MultiSelect/MultiSelect.js +3 -2
- package/es/components/MultiSelect/MultiSelectPropTypes.d.ts +5 -2
- package/es/components/MultiSelect/tools/sorting.js +8 -7
- package/es/components/Notification/Notification.js +1 -1
- package/es/components/NumberInput/NumberInput.js +12 -12
- package/es/components/OverflowMenu/OverflowMenu.d.ts +8 -20
- package/es/components/OverflowMenu/OverflowMenu.js +7 -9
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +1 -1
- package/es/components/ProgressIndicator/ProgressIndicator.js +1 -1
- package/es/components/RadioTile/RadioTile.js +1 -1
- package/es/components/Select/Select.js +11 -2
- package/es/components/ShapeIndicator/index.d.ts +29 -0
- package/es/components/ShapeIndicator/index.js +92 -0
- package/es/components/Tabs/Tabs.d.ts +6 -4
- package/es/components/Tabs/Tabs.js +27 -8
- package/es/components/Tag/OperationalTag.d.ts +1 -36
- package/es/components/Tag/OperationalTag.js +7 -5
- package/es/components/Text/Text.d.ts +11 -9
- package/es/components/Text/Text.js +6 -6
- package/es/components/Text/TextDirection.d.ts +7 -9
- package/es/components/Text/TextDirection.js +5 -2
- package/es/components/Text/TextDirectionContext.d.ts +14 -0
- package/es/components/Text/TextDirectionContext.js +6 -2
- package/es/components/Text/createTextComponent.d.ts +5 -5
- package/es/components/Text/createTextComponent.js +5 -4
- package/es/components/Text/index.d.ts +6 -7
- package/es/components/Text/index.js +3 -2
- package/es/components/Tile/Tile.d.ts +6 -0
- package/es/components/Tile/Tile.js +5 -9
- package/es/components/Toggletip/index.d.ts +3 -2
- package/es/components/Tooltip/DefinitionTooltip.d.ts +4 -0
- package/es/components/Tooltip/DefinitionTooltip.js +7 -1
- package/es/components/Tooltip/Tooltip.d.ts +5 -66
- package/es/components/Tooltip/Tooltip.js +26 -26
- package/es/components/UIShell/HeaderGlobalAction.d.ts +9 -0
- package/es/components/UIShell/HeaderGlobalAction.js +16 -1
- package/es/index.d.ts +4 -1
- package/es/index.js +2 -1
- package/es/internal/FloatingMenu.d.ts +83 -0
- package/es/internal/FloatingMenu.js +216 -408
- package/es/internal/wrapFocus.js +1 -1
- package/lib/components/Accordion/AccordionItem.js +1 -1
- package/lib/components/BadgeIndicator/index.d.ts +23 -0
- package/lib/components/BadgeIndicator/index.js +56 -0
- package/lib/components/Breadcrumb/Breadcrumb.d.ts +5 -0
- package/lib/components/Breadcrumb/Breadcrumb.js +8 -2
- package/lib/components/Button/Button.d.ts +9 -0
- package/lib/components/Button/Button.js +13 -0
- package/lib/components/ComboBox/ComboBox.js +13 -9
- package/lib/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.js +2 -1
- package/lib/components/FileUploader/FileUploader.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +1 -1
- package/lib/components/IconButton/index.d.ts +7 -1
- package/lib/components/IconButton/index.js +18 -2
- package/lib/components/IconIndicator/index.d.ts +1 -1
- package/lib/components/InlineLoading/InlineLoading.js +2 -5
- package/lib/components/Menu/MenuItem.js +1 -1
- package/lib/components/Modal/Modal.d.ts +3 -3
- package/lib/components/Modal/Modal.js +9 -3
- package/lib/components/Modal/next/index.d.ts +1 -5
- package/lib/components/MultiSelect/MultiSelect.js +2 -1
- package/lib/components/MultiSelect/MultiSelectPropTypes.d.ts +5 -2
- package/lib/components/MultiSelect/tools/sorting.js +8 -7
- package/lib/components/Notification/Notification.js +1 -1
- package/lib/components/NumberInput/NumberInput.js +12 -12
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +8 -20
- package/lib/components/OverflowMenu/OverflowMenu.js +7 -9
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +1 -1
- package/lib/components/ProgressIndicator/ProgressIndicator.js +1 -1
- package/lib/components/RadioTile/RadioTile.js +1 -1
- package/lib/components/Select/Select.js +11 -2
- package/lib/components/ShapeIndicator/index.d.ts +29 -0
- package/lib/components/ShapeIndicator/index.js +104 -0
- package/lib/components/Tabs/Tabs.d.ts +6 -4
- package/lib/components/Tabs/Tabs.js +42 -23
- package/lib/components/Tag/OperationalTag.d.ts +1 -36
- package/lib/components/Tag/OperationalTag.js +6 -4
- package/lib/components/Text/Text.d.ts +11 -9
- package/lib/components/Text/Text.js +5 -5
- package/lib/components/Text/TextDirection.d.ts +7 -9
- package/lib/components/Text/TextDirection.js +5 -2
- package/lib/components/Text/TextDirectionContext.d.ts +14 -0
- package/lib/components/Text/TextDirectionContext.js +6 -2
- package/lib/components/Text/createTextComponent.d.ts +5 -5
- package/lib/components/Text/createTextComponent.js +5 -4
- package/lib/components/Text/index.d.ts +6 -7
- package/lib/components/Text/index.js +4 -3
- package/lib/components/Tile/Tile.d.ts +6 -0
- package/lib/components/Tile/Tile.js +5 -9
- package/lib/components/Toggletip/index.d.ts +3 -2
- package/lib/components/Tooltip/DefinitionTooltip.d.ts +4 -0
- package/lib/components/Tooltip/DefinitionTooltip.js +7 -1
- package/lib/components/Tooltip/Tooltip.d.ts +5 -66
- package/lib/components/Tooltip/Tooltip.js +26 -26
- package/lib/components/UIShell/HeaderGlobalAction.d.ts +9 -0
- package/lib/components/UIShell/HeaderGlobalAction.js +16 -1
- package/lib/index.d.ts +4 -1
- package/lib/index.js +42 -40
- package/lib/internal/FloatingMenu.d.ts +83 -0
- package/lib/internal/FloatingMenu.js +216 -409
- package/lib/internal/wrapFocus.js +1 -1
- package/package.json +5 -5
- package/scss/components/badge-indicator/_badge-indicator.scss +9 -0
- package/scss/components/badge-indicator/_index.scss +9 -0
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
13
|
var PropTypes = require('prop-types');
|
|
14
14
|
var React = require('react');
|
|
15
|
+
require('./index.js');
|
|
15
16
|
var TextDirectionContext = require('./TextDirectionContext.js');
|
|
16
17
|
|
|
17
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -19,14 +20,13 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
19
20
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
20
21
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
21
22
|
|
|
22
|
-
const Text = /*#__PURE__*/
|
|
23
|
+
const Text = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
23
24
|
let {
|
|
24
25
|
as,
|
|
25
26
|
children,
|
|
26
27
|
dir = 'auto',
|
|
27
28
|
...rest
|
|
28
29
|
} = _ref;
|
|
29
|
-
// TODO: Update with context typing once its been converted to TS
|
|
30
30
|
const context = React.useContext(TextDirectionContext.TextDirectionContext);
|
|
31
31
|
const textProps = {};
|
|
32
32
|
const BaseComponent = as ?? 'span';
|
|
@@ -78,11 +78,11 @@ Text.propTypes = {
|
|
|
78
78
|
*/
|
|
79
79
|
dir: PropTypes__default["default"].oneOf(['ltr', 'rtl', 'auto'])
|
|
80
80
|
};
|
|
81
|
-
|
|
81
|
+
const getTextFromChildren = children => {
|
|
82
82
|
if (typeof children === 'string') {
|
|
83
83
|
return children;
|
|
84
84
|
}
|
|
85
|
-
const text =
|
|
85
|
+
const text = React.Children.map(children, child => {
|
|
86
86
|
if (typeof child === 'string') {
|
|
87
87
|
return child;
|
|
88
88
|
}
|
|
@@ -94,6 +94,6 @@ function getTextFromChildren(children) {
|
|
|
94
94
|
return text[0];
|
|
95
95
|
}
|
|
96
96
|
return text;
|
|
97
|
-
}
|
|
97
|
+
};
|
|
98
98
|
|
|
99
99
|
exports.Text = Text;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
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
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { ReactNode } from 'react';
|
|
9
|
-
|
|
10
|
-
export type GetTextDirection = (text: string | string[] | undefined) => TextDir;
|
|
9
|
+
import { type GetTextDirection, type TextDir } from '.';
|
|
11
10
|
export interface TextDirectionProps {
|
|
12
|
-
children: ReactNode
|
|
11
|
+
children: ReactNode;
|
|
13
12
|
dir?: TextDir;
|
|
14
13
|
getTextDirection?: GetTextDirection;
|
|
15
14
|
}
|
|
16
|
-
declare
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
export declare const TextDirection: {
|
|
16
|
+
({ children, dir, getTextDirection, }: TextDirectionProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
propTypes: {
|
|
19
18
|
/**
|
|
20
19
|
* Provide children to be rendered inside of this component
|
|
21
20
|
*/
|
|
@@ -31,5 +30,4 @@ declare namespace TextDirection {
|
|
|
31
30
|
*/
|
|
32
31
|
getTextDirection: PropTypes.Requireable<(...args: any[]) => any>;
|
|
33
32
|
};
|
|
34
|
-
}
|
|
35
|
-
export { TextDirection };
|
|
33
|
+
};
|
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
11
11
|
|
|
12
12
|
var PropTypes = require('prop-types');
|
|
13
13
|
var React = require('react');
|
|
14
|
+
require('./index.js');
|
|
14
15
|
var TextDirectionContext = require('./TextDirectionContext.js');
|
|
15
16
|
|
|
16
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -18,7 +19,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
18
19
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
19
20
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
const TextDirection = _ref => {
|
|
22
23
|
let {
|
|
23
24
|
children,
|
|
24
25
|
dir = 'auto',
|
|
@@ -33,11 +34,13 @@ function TextDirection(_ref) {
|
|
|
33
34
|
}, [dir]);
|
|
34
35
|
React.useEffect(() => {
|
|
35
36
|
savedCallback.current = getTextDirection;
|
|
37
|
+
// TODO: Is this `useEffect` supposed to have a dependency on
|
|
38
|
+
// `getTextDirection`?
|
|
36
39
|
});
|
|
37
40
|
return /*#__PURE__*/React__default["default"].createElement(TextDirectionContext.TextDirectionContext.Provider, {
|
|
38
41
|
value: value
|
|
39
42
|
}, children);
|
|
40
|
-
}
|
|
43
|
+
};
|
|
41
44
|
TextDirection.propTypes = {
|
|
42
45
|
/**
|
|
43
46
|
* Provide children to be rendered inside of this component
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { type MutableRefObject } from 'react';
|
|
8
|
+
export type TextDir = 'ltr' | 'rtl' | 'auto' | string;
|
|
9
|
+
export type GetTextDirection = (text: string | string[] | undefined) => TextDir;
|
|
10
|
+
export interface TextDirectionContextType {
|
|
11
|
+
direction: TextDir;
|
|
12
|
+
getTextDirection: MutableRefObject<GetTextDirection | undefined>;
|
|
13
|
+
}
|
|
14
|
+
export declare const TextDirectionContext: import("react").Context<TextDirectionContextType>;
|
|
@@ -11,7 +11,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
11
11
|
|
|
12
12
|
var React = require('react');
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const TextDirectionContext = /*#__PURE__*/React.createContext({
|
|
15
|
+
direction: 'auto',
|
|
16
|
+
getTextDirection: {
|
|
17
|
+
current: undefined
|
|
18
|
+
}
|
|
19
|
+
});
|
|
16
20
|
|
|
17
21
|
exports.TextDirectionContext = TextDirectionContext;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
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
|
|
8
|
-
import { TextProps } from '
|
|
7
|
+
import { type ElementType } from 'react';
|
|
8
|
+
import { TextProps } from '.';
|
|
9
9
|
/**
|
|
10
10
|
* Create a text component wrapper for a given text node type. Useful for
|
|
11
11
|
* returning a `Text` component for a text node like a `<label>`.
|
|
12
12
|
* @param {string} element
|
|
13
13
|
* @param {string} displayName
|
|
14
14
|
*/
|
|
15
|
-
export declare
|
|
16
|
-
(props: TextProps<
|
|
15
|
+
export declare const createTextComponent: (element: ElementType, displayName: string) => {
|
|
16
|
+
(props: TextProps<ElementType>): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
displayName: string;
|
|
18
18
|
};
|
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
11
11
|
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
13
|
var React = require('react');
|
|
14
|
+
require('./index.js');
|
|
14
15
|
var Text = require('./Text.js');
|
|
15
16
|
|
|
16
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -23,16 +24,16 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
23
24
|
* @param {string} element
|
|
24
25
|
* @param {string} displayName
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const createTextComponent = (element, displayName) => {
|
|
28
|
+
const TextWrapper = props => {
|
|
28
29
|
return /*#__PURE__*/React__default["default"].createElement(Text.Text, _rollupPluginBabelHelpers["extends"]({
|
|
29
30
|
as: element
|
|
30
31
|
}, props));
|
|
31
|
-
}
|
|
32
|
+
};
|
|
32
33
|
if (process.env.NODE_ENV !== "production") {
|
|
33
34
|
TextWrapper.displayName = displayName;
|
|
34
35
|
}
|
|
35
36
|
return TextWrapper;
|
|
36
|
-
}
|
|
37
|
+
};
|
|
37
38
|
|
|
38
39
|
exports.createTextComponent = createTextComponent;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
3
|
*
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export type { TextBaseProps, TextProps, TextDirectionProps, GetTextDirection, TextDir, };
|
|
7
|
+
export * from './Text';
|
|
8
|
+
export * from './TextDirection';
|
|
9
|
+
export * from './TextDirectionContext';
|
|
11
10
|
export declare const Label: {
|
|
12
|
-
(props: TextProps<
|
|
11
|
+
(props: import("./Text").TextProps<import("react").ElementType>): import("react/jsx-runtime").JSX.Element;
|
|
13
12
|
displayName: string;
|
|
14
13
|
};
|
|
15
14
|
export declare const Legend: {
|
|
16
|
-
(props: TextProps<
|
|
15
|
+
(props: import("./Text").TextProps<import("react").ElementType>): import("react/jsx-runtime").JSX.Element;
|
|
17
16
|
displayName: string;
|
|
18
17
|
};
|
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
-
var TextDirection = require('./TextDirection.js');
|
|
13
|
-
var Text = require('./Text.js');
|
|
14
12
|
var createTextComponent = require('./createTextComponent.js');
|
|
13
|
+
var Text = require('./Text.js');
|
|
14
|
+
var TextDirection = require('./TextDirection.js');
|
|
15
|
+
require('react');
|
|
15
16
|
|
|
16
17
|
createTextComponent.createTextComponent('label', 'Label');
|
|
17
18
|
const Legend = createTextComponent.createTextComponent('legend', 'Legend');
|
|
18
19
|
|
|
19
|
-
exports.TextDirection = TextDirection.TextDirection;
|
|
20
20
|
exports.Text = Text.Text;
|
|
21
|
+
exports.TextDirection = TextDirection.TextDirection;
|
|
21
22
|
exports.Legend = Legend;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2019, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
1
7
|
import React, { type ReactNode, type MouseEvent, type KeyboardEvent, type HTMLAttributes, type ChangeEvent, type ComponentType } from 'react';
|
|
2
8
|
export interface TileProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
9
|
children?: ReactNode;
|
|
@@ -24,8 +24,8 @@ var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
|
24
24
|
var index = require('../FeatureFlags/index.js');
|
|
25
25
|
var useId = require('../../internal/useId.js');
|
|
26
26
|
require('../Text/index.js');
|
|
27
|
-
var Text = require('../Text/Text.js');
|
|
28
27
|
var match = require('../../internal/keyboard/match.js');
|
|
28
|
+
var Text = require('../Text/Text.js');
|
|
29
29
|
var keys = require('../../internal/keyboard/keys.js');
|
|
30
30
|
|
|
31
31
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -249,9 +249,7 @@ const SelectableTile = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
249
249
|
[`${prefix}--tile--decorator`]: decorator,
|
|
250
250
|
[`${prefix}--tile--decorator-rounded`]: decorator && hasRoundedCorners
|
|
251
251
|
}, className);
|
|
252
|
-
|
|
253
|
-
// TODO: rename to handleClick when handleClick prop is deprecated
|
|
254
|
-
function handleOnClick(evt) {
|
|
252
|
+
function handleClick(evt) {
|
|
255
253
|
evt.preventDefault();
|
|
256
254
|
evt?.persist?.();
|
|
257
255
|
if (normalizedDecorator && decoratorRef.current && decoratorRef.current.contains(evt.target)) {
|
|
@@ -261,9 +259,7 @@ const SelectableTile = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
261
259
|
clickHandler(evt);
|
|
262
260
|
onChange(evt, isSelected, id);
|
|
263
261
|
}
|
|
264
|
-
|
|
265
|
-
// TODO: rename to handleKeyDown when handleKeyDown prop is deprecated
|
|
266
|
-
function handleOnKeyDown(evt) {
|
|
262
|
+
function handleKeyDown(evt) {
|
|
267
263
|
evt?.persist?.();
|
|
268
264
|
if (match.matches(evt, [keys.Enter, keys.Space])) {
|
|
269
265
|
evt.preventDefault();
|
|
@@ -295,10 +291,10 @@ const SelectableTile = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
295
291
|
// eslint-disable-next-line jsx-a11y/interactive-supports-focus
|
|
296
292
|
React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
297
293
|
className: classes,
|
|
298
|
-
onClick: !disabled ?
|
|
294
|
+
onClick: !disabled ? handleClick : undefined,
|
|
299
295
|
role: "checkbox",
|
|
300
296
|
"aria-checked": isSelected,
|
|
301
|
-
onKeyDown: !disabled ?
|
|
297
|
+
onKeyDown: !disabled ? handleKeyDown : undefined
|
|
302
298
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
303
299
|
,
|
|
304
300
|
tabIndex: !disabled ? tabIndex : undefined,
|
|
@@ -8,6 +8,7 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import React, { type ElementType, type ReactNode } from 'react';
|
|
9
9
|
import { type PopoverAlignment } from '../Popover';
|
|
10
10
|
import { PolymorphicProps } from '../../types/common';
|
|
11
|
+
import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
|
|
11
12
|
type ToggletipLabelProps<E extends ElementType> = {
|
|
12
13
|
as?: E;
|
|
13
14
|
children?: ReactNode;
|
|
@@ -35,15 +36,15 @@ export declare namespace ToggletipLabel {
|
|
|
35
36
|
className: PropTypes.Requireable<string>;
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
|
-
export interface
|
|
39
|
+
export interface ToggletipBaseProps {
|
|
39
40
|
align?: PopoverAlignment;
|
|
40
41
|
alignmentAxisOffset?: number;
|
|
41
|
-
as?: E;
|
|
42
42
|
autoAlign?: boolean;
|
|
43
43
|
className?: string;
|
|
44
44
|
children?: ReactNode;
|
|
45
45
|
defaultOpen?: boolean;
|
|
46
46
|
}
|
|
47
|
+
export type ToggletipProps<T extends ElementType> = PolymorphicComponentPropWithRef<T, ToggletipBaseProps>;
|
|
47
48
|
/**
|
|
48
49
|
* Used as a container for the button and content of a toggletip. This component
|
|
49
50
|
* is responsible for coordinating between interactions with the button and the
|
|
@@ -11,6 +11,10 @@ export interface DefinitionTooltipProps extends Omit<React.ButtonHTMLAttributes<
|
|
|
11
11
|
* Specify how the trigger should align with the tooltip
|
|
12
12
|
*/
|
|
13
13
|
align?: PopoverAlignment;
|
|
14
|
+
/**
|
|
15
|
+
* Will auto-align Definition Tooltip. This prop is currently experimental and is subject to future changes.
|
|
16
|
+
*/
|
|
17
|
+
autoAlign?: boolean;
|
|
14
18
|
/**
|
|
15
19
|
* The `children` prop will be used as the value that is being defined
|
|
16
20
|
*/
|
|
@@ -28,7 +28,8 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
28
28
|
|
|
29
29
|
const DefinitionTooltip = _ref => {
|
|
30
30
|
let {
|
|
31
|
-
align = 'bottom
|
|
31
|
+
align = 'bottom',
|
|
32
|
+
autoAlign,
|
|
32
33
|
className,
|
|
33
34
|
children,
|
|
34
35
|
definition,
|
|
@@ -51,6 +52,7 @@ const DefinitionTooltip = _ref => {
|
|
|
51
52
|
return /*#__PURE__*/React__default["default"].createElement(index.Popover, {
|
|
52
53
|
align: align,
|
|
53
54
|
className: className,
|
|
55
|
+
autoAlign: autoAlign,
|
|
54
56
|
dropShadow: false,
|
|
55
57
|
highContrast: true,
|
|
56
58
|
onMouseLeave: () => {
|
|
@@ -108,6 +110,10 @@ DefinitionTooltip.propTypes = {
|
|
|
108
110
|
|
|
109
111
|
// new values to match floating-ui
|
|
110
112
|
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
113
|
+
/**
|
|
114
|
+
* Will auto-align the popover. This prop is currently experimental and is subject to future changes.
|
|
115
|
+
*/
|
|
116
|
+
autoAlign: PropTypes__default["default"].bool,
|
|
111
117
|
/**
|
|
112
118
|
* The `children` prop will be used as the value that is being defined
|
|
113
119
|
*/
|
|
@@ -4,10 +4,9 @@
|
|
|
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 PropTypes from 'prop-types';
|
|
8
7
|
import React from 'react';
|
|
9
|
-
import { PopoverAlignment } from '../Popover';
|
|
10
|
-
import {
|
|
8
|
+
import { Popover, PopoverAlignment } from '../Popover';
|
|
9
|
+
import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
|
|
11
10
|
interface TooltipBaseProps {
|
|
12
11
|
/**
|
|
13
12
|
* Specify how the trigger should align with the tooltip
|
|
@@ -67,67 +66,7 @@ interface TooltipBaseProps {
|
|
|
67
66
|
*/
|
|
68
67
|
leaveDelayMs?: number;
|
|
69
68
|
}
|
|
70
|
-
export type TooltipProps<T extends React.ElementType> =
|
|
71
|
-
|
|
72
|
-
declare
|
|
73
|
-
var propTypes: {
|
|
74
|
-
/**
|
|
75
|
-
* Specify how the trigger should align with the tooltip
|
|
76
|
-
*/
|
|
77
|
-
align: PropTypes.Requireable<string>;
|
|
78
|
-
/**
|
|
79
|
-
* Pass in the child to which the tooltip will be applied
|
|
80
|
-
*/
|
|
81
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
82
|
-
/**
|
|
83
|
-
* Specify an optional className to be applied to the container node
|
|
84
|
-
*/
|
|
85
|
-
className: PropTypes.Requireable<string>;
|
|
86
|
-
/**
|
|
87
|
-
* Determines wether the tooltip should close when inner content is activated (click, Enter or Space)
|
|
88
|
-
*/
|
|
89
|
-
closeOnActivation: PropTypes.Requireable<boolean>;
|
|
90
|
-
/**
|
|
91
|
-
* Specify whether the tooltip should be open when it first renders
|
|
92
|
-
*/
|
|
93
|
-
defaultOpen: PropTypes.Requireable<boolean>;
|
|
94
|
-
/**
|
|
95
|
-
* Provide the description to be rendered inside of the Tooltip. The
|
|
96
|
-
* description will use `aria-describedby` and will describe the child node
|
|
97
|
-
* in addition to the text rendered inside of the child. This means that if you
|
|
98
|
-
* have text in the child node, that it will be announced alongside the
|
|
99
|
-
* description to the screen reader.
|
|
100
|
-
*
|
|
101
|
-
* Note: if label and description are both provided, label will be used and
|
|
102
|
-
* description will not be used
|
|
103
|
-
*/
|
|
104
|
-
description: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
105
|
-
/**
|
|
106
|
-
* Specify whether a drop shadow should be rendered
|
|
107
|
-
*/
|
|
108
|
-
dropShadow: PropTypes.Requireable<boolean>;
|
|
109
|
-
/**
|
|
110
|
-
* Specify the duration in milliseconds to delay before displaying the tooltip
|
|
111
|
-
*/
|
|
112
|
-
enterDelayMs: PropTypes.Requireable<number>;
|
|
113
|
-
/**
|
|
114
|
-
* Render the component using the high-contrast theme
|
|
115
|
-
*/
|
|
116
|
-
highContrast: PropTypes.Requireable<boolean>;
|
|
117
|
-
/**
|
|
118
|
-
* Provide the label to be rendered inside of the Tooltip. The label will use
|
|
119
|
-
* `aria-labelledby` and will fully describe the child node that is provided.
|
|
120
|
-
* This means that if you have text in the child node, that it will not be
|
|
121
|
-
* announced to the screen reader.
|
|
122
|
-
*
|
|
123
|
-
* Note: if label and description are both provided, description will not be
|
|
124
|
-
* used
|
|
125
|
-
*/
|
|
126
|
-
label: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
127
|
-
/**
|
|
128
|
-
* Specify the duration in milliseconds to delay before hiding the tooltip
|
|
129
|
-
*/
|
|
130
|
-
leaveDelayMs: PropTypes.Requireable<number>;
|
|
131
|
-
};
|
|
132
|
-
}
|
|
69
|
+
export type TooltipProps<T extends React.ElementType> = PolymorphicComponentPropWithRef<T, TooltipBaseProps>;
|
|
70
|
+
type TooltipComponent = <T extends React.ElementType = typeof Popover>(props: TooltipProps<T>) => React.ReactElement | any;
|
|
71
|
+
declare const Tooltip: TooltipComponent;
|
|
133
72
|
export { Tooltip };
|
|
@@ -32,8 +32,9 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
32
32
|
* Event types that trigger a "drag" to stop.
|
|
33
33
|
*/
|
|
34
34
|
const DRAG_STOP_EVENT_TYPES = new Set(['mouseup', 'touchend', 'touchcancel']);
|
|
35
|
-
|
|
35
|
+
const Tooltip = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
36
36
|
let {
|
|
37
|
+
as,
|
|
37
38
|
align = 'top',
|
|
38
39
|
className: customClassName,
|
|
39
40
|
children,
|
|
@@ -160,31 +161,30 @@ function Tooltip(_ref) {
|
|
|
160
161
|
});
|
|
161
162
|
};
|
|
162
163
|
}, [isDragging, onDragStop]);
|
|
163
|
-
return (
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
164
|
+
return /*#__PURE__*/React__default["default"].createElement(index.Popover, _rollupPluginBabelHelpers["extends"]({
|
|
165
|
+
as: as,
|
|
166
|
+
ref: ref
|
|
167
|
+
}, rest, {
|
|
168
|
+
align: align,
|
|
169
|
+
className: cx__default["default"](`${prefix}--tooltip`, customClassName),
|
|
170
|
+
dropShadow: dropShadow,
|
|
171
|
+
highContrast: highContrast,
|
|
172
|
+
onKeyDown: onKeyDown,
|
|
173
|
+
onMouseLeave: onMouseLeave,
|
|
174
|
+
open: open
|
|
175
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
176
|
+
className: `${prefix}--tooltip-trigger__wrapper`
|
|
177
|
+
}, child !== undefined ? /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
178
|
+
...triggerProps,
|
|
179
|
+
...getChildEventHandlers(child.props)
|
|
180
|
+
}) : null), /*#__PURE__*/React__default["default"].createElement(index.PopoverContent, {
|
|
181
|
+
"aria-hidden": open ? 'false' : 'true',
|
|
182
|
+
className: `${prefix}--tooltip-content`,
|
|
183
|
+
id: id,
|
|
184
|
+
onMouseEnter: onMouseEnter,
|
|
185
|
+
role: "tooltip"
|
|
186
|
+
}, label || description));
|
|
187
|
+
});
|
|
188
188
|
Tooltip.propTypes = {
|
|
189
189
|
/**
|
|
190
190
|
* Specify how the trigger should align with the tooltip
|
|
@@ -37,6 +37,15 @@ export interface HeaderGlobalActionProps {
|
|
|
37
37
|
* Can be one of: start, center, or end.
|
|
38
38
|
*/
|
|
39
39
|
tooltipAlignment?: 'start' | 'center' | 'end';
|
|
40
|
+
/**
|
|
41
|
+
* Enable drop shadow for tooltips for icon-only buttons.
|
|
42
|
+
*/
|
|
43
|
+
tooltipDropShadow?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Render the tooltip using the high-contrast theme
|
|
46
|
+
* Default is true
|
|
47
|
+
*/
|
|
48
|
+
tooltipHighContrast?: boolean;
|
|
40
49
|
}
|
|
41
50
|
/**
|
|
42
51
|
* HeaderGlobalAction is used as a part of the `HeaderGlobalBar`. It is
|
|
@@ -39,6 +39,8 @@ const HeaderGlobalAction = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
|
39
39
|
children,
|
|
40
40
|
className: customClassName,
|
|
41
41
|
onClick,
|
|
42
|
+
tooltipHighContrast = true,
|
|
43
|
+
tooltipDropShadow,
|
|
42
44
|
isActive,
|
|
43
45
|
tooltipAlignment,
|
|
44
46
|
...rest
|
|
@@ -58,9 +60,13 @@ const HeaderGlobalAction = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
|
58
60
|
onClick: onClick,
|
|
59
61
|
type: "button",
|
|
60
62
|
hasIconOnly: true,
|
|
63
|
+
size: "lg",
|
|
64
|
+
kind: "ghost",
|
|
61
65
|
iconDescription: ariaLabel,
|
|
62
66
|
tooltipPosition: "bottom",
|
|
63
67
|
tooltipAlignment: tooltipAlignment,
|
|
68
|
+
tooltipDropShadow: tooltipDropShadow,
|
|
69
|
+
tooltipHighContrast: tooltipHighContrast,
|
|
64
70
|
ref: ref
|
|
65
71
|
}), children);
|
|
66
72
|
});
|
|
@@ -91,7 +97,16 @@ HeaderGlobalAction.propTypes = {
|
|
|
91
97
|
* Specify the alignment of the tooltip to the icon-only button.
|
|
92
98
|
* Can be one of: start, center, or end.
|
|
93
99
|
*/
|
|
94
|
-
tooltipAlignment: PropTypes__default["default"].oneOf(['start', 'center', 'end'])
|
|
100
|
+
tooltipAlignment: PropTypes__default["default"].oneOf(['start', 'center', 'end']),
|
|
101
|
+
/**
|
|
102
|
+
* Enable drop shadow for tooltips for icon-only buttons.
|
|
103
|
+
*/
|
|
104
|
+
tooltipDropShadow: PropTypes__default["default"].bool,
|
|
105
|
+
/**
|
|
106
|
+
* Render the tooltip using the high-contrast theme
|
|
107
|
+
* Default is true
|
|
108
|
+
*/
|
|
109
|
+
tooltipHighContrast: PropTypes__default["default"].bool
|
|
95
110
|
};
|
|
96
111
|
HeaderGlobalAction.displayName = 'HeaderGlobalAction';
|
|
97
112
|
|
package/lib/index.d.ts
CHANGED
|
@@ -117,6 +117,8 @@ export { PageSelector as unstable_PageSelector, Pagination as unstable_Paginatio
|
|
|
117
117
|
export * from './components/Popover';
|
|
118
118
|
export * from './components/ProgressBar';
|
|
119
119
|
export { AILabel, AILabelContent, AILabelActions } from './components/AILabel';
|
|
120
|
+
export { IconIndicator as unstable__IconIndicator } from './components/IconIndicator';
|
|
121
|
+
export { ShapeIndicator as unstable__ShapeIndicator } from './components/ShapeIndicator';
|
|
120
122
|
export { AILabel as unstable__Slug, AILabelContent as unstable__SlugContent, AILabelActions as unstable__SlugActions, } from './components/AILabel';
|
|
121
123
|
export { ChatButton as unstable__ChatButton, ChatButtonSkeleton as unstable__ChatButtonSkeleton, } from './components/ChatButton';
|
|
122
124
|
export { AISkeletonText, AISkeletonIcon, AISkeletonPlaceholder, } from './components/AISkeleton';
|
|
@@ -224,6 +226,7 @@ export type { RowProps } from './components/Grid/Row';
|
|
|
224
226
|
export type { SectionProps } from './components/Heading/index';
|
|
225
227
|
export type { IconSkeletonProps } from './components/Icon/Icon.Skeleton';
|
|
226
228
|
export type { IconButtonProps } from './components/IconButton/index';
|
|
229
|
+
export type { IconIndicatorProps } from './components/IconIndicator/index';
|
|
227
230
|
export type { IdPrefixProps } from './components/IdPrefix/index';
|
|
228
231
|
export type { InlineCheckboxProps } from './components/InlineCheckbox';
|
|
229
232
|
export type { InlineLoadingProps } from './components/InlineLoading/InlineLoading';
|
|
@@ -282,6 +285,7 @@ export type { SelectProps } from './components/Select/Select';
|
|
|
282
285
|
export type { SelectSkeletonProps } from './components/Select/Select.Skeleton';
|
|
283
286
|
export type { SelectItemProps } from './components/SelectItem/SelectItem';
|
|
284
287
|
export type { SelectItemGroupProps } from './components/SelectItemGroup/SelectItemGroup';
|
|
288
|
+
export type { ShapeIndicatorProps } from './components/ShapeIndicator/index';
|
|
285
289
|
export type { SkeletonIconProps } from './components/SkeletonIcon/SkeletonIcon';
|
|
286
290
|
export type { SkeletonPlaceholderProps } from './components/SkeletonPlaceholder/SkeletonPlaceholder';
|
|
287
291
|
export type { SkeletonTextProps } from './components/SkeletonText/SkeletonText';
|
|
@@ -367,4 +371,3 @@ export type { BaseSwitcherProps } from './components/UIShell/Switcher';
|
|
|
367
371
|
export type { SwitcherDividerProps } from './components/UIShell/SwitcherDivider';
|
|
368
372
|
export type { SwitcherItemProps } from './components/UIShell/SwitcherItem';
|
|
369
373
|
export type { UnorderedListProps } from './components/UnorderedList/UnorderedList';
|
|
370
|
-
export { IconIndicator as unstable__IconIndicator } from './components/IconIndicator';
|