@carbon/react 1.108.0-rc.0 → 1.108.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 +985 -985
- package/es/components/Button/ButtonBase.js +5 -5
- package/es/components/ComposedModal/ModalFooter.d.ts +5 -0
- package/es/components/ComposedModal/ModalFooter.js +3 -1
- package/es/components/Dialog/Dialog.d.ts +5 -0
- package/es/components/Dialog/Dialog.js +3 -1
- package/es/components/Menu/MenuItem.js +3 -2
- package/es/components/Modal/Modal.d.ts +5 -0
- package/es/components/Modal/Modal.js +4 -1
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +3 -2
- package/es/components/Tabs/Tabs.d.ts +5 -1
- package/es/components/Tabs/Tabs.js +2 -1
- package/lib/components/Button/ButtonBase.js +5 -5
- package/lib/components/ComposedModal/ModalFooter.d.ts +5 -0
- package/lib/components/ComposedModal/ModalFooter.js +3 -1
- package/lib/components/Dialog/Dialog.d.ts +5 -0
- package/lib/components/Dialog/Dialog.js +3 -1
- package/lib/components/Menu/MenuItem.js +3 -2
- package/lib/components/Modal/Modal.d.ts +5 -0
- package/lib/components/Modal/Modal.js +4 -1
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +3 -2
- package/lib/components/Tabs/Tabs.d.ts +5 -1
- package/lib/components/Tabs/Tabs.js +2 -1
- package/package.json +8 -8
|
@@ -17,7 +17,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
17
17
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
18
18
|
* LICENSE file in the root directory of this source tree.
|
|
19
19
|
*/
|
|
20
|
-
const ButtonBase = React.forwardRef(function ButtonBase({ as, children, className, dangerDescription = "
|
|
20
|
+
const ButtonBase = React.forwardRef(function ButtonBase({ as, children, className, dangerDescription = "", disabled = false, hasIconOnly = false, href, iconDescription, isExpressive = false, isSelected, kind = "primary", onBlur, onClick, onFocus, onMouseEnter, onMouseLeave, renderIcon: ButtonImageElement, size, tabIndex, type = "button", ...rest }, ref) {
|
|
21
21
|
const prefix = usePrefix();
|
|
22
22
|
const commonProps = {
|
|
23
23
|
tabIndex,
|
|
@@ -43,23 +43,23 @@ const ButtonBase = React.forwardRef(function ButtonBase({ as, children, classNam
|
|
|
43
43
|
className: `${prefix}--btn__icon`,
|
|
44
44
|
"aria-hidden": "true"
|
|
45
45
|
});
|
|
46
|
-
const
|
|
46
|
+
const hasDangerDescription = [
|
|
47
47
|
"danger",
|
|
48
48
|
"danger--tertiary",
|
|
49
49
|
"danger--ghost"
|
|
50
|
-
];
|
|
50
|
+
].includes(kind) && Boolean(dangerDescription);
|
|
51
51
|
let component = "button";
|
|
52
52
|
const assistiveId = useId("danger-description");
|
|
53
53
|
const { "aria-pressed": ariaPressed, "aria-describedby": ariaDescribedBy } = rest;
|
|
54
54
|
let otherProps = {
|
|
55
55
|
disabled,
|
|
56
56
|
type,
|
|
57
|
-
"aria-describedby":
|
|
57
|
+
"aria-describedby": hasDangerDescription ? assistiveId : ariaDescribedBy || void 0,
|
|
58
58
|
"aria-pressed": ariaPressed ?? (hasIconOnly && kind === "ghost" ? isSelected : void 0)
|
|
59
59
|
};
|
|
60
60
|
const anchorProps = { href };
|
|
61
61
|
let assistiveText = null;
|
|
62
|
-
if (
|
|
62
|
+
if (hasDangerDescription) assistiveText = /* @__PURE__ */ jsx("span", {
|
|
63
63
|
id: assistiveId,
|
|
64
64
|
className: `${prefix}--visually-hidden`,
|
|
65
65
|
children: dangerDescription
|
|
@@ -36,6 +36,11 @@ export interface ModalFooterProps {
|
|
|
36
36
|
* Note that this prop is not applied if you render primary/danger button by yourself
|
|
37
37
|
*/
|
|
38
38
|
danger?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Specify the message read by screen readers for the danger primary button.
|
|
41
|
+
* Defaults to an empty string; provide localized text to opt in.
|
|
42
|
+
*/
|
|
43
|
+
dangerDescription?: string;
|
|
39
44
|
/**
|
|
40
45
|
* The `ref` callback for the primary button.
|
|
41
46
|
*/
|
|
@@ -61,7 +61,7 @@ SecondaryButtonSet.propTypes = {
|
|
|
61
61
|
},
|
|
62
62
|
secondaryClassName: PropTypes.string
|
|
63
63
|
};
|
|
64
|
-
const ModalFooter = React.forwardRef(function ModalFooter({ children, className: customClassName, closeModal = noopFn, danger, inputref, onRequestClose = noopFn, onRequestSubmit = noopFn, primaryButtonDisabled, primaryButtonText, primaryClassName, secondaryButtonText, secondaryButtons, secondaryClassName, loadingStatus = "inactive", loadingDescription, loadingIconDescription, onLoadingSuccess = noopFn, ...rest }, ref) {
|
|
64
|
+
const ModalFooter = React.forwardRef(function ModalFooter({ children, className: customClassName, closeModal = noopFn, danger, dangerDescription = "", inputref, onRequestClose = noopFn, onRequestSubmit = noopFn, primaryButtonDisabled, primaryButtonText, primaryClassName, secondaryButtonText, secondaryButtons, secondaryClassName, loadingStatus = "inactive", loadingDescription, loadingIconDescription, onLoadingSuccess = noopFn, ...rest }, ref) {
|
|
65
65
|
const prefix = usePrefix();
|
|
66
66
|
const footerClass = classNames(`${prefix}--modal-footer`, customClassName, Array.isArray(secondaryButtons) && secondaryButtons.length === 2 ? `${prefix}--modal-footer--three-button` : null);
|
|
67
67
|
const primaryButtonClass = classNames(primaryClassName, loadingStatus !== "inactive" ? `${prefix}--btn--loading` : null);
|
|
@@ -85,6 +85,7 @@ const ModalFooter = React.forwardRef(function ModalFooter({ children, className:
|
|
|
85
85
|
onClick: onRequestSubmit,
|
|
86
86
|
className: primaryButtonClass,
|
|
87
87
|
disabled: loadingActive || primaryButtonDisabled,
|
|
88
|
+
dangerDescription,
|
|
88
89
|
kind: danger ? "danger" : "primary",
|
|
89
90
|
ref: inputref,
|
|
90
91
|
children: loadingStatus === "inactive" ? primaryButtonText : /* @__PURE__ */ jsx(InlineLoading_default, {
|
|
@@ -104,6 +105,7 @@ ModalFooter.propTypes = {
|
|
|
104
105
|
className: PropTypes.string,
|
|
105
106
|
closeModal: PropTypes.func,
|
|
106
107
|
danger: PropTypes.bool,
|
|
108
|
+
dangerDescription: PropTypes.string,
|
|
107
109
|
inputref: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]),
|
|
108
110
|
loadingDescription: PropTypes.string,
|
|
109
111
|
loadingIconDescription: PropTypes.string,
|
|
@@ -232,6 +232,11 @@ interface DialogFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
232
232
|
* Specify whether the Dialog is for dangerous actions
|
|
233
233
|
*/
|
|
234
234
|
danger?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Specify the message read by screen readers for the danger primary button.
|
|
237
|
+
* Defaults to an empty string; provide localized text to opt in.
|
|
238
|
+
*/
|
|
239
|
+
dangerDescription?: string;
|
|
235
240
|
/**
|
|
236
241
|
* Specify loading status
|
|
237
242
|
*/
|
|
@@ -248,7 +248,7 @@ DialogBody.propTypes = {
|
|
|
248
248
|
className: PropTypes.string,
|
|
249
249
|
hasScrollingContent: PropTypes.bool
|
|
250
250
|
};
|
|
251
|
-
const DialogFooter = React.forwardRef(({ children, className, onRequestClose = noopFn, onSecondarySubmit, onRequestSubmit = noopFn, primaryButtonText = "Save", primaryButtonDisabled = false, secondaryButtonText = "Cancel", secondaryButtons, loadingStatus = "inactive", loadingDescription, loadingIconDescription, onLoadingSuccess = noopFn, danger = false, ...rest }, ref) => {
|
|
251
|
+
const DialogFooter = React.forwardRef(({ children, className, onRequestClose = noopFn, onSecondarySubmit, onRequestSubmit = noopFn, primaryButtonText = "Save", primaryButtonDisabled = false, secondaryButtonText = "Cancel", secondaryButtons, loadingStatus = "inactive", loadingDescription, loadingIconDescription, onLoadingSuccess = noopFn, danger = false, dangerDescription = "", ...rest }, ref) => {
|
|
252
252
|
const prefix = usePrefix();
|
|
253
253
|
const button = useRef(null);
|
|
254
254
|
const { isOpen } = useContext(DialogContext);
|
|
@@ -296,6 +296,7 @@ const DialogFooter = React.forwardRef(({ children, className, onRequestClose = n
|
|
|
296
296
|
}), /* @__PURE__ */ jsx(Button_default, {
|
|
297
297
|
className: primaryButtonClass,
|
|
298
298
|
kind: danger ? "danger" : "primary",
|
|
299
|
+
dangerDescription,
|
|
299
300
|
disabled: loadingActive || primaryButtonDisabled,
|
|
300
301
|
onClick: onRequestSubmit,
|
|
301
302
|
ref: button,
|
|
@@ -333,6 +334,7 @@ DialogFooter.propTypes = {
|
|
|
333
334
|
return null;
|
|
334
335
|
},
|
|
335
336
|
danger: PropTypes.bool,
|
|
337
|
+
dangerDescription: PropTypes.string,
|
|
336
338
|
loadingStatus: PropTypes.oneOf([
|
|
337
339
|
"inactive",
|
|
338
340
|
"active",
|
|
@@ -29,7 +29,7 @@ import { FloatingFocusManager, autoUpdate, flip, offset, safePolygon, useFloatin
|
|
|
29
29
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
30
30
|
* LICENSE file in the root directory of this source tree.
|
|
31
31
|
*/
|
|
32
|
-
const MenuItem = forwardRef(function MenuItem({ children, className, dangerDescription = "
|
|
32
|
+
const MenuItem = forwardRef(function MenuItem({ children, className, dangerDescription = "", disabled, kind = "default", label, onClick, renderIcon: IconElement, shortcut, ...rest }, forwardRef) {
|
|
33
33
|
const [submenuOpen, setSubmenuOpen] = useState(false);
|
|
34
34
|
const [rtl, setRtl] = useState(false);
|
|
35
35
|
const { refs, floatingStyles, context: floatingContext } = useFloating({
|
|
@@ -67,6 +67,7 @@ const MenuItem = forwardRef(function MenuItem({ children, className, dangerDescr
|
|
|
67
67
|
const hasChildren = React.Children.toArray(children).length > 0;
|
|
68
68
|
const isDisabled = disabled && !hasChildren;
|
|
69
69
|
const isDanger = kind === "danger" && !hasChildren;
|
|
70
|
+
const hasDangerDescription = isDanger && Boolean(dangerDescription);
|
|
70
71
|
function registerItem() {
|
|
71
72
|
context.dispatch({
|
|
72
73
|
type: "registerItem",
|
|
@@ -169,7 +170,7 @@ const MenuItem = forwardRef(function MenuItem({ children, className, dangerDescr
|
|
|
169
170
|
className: `${prefix}--menu-item__label`,
|
|
170
171
|
children: label
|
|
171
172
|
}),
|
|
172
|
-
|
|
173
|
+
hasDangerDescription && /* @__PURE__ */ jsx("span", {
|
|
173
174
|
id: assistiveId,
|
|
174
175
|
className: `${prefix}--visually-hidden`,
|
|
175
176
|
children: dangerDescription
|
|
@@ -38,6 +38,11 @@ export interface ModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
38
38
|
* Specify whether the Modal is for dangerous actions
|
|
39
39
|
*/
|
|
40
40
|
danger?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Specify the message read by screen readers for the danger primary button.
|
|
43
|
+
* Defaults to an empty string; provide localized text to opt in.
|
|
44
|
+
*/
|
|
45
|
+
dangerDescription?: string;
|
|
41
46
|
/**
|
|
42
47
|
* **Experimental**: Provide a decorator component to be rendered inside the `Modal` component
|
|
43
48
|
*/
|
|
@@ -73,7 +73,7 @@ const Modal = React.forwardRef(function Modal({ open, ...props }, ref) {
|
|
|
73
73
|
...props
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
|
-
const ModalDialog = React.forwardRef(function ModalDialog({ "aria-label": ariaLabelProp, children, className, decorator, modalHeading = "", modalLabel = "", modalAriaLabel, passiveModal = false, secondaryButtonText, primaryButtonText, open: externalOpen, onRequestClose = noopFn, onRequestSubmit = noopFn, onSecondarySubmit, primaryButtonDisabled = false, danger, alert, secondaryButtons, selectorPrimaryFocus = "[data-modal-primary-focus]", selectorsFloatingMenus, shouldSubmitOnEnter, size, hasScrollingContent = false, closeButtonLabel = "Close", preventCloseOnClickOutside, isFullWidth, launcherButtonRef, loadingStatus = "inactive", loadingDescription, loadingIconDescription, onLoadingSuccess = noopFn, slug, ...rest }, ref) {
|
|
76
|
+
const ModalDialog = React.forwardRef(function ModalDialog({ "aria-label": ariaLabelProp, children, className, decorator, modalHeading = "", modalLabel = "", modalAriaLabel, passiveModal = false, secondaryButtonText, primaryButtonText, open: externalOpen, onRequestClose = noopFn, onRequestSubmit = noopFn, onSecondarySubmit, primaryButtonDisabled = false, danger, dangerDescription = "", alert, secondaryButtons, selectorPrimaryFocus = "[data-modal-primary-focus]", selectorsFloatingMenus, shouldSubmitOnEnter, size, hasScrollingContent = false, closeButtonLabel = "Close", preventCloseOnClickOutside, isFullWidth, launcherButtonRef, loadingStatus = "inactive", loadingDescription, loadingIconDescription, onLoadingSuccess = noopFn, slug, ...rest }, ref) {
|
|
77
77
|
const prefix = usePrefix();
|
|
78
78
|
const button = useRef(null);
|
|
79
79
|
const secondaryButton = useRef(null);
|
|
@@ -362,6 +362,7 @@ const ModalDialog = React.forwardRef(function ModalDialog({ "aria-label": ariaLa
|
|
|
362
362
|
}), /* @__PURE__ */ jsx(Button_default, {
|
|
363
363
|
className: primaryButtonClass,
|
|
364
364
|
kind: danger ? "danger" : "primary",
|
|
365
|
+
dangerDescription,
|
|
365
366
|
disabled: loadingActive || primaryButtonDisabled,
|
|
366
367
|
onClick: onRequestSubmit,
|
|
367
368
|
ref: button,
|
|
@@ -438,6 +439,7 @@ const ModalDialog = React.forwardRef(function ModalDialog({ "aria-label": ariaLa
|
|
|
438
439
|
}), /* @__PURE__ */ jsx(Button_default, {
|
|
439
440
|
className: primaryButtonClass,
|
|
440
441
|
kind: danger ? "danger" : "primary",
|
|
442
|
+
dangerDescription,
|
|
441
443
|
disabled: loadingActive || primaryButtonDisabled,
|
|
442
444
|
onClick: onRequestSubmit,
|
|
443
445
|
ref: button,
|
|
@@ -480,6 +482,7 @@ Modal.propTypes = {
|
|
|
480
482
|
className: PropTypes.string,
|
|
481
483
|
closeButtonLabel: PropTypes.string,
|
|
482
484
|
danger: PropTypes.bool,
|
|
485
|
+
dangerDescription: PropTypes.string,
|
|
483
486
|
decorator: PropTypes.node,
|
|
484
487
|
hasScrollingContent: PropTypes.bool,
|
|
485
488
|
id: PropTypes.string,
|
|
@@ -23,7 +23,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
23
23
|
* LICENSE file in the root directory of this source tree.
|
|
24
24
|
*/
|
|
25
25
|
const OverflowMenuItem = forwardRef((props, ref) => {
|
|
26
|
-
const { className, closeMenu, dangerDescription = "
|
|
26
|
+
const { className, closeMenu, dangerDescription = "", disabled = false, handleOverflowMenuItemFocus, hasDivider = false, href, isDelete = false, index, itemText = "Provide itemText", onClick = () => {}, onKeyDown = () => {}, requireTitle, title, wrapperClassName, ...rest } = props;
|
|
27
27
|
const prefix = usePrefix();
|
|
28
28
|
function setTabFocus(evt) {
|
|
29
29
|
if (match(evt, ArrowDown)) handleOverflowMenuItemFocus?.({
|
|
@@ -47,13 +47,14 @@ const OverflowMenuItem = forwardRef((props, ref) => {
|
|
|
47
47
|
[`${prefix}--overflow-menu-options__option--disabled`]: disabled
|
|
48
48
|
}, wrapperClassName);
|
|
49
49
|
const TagToUse = href ? "a" : "button";
|
|
50
|
+
const hasDangerDescription = isDelete && Boolean(dangerDescription);
|
|
50
51
|
const assistiveId = useId("danger-description");
|
|
51
52
|
const OverflowMenuItemContent = (() => {
|
|
52
53
|
if (typeof itemText !== "string") return itemText;
|
|
53
54
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
54
55
|
className: `${prefix}--overflow-menu-options__option-content`,
|
|
55
56
|
children: itemText
|
|
56
|
-
}),
|
|
57
|
+
}), hasDangerDescription && /* @__PURE__ */ jsx("span", {
|
|
57
58
|
id: assistiveId,
|
|
58
59
|
className: `${prefix}--visually-hidden`,
|
|
59
60
|
children: dangerDescription
|
|
@@ -192,8 +192,12 @@ export interface TabListProps extends DivAttributes {
|
|
|
192
192
|
* on component rerender
|
|
193
193
|
*/
|
|
194
194
|
scrollIntoView?: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Specify the size of the tabs.
|
|
197
|
+
*/
|
|
198
|
+
size?: 'sm' | 'md' | 'lg';
|
|
195
199
|
}
|
|
196
|
-
declare function TabList({ activation, 'aria-label': label, children, className: customClassName, contained, fullWidth, iconSize, leftOverflowButtonProps, light, rightOverflowButtonProps, scrollDebounceWait, scrollIntoView, ...rest }: TabListProps): import("react/jsx-runtime").JSX.Element;
|
|
200
|
+
declare function TabList({ activation, 'aria-label': label, children, className: customClassName, contained, fullWidth, iconSize, leftOverflowButtonProps, light, rightOverflowButtonProps, scrollDebounceWait, scrollIntoView, size, ...rest }: TabListProps): import("react/jsx-runtime").JSX.Element;
|
|
197
201
|
declare namespace TabList {
|
|
198
202
|
var propTypes: {
|
|
199
203
|
/**
|
|
@@ -144,7 +144,7 @@ function getNextIndexVertical(event, total, index) {
|
|
|
144
144
|
default: return index;
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
function TabList({ activation = "automatic", "aria-label": label, children, className: customClassName, contained = false, fullWidth = false, iconSize, leftOverflowButtonProps, light, rightOverflowButtonProps, scrollDebounceWait = 200, scrollIntoView, ...rest }) {
|
|
147
|
+
function TabList({ activation = "automatic", "aria-label": label, children, className: customClassName, contained = false, fullWidth = false, iconSize, leftOverflowButtonProps, light, rightOverflowButtonProps, scrollDebounceWait = 200, scrollIntoView, size, ...rest }) {
|
|
148
148
|
const { activeIndex, selectedIndex, setSelectedIndex, setActiveIndex, dismissable } = React.useContext(TabsContext);
|
|
149
149
|
const prefix = usePrefix();
|
|
150
150
|
const ref = useRef(null);
|
|
@@ -161,6 +161,7 @@ function TabList({ activation = "automatic", "aria-label": label, children, clas
|
|
|
161
161
|
[`${prefix}--tabs__icon--default`]: iconSize === "default",
|
|
162
162
|
[`${prefix}--tabs__icon--lg`]: iconSize === "lg",
|
|
163
163
|
[`${prefix}--layout--size-lg`]: iconSize === "lg",
|
|
164
|
+
[`${prefix}--layout--size-${size}`]: size && contained && !hasSecondaryLabelTabs,
|
|
164
165
|
[`${prefix}--tabs--tall`]: hasSecondaryLabelTabs,
|
|
165
166
|
[`${prefix}--tabs--full-width`]: distributeWidth,
|
|
166
167
|
[`${prefix}--tabs--dismissable`]: dismissable
|
|
@@ -20,7 +20,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
20
20
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
21
21
|
* LICENSE file in the root directory of this source tree.
|
|
22
22
|
*/
|
|
23
|
-
const ButtonBase = react.default.forwardRef(function ButtonBase({ as, children, className, dangerDescription = "
|
|
23
|
+
const ButtonBase = react.default.forwardRef(function ButtonBase({ as, children, className, dangerDescription = "", disabled = false, hasIconOnly = false, href, iconDescription, isExpressive = false, isSelected, kind = "primary", onBlur, onClick, onFocus, onMouseEnter, onMouseLeave, renderIcon: ButtonImageElement, size, tabIndex, type = "button", ...rest }, ref) {
|
|
24
24
|
const prefix = require_usePrefix.usePrefix();
|
|
25
25
|
const commonProps = {
|
|
26
26
|
tabIndex,
|
|
@@ -46,23 +46,23 @@ const ButtonBase = react.default.forwardRef(function ButtonBase({ as, children,
|
|
|
46
46
|
className: `${prefix}--btn__icon`,
|
|
47
47
|
"aria-hidden": "true"
|
|
48
48
|
});
|
|
49
|
-
const
|
|
49
|
+
const hasDangerDescription = [
|
|
50
50
|
"danger",
|
|
51
51
|
"danger--tertiary",
|
|
52
52
|
"danger--ghost"
|
|
53
|
-
];
|
|
53
|
+
].includes(kind) && Boolean(dangerDescription);
|
|
54
54
|
let component = "button";
|
|
55
55
|
const assistiveId = require_useId.useId("danger-description");
|
|
56
56
|
const { "aria-pressed": ariaPressed, "aria-describedby": ariaDescribedBy } = rest;
|
|
57
57
|
let otherProps = {
|
|
58
58
|
disabled,
|
|
59
59
|
type,
|
|
60
|
-
"aria-describedby":
|
|
60
|
+
"aria-describedby": hasDangerDescription ? assistiveId : ariaDescribedBy || void 0,
|
|
61
61
|
"aria-pressed": ariaPressed ?? (hasIconOnly && kind === "ghost" ? isSelected : void 0)
|
|
62
62
|
};
|
|
63
63
|
const anchorProps = { href };
|
|
64
64
|
let assistiveText = null;
|
|
65
|
-
if (
|
|
65
|
+
if (hasDangerDescription) assistiveText = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
66
66
|
id: assistiveId,
|
|
67
67
|
className: `${prefix}--visually-hidden`,
|
|
68
68
|
children: dangerDescription
|
|
@@ -36,6 +36,11 @@ export interface ModalFooterProps {
|
|
|
36
36
|
* Note that this prop is not applied if you render primary/danger button by yourself
|
|
37
37
|
*/
|
|
38
38
|
danger?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Specify the message read by screen readers for the danger primary button.
|
|
41
|
+
* Defaults to an empty string; provide localized text to opt in.
|
|
42
|
+
*/
|
|
43
|
+
dangerDescription?: string;
|
|
39
44
|
/**
|
|
40
45
|
* The `ref` callback for the primary button.
|
|
41
46
|
*/
|
|
@@ -65,7 +65,7 @@ SecondaryButtonSet.propTypes = {
|
|
|
65
65
|
},
|
|
66
66
|
secondaryClassName: prop_types.default.string
|
|
67
67
|
};
|
|
68
|
-
const ModalFooter = react.default.forwardRef(function ModalFooter({ children, className: customClassName, closeModal = require_noopFn.noopFn, danger, inputref, onRequestClose = require_noopFn.noopFn, onRequestSubmit = require_noopFn.noopFn, primaryButtonDisabled, primaryButtonText, primaryClassName, secondaryButtonText, secondaryButtons, secondaryClassName, loadingStatus = "inactive", loadingDescription, loadingIconDescription, onLoadingSuccess = require_noopFn.noopFn, ...rest }, ref) {
|
|
68
|
+
const ModalFooter = react.default.forwardRef(function ModalFooter({ children, className: customClassName, closeModal = require_noopFn.noopFn, danger, dangerDescription = "", inputref, onRequestClose = require_noopFn.noopFn, onRequestSubmit = require_noopFn.noopFn, primaryButtonDisabled, primaryButtonText, primaryClassName, secondaryButtonText, secondaryButtons, secondaryClassName, loadingStatus = "inactive", loadingDescription, loadingIconDescription, onLoadingSuccess = require_noopFn.noopFn, ...rest }, ref) {
|
|
69
69
|
const prefix = require_usePrefix.usePrefix();
|
|
70
70
|
const footerClass = (0, classnames.default)(`${prefix}--modal-footer`, customClassName, Array.isArray(secondaryButtons) && secondaryButtons.length === 2 ? `${prefix}--modal-footer--three-button` : null);
|
|
71
71
|
const primaryButtonClass = (0, classnames.default)(primaryClassName, loadingStatus !== "inactive" ? `${prefix}--btn--loading` : null);
|
|
@@ -89,6 +89,7 @@ const ModalFooter = react.default.forwardRef(function ModalFooter({ children, cl
|
|
|
89
89
|
onClick: onRequestSubmit,
|
|
90
90
|
className: primaryButtonClass,
|
|
91
91
|
disabled: loadingActive || primaryButtonDisabled,
|
|
92
|
+
dangerDescription,
|
|
92
93
|
kind: danger ? "danger" : "primary",
|
|
93
94
|
ref: inputref,
|
|
94
95
|
children: loadingStatus === "inactive" ? primaryButtonText : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$2.default, {
|
|
@@ -108,6 +109,7 @@ ModalFooter.propTypes = {
|
|
|
108
109
|
className: prop_types.default.string,
|
|
109
110
|
closeModal: prop_types.default.func,
|
|
110
111
|
danger: prop_types.default.bool,
|
|
112
|
+
dangerDescription: prop_types.default.string,
|
|
111
113
|
inputref: prop_types.default.oneOfType([prop_types.default.func, prop_types.default.shape({ current: prop_types.default.any })]),
|
|
112
114
|
loadingDescription: prop_types.default.string,
|
|
113
115
|
loadingIconDescription: prop_types.default.string,
|
|
@@ -232,6 +232,11 @@ interface DialogFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
232
232
|
* Specify whether the Dialog is for dangerous actions
|
|
233
233
|
*/
|
|
234
234
|
danger?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Specify the message read by screen readers for the danger primary button.
|
|
237
|
+
* Defaults to an empty string; provide localized text to opt in.
|
|
238
|
+
*/
|
|
239
|
+
dangerDescription?: string;
|
|
235
240
|
/**
|
|
236
241
|
* Specify loading status
|
|
237
242
|
*/
|
|
@@ -252,7 +252,7 @@ DialogBody.propTypes = {
|
|
|
252
252
|
className: prop_types.default.string,
|
|
253
253
|
hasScrollingContent: prop_types.default.bool
|
|
254
254
|
};
|
|
255
|
-
const DialogFooter = react.default.forwardRef(({ children, className, onRequestClose = require_noopFn.noopFn, onSecondarySubmit, onRequestSubmit = require_noopFn.noopFn, primaryButtonText = "Save", primaryButtonDisabled = false, secondaryButtonText = "Cancel", secondaryButtons, loadingStatus = "inactive", loadingDescription, loadingIconDescription, onLoadingSuccess = require_noopFn.noopFn, danger = false, ...rest }, ref) => {
|
|
255
|
+
const DialogFooter = react.default.forwardRef(({ children, className, onRequestClose = require_noopFn.noopFn, onSecondarySubmit, onRequestSubmit = require_noopFn.noopFn, primaryButtonText = "Save", primaryButtonDisabled = false, secondaryButtonText = "Cancel", secondaryButtons, loadingStatus = "inactive", loadingDescription, loadingIconDescription, onLoadingSuccess = require_noopFn.noopFn, danger = false, dangerDescription = "", ...rest }, ref) => {
|
|
256
256
|
const prefix = require_usePrefix.usePrefix();
|
|
257
257
|
const button = (0, react.useRef)(null);
|
|
258
258
|
const { isOpen } = (0, react.useContext)(DialogContext);
|
|
@@ -300,6 +300,7 @@ const DialogFooter = react.default.forwardRef(({ children, className, onRequestC
|
|
|
300
300
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$1.default, {
|
|
301
301
|
className: primaryButtonClass,
|
|
302
302
|
kind: danger ? "danger" : "primary",
|
|
303
|
+
dangerDescription,
|
|
303
304
|
disabled: loadingActive || primaryButtonDisabled,
|
|
304
305
|
onClick: onRequestSubmit,
|
|
305
306
|
ref: button,
|
|
@@ -337,6 +338,7 @@ DialogFooter.propTypes = {
|
|
|
337
338
|
return null;
|
|
338
339
|
},
|
|
339
340
|
danger: prop_types.default.bool,
|
|
341
|
+
dangerDescription: prop_types.default.string,
|
|
340
342
|
loadingStatus: prop_types.default.oneOf([
|
|
341
343
|
"inactive",
|
|
342
344
|
"active",
|
|
@@ -33,7 +33,7 @@ let _floating_ui_react = require("@floating-ui/react");
|
|
|
33
33
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
34
34
|
* LICENSE file in the root directory of this source tree.
|
|
35
35
|
*/
|
|
36
|
-
const MenuItem = (0, react.forwardRef)(function MenuItem({ children, className, dangerDescription = "
|
|
36
|
+
const MenuItem = (0, react.forwardRef)(function MenuItem({ children, className, dangerDescription = "", disabled, kind = "default", label, onClick, renderIcon: IconElement, shortcut, ...rest }, forwardRef) {
|
|
37
37
|
const [submenuOpen, setSubmenuOpen] = (0, react.useState)(false);
|
|
38
38
|
const [rtl, setRtl] = (0, react.useState)(false);
|
|
39
39
|
const { refs, floatingStyles, context: floatingContext } = (0, _floating_ui_react.useFloating)({
|
|
@@ -71,6 +71,7 @@ const MenuItem = (0, react.forwardRef)(function MenuItem({ children, className,
|
|
|
71
71
|
const hasChildren = react.default.Children.toArray(children).length > 0;
|
|
72
72
|
const isDisabled = disabled && !hasChildren;
|
|
73
73
|
const isDanger = kind === "danger" && !hasChildren;
|
|
74
|
+
const hasDangerDescription = isDanger && Boolean(dangerDescription);
|
|
74
75
|
function registerItem() {
|
|
75
76
|
context.dispatch({
|
|
76
77
|
type: "registerItem",
|
|
@@ -173,7 +174,7 @@ const MenuItem = (0, react.forwardRef)(function MenuItem({ children, className,
|
|
|
173
174
|
className: `${prefix}--menu-item__label`,
|
|
174
175
|
children: label
|
|
175
176
|
}),
|
|
176
|
-
|
|
177
|
+
hasDangerDescription && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
177
178
|
id: assistiveId,
|
|
178
179
|
className: `${prefix}--visually-hidden`,
|
|
179
180
|
children: dangerDescription
|
|
@@ -38,6 +38,11 @@ export interface ModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
38
38
|
* Specify whether the Modal is for dangerous actions
|
|
39
39
|
*/
|
|
40
40
|
danger?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Specify the message read by screen readers for the danger primary button.
|
|
43
|
+
* Defaults to an empty string; provide localized text to opt in.
|
|
44
|
+
*/
|
|
45
|
+
dangerDescription?: string;
|
|
41
46
|
/**
|
|
42
47
|
* **Experimental**: Provide a decorator component to be rendered inside the `Modal` component
|
|
43
48
|
*/
|
|
@@ -77,7 +77,7 @@ const Modal = react.default.forwardRef(function Modal({ open, ...props }, ref) {
|
|
|
77
77
|
...props
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
|
-
const ModalDialog = react.default.forwardRef(function ModalDialog({ "aria-label": ariaLabelProp, children, className, decorator, modalHeading = "", modalLabel = "", modalAriaLabel, passiveModal = false, secondaryButtonText, primaryButtonText, open: externalOpen, onRequestClose = require_noopFn.noopFn, onRequestSubmit = require_noopFn.noopFn, onSecondarySubmit, primaryButtonDisabled = false, danger, alert, secondaryButtons, selectorPrimaryFocus = "[data-modal-primary-focus]", selectorsFloatingMenus, shouldSubmitOnEnter, size, hasScrollingContent = false, closeButtonLabel = "Close", preventCloseOnClickOutside, isFullWidth, launcherButtonRef, loadingStatus = "inactive", loadingDescription, loadingIconDescription, onLoadingSuccess = require_noopFn.noopFn, slug, ...rest }, ref) {
|
|
80
|
+
const ModalDialog = react.default.forwardRef(function ModalDialog({ "aria-label": ariaLabelProp, children, className, decorator, modalHeading = "", modalLabel = "", modalAriaLabel, passiveModal = false, secondaryButtonText, primaryButtonText, open: externalOpen, onRequestClose = require_noopFn.noopFn, onRequestSubmit = require_noopFn.noopFn, onSecondarySubmit, primaryButtonDisabled = false, danger, dangerDescription = "", alert, secondaryButtons, selectorPrimaryFocus = "[data-modal-primary-focus]", selectorsFloatingMenus, shouldSubmitOnEnter, size, hasScrollingContent = false, closeButtonLabel = "Close", preventCloseOnClickOutside, isFullWidth, launcherButtonRef, loadingStatus = "inactive", loadingDescription, loadingIconDescription, onLoadingSuccess = require_noopFn.noopFn, slug, ...rest }, ref) {
|
|
81
81
|
const prefix = require_usePrefix.usePrefix();
|
|
82
82
|
const button = (0, react.useRef)(null);
|
|
83
83
|
const secondaryButton = (0, react.useRef)(null);
|
|
@@ -366,6 +366,7 @@ const ModalDialog = react.default.forwardRef(function ModalDialog({ "aria-label"
|
|
|
366
366
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$2.default, {
|
|
367
367
|
className: primaryButtonClass,
|
|
368
368
|
kind: danger ? "danger" : "primary",
|
|
369
|
+
dangerDescription,
|
|
369
370
|
disabled: loadingActive || primaryButtonDisabled,
|
|
370
371
|
onClick: onRequestSubmit,
|
|
371
372
|
ref: button,
|
|
@@ -442,6 +443,7 @@ const ModalDialog = react.default.forwardRef(function ModalDialog({ "aria-label"
|
|
|
442
443
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$2.default, {
|
|
443
444
|
className: primaryButtonClass,
|
|
444
445
|
kind: danger ? "danger" : "primary",
|
|
446
|
+
dangerDescription,
|
|
445
447
|
disabled: loadingActive || primaryButtonDisabled,
|
|
446
448
|
onClick: onRequestSubmit,
|
|
447
449
|
ref: button,
|
|
@@ -484,6 +486,7 @@ Modal.propTypes = {
|
|
|
484
486
|
className: prop_types.default.string,
|
|
485
487
|
closeButtonLabel: prop_types.default.string,
|
|
486
488
|
danger: prop_types.default.bool,
|
|
489
|
+
dangerDescription: prop_types.default.string,
|
|
487
490
|
decorator: prop_types.default.node,
|
|
488
491
|
hasScrollingContent: prop_types.default.bool,
|
|
489
492
|
id: prop_types.default.string,
|
|
@@ -27,7 +27,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
27
27
|
* LICENSE file in the root directory of this source tree.
|
|
28
28
|
*/
|
|
29
29
|
const OverflowMenuItem = (0, react.forwardRef)((props, ref) => {
|
|
30
|
-
const { className, closeMenu, dangerDescription = "
|
|
30
|
+
const { className, closeMenu, dangerDescription = "", disabled = false, handleOverflowMenuItemFocus, hasDivider = false, href, isDelete = false, index, itemText = "Provide itemText", onClick = () => {}, onKeyDown = () => {}, requireTitle, title, wrapperClassName, ...rest } = props;
|
|
31
31
|
const prefix = require_usePrefix.usePrefix();
|
|
32
32
|
function setTabFocus(evt) {
|
|
33
33
|
if (require_match.match(evt, require_keys.ArrowDown)) handleOverflowMenuItemFocus?.({
|
|
@@ -51,13 +51,14 @@ const OverflowMenuItem = (0, react.forwardRef)((props, ref) => {
|
|
|
51
51
|
[`${prefix}--overflow-menu-options__option--disabled`]: disabled
|
|
52
52
|
}, wrapperClassName);
|
|
53
53
|
const TagToUse = href ? "a" : "button";
|
|
54
|
+
const hasDangerDescription = isDelete && Boolean(dangerDescription);
|
|
54
55
|
const assistiveId = require_useId.useId("danger-description");
|
|
55
56
|
const OverflowMenuItemContent = (() => {
|
|
56
57
|
if (typeof itemText !== "string") return itemText;
|
|
57
58
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
58
59
|
className: `${prefix}--overflow-menu-options__option-content`,
|
|
59
60
|
children: itemText
|
|
60
|
-
}),
|
|
61
|
+
}), hasDangerDescription && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
61
62
|
id: assistiveId,
|
|
62
63
|
className: `${prefix}--visually-hidden`,
|
|
63
64
|
children: dangerDescription
|
|
@@ -192,8 +192,12 @@ export interface TabListProps extends DivAttributes {
|
|
|
192
192
|
* on component rerender
|
|
193
193
|
*/
|
|
194
194
|
scrollIntoView?: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Specify the size of the tabs.
|
|
197
|
+
*/
|
|
198
|
+
size?: 'sm' | 'md' | 'lg';
|
|
195
199
|
}
|
|
196
|
-
declare function TabList({ activation, 'aria-label': label, children, className: customClassName, contained, fullWidth, iconSize, leftOverflowButtonProps, light, rightOverflowButtonProps, scrollDebounceWait, scrollIntoView, ...rest }: TabListProps): import("react/jsx-runtime").JSX.Element;
|
|
200
|
+
declare function TabList({ activation, 'aria-label': label, children, className: customClassName, contained, fullWidth, iconSize, leftOverflowButtonProps, light, rightOverflowButtonProps, scrollDebounceWait, scrollIntoView, size, ...rest }: TabListProps): import("react/jsx-runtime").JSX.Element;
|
|
197
201
|
declare namespace TabList {
|
|
198
202
|
var propTypes: {
|
|
199
203
|
/**
|
|
@@ -148,7 +148,7 @@ function getNextIndexVertical(event, total, index) {
|
|
|
148
148
|
default: return index;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
function TabList({ activation = "automatic", "aria-label": label, children, className: customClassName, contained = false, fullWidth = false, iconSize, leftOverflowButtonProps, light, rightOverflowButtonProps, scrollDebounceWait = 200, scrollIntoView, ...rest }) {
|
|
151
|
+
function TabList({ activation = "automatic", "aria-label": label, children, className: customClassName, contained = false, fullWidth = false, iconSize, leftOverflowButtonProps, light, rightOverflowButtonProps, scrollDebounceWait = 200, scrollIntoView, size, ...rest }) {
|
|
152
152
|
const { activeIndex, selectedIndex, setSelectedIndex, setActiveIndex, dismissable } = react.default.useContext(TabsContext);
|
|
153
153
|
const prefix = require_usePrefix.usePrefix();
|
|
154
154
|
const ref = (0, react.useRef)(null);
|
|
@@ -165,6 +165,7 @@ function TabList({ activation = "automatic", "aria-label": label, children, clas
|
|
|
165
165
|
[`${prefix}--tabs__icon--default`]: iconSize === "default",
|
|
166
166
|
[`${prefix}--tabs__icon--lg`]: iconSize === "lg",
|
|
167
167
|
[`${prefix}--layout--size-lg`]: iconSize === "lg",
|
|
168
|
+
[`${prefix}--layout--size-${size}`]: size && contained && !hasSecondaryLabelTabs,
|
|
168
169
|
[`${prefix}--tabs--tall`]: hasSecondaryLabelTabs,
|
|
169
170
|
[`${prefix}--tabs--full-width`]: distributeWidth,
|
|
170
171
|
[`${prefix}--tabs--dismissable`]: dismissable
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/react",
|
|
3
3
|
"description": "React components for the Carbon Design System",
|
|
4
|
-
"version": "1.108.0
|
|
4
|
+
"version": "1.108.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@babel/runtime": "^7.27.3",
|
|
55
55
|
"@carbon/feature-flags": "^1.3.0",
|
|
56
|
-
"@carbon/icons-react": "^11.81.0
|
|
57
|
-
"@carbon/layout": "^11.53.0
|
|
58
|
-
"@carbon/styles": "^1.107.0
|
|
59
|
-
"@carbon/utilities": "^0.20.0
|
|
56
|
+
"@carbon/icons-react": "^11.81.0",
|
|
57
|
+
"@carbon/layout": "^11.53.0",
|
|
58
|
+
"@carbon/styles": "^1.107.0",
|
|
59
|
+
"@carbon/utilities": "^0.20.0",
|
|
60
60
|
"@floating-ui/react": "^0.27.4",
|
|
61
61
|
"@ibm/telemetry-js": "^1.5.0",
|
|
62
62
|
"classnames": "2.5.1",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@babel/preset-react": "^7.27.1",
|
|
80
80
|
"@babel/preset-typescript": "^7.27.1",
|
|
81
81
|
"@carbon/test-utils": "^10.41.0",
|
|
82
|
-
"@carbon/themes": "^11.74.0
|
|
82
|
+
"@carbon/themes": "^11.74.0",
|
|
83
83
|
"@figma/code-connect": "^1.4.2",
|
|
84
84
|
"@stackblitz/sdk": "^1.11.0",
|
|
85
85
|
"@storybook/addon-a11y": "^10.3.5",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"stream-browserify": "^3.0.0",
|
|
111
111
|
"tinyclip": "^0.1.12",
|
|
112
112
|
"tsdown": "^0.21.0",
|
|
113
|
-
"typescript-config-carbon": "^0.10.0
|
|
113
|
+
"typescript-config-carbon": "^0.10.0",
|
|
114
114
|
"use-sync-external-store": "^1.5.0",
|
|
115
115
|
"vite": "^7.1.2"
|
|
116
116
|
},
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"**/*.scss",
|
|
126
126
|
"**/*.css"
|
|
127
127
|
],
|
|
128
|
-
"gitHead": "
|
|
128
|
+
"gitHead": "2d98f4ee9914fa44acba58f62599c3f5382acad0"
|
|
129
129
|
}
|