@carbon/react 1.58.1 → 1.59.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 +1059 -1041
- package/es/components/Accordion/Accordion.Skeleton.d.ts +6 -1
- package/es/components/Accordion/Accordion.Skeleton.js +3 -1
- package/es/components/Accordion/Accordion.d.ts +11 -1
- package/es/components/Accordion/Accordion.js +8 -1
- package/es/components/CheckboxGroup/CheckboxGroup.js +7 -0
- package/es/components/ComboButton/index.d.ts +2 -1
- package/es/components/ComboButton/index.js +51 -31
- package/es/components/ContainedList/index.js +4 -0
- package/es/components/DatePicker/plugins/rangePlugin.js +0 -1
- package/es/components/ListBox/ListBoxMenuItem.js +1 -1
- package/es/components/RadioTile/RadioTile.d.ts +9 -0
- package/es/components/RadioTile/RadioTile.js +24 -3
- package/es/components/Tooltip/Tooltip.js +41 -21
- package/es/components/UIShell/Content.d.ts +3 -3
- package/es/components/UIShell/SwitcherItem.d.ts +5 -1
- package/es/components/UIShell/SwitcherItem.js +7 -1
- package/lib/components/Accordion/Accordion.Skeleton.d.ts +6 -1
- package/lib/components/Accordion/Accordion.Skeleton.js +3 -1
- package/lib/components/Accordion/Accordion.d.ts +11 -1
- package/lib/components/Accordion/Accordion.js +8 -1
- package/lib/components/CheckboxGroup/CheckboxGroup.js +7 -0
- package/lib/components/ComboButton/index.d.ts +2 -1
- package/lib/components/ComboButton/index.js +45 -25
- package/lib/components/ContainedList/index.js +4 -0
- package/lib/components/DatePicker/plugins/rangePlugin.js +0 -1
- package/lib/components/ListBox/ListBoxMenuItem.js +1 -1
- package/lib/components/RadioTile/RadioTile.d.ts +9 -0
- package/lib/components/RadioTile/RadioTile.js +24 -3
- package/lib/components/Tooltip/Tooltip.js +41 -21
- package/lib/components/UIShell/Content.d.ts +3 -3
- package/lib/components/UIShell/SwitcherItem.d.ts +5 -1
- package/lib/components/UIShell/SwitcherItem.js +7 -1
- package/package.json +4 -4
|
@@ -28,8 +28,13 @@ interface AccordionSkeletonProps {
|
|
|
28
28
|
* `false` to not display the first item opened.
|
|
29
29
|
*/
|
|
30
30
|
open?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Specify if the Accordion should be an ordered list,
|
|
33
|
+
* default is `false`
|
|
34
|
+
*/
|
|
35
|
+
ordered?: boolean;
|
|
31
36
|
}
|
|
32
|
-
declare function AccordionSkeleton({ align, className, count, isFlush, open, ...rest }: AccordionSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
declare function AccordionSkeleton({ align, className, count, isFlush, open, ordered, ...rest }: AccordionSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
33
38
|
declare namespace AccordionSkeleton {
|
|
34
39
|
var propTypes: {
|
|
35
40
|
/**
|
|
@@ -21,6 +21,7 @@ function AccordionSkeleton(_ref) {
|
|
|
21
21
|
count = 4,
|
|
22
22
|
isFlush,
|
|
23
23
|
open = true,
|
|
24
|
+
ordered = false,
|
|
24
25
|
...rest
|
|
25
26
|
} = _ref;
|
|
26
27
|
const prefix = usePrefix();
|
|
@@ -29,7 +30,8 @@ function AccordionSkeleton(_ref) {
|
|
|
29
30
|
[`${prefix}--accordion--flush`]: isFlush && align !== 'start'
|
|
30
31
|
});
|
|
31
32
|
const numSkeletonItems = open ? count - 1 : count;
|
|
32
|
-
|
|
33
|
+
const ListTag = ordered ? 'ol' : 'ul';
|
|
34
|
+
return /*#__PURE__*/React__default.createElement(ListTag, _extends({
|
|
33
35
|
className: classes
|
|
34
36
|
}, rest), open && /*#__PURE__*/React__default.createElement("li", {
|
|
35
37
|
className: `${prefix}--accordion__item ${prefix}--accordion__item--active`
|
|
@@ -27,13 +27,18 @@ export interface AccordionProps {
|
|
|
27
27
|
* default is `false`, does not work with `align="start"`.
|
|
28
28
|
*/
|
|
29
29
|
isFlush?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Specify if the Accordion should be an ordered list,
|
|
32
|
+
* default is `false`
|
|
33
|
+
*/
|
|
34
|
+
ordered?: boolean;
|
|
30
35
|
/**
|
|
31
36
|
* Specify the size of the Accordion. Currently
|
|
32
37
|
* supports the following: `sm`, `md`, `lg`
|
|
33
38
|
*/
|
|
34
39
|
size?: 'sm' | 'md' | 'lg';
|
|
35
40
|
}
|
|
36
|
-
declare function Accordion({ align, children, className: customClassName, disabled, isFlush, size, ...rest }: PropsWithChildren<AccordionProps>): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
declare function Accordion({ align, children, className: customClassName, disabled, isFlush, ordered, size, ...rest }: PropsWithChildren<AccordionProps>): import("react/jsx-runtime").JSX.Element;
|
|
37
42
|
declare namespace Accordion {
|
|
38
43
|
var propTypes: {
|
|
39
44
|
/**
|
|
@@ -56,6 +61,11 @@ declare namespace Accordion {
|
|
|
56
61
|
* Specify whether Accordion text should be flush, default is false, does not work with align="start"
|
|
57
62
|
*/
|
|
58
63
|
isFlush: PropTypes.Requireable<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Specify if the Accordion should be an ordered list,
|
|
66
|
+
* default is `false`
|
|
67
|
+
*/
|
|
68
|
+
ordered: PropTypes.Requireable<boolean>;
|
|
59
69
|
/**
|
|
60
70
|
* Specify the size of the Accordion. Currently supports the following:
|
|
61
71
|
*/
|
|
@@ -19,6 +19,7 @@ function Accordion(_ref) {
|
|
|
19
19
|
className: customClassName,
|
|
20
20
|
disabled = false,
|
|
21
21
|
isFlush = false,
|
|
22
|
+
ordered = false,
|
|
22
23
|
size,
|
|
23
24
|
...rest
|
|
24
25
|
} = _ref;
|
|
@@ -30,9 +31,10 @@ function Accordion(_ref) {
|
|
|
30
31
|
[`${prefix}--layout--size-${size}`]: size,
|
|
31
32
|
[`${prefix}--accordion--flush`]: isFlush && align !== 'start'
|
|
32
33
|
});
|
|
34
|
+
const ListTag = ordered ? 'ol' : 'ul';
|
|
33
35
|
return /*#__PURE__*/React__default.createElement(AccordionProvider, {
|
|
34
36
|
disabled: disabled
|
|
35
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
37
|
+
}, /*#__PURE__*/React__default.createElement(ListTag, _extends({
|
|
36
38
|
className: className
|
|
37
39
|
}, rest), children));
|
|
38
40
|
}
|
|
@@ -57,6 +59,11 @@ Accordion.propTypes = {
|
|
|
57
59
|
* Specify whether Accordion text should be flush, default is false, does not work with align="start"
|
|
58
60
|
*/
|
|
59
61
|
isFlush: PropTypes.bool,
|
|
62
|
+
/**
|
|
63
|
+
* Specify if the Accordion should be an ordered list,
|
|
64
|
+
* default is `false`
|
|
65
|
+
*/
|
|
66
|
+
ordered: PropTypes.bool,
|
|
60
67
|
/**
|
|
61
68
|
* Specify the size of the Accordion. Currently supports the following:
|
|
62
69
|
*/
|
|
@@ -27,6 +27,7 @@ function CheckboxGroup(_ref) {
|
|
|
27
27
|
warn,
|
|
28
28
|
warnText,
|
|
29
29
|
slug,
|
|
30
|
+
orientation = 'vertical',
|
|
30
31
|
...rest
|
|
31
32
|
} = _ref;
|
|
32
33
|
const prefix = usePrefix();
|
|
@@ -39,6 +40,7 @@ function CheckboxGroup(_ref) {
|
|
|
39
40
|
className: `${prefix}--form__helper-text`
|
|
40
41
|
}, helperText) : null;
|
|
41
42
|
const fieldsetClasses = cx(`${prefix}--checkbox-group`, className, {
|
|
43
|
+
[`${prefix}--checkbox-group--${orientation}`]: orientation === 'horizontal',
|
|
42
44
|
[`${prefix}--checkbox-group--readonly`]: readOnly,
|
|
43
45
|
[`${prefix}--checkbox-group--invalid`]: !readOnly && invalid,
|
|
44
46
|
[`${prefix}--checkbox-group--warning`]: showWarning,
|
|
@@ -58,6 +60,7 @@ function CheckboxGroup(_ref) {
|
|
|
58
60
|
"data-invalid": invalid ? true : undefined,
|
|
59
61
|
"aria-labelledby": rest['aria-labelledby'] || legendId,
|
|
60
62
|
"aria-readonly": readOnly,
|
|
63
|
+
orientation: "vertical",
|
|
61
64
|
"aria-describedby": !invalid && !warn && helper ? helperId : undefined
|
|
62
65
|
}, rest), /*#__PURE__*/React__default.createElement("legend", {
|
|
63
66
|
className: `${prefix}--label`,
|
|
@@ -104,6 +107,10 @@ CheckboxGroup.propTypes = {
|
|
|
104
107
|
* Provide the text to be rendered inside of the fieldset <legend>
|
|
105
108
|
*/
|
|
106
109
|
legendText: PropTypes.node.isRequired,
|
|
110
|
+
/**
|
|
111
|
+
* Provide the orientation for how the checkbox should be displayed
|
|
112
|
+
*/
|
|
113
|
+
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
107
114
|
/**
|
|
108
115
|
* Whether the CheckboxGroup should be read-only
|
|
109
116
|
*/
|
|
@@ -8,6 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import { IconButton } from '../IconButton';
|
|
9
9
|
import Button from '../Button';
|
|
10
10
|
import { Menu } from '../Menu';
|
|
11
|
+
export type MenuAlignment = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end';
|
|
11
12
|
interface ComboButtonProps {
|
|
12
13
|
/**
|
|
13
14
|
* A collection of `MenuItems` to be rendered as additional actions for this `ComboButton`.
|
|
@@ -28,7 +29,7 @@ interface ComboButtonProps {
|
|
|
28
29
|
/**
|
|
29
30
|
* Experimental property. Specify how the menu should align with the button element
|
|
30
31
|
*/
|
|
31
|
-
menuAlignment?:
|
|
32
|
+
menuAlignment?: MenuAlignment;
|
|
32
33
|
/**
|
|
33
34
|
* Provide an optional function to be called when the primary action element is clicked.
|
|
34
35
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React__default, { useRef,
|
|
9
|
+
import React__default, { useRef, useLayoutEffect } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { ChevronDown } from '@carbon/icons-react';
|
|
@@ -17,11 +17,11 @@ import { Menu } from '../Menu/Menu.js';
|
|
|
17
17
|
import '../Menu/MenuItem.js';
|
|
18
18
|
import { useAttachedMenu } from '../../internal/useAttachedMenu.js';
|
|
19
19
|
import { useId } from '../../internal/useId.js';
|
|
20
|
-
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
21
20
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
21
|
+
import { flip, size, useFloating, autoUpdate } from '@floating-ui/react';
|
|
22
|
+
import mergeRefs from '../../tools/mergeRefs.js';
|
|
22
23
|
|
|
23
24
|
var _ChevronDown;
|
|
24
|
-
const spacing = 0; // top and bottom spacing between the button and the menu. in px
|
|
25
25
|
const defaultTranslations = {
|
|
26
26
|
'carbon.combo-button.additional-actions': 'Additional actions'
|
|
27
27
|
};
|
|
@@ -35,7 +35,7 @@ const ComboButton = /*#__PURE__*/React__default.forwardRef(function ComboButton(
|
|
|
35
35
|
disabled,
|
|
36
36
|
label,
|
|
37
37
|
onClick,
|
|
38
|
-
size = 'lg',
|
|
38
|
+
size: size$1 = 'lg',
|
|
39
39
|
menuAlignment = 'bottom',
|
|
40
40
|
tooltipAlignment,
|
|
41
41
|
translateWithId: t = defaultTranslateWithId,
|
|
@@ -44,23 +44,54 @@ const ComboButton = /*#__PURE__*/React__default.forwardRef(function ComboButton(
|
|
|
44
44
|
const id = useId('combobutton');
|
|
45
45
|
const prefix = usePrefix();
|
|
46
46
|
const containerRef = useRef(null);
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
const middlewares = [flip({
|
|
48
|
+
crossAxis: false
|
|
49
|
+
})];
|
|
50
|
+
if (menuAlignment === 'bottom' || menuAlignment === 'top') {
|
|
51
|
+
middlewares.push(size({
|
|
52
|
+
apply(_ref2) {
|
|
53
|
+
let {
|
|
54
|
+
rects,
|
|
55
|
+
elements
|
|
56
|
+
} = _ref2;
|
|
57
|
+
Object.assign(elements.floating.style, {
|
|
58
|
+
width: `${rects.reference.width}px`
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
const {
|
|
64
|
+
refs,
|
|
65
|
+
floatingStyles,
|
|
66
|
+
placement,
|
|
67
|
+
middlewareData
|
|
68
|
+
} = useFloating({
|
|
69
|
+
placement: menuAlignment,
|
|
70
|
+
// The floating element is positioned relative to its nearest
|
|
71
|
+
// containing block (usually the viewport). It will in many cases also
|
|
72
|
+
// “break” the floating element out of a clipping ancestor.
|
|
73
|
+
// https://floating-ui.com/docs/misc#clipping
|
|
74
|
+
strategy: 'fixed',
|
|
75
|
+
// Middleware order matters, arrow should be last
|
|
76
|
+
middleware: middlewares,
|
|
77
|
+
whileElementsMounted: autoUpdate
|
|
78
|
+
});
|
|
79
|
+
const ref = mergeRefs(forwardRef, containerRef, refs.setReference);
|
|
50
80
|
const {
|
|
51
81
|
open,
|
|
52
|
-
x,
|
|
53
|
-
y,
|
|
54
82
|
handleClick: hookOnClick,
|
|
55
83
|
handleMousedown: handleTriggerMousedown,
|
|
56
84
|
handleClose
|
|
57
85
|
} = useAttachedMenu(containerRef);
|
|
86
|
+
useLayoutEffect(() => {
|
|
87
|
+
Object.keys(floatingStyles).forEach(style => {
|
|
88
|
+
if (refs.floating.current) {
|
|
89
|
+
refs.floating.current.style[style] = floatingStyles[style];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}, [floatingStyles, refs.floating, middlewareData, placement, open]);
|
|
58
93
|
function handleTriggerClick() {
|
|
59
94
|
if (containerRef.current) {
|
|
60
|
-
const {
|
|
61
|
-
width: w
|
|
62
|
-
} = containerRef.current.getBoundingClientRect();
|
|
63
|
-
setWidth(w);
|
|
64
95
|
hookOnClick();
|
|
65
96
|
}
|
|
66
97
|
}
|
|
@@ -69,16 +100,7 @@ const ComboButton = /*#__PURE__*/React__default.forwardRef(function ComboButton(
|
|
|
69
100
|
onClick(e);
|
|
70
101
|
}
|
|
71
102
|
}
|
|
72
|
-
|
|
73
|
-
if (menuRef.current) {
|
|
74
|
-
menuRef.current.style.inlineSize = `${width}px`;
|
|
75
|
-
menuRef.current.style.minInlineSize = `${width}px`;
|
|
76
|
-
if (menuAlignment !== 'bottom' && menuAlignment !== 'top') {
|
|
77
|
-
menuRef.current.style.inlineSize = `fit-content`;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
const containerClasses = cx(`${prefix}--combo-button__container`, `${prefix}--combo-button__container--${size}`, {
|
|
103
|
+
const containerClasses = cx(`${prefix}--combo-button__container`, `${prefix}--combo-button__container--${size$1}`, {
|
|
82
104
|
[`${prefix}--combo-button__container--open`]: open
|
|
83
105
|
}, className);
|
|
84
106
|
const menuClasses = cx(`${prefix}--combo-button__${menuAlignment}`);
|
|
@@ -92,13 +114,14 @@ const ComboButton = /*#__PURE__*/React__default.forwardRef(function ComboButton(
|
|
|
92
114
|
className: primaryActionClasses
|
|
93
115
|
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
94
116
|
title: label,
|
|
95
|
-
size: size,
|
|
117
|
+
size: size$1,
|
|
96
118
|
disabled: disabled,
|
|
97
119
|
onClick: handlePrimaryActionClick
|
|
98
120
|
}, label)), /*#__PURE__*/React__default.createElement(IconButton, {
|
|
121
|
+
ref: refs.setReference,
|
|
99
122
|
className: triggerClasses,
|
|
100
123
|
label: t('carbon.combo-button.additional-actions'),
|
|
101
|
-
size: size,
|
|
124
|
+
size: size$1,
|
|
102
125
|
disabled: disabled,
|
|
103
126
|
align: tooltipAlignment,
|
|
104
127
|
"aria-haspopup": true,
|
|
@@ -110,16 +133,13 @@ const ComboButton = /*#__PURE__*/React__default.forwardRef(function ComboButton(
|
|
|
110
133
|
containerRef: containerRef,
|
|
111
134
|
menuAlignment: menuAlignment,
|
|
112
135
|
className: menuClasses,
|
|
113
|
-
ref:
|
|
136
|
+
ref: refs.setFloating,
|
|
114
137
|
id: id,
|
|
115
138
|
label: t('carbon.combo-button.additional-actions'),
|
|
116
139
|
mode: "basic",
|
|
117
|
-
size: size,
|
|
140
|
+
size: size$1,
|
|
118
141
|
open: open,
|
|
119
|
-
onClose: handleClose
|
|
120
|
-
onOpen: handleOpen,
|
|
121
|
-
x: x,
|
|
122
|
-
y: [y[0] - spacing, y[1] + spacing]
|
|
142
|
+
onClose: handleClose
|
|
123
143
|
}, children));
|
|
124
144
|
});
|
|
125
145
|
ComboButton.propTypes = {
|
|
@@ -5,9 +5,13 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { deprecateFieldOnObject } from '../../internal/deprecateFieldOnObject.js';
|
|
8
9
|
import ContainedList from './ContainedList.js';
|
|
9
10
|
export { default as ContainedList, default } from './ContainedList.js';
|
|
10
11
|
import ContainedListItem from './ContainedListItem/ContainedListItem.js';
|
|
11
12
|
export { default as ContainedListItem } from './ContainedListItem/ContainedListItem.js';
|
|
12
13
|
|
|
13
14
|
ContainedList.ContainedListItem = ContainedListItem;
|
|
15
|
+
if (process.env.NODE_ENV !== "production") {
|
|
16
|
+
deprecateFieldOnObject(ContainedList, 'ContainedListItem', ContainedListItem);
|
|
17
|
+
}
|
|
@@ -30,7 +30,6 @@ var carbonFlatpickrRangePlugin = (config => {
|
|
|
30
30
|
_input: inputDates
|
|
31
31
|
} = fp;
|
|
32
32
|
const inputDatesArray = inputDates.value.split(' ');
|
|
33
|
-
fp.close();
|
|
34
33
|
[inputDatesArray[0], inputDatesArray[2]].forEach((input, i) => {
|
|
35
34
|
if (input) {
|
|
36
35
|
input = !dates[i] ? '' : fp.formatDate(new Date(dates[i]), fp.config.dateFormat);
|
|
@@ -22,6 +22,11 @@ export interface RadioTileProps {
|
|
|
22
22
|
* Specify whether the `RadioTile` should be disabled.
|
|
23
23
|
*/
|
|
24
24
|
disabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* **Experimental**: Specify if the `ExpandableTile` component should be rendered with rounded corners.
|
|
27
|
+
* Only valid when `slug` prop is present
|
|
28
|
+
*/
|
|
29
|
+
hasRoundedCorners?: boolean;
|
|
25
30
|
/**
|
|
26
31
|
* Provide a unique id for the underlying `<input>`.
|
|
27
32
|
*/
|
|
@@ -42,6 +47,10 @@ export interface RadioTileProps {
|
|
|
42
47
|
* the underlying `<input>` changes.
|
|
43
48
|
*/
|
|
44
49
|
onChange?: (value: string | number, name: string | undefined, event: React.ChangeEvent<HTMLInputElement> | React.KeyboardEvent<HTMLInputElement>) => void;
|
|
50
|
+
/**
|
|
51
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `SelectableTile` component
|
|
52
|
+
*/
|
|
53
|
+
slug?: React.ReactNode;
|
|
45
54
|
/**
|
|
46
55
|
* Specify the tab index of the underlying `<input>`.
|
|
47
56
|
*/
|
|
@@ -33,15 +33,19 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
|
|
|
33
33
|
id,
|
|
34
34
|
onChange = noopFn,
|
|
35
35
|
tabIndex = 0,
|
|
36
|
+
hasRoundedCorners,
|
|
37
|
+
slug,
|
|
36
38
|
required,
|
|
37
39
|
...rest
|
|
38
40
|
} = _ref;
|
|
39
41
|
const prefix = usePrefix();
|
|
40
42
|
const inputId = useFallbackId(id);
|
|
41
|
-
const className = cx(customClassName, `${prefix}--tile`, `${prefix}--tile--selectable`, {
|
|
43
|
+
const className = cx(customClassName, `${prefix}--tile`, `${prefix}--tile--selectable`, `${prefix}--tile--radio`, {
|
|
42
44
|
[`${prefix}--tile--is-selected`]: checked,
|
|
43
45
|
[`${prefix}--tile--light`]: light,
|
|
44
|
-
[`${prefix}--tile--disabled`]: disabled
|
|
46
|
+
[`${prefix}--tile--disabled`]: disabled,
|
|
47
|
+
[`${prefix}--tile--slug`]: slug,
|
|
48
|
+
[`${prefix}--tile--slug-rounded`]: slug && hasRoundedCorners
|
|
45
49
|
});
|
|
46
50
|
const v12TileRadioIcons = useFeatureFlag('enable-v12-tile-radio-icons');
|
|
47
51
|
function icon() {
|
|
@@ -64,6 +68,14 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
|
|
|
64
68
|
onChange(value, name, evt);
|
|
65
69
|
}
|
|
66
70
|
}
|
|
71
|
+
|
|
72
|
+
// Slug is always size `xs`
|
|
73
|
+
let normalizedSlug;
|
|
74
|
+
if (slug && slug['type']?.displayName === 'Slug') {
|
|
75
|
+
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
76
|
+
size: 'xs'
|
|
77
|
+
});
|
|
78
|
+
}
|
|
67
79
|
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("input", {
|
|
68
80
|
checked: checked,
|
|
69
81
|
className: `${prefix}--tile-input`,
|
|
@@ -84,7 +96,7 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
|
|
|
84
96
|
className: `${prefix}--tile__checkmark`
|
|
85
97
|
}, icon()), /*#__PURE__*/React__default.createElement(Text, {
|
|
86
98
|
className: `${prefix}--tile-content`
|
|
87
|
-
}, children)));
|
|
99
|
+
}, children), normalizedSlug));
|
|
88
100
|
});
|
|
89
101
|
RadioTile.displayName = 'RadioTile';
|
|
90
102
|
RadioTile.propTypes = {
|
|
@@ -104,6 +116,11 @@ RadioTile.propTypes = {
|
|
|
104
116
|
* Specify whether the `RadioTile` should be disabled.
|
|
105
117
|
*/
|
|
106
118
|
disabled: PropTypes.bool,
|
|
119
|
+
/**
|
|
120
|
+
* Specify if the `ExpandableTile` component should be rendered with rounded corners.
|
|
121
|
+
* Only valid when `slug` prop is present
|
|
122
|
+
*/
|
|
123
|
+
hasRoundedCorners: PropTypes.bool,
|
|
107
124
|
/**
|
|
108
125
|
* Provide a unique id for the underlying `<input>`.
|
|
109
126
|
*/
|
|
@@ -126,6 +143,10 @@ RadioTile.propTypes = {
|
|
|
126
143
|
* `true` to specify if the control is required.
|
|
127
144
|
*/
|
|
128
145
|
required: PropTypes.bool,
|
|
146
|
+
/**
|
|
147
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `SelectableTile` component
|
|
148
|
+
*/
|
|
149
|
+
slug: PropTypes.node,
|
|
129
150
|
/**
|
|
130
151
|
* Specify the tab index of the underlying `<input>`.
|
|
131
152
|
*/
|
|
@@ -14,6 +14,7 @@ import { useDelayedState } from '../../internal/useDelayedState.js';
|
|
|
14
14
|
import { useId } from '../../internal/useId.js';
|
|
15
15
|
import { useNoInteractiveChildren } from '../../internal/useNoInteractiveChildren.js';
|
|
16
16
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
17
|
+
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
17
18
|
import { match } from '../../internal/keyboard/match.js';
|
|
18
19
|
import { Escape, Enter, Space } from '../../internal/keyboard/keys.js';
|
|
19
20
|
|
|
@@ -74,7 +75,7 @@ function Tooltip(_ref) {
|
|
|
74
75
|
} else {
|
|
75
76
|
triggerProps['aria-describedby'] = id;
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
+
const onKeyDown = useCallback(event => {
|
|
78
79
|
if (open && match(event, Escape)) {
|
|
79
80
|
event.stopPropagation();
|
|
80
81
|
setOpen(false);
|
|
@@ -82,7 +83,21 @@ function Tooltip(_ref) {
|
|
|
82
83
|
if (open && closeOnActivation && (match(event, Enter) || match(event, Space))) {
|
|
83
84
|
setOpen(false);
|
|
84
85
|
}
|
|
85
|
-
}
|
|
86
|
+
}, [closeOnActivation, open, setOpen]);
|
|
87
|
+
useIsomorphicEffect(() => {
|
|
88
|
+
if (!open) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
function handleKeyDown(event) {
|
|
92
|
+
if (match(event, Escape)) {
|
|
93
|
+
onKeyDown(event);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
97
|
+
return () => {
|
|
98
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
99
|
+
};
|
|
100
|
+
}, [open, onKeyDown]);
|
|
86
101
|
function onMouseEnter() {
|
|
87
102
|
// Interactive Tags should not support onMouseEnter
|
|
88
103
|
if (!rest?.onMouseEnter) {
|
|
@@ -133,25 +148,30 @@ function Tooltip(_ref) {
|
|
|
133
148
|
});
|
|
134
149
|
};
|
|
135
150
|
}, [isDragging, onDragStop]);
|
|
136
|
-
return
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
return (
|
|
152
|
+
/*#__PURE__*/
|
|
153
|
+
// @ts-ignore-error Popover throws a TS error everytime is imported
|
|
154
|
+
React__default.createElement(Popover, _extends({}, rest, {
|
|
155
|
+
align: align,
|
|
156
|
+
className: cx(`${prefix}--tooltip`, customClassName),
|
|
157
|
+
dropShadow: false,
|
|
158
|
+
highContrast: true,
|
|
159
|
+
onKeyDown: onKeyDown,
|
|
160
|
+
onMouseLeave: onMouseLeave,
|
|
161
|
+
open: open
|
|
162
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
163
|
+
className: `${prefix}--tooltip-trigger__wrapper`
|
|
164
|
+
}, child !== undefined ? /*#__PURE__*/React__default.cloneElement(child, {
|
|
165
|
+
...triggerProps,
|
|
166
|
+
...getChildEventHandlers(child.props)
|
|
167
|
+
}) : null), /*#__PURE__*/React__default.createElement(PopoverContent, {
|
|
168
|
+
"aria-hidden": open ? 'false' : 'true',
|
|
169
|
+
className: `${prefix}--tooltip-content`,
|
|
170
|
+
id: id,
|
|
171
|
+
onMouseEnter: onMouseEnter,
|
|
172
|
+
role: "tooltip"
|
|
173
|
+
}, label || description))
|
|
174
|
+
);
|
|
155
175
|
}
|
|
156
176
|
Tooltip.propTypes = {
|
|
157
177
|
/**
|
|
@@ -29,7 +29,7 @@ declare const Content: {
|
|
|
29
29
|
suppressHydrationWarning?: boolean | undefined;
|
|
30
30
|
accessKey?: string | undefined;
|
|
31
31
|
autoFocus?: boolean | undefined;
|
|
32
|
-
contentEditable?:
|
|
32
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
|
|
33
33
|
contextMenu?: string | undefined;
|
|
34
34
|
dir?: string | undefined;
|
|
35
35
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
@@ -43,7 +43,7 @@ declare const Content: {
|
|
|
43
43
|
style?: React.CSSProperties | undefined;
|
|
44
44
|
tabIndex?: number | undefined;
|
|
45
45
|
title?: string | undefined;
|
|
46
|
-
translate?: "
|
|
46
|
+
translate?: "yes" | "no" | undefined;
|
|
47
47
|
radioGroup?: string | undefined;
|
|
48
48
|
role?: React.AriaRole | undefined;
|
|
49
49
|
about?: string | undefined;
|
|
@@ -93,7 +93,7 @@ declare const Content: {
|
|
|
93
93
|
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
94
94
|
"aria-flowto"?: string | undefined;
|
|
95
95
|
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
96
|
-
"aria-haspopup"?: boolean | "dialog" | "menu" | "
|
|
96
|
+
"aria-haspopup"?: boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
|
|
97
97
|
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
98
98
|
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
99
99
|
"aria-keyshortcuts"?: string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { HTMLAttributeAnchorTarget } from 'react';
|
|
2
2
|
interface BaseSwitcherItemProps {
|
|
3
3
|
/**
|
|
4
4
|
* Specify the text content for the link
|
|
@@ -43,6 +43,10 @@ interface BaseSwitcherItemProps {
|
|
|
43
43
|
* Optionally provide an href for the underlying li`
|
|
44
44
|
*/
|
|
45
45
|
href?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Specify where to open the link.
|
|
48
|
+
*/
|
|
49
|
+
target?: HTMLAttributeAnchorTarget;
|
|
46
50
|
}
|
|
47
51
|
interface SwitcherItemWithAriaLabel extends BaseSwitcherItemProps {
|
|
48
52
|
'aria-label': string;
|
|
@@ -28,6 +28,7 @@ const SwitcherItem = /*#__PURE__*/forwardRef(function SwitcherItem(props, forwar
|
|
|
28
28
|
handleSwitcherItemFocus,
|
|
29
29
|
onKeyDown = () => {},
|
|
30
30
|
href,
|
|
31
|
+
target,
|
|
31
32
|
...rest
|
|
32
33
|
} = props;
|
|
33
34
|
const prefix = usePrefix();
|
|
@@ -65,6 +66,7 @@ const SwitcherItem = /*#__PURE__*/forwardRef(function SwitcherItem(props, forwar
|
|
|
65
66
|
onKeyDown(evt);
|
|
66
67
|
},
|
|
67
68
|
href: href,
|
|
69
|
+
target: target,
|
|
68
70
|
ref: forwardRef
|
|
69
71
|
}, rest, {
|
|
70
72
|
className: linkClassName,
|
|
@@ -105,7 +107,11 @@ SwitcherItem.propTypes = {
|
|
|
105
107
|
/**
|
|
106
108
|
* Specify the tab index of the Link
|
|
107
109
|
*/
|
|
108
|
-
tabIndex: PropTypes.number
|
|
110
|
+
tabIndex: PropTypes.number,
|
|
111
|
+
/**
|
|
112
|
+
* Specify where to open the link.
|
|
113
|
+
*/
|
|
114
|
+
target: PropTypes.string
|
|
109
115
|
};
|
|
110
116
|
|
|
111
117
|
export { SwitcherItem as default };
|
|
@@ -28,8 +28,13 @@ interface AccordionSkeletonProps {
|
|
|
28
28
|
* `false` to not display the first item opened.
|
|
29
29
|
*/
|
|
30
30
|
open?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Specify if the Accordion should be an ordered list,
|
|
33
|
+
* default is `false`
|
|
34
|
+
*/
|
|
35
|
+
ordered?: boolean;
|
|
31
36
|
}
|
|
32
|
-
declare function AccordionSkeleton({ align, className, count, isFlush, open, ...rest }: AccordionSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
declare function AccordionSkeleton({ align, className, count, isFlush, open, ordered, ...rest }: AccordionSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
33
38
|
declare namespace AccordionSkeleton {
|
|
34
39
|
var propTypes: {
|
|
35
40
|
/**
|
|
@@ -31,6 +31,7 @@ function AccordionSkeleton(_ref) {
|
|
|
31
31
|
count = 4,
|
|
32
32
|
isFlush,
|
|
33
33
|
open = true,
|
|
34
|
+
ordered = false,
|
|
34
35
|
...rest
|
|
35
36
|
} = _ref;
|
|
36
37
|
const prefix = usePrefix.usePrefix();
|
|
@@ -39,7 +40,8 @@ function AccordionSkeleton(_ref) {
|
|
|
39
40
|
[`${prefix}--accordion--flush`]: isFlush && align !== 'start'
|
|
40
41
|
});
|
|
41
42
|
const numSkeletonItems = open ? count - 1 : count;
|
|
42
|
-
|
|
43
|
+
const ListTag = ordered ? 'ol' : 'ul';
|
|
44
|
+
return /*#__PURE__*/React__default["default"].createElement(ListTag, _rollupPluginBabelHelpers["extends"]({
|
|
43
45
|
className: classes
|
|
44
46
|
}, rest), open && /*#__PURE__*/React__default["default"].createElement("li", {
|
|
45
47
|
className: `${prefix}--accordion__item ${prefix}--accordion__item--active`
|
|
@@ -27,13 +27,18 @@ export interface AccordionProps {
|
|
|
27
27
|
* default is `false`, does not work with `align="start"`.
|
|
28
28
|
*/
|
|
29
29
|
isFlush?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Specify if the Accordion should be an ordered list,
|
|
32
|
+
* default is `false`
|
|
33
|
+
*/
|
|
34
|
+
ordered?: boolean;
|
|
30
35
|
/**
|
|
31
36
|
* Specify the size of the Accordion. Currently
|
|
32
37
|
* supports the following: `sm`, `md`, `lg`
|
|
33
38
|
*/
|
|
34
39
|
size?: 'sm' | 'md' | 'lg';
|
|
35
40
|
}
|
|
36
|
-
declare function Accordion({ align, children, className: customClassName, disabled, isFlush, size, ...rest }: PropsWithChildren<AccordionProps>): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
declare function Accordion({ align, children, className: customClassName, disabled, isFlush, ordered, size, ...rest }: PropsWithChildren<AccordionProps>): import("react/jsx-runtime").JSX.Element;
|
|
37
42
|
declare namespace Accordion {
|
|
38
43
|
var propTypes: {
|
|
39
44
|
/**
|
|
@@ -56,6 +61,11 @@ declare namespace Accordion {
|
|
|
56
61
|
* Specify whether Accordion text should be flush, default is false, does not work with align="start"
|
|
57
62
|
*/
|
|
58
63
|
isFlush: PropTypes.Requireable<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Specify if the Accordion should be an ordered list,
|
|
66
|
+
* default is `false`
|
|
67
|
+
*/
|
|
68
|
+
ordered: PropTypes.Requireable<boolean>;
|
|
59
69
|
/**
|
|
60
70
|
* Specify the size of the Accordion. Currently supports the following:
|
|
61
71
|
*/
|