@carbon/react 1.114.0-rc.0 → 1.114.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.
Files changed (101) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +984 -984
  2. package/es/components/Card/Card.d.ts +48 -0
  3. package/es/components/Card/Card.js +148 -0
  4. package/es/components/Card/Card.types.d.ts +88 -0
  5. package/es/components/Card/CardAction.d.ts +37 -0
  6. package/es/components/Card/CardAction.js +32 -0
  7. package/es/components/Card/CardActions.d.ts +30 -0
  8. package/es/components/Card/CardActions.js +93 -0
  9. package/es/components/Card/CardBody.d.ts +11 -0
  10. package/es/components/Card/CardBody.js +34 -0
  11. package/es/components/Card/CardContext.d.ts +17 -0
  12. package/es/components/Card/CardContext.js +31 -0
  13. package/es/components/Card/CardFooter.d.ts +11 -0
  14. package/es/components/Card/CardFooter.js +34 -0
  15. package/es/components/Card/CardHeader.d.ts +11 -0
  16. package/es/components/Card/CardHeader.js +44 -0
  17. package/es/components/Card/CardHeaderMedia.d.ts +21 -0
  18. package/es/components/Card/CardHeaderMedia.js +24 -0
  19. package/es/components/Card/CardMedia.d.ts +35 -0
  20. package/es/components/Card/CardMedia.js +42 -0
  21. package/es/components/Card/CardTitle.d.ts +72 -0
  22. package/es/components/Card/CardTitle.js +86 -0
  23. package/es/components/Card/CardTitleMedia.d.ts +23 -0
  24. package/es/components/Card/CardTitleMedia.js +36 -0
  25. package/es/components/Card/_story-assets/data.d.ts +6 -0
  26. package/es/components/Card/_story-assets/options.d.ts +47 -0
  27. package/es/components/Card/index.d.ts +8 -0
  28. package/es/components/Card/index.js +33 -0
  29. package/es/components/Checkbox/Checkbox.js +1 -1
  30. package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
  31. package/es/components/ComboBox/ComboBox.js +2 -2
  32. package/es/components/ComboButton/index.js +1 -1
  33. package/es/components/ComposedModal/ComposedModal.js +1 -1
  34. package/es/components/DatePicker/DatePicker.js +1 -1
  35. package/es/components/DatePickerInput/DatePickerInput.js +1 -1
  36. package/es/components/Dropdown/Dropdown.js +2 -2
  37. package/es/components/ExpandableSearch/ExpandableSearch.js +1 -1
  38. package/es/components/MenuButton/index.js +1 -1
  39. package/es/components/MultiSelect/FilterableMultiSelect.js +2 -2
  40. package/es/components/MultiSelect/MultiSelect.js +2 -2
  41. package/es/components/NumberInput/NumberInput.js +2 -2
  42. package/es/components/OverflowMenu/next/index.js +1 -1
  43. package/es/components/RadioButton/RadioButton.js +1 -1
  44. package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  45. package/es/components/Select/Select.js +1 -1
  46. package/es/components/Tag/SelectableTag.js +1 -1
  47. package/es/components/TextArea/TextArea.js +1 -1
  48. package/es/components/TextInput/TextInput.js +1 -1
  49. package/es/index.d.ts +1 -0
  50. package/es/index.js +6 -5
  51. package/lib/components/Card/Card.d.ts +48 -0
  52. package/lib/components/Card/Card.js +161 -0
  53. package/lib/components/Card/Card.types.d.ts +88 -0
  54. package/lib/components/Card/CardAction.d.ts +37 -0
  55. package/lib/components/Card/CardAction.js +41 -0
  56. package/lib/components/Card/CardActions.d.ts +30 -0
  57. package/lib/components/Card/CardActions.js +96 -0
  58. package/lib/components/Card/CardBody.d.ts +11 -0
  59. package/lib/components/Card/CardBody.js +37 -0
  60. package/lib/components/Card/CardContext.d.ts +17 -0
  61. package/lib/components/Card/CardContext.js +32 -0
  62. package/lib/components/Card/CardFooter.d.ts +11 -0
  63. package/lib/components/Card/CardFooter.js +37 -0
  64. package/lib/components/Card/CardHeader.d.ts +11 -0
  65. package/lib/components/Card/CardHeader.js +47 -0
  66. package/lib/components/Card/CardHeaderMedia.d.ts +21 -0
  67. package/lib/components/Card/CardHeaderMedia.js +33 -0
  68. package/lib/components/Card/CardMedia.d.ts +35 -0
  69. package/lib/components/Card/CardMedia.js +51 -0
  70. package/lib/components/Card/CardTitle.d.ts +72 -0
  71. package/lib/components/Card/CardTitle.js +89 -0
  72. package/lib/components/Card/CardTitleMedia.d.ts +23 -0
  73. package/lib/components/Card/CardTitleMedia.js +39 -0
  74. package/lib/components/Card/_story-assets/data.d.ts +6 -0
  75. package/lib/components/Card/_story-assets/options.d.ts +47 -0
  76. package/lib/components/Card/index.d.ts +8 -0
  77. package/lib/components/Card/index.js +48 -0
  78. package/lib/components/Checkbox/Checkbox.js +1 -1
  79. package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
  80. package/lib/components/ComboBox/ComboBox.js +2 -2
  81. package/lib/components/ComboButton/index.js +1 -1
  82. package/lib/components/ComposedModal/ComposedModal.js +1 -1
  83. package/lib/components/DatePicker/DatePicker.js +1 -1
  84. package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
  85. package/lib/components/Dropdown/Dropdown.js +2 -2
  86. package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -1
  87. package/lib/components/MenuButton/index.js +1 -1
  88. package/lib/components/MultiSelect/FilterableMultiSelect.js +2 -2
  89. package/lib/components/MultiSelect/MultiSelect.js +2 -2
  90. package/lib/components/NumberInput/NumberInput.js +2 -2
  91. package/lib/components/OverflowMenu/next/index.js +1 -1
  92. package/lib/components/RadioButton/RadioButton.js +1 -1
  93. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  94. package/lib/components/Select/Select.js +1 -1
  95. package/lib/components/Tag/SelectableTag.js +1 -1
  96. package/lib/components/TextArea/TextArea.js +1 -1
  97. package/lib/components/TextInput/TextInput.js +1 -1
  98. package/lib/index.d.ts +1 -0
  99. package/lib/index.js +54 -47
  100. package/package.json +9 -9
  101. package/telemetry.yml +16 -0
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Copyright IBM Corp. 2026
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 React from 'react';
8
+ import { CardProps } from './Card.types';
9
+ import { CardHeader } from './CardHeader';
10
+ import { CardBody } from './CardBody';
11
+ import { CardFooter } from './CardFooter';
12
+ import { CardHeaderMedia } from './CardHeaderMedia';
13
+ import { CardMedia } from './CardMedia';
14
+ import { CardTitle } from './CardTitle';
15
+ import { CardTitleMedia } from './CardTitleMedia';
16
+ import { CardActions } from './CardActions';
17
+ import { CardAction } from './CardAction';
18
+ export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>> & {
19
+ Header: React.ForwardRefExoticComponent<import("./Card.types").CardBaseProps & React.RefAttributes<HTMLDivElement>>;
20
+ Body: React.ForwardRefExoticComponent<import("./Card.types").CardBaseProps & React.RefAttributes<HTMLDivElement>>;
21
+ Footer: React.ForwardRefExoticComponent<import("./Card.types").CardBaseProps & React.RefAttributes<HTMLDivElement>>;
22
+ HeaderMedia: {
23
+ ({ children, className, ...rest }: import("./CardHeaderMedia").CardHeaderMediaProps): import("react/jsx-runtime").JSX.Element;
24
+ displayName: string;
25
+ };
26
+ Media: {
27
+ ({ children, className, ratio, mediaWidth, ...rest }: import("./CardMedia").CardMediaProps): import("react/jsx-runtime").JSX.Element;
28
+ displayName: string;
29
+ };
30
+ Title: React.ForwardRefExoticComponent<import("./CardTitle").CardTitleProps & React.RefAttributes<HTMLDivElement>>;
31
+ TitleMedia: React.ForwardRefExoticComponent<import("./CardTitleMedia").CardTitleMediaProps & React.RefAttributes<HTMLDivElement>>;
32
+ Actions: {
33
+ ({ children, className, overflowMenuLabel, ...rest }: import("./CardActions").CardActionsProps): import("react/jsx-runtime").JSX.Element;
34
+ displayName: string;
35
+ };
36
+ Action: {
37
+ ({ children, className, ...rest }: import("./CardAction").CardActionProps): import("react/jsx-runtime").JSX.Element;
38
+ displayName: string;
39
+ };
40
+ };
41
+ export { Card as default, CardHeader, CardBody, CardFooter, CardHeaderMedia, CardMedia, CardTitle, CardTitleMedia, CardActions, CardAction, };
42
+ export type { CardProps, CardHeaderProps, CardBodyProps, CardFooterProps, } from './Card.types';
43
+ export type { CardHeaderMediaProps } from './CardHeaderMedia';
44
+ export type { CardMediaProps } from './CardMedia';
45
+ export type { CardTitleProps } from './CardTitle';
46
+ export type { CardTitleMediaProps } from './CardTitleMedia';
47
+ export type { CardActionsProps } from './CardActions';
48
+ export type { CardActionProps } from './CardAction';
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2026
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
+
8
+ import { usePrefix } from "../../internal/usePrefix.js";
9
+ import { AILabel } from "../AILabel/index.js";
10
+ import { CardContext } from "./CardContext.js";
11
+ import { CardHeader } from "./CardHeader.js";
12
+ import { CardBody } from "./CardBody.js";
13
+ import { CardFooter } from "./CardFooter.js";
14
+ import { CardHeaderMedia } from "./CardHeaderMedia.js";
15
+ import { CardMedia } from "./CardMedia.js";
16
+ import { CardTitle } from "./CardTitle.js";
17
+ import { CardTitleMedia } from "./CardTitleMedia.js";
18
+ import { CardActions } from "./CardActions.js";
19
+ import { CardAction } from "./CardAction.js";
20
+ import React, { forwardRef, isValidElement, useCallback, useMemo } from "react";
21
+ import cx from "classnames";
22
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
23
+ //#region src/components/Card/Card.tsx
24
+ /**
25
+ * Copyright IBM Corp. 2026
26
+ *
27
+ * This source code is licensed under the Apache-2.0 license found in the
28
+ * LICENSE file in the root directory of this source tree.
29
+ */
30
+ const componentName = "Card";
31
+ /**
32
+ * Card component - Root container for composable card
33
+ */
34
+ const CardComponent = forwardRef(({ clickable = false, onClick, onKeyDown, disabled = false, density = "productive", decorator, horizontal = false, className, children, ...rest }, ref) => {
35
+ const blockClass = `${usePrefix()}--card`;
36
+ const hasAILabel = useMemo(() => isValidElement(decorator) && decorator.type === AILabel, [decorator]);
37
+ const contextValue = useMemo(() => ({
38
+ clickable,
39
+ disabled,
40
+ decorator,
41
+ horizontal
42
+ }), [
43
+ clickable,
44
+ disabled,
45
+ decorator,
46
+ horizontal
47
+ ]);
48
+ const handleKeyDown = useCallback((event) => {
49
+ if (clickable && !disabled && (event.key === "Enter" || event.key === " ")) {
50
+ event.preventDefault();
51
+ onClick?.(event);
52
+ }
53
+ onKeyDown?.(event);
54
+ }, [
55
+ clickable,
56
+ disabled,
57
+ onClick,
58
+ onKeyDown
59
+ ]);
60
+ const handleClick = useCallback((event) => {
61
+ if (!disabled) onClick?.(event);
62
+ }, [disabled, onClick]);
63
+ const cardClasses = cx(blockClass, className, {
64
+ [`${blockClass}--clickable`]: clickable && !disabled,
65
+ [`${blockClass}--disabled`]: disabled,
66
+ [`${blockClass}--${density}`]: density,
67
+ [`${blockClass}--has-ai-label`]: hasAILabel,
68
+ [`${blockClass}--horizontal`]: horizontal
69
+ });
70
+ const cardProps = {
71
+ ...rest,
72
+ ref,
73
+ className: cardClasses,
74
+ ...clickable && {
75
+ role: "button",
76
+ tabIndex: disabled ? -1 : 0,
77
+ onClick: handleClick,
78
+ onKeyDown: handleKeyDown,
79
+ "aria-disabled": disabled
80
+ }
81
+ };
82
+ const { mediaChildren, contentChildren, mediaIsFirst } = useMemo(() => {
83
+ if (!horizontal) return {
84
+ mediaChildren: [],
85
+ contentChildren: [],
86
+ mediaIsFirst: false
87
+ };
88
+ const childArray = React.Children.toArray(children);
89
+ const isMedia = (child) => React.isValidElement(child) && child.type === CardMedia;
90
+ return {
91
+ mediaChildren: childArray.filter(isMedia),
92
+ contentChildren: childArray.filter((c) => !isMedia(c)),
93
+ mediaIsFirst: childArray.findIndex(isMedia) < childArray.findIndex((c) => !isMedia(c))
94
+ };
95
+ }, [children, horizontal]);
96
+ let renderedChildren = children;
97
+ if (horizontal) {
98
+ const contentWrapper = /* @__PURE__ */ jsx("div", {
99
+ className: `${blockClass}__content`,
100
+ children: contentChildren
101
+ });
102
+ renderedChildren = mediaIsFirst ? /* @__PURE__ */ jsxs(Fragment, { children: [mediaChildren, contentWrapper] }) : /* @__PURE__ */ jsxs(Fragment, { children: [contentWrapper, mediaChildren] });
103
+ }
104
+ return /* @__PURE__ */ jsx(CardContext.Provider, {
105
+ value: contextValue,
106
+ children: /* @__PURE__ */ jsx("div", {
107
+ ...cardProps,
108
+ children: renderedChildren
109
+ })
110
+ });
111
+ });
112
+ CardComponent.displayName = componentName;
113
+ /**
114
+ * -------
115
+ * Exports
116
+ * -------
117
+ */
118
+ const Header = CardHeader;
119
+ Header.displayName = "Card.Header";
120
+ const Body = CardBody;
121
+ Body.displayName = "Card.Body";
122
+ const Footer = CardFooter;
123
+ Footer.displayName = "Card.Footer";
124
+ const HeaderMedia = CardHeaderMedia;
125
+ HeaderMedia.displayName = "Card.HeaderMedia";
126
+ const Media = CardMedia;
127
+ Media.displayName = "Card.Media";
128
+ const Title = CardTitle;
129
+ Title.displayName = "Card.Title";
130
+ const TitleMedia = CardTitleMedia;
131
+ TitleMedia.displayName = "Card.TitleMedia";
132
+ const Actions = CardActions;
133
+ Actions.displayName = "Card.Actions";
134
+ const Action = CardAction;
135
+ Action.displayName = "Card.Action";
136
+ const Card = Object.assign(CardComponent, {
137
+ Header,
138
+ Body,
139
+ Footer,
140
+ HeaderMedia,
141
+ Media,
142
+ Title,
143
+ TitleMedia,
144
+ Actions,
145
+ Action
146
+ });
147
+ //#endregion
148
+ export { Card, Card as default, CardAction, CardActions, CardBody, CardFooter, CardHeader, CardHeaderMedia, CardMedia, CardTitle, CardTitleMedia };
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Copyright IBM Corp. 2026
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 { ReactNode } from 'react';
8
+ /**
9
+ * Base props shared across card components
10
+ */
11
+ export interface CardBaseProps {
12
+ /**
13
+ * Additional CSS class names
14
+ */
15
+ className?: string;
16
+ /**
17
+ * Card content
18
+ */
19
+ children?: ReactNode;
20
+ }
21
+ /**
22
+ * Props for the Card root component
23
+ */
24
+ export interface CardProps extends CardBaseProps {
25
+ /**
26
+ * Makes the entire card clickable
27
+ */
28
+ clickable?: boolean;
29
+ /**
30
+ * Click handler for clickable cards
31
+ */
32
+ onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
33
+ /**
34
+ * Keyboard event handler for clickable cards
35
+ */
36
+ onKeyDown?: (event: React.KeyboardEvent<HTMLDivElement>) => void;
37
+ /**
38
+ * Disables the card and all interactive elements
39
+ */
40
+ disabled?: boolean;
41
+ /**
42
+ * Density variant: productive uses heading-compact-02, expressive uses heading-03
43
+ */
44
+ density?: 'productive' | 'expressive';
45
+ /**
46
+ * Optional decorator component (typically AILabel from Carbon).
47
+ * Renders in the top-right corner of the card header with a blue gradient border.
48
+ */
49
+ decorator?: ReactNode;
50
+ /**
51
+ * When true, the card renders in a horizontal layout: media on the left,
52
+ * header/body/footer stacked vertically on the right.
53
+ */
54
+ horizontal?: boolean;
55
+ }
56
+ /**
57
+ * Props for CardHeader component
58
+ */
59
+ export type CardHeaderProps = CardBaseProps;
60
+ /**
61
+ * Props for CardBody component
62
+ */
63
+ export type CardBodyProps = CardBaseProps;
64
+ /**
65
+ * Props for CardFooter component
66
+ */
67
+ export type CardFooterProps = CardBaseProps;
68
+ /**
69
+ * Context value for Card
70
+ */
71
+ export interface CardContextValue {
72
+ /**
73
+ * Whether the card is clickable
74
+ */
75
+ clickable: boolean;
76
+ /**
77
+ * Whether the card is disabled
78
+ */
79
+ disabled: boolean;
80
+ /**
81
+ * Optional decorator component (typically AILabel) to be rendered by CardHeader
82
+ */
83
+ decorator?: ReactNode;
84
+ /**
85
+ * Whether the card is in horizontal layout mode
86
+ */
87
+ horizontal?: boolean;
88
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright IBM Corp. 2026
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 { ReactNode } from 'react';
8
+ export interface CardActionProps {
9
+ /**
10
+ * Provide the contents of the CardAction (typically a Button or IconButton).
11
+ * Wrapping content in CardAction opts into action-set layout: no footer
12
+ * padding, automatic top border, and stretch/fixed-width button behavior.
13
+ */
14
+ children?: ReactNode;
15
+ /**
16
+ * Provide an optional class to be applied to the containing node.
17
+ */
18
+ className?: string;
19
+ /**
20
+ * Label shown in the overflow menu when this action is hidden.
21
+ * If not provided, CardActions will attempt to read it from the
22
+ * direct child's props (label, iconDescription, or children text).
23
+ */
24
+ label?: string;
25
+ }
26
+ /**
27
+ * CardAction is a wrapper for interactive elements in the card footer.
28
+ * Its presence signals action-set layout to the footer (no padding, auto
29
+ * border, stretch behavior).
30
+ *
31
+ * Note: do not use CardAction inside a clickable card — clickable cards
32
+ * should not contain interactive elements (see usage guidelines).
33
+ */
34
+ export declare const CardAction: {
35
+ ({ children, className, ...rest }: CardActionProps): import("react/jsx-runtime").JSX.Element;
36
+ displayName: string;
37
+ };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2026
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
+
8
+ import { usePrefix } from "../../internal/usePrefix.js";
9
+ import "react";
10
+ import cx from "classnames";
11
+ import { jsx } from "react/jsx-runtime";
12
+ //#region src/components/Card/CardAction.tsx
13
+ const componentName = "CardAction";
14
+ /**
15
+ * CardAction is a wrapper for interactive elements in the card footer.
16
+ * Its presence signals action-set layout to the footer (no padding, auto
17
+ * border, stretch behavior).
18
+ *
19
+ * Note: do not use CardAction inside a clickable card — clickable cards
20
+ * should not contain interactive elements (see usage guidelines).
21
+ */
22
+ const CardAction = ({ children, className, ...rest }) => {
23
+ const prefix = usePrefix();
24
+ return /* @__PURE__ */ jsx("div", {
25
+ ...rest,
26
+ className: cx(`${prefix}--card__action`, className),
27
+ children
28
+ });
29
+ };
30
+ CardAction.displayName = componentName;
31
+ //#endregion
32
+ export { CardAction };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright IBM Corp. 2026
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 { ReactNode } from 'react';
8
+ export interface CardActionsProps {
9
+ /**
10
+ * Provide the contents of the CardActions (typically CardAction components).
11
+ */
12
+ children?: ReactNode;
13
+ /**
14
+ * Provide an optional class to be applied to the containing node.
15
+ */
16
+ className?: string;
17
+ /**
18
+ * Aria label for the overflow menu
19
+ */
20
+ overflowMenuLabel?: string;
21
+ }
22
+ /**
23
+ * CardActions is a container for action buttons in the card header.
24
+ * Positioned in the top-right corner with 8px gap between actions.
25
+ * When actions exceed 50% of available header space, overflow menu is shown.
26
+ */
27
+ export declare const CardActions: {
28
+ ({ children, className, overflowMenuLabel, ...rest }: CardActionsProps): import("react/jsx-runtime").JSX.Element;
29
+ displayName: string;
30
+ };
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2026
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
+
8
+ import { usePrefix } from "../../internal/usePrefix.js";
9
+ import { MenuItem } from "../Menu/MenuItem.js";
10
+ import { OverflowMenu } from "../OverflowMenu/next/index.js";
11
+ import React, { Children, useEffect, useMemo, useRef, useState } from "react";
12
+ import cx from "classnames";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ import { createOverflowHandler } from "@carbon/utilities";
15
+ //#region src/components/Card/CardActions.tsx
16
+ /**
17
+ * Copyright IBM Corp. 2026
18
+ *
19
+ * This source code is licensed under the Apache-2.0 license found in the
20
+ * LICENSE file in the root directory of this source tree.
21
+ */
22
+ const componentName = "CardActions";
23
+ /**
24
+ * CardActions is a container for action buttons in the card header.
25
+ * Positioned in the top-right corner with 8px gap between actions.
26
+ * When actions exceed 50% of available header space, overflow menu is shown.
27
+ */
28
+ const CardActions = ({ children, className, overflowMenuLabel = "More actions", ...rest }) => {
29
+ const blockClass = `${usePrefix()}--card`;
30
+ const containerRef = useRef(null);
31
+ const [hiddenItems, setHiddenItems] = useState([]);
32
+ const classes = cx(`${blockClass}__actions`, className);
33
+ const actionItems = useMemo(() => {
34
+ const items = [];
35
+ Children.forEach(children, (child, index) => {
36
+ if (React.isValidElement(child)) {
37
+ const actionProps = child.props;
38
+ const button = actionProps.children;
39
+ const buttonProps = React.isValidElement(button) ? button.props : null;
40
+ const label = actionProps.label ?? buttonProps?.label ?? buttonProps?.iconDescription ?? (typeof buttonProps?.children === "string" ? buttonProps.children : `Action ${index + 1}`);
41
+ const id = `${label}-${index}`;
42
+ items.push({
43
+ id,
44
+ element: child,
45
+ label
46
+ });
47
+ }
48
+ });
49
+ return items;
50
+ }, [children]);
51
+ useEffect(() => {
52
+ if (!containerRef.current || actionItems.length === 0) return;
53
+ const handler = createOverflowHandler({
54
+ container: containerRef.current,
55
+ onChange: (_visible, hidden) => {
56
+ const hiddenIds = hidden.map((el) => el.dataset.id);
57
+ setHiddenItems(actionItems.filter((item) => hiddenIds.includes(item.id)));
58
+ }
59
+ });
60
+ return () => handler.disconnect();
61
+ }, [actionItems]);
62
+ return /* @__PURE__ */ jsxs("div", {
63
+ ref: containerRef,
64
+ className: classes,
65
+ ...rest,
66
+ children: [actionItems.map((item) => /* @__PURE__ */ jsx("div", {
67
+ "data-id": item.id,
68
+ children: item.element
69
+ }, item.id)), /* @__PURE__ */ jsx("div", {
70
+ "data-offset": true,
71
+ "data-hidden": true,
72
+ "data-floating-menu-container": true,
73
+ style: { position: "relative" },
74
+ children: /* @__PURE__ */ jsx(OverflowMenu, {
75
+ size: "sm",
76
+ "aria-label": overflowMenuLabel,
77
+ children: hiddenItems.map((item) => /* @__PURE__ */ jsx(MenuItem, {
78
+ label: item.label || "Action",
79
+ onClick: () => {
80
+ const button = item.element.props.children;
81
+ if (button && React.isValidElement(button)) {
82
+ const buttonProps = button.props;
83
+ if (buttonProps.onClick) buttonProps.onClick();
84
+ }
85
+ }
86
+ }, item.id))
87
+ })
88
+ })]
89
+ });
90
+ };
91
+ CardActions.displayName = componentName;
92
+ //#endregion
93
+ export { CardActions };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright IBM Corp. 2026
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 React from 'react';
8
+ /**
9
+ * CardBody component - Body section of the card for free-form content
10
+ */
11
+ export declare const CardBody: React.ForwardRefExoticComponent<import("./Card.types").CardBaseProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2026
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
+
8
+ import { usePrefix } from "../../internal/usePrefix.js";
9
+ import { forwardRef } from "react";
10
+ import cx from "classnames";
11
+ import { jsx } from "react/jsx-runtime";
12
+ //#region src/components/Card/CardBody.tsx
13
+ /**
14
+ * Copyright IBM Corp. 2026
15
+ *
16
+ * This source code is licensed under the Apache-2.0 license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */
19
+ const componentName = "CardBody";
20
+ /**
21
+ * CardBody component - Body section of the card for free-form content
22
+ */
23
+ const CardBody = forwardRef(({ className, children, ...rest }, ref) => {
24
+ const bodyClasses = cx(`${usePrefix()}--card__body`, className);
25
+ return /* @__PURE__ */ jsx("div", {
26
+ ...rest,
27
+ ref,
28
+ className: bodyClasses,
29
+ children
30
+ });
31
+ });
32
+ CardBody.displayName = componentName;
33
+ //#endregion
34
+ export { CardBody };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright IBM Corp. 2026
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 { CardContextValue } from './Card.types';
8
+ /**
9
+ * Context for sharing Card state with child components
10
+ */
11
+ export declare const CardContext: import("react").Context<CardContextValue | undefined>;
12
+ /**
13
+ * Hook to access Card context
14
+ * @returns CardContextValue
15
+ * @throws Error if used outside of Card component
16
+ */
17
+ export declare const useCardContext: () => CardContextValue;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2026
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
+
8
+ import { createContext, useContext } from "react";
9
+ //#region src/components/Card/CardContext.tsx
10
+ /**
11
+ * Copyright IBM Corp. 2026
12
+ *
13
+ * This source code is licensed under the Apache-2.0 license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+ /**
17
+ * Context for sharing Card state with child components
18
+ */
19
+ const CardContext = createContext(void 0);
20
+ /**
21
+ * Hook to access Card context
22
+ * @returns CardContextValue
23
+ * @throws Error if used outside of Card component
24
+ */
25
+ const useCardContext = () => {
26
+ const context = useContext(CardContext);
27
+ if (!context) throw new Error("Card subcomponents must be used within a Card component");
28
+ return context;
29
+ };
30
+ //#endregion
31
+ export { CardContext, useCardContext };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright IBM Corp. 2026
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 React from 'react';
8
+ /**
9
+ * CardFooter component - Footer section of the card
10
+ */
11
+ export declare const CardFooter: React.ForwardRefExoticComponent<import("./Card.types").CardBaseProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2026
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
+
8
+ import { usePrefix } from "../../internal/usePrefix.js";
9
+ import { forwardRef } from "react";
10
+ import cx from "classnames";
11
+ import { jsx } from "react/jsx-runtime";
12
+ //#region src/components/Card/CardFooter.tsx
13
+ /**
14
+ * Copyright IBM Corp. 2026
15
+ *
16
+ * This source code is licensed under the Apache-2.0 license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */
19
+ const componentName = "CardFooter";
20
+ /**
21
+ * CardFooter component - Footer section of the card
22
+ */
23
+ const CardFooter = forwardRef(({ className, children, ...rest }, ref) => {
24
+ const footerClasses = cx(`${usePrefix()}--card__footer`, className);
25
+ return /* @__PURE__ */ jsx("div", {
26
+ ...rest,
27
+ ref,
28
+ className: footerClasses,
29
+ children
30
+ });
31
+ });
32
+ CardFooter.displayName = componentName;
33
+ //#endregion
34
+ export { CardFooter };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright IBM Corp. 2026
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 React from 'react';
8
+ /**
9
+ * CardHeader — header section of the card.
10
+ */
11
+ export declare const CardHeader: React.ForwardRefExoticComponent<import("./Card.types").CardBaseProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2026
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
+
8
+ import { usePrefix } from "../../internal/usePrefix.js";
9
+ import { useCardContext } from "./CardContext.js";
10
+ import { forwardRef, useCallback } from "react";
11
+ import cx from "classnames";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ //#region src/components/Card/CardHeader.tsx
14
+ /**
15
+ * Copyright IBM Corp. 2026
16
+ *
17
+ * This source code is licensed under the Apache-2.0 license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */
20
+ const componentName = "CardHeader";
21
+ /**
22
+ * CardHeader — header section of the card.
23
+ */
24
+ const CardHeader = forwardRef(({ className, children, ...rest }, ref) => {
25
+ const blockClass = `${usePrefix()}--card`;
26
+ const context = useCardContext();
27
+ const handleDecoratorClick = useCallback((e) => e.stopPropagation(), []);
28
+ const handleDecoratorKeyDown = useCallback((e) => e.stopPropagation(), []);
29
+ return /* @__PURE__ */ jsxs("div", {
30
+ ...rest,
31
+ ref,
32
+ className: cx(`${blockClass}__header`, className),
33
+ children: [children, context.decorator && /* @__PURE__ */ jsx("div", {
34
+ className: `${blockClass}__decorator`,
35
+ role: "presentation",
36
+ onClick: handleDecoratorClick,
37
+ onKeyDown: handleDecoratorKeyDown,
38
+ children: context.decorator
39
+ })]
40
+ });
41
+ });
42
+ CardHeader.displayName = componentName;
43
+ //#endregion
44
+ export { CardHeader };