@carbon/react 1.114.0-rc.0 → 1.115.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +2816 -1339
  2. package/es/components/BigNumber/BigNumber.d.ts +82 -0
  3. package/es/components/BigNumber/BigNumberSkeleton.d.ts +16 -0
  4. package/es/components/BigNumber/constants.d.ts +19 -0
  5. package/es/components/BigNumber/index.d.ts +9 -0
  6. package/es/components/Card/Card.d.ts +48 -0
  7. package/es/components/Card/Card.js +160 -0
  8. package/es/components/Card/Card.types.d.ts +119 -0
  9. package/es/components/Card/CardAction.d.ts +37 -0
  10. package/es/components/Card/CardAction.js +32 -0
  11. package/es/components/Card/CardActions.d.ts +30 -0
  12. package/es/components/Card/CardActions.js +93 -0
  13. package/es/components/Card/CardBody.d.ts +12 -0
  14. package/es/components/Card/CardBody.js +35 -0
  15. package/es/components/Card/CardContext.d.ts +17 -0
  16. package/es/components/Card/CardContext.js +31 -0
  17. package/es/components/Card/CardFooter.d.ts +15 -0
  18. package/es/components/Card/CardFooter.js +45 -0
  19. package/es/components/Card/CardHeader.d.ts +11 -0
  20. package/es/components/Card/CardHeader.js +44 -0
  21. package/es/components/Card/CardHeaderMedia.d.ts +21 -0
  22. package/es/components/Card/CardHeaderMedia.js +24 -0
  23. package/es/components/Card/CardMedia.d.ts +35 -0
  24. package/es/components/Card/CardMedia.js +42 -0
  25. package/es/components/Card/CardTitle.d.ts +72 -0
  26. package/es/components/Card/CardTitle.js +86 -0
  27. package/es/components/Card/CardTitleMedia.d.ts +23 -0
  28. package/es/components/Card/CardTitleMedia.js +36 -0
  29. package/es/components/Card/_story-assets/data.d.ts +6 -0
  30. package/es/components/Card/_story-assets/options.d.ts +47 -0
  31. package/es/components/Card/index.d.ts +8 -0
  32. package/es/components/Card/index.js +33 -0
  33. package/es/components/Checkbox/Checkbox.js +1 -1
  34. package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
  35. package/es/components/ComboBox/ComboBox.js +2 -2
  36. package/es/components/ComboButton/index.js +1 -1
  37. package/es/components/ComposedModal/ComposedModal.js +1 -1
  38. package/es/components/DatePicker/DatePicker.d.ts +1 -1
  39. package/es/components/DatePicker/DatePicker.js +1 -1
  40. package/es/components/DatePicker/plugins/rangePlugin.d.ts +1 -1
  41. package/es/components/DatePickerInput/DatePickerInput.js +1 -1
  42. package/es/components/Dropdown/Dropdown.js +2 -2
  43. package/es/components/ExpandableSearch/ExpandableSearch.js +1 -1
  44. package/es/components/FileUploader/FileUploaderDropContainer.js +11 -5
  45. package/es/components/FormLabel/FormLabel.d.ts +2 -2
  46. package/es/components/FormLabel/FormLabel.js +1 -1
  47. package/es/components/MenuButton/index.js +1 -1
  48. package/es/components/MultiSelect/FilterableMultiSelect.js +2 -2
  49. package/es/components/MultiSelect/MultiSelect.js +2 -2
  50. package/es/components/NumberInput/NumberInput.js +2 -2
  51. package/es/components/OverflowMenu/next/index.js +1 -1
  52. package/es/components/RadioButton/RadioButton.js +1 -1
  53. package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  54. package/es/components/Select/Select.js +1 -1
  55. package/es/components/Tabs/Tabs.js +13 -2
  56. package/es/components/Tag/SelectableTag.js +1 -1
  57. package/es/components/TextArea/TextArea.js +1 -1
  58. package/es/components/TextInput/TextInput.js +1 -1
  59. package/es/components/Tile/Tile.js +1 -1
  60. package/es/index.d.ts +3 -1
  61. package/es/index.js +7 -6
  62. package/es/internal/DisplayBox.d.ts +14 -0
  63. package/es/internal/getSupportedLocale.d.ts +12 -0
  64. package/lib/components/BigNumber/BigNumber.d.ts +82 -0
  65. package/lib/components/BigNumber/BigNumberSkeleton.d.ts +16 -0
  66. package/lib/components/BigNumber/constants.d.ts +19 -0
  67. package/lib/components/BigNumber/index.d.ts +9 -0
  68. package/lib/components/Card/Card.d.ts +48 -0
  69. package/lib/components/Card/Card.js +173 -0
  70. package/lib/components/Card/Card.types.d.ts +119 -0
  71. package/lib/components/Card/CardAction.d.ts +37 -0
  72. package/lib/components/Card/CardAction.js +41 -0
  73. package/lib/components/Card/CardActions.d.ts +30 -0
  74. package/lib/components/Card/CardActions.js +96 -0
  75. package/lib/components/Card/CardBody.d.ts +12 -0
  76. package/lib/components/Card/CardBody.js +38 -0
  77. package/lib/components/Card/CardContext.d.ts +17 -0
  78. package/lib/components/Card/CardContext.js +32 -0
  79. package/lib/components/Card/CardFooter.d.ts +15 -0
  80. package/lib/components/Card/CardFooter.js +48 -0
  81. package/lib/components/Card/CardHeader.d.ts +11 -0
  82. package/lib/components/Card/CardHeader.js +47 -0
  83. package/lib/components/Card/CardHeaderMedia.d.ts +21 -0
  84. package/lib/components/Card/CardHeaderMedia.js +33 -0
  85. package/lib/components/Card/CardMedia.d.ts +35 -0
  86. package/lib/components/Card/CardMedia.js +51 -0
  87. package/lib/components/Card/CardTitle.d.ts +72 -0
  88. package/lib/components/Card/CardTitle.js +89 -0
  89. package/lib/components/Card/CardTitleMedia.d.ts +23 -0
  90. package/lib/components/Card/CardTitleMedia.js +39 -0
  91. package/lib/components/Card/_story-assets/data.d.ts +6 -0
  92. package/lib/components/Card/_story-assets/options.d.ts +47 -0
  93. package/lib/components/Card/index.d.ts +8 -0
  94. package/lib/components/Card/index.js +48 -0
  95. package/lib/components/Checkbox/Checkbox.js +1 -1
  96. package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
  97. package/lib/components/ComboBox/ComboBox.js +2 -2
  98. package/lib/components/ComboButton/index.js +1 -1
  99. package/lib/components/ComposedModal/ComposedModal.js +1 -1
  100. package/lib/components/DatePicker/DatePicker.d.ts +1 -1
  101. package/lib/components/DatePicker/DatePicker.js +1 -1
  102. package/lib/components/DatePicker/plugins/rangePlugin.d.ts +1 -1
  103. package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
  104. package/lib/components/Dropdown/Dropdown.js +2 -2
  105. package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -1
  106. package/lib/components/FileUploader/FileUploaderDropContainer.js +11 -5
  107. package/lib/components/FormLabel/FormLabel.d.ts +2 -2
  108. package/lib/components/FormLabel/FormLabel.js +1 -1
  109. package/lib/components/MenuButton/index.js +1 -1
  110. package/lib/components/MultiSelect/FilterableMultiSelect.js +2 -2
  111. package/lib/components/MultiSelect/MultiSelect.js +2 -2
  112. package/lib/components/NumberInput/NumberInput.js +2 -2
  113. package/lib/components/OverflowMenu/next/index.js +1 -1
  114. package/lib/components/RadioButton/RadioButton.js +1 -1
  115. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
  116. package/lib/components/Select/Select.js +1 -1
  117. package/lib/components/Tabs/Tabs.js +13 -2
  118. package/lib/components/Tag/SelectableTag.js +1 -1
  119. package/lib/components/TextArea/TextArea.js +1 -1
  120. package/lib/components/TextInput/TextInput.js +1 -1
  121. package/lib/components/Tile/Tile.js +1 -1
  122. package/lib/index.d.ts +3 -1
  123. package/lib/index.js +55 -48
  124. package/lib/internal/DisplayBox.d.ts +14 -0
  125. package/lib/internal/getSupportedLocale.d.ts +12 -0
  126. package/package.json +20 -20
  127. package/scss/_border-radius.scss +9 -0
  128. package/scss/components/OptionsTile/_index.scss +5 -0
  129. package/scss/components/OptionsTile/_options-tile.scss +5 -0
  130. package/scss/components/big-number/_big-number.scss +9 -0
  131. package/scss/components/big-number/_index.scss +9 -0
  132. package/scss/components/coachmark/_coachmark.scss +5 -0
  133. package/scss/components/coachmark/_index.scss +5 -0
  134. package/scss/components/edit-in-place/_edit-in-place.scss +5 -0
  135. package/scss/components/edit-in-place/_index.scss +5 -0
  136. package/scss/components/full-page-error/_full-page-error.scss +5 -0
  137. package/scss/components/full-page-error/_index.scss +5 -0
  138. package/scss/components/interstitial-screen/_index.scss +6 -0
  139. package/scss/components/interstitial-screen/_interstitial-screen.scss +12 -0
  140. package/scss/components/scroll-gradient/_index.scss +9 -0
  141. package/scss/components/scroll-gradient/_scroll-gradient.scss +9 -0
  142. package/scss/components/user-avatar/_index.scss +9 -0
  143. package/scss/components/user-avatar/_user-avatar.scss +9 -0
  144. package/telemetry.yml +107 -3
@@ -0,0 +1,82 @@
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, { ReactNode } from 'react';
8
+ import { BigNumberSizeValues } from './constants';
9
+ export interface BigNumberProps {
10
+ /**
11
+ * Provide an optional class to be applied to the containing node.
12
+ */
13
+ className?: string;
14
+ /**
15
+ * The default behavior will hide `total` if `undefined` or is the same as `value`.
16
+ *
17
+ * Set to `true` to ignore the default behavior and show the `total`.
18
+ */
19
+ forceShowTotal?: boolean;
20
+ /**
21
+ * Specifies the number of fraction digits when truncating `value` and `total`.
22
+ */
23
+ fractionDigits?: number;
24
+ /**
25
+ * Displays an icon button next to `value`.
26
+ */
27
+ iconButton?: ReactNode;
28
+ /**
29
+ * Text label above the `value`.
30
+ */
31
+ label: string;
32
+ /**
33
+ * When `true`, will show the loading state.
34
+ */
35
+ loading?: boolean;
36
+ /**
37
+ * Determines how `value` and `total` will be formatted.
38
+ */
39
+ locale?: string;
40
+ /**
41
+ * Appends a percent sign (_%_) after `value` and hides `total`.
42
+ */
43
+ percentage?: boolean;
44
+ /**
45
+ * Controls the visual size of the component.
46
+ */
47
+ size?: BigNumberSizeValues;
48
+ /**
49
+ * When applied, an information icon will be rendered next to the
50
+ * `label` and the description will be applied to its tooltip.
51
+ */
52
+ tooltipDescription?: string;
53
+ /**
54
+ * The number that will appear after the slash (i.e. the "denominator" of a fraction).
55
+ *
56
+ * This number will not be rendered if it's the same as `value` or
57
+ * `percentage` is true. See also the **forceShowTotal** prop.
58
+ */
59
+ total?: number;
60
+ /**
61
+ * When `true`, will render a "trending up" icon.
62
+ */
63
+ trending?: boolean;
64
+ /**
65
+ * Abbreviates the number when `true`. E.g. from _1,000_ to _1K_.
66
+ */
67
+ truncate?: boolean;
68
+ /**
69
+ * The primary value to display (or the "numerator" of a fraction).
70
+ */
71
+ value?: number;
72
+ }
73
+ /**
74
+ * BigNumber is used to display large values in a small area. The display of
75
+ * values can be the value itself, or grouped in a `numerator/denominator` fashion.
76
+ * Control over the total fraction decimals displayed as well as how the
77
+ * values/totals are displayed are done via a locale prop. Other optional props
78
+ * allow control over size, truncation, if the value is a percentage, the addition
79
+ * of a button as well as tooltip functionality.
80
+ * The default locale is English (`en-US`) if one is not provided or if the provided one is not supported.
81
+ */
82
+ export declare const BigNumber: React.ForwardRefExoticComponent<BigNumberProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,16 @@
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 { BigNumberProps } from './BigNumber';
9
+ /**
10
+ * BigNumberSkeleton is used to display a skeleton version while
11
+ * content is loading (handled by the BigNumber prop `loading`).
12
+ *
13
+ * Note: This component is only used within BigNumber.
14
+ */
15
+ export type BigNumberSkeletonProps = Pick<BigNumberProps, 'className' | 'size'> & React.HTMLAttributes<HTMLDivElement>;
16
+ export declare const BigNumberSkeleton: React.ForwardRefExoticComponent<Pick<BigNumberProps, "className" | "size"> & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,19 @@
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
+ export declare enum BigNumberSize {
8
+ Default = "default",
9
+ Large = "lg",
10
+ XLarge = "xl"
11
+ }
12
+ export type BigNumberSizeValues = `${BigNumberSize}`;
13
+ export declare enum Characters {
14
+ Dash = "\u2013",
15
+ Slash = "/"
16
+ }
17
+ export declare const DefaultLocale = "en-US";
18
+ export declare const formatValue: (locale: Intl.LocalesArgument, value: number | null | undefined, fractionDigits: number, truncate: boolean) => string | null | undefined;
19
+ export declare const getIconSize: (size: BigNumberSizeValues) => number;
@@ -0,0 +1,9 @@
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
+ export { BigNumber } from './BigNumber';
8
+ export type { BigNumberProps } from './BigNumber';
9
+ export { BigNumberSkeleton } from './BigNumberSkeleton';
@@ -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").CardBodyProps & 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,160 @@
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
+ import { ArrowRight } from "@carbon/icons-react";
24
+ //#region src/components/Card/Card.tsx
25
+ /**
26
+ * Copyright IBM Corp. 2026
27
+ *
28
+ * This source code is licensed under the Apache-2.0 license found in the
29
+ * LICENSE file in the root directory of this source tree.
30
+ */
31
+ const componentName = "Card";
32
+ /**
33
+ * Card component - Root container for composable card
34
+ */
35
+ const CardComponent = forwardRef(({ as, clickable = false, onClick, onKeyDown, disabled = false, density = "productive", decorator, horizontal = false, renderFooterIcon: FooterIcon = ArrowRight, className, children, ...rest }, ref) => {
36
+ const blockClass = `${usePrefix()}--card`;
37
+ const hasAILabel = useMemo(() => isValidElement(decorator) && decorator.type === AILabel, [decorator]);
38
+ if (FooterIcon !== ArrowRight && !clickable) console.error("[Card] `renderFooterIcon` only has effect when `clickable` is true.");
39
+ if (clickable && !rest["aria-label"] && !rest["aria-labelledby"]) console.error("[Card] A clickable card must have an accessible name. Pass `aria-label` or `aria-labelledby` to the Card.");
40
+ const contextValue = useMemo(() => ({
41
+ clickable,
42
+ disabled,
43
+ decorator,
44
+ horizontal,
45
+ onClick
46
+ }), [
47
+ clickable,
48
+ disabled,
49
+ decorator,
50
+ horizontal,
51
+ onClick
52
+ ]);
53
+ const handleKeyDown = useCallback((event) => {
54
+ if (clickable && !disabled && (event.key === "Enter" || event.key === " ")) {
55
+ event.preventDefault();
56
+ onClick?.(event);
57
+ }
58
+ onKeyDown?.(event);
59
+ }, [
60
+ clickable,
61
+ disabled,
62
+ onClick,
63
+ onKeyDown
64
+ ]);
65
+ const handleClick = useCallback((event) => {
66
+ if (!disabled) onClick?.(event);
67
+ }, [disabled, onClick]);
68
+ const cardClasses = cx(blockClass, className, {
69
+ [`${blockClass}--clickable`]: clickable && !disabled,
70
+ [`${blockClass}--disabled`]: disabled,
71
+ [`${blockClass}--${density}`]: density,
72
+ [`${blockClass}--has-ai-label`]: hasAILabel,
73
+ [`${blockClass}--horizontal`]: horizontal
74
+ });
75
+ const BaseComponent = as ?? "div";
76
+ const isAnchor = BaseComponent === "a";
77
+ const cardProps = {
78
+ ...rest,
79
+ ref,
80
+ className: cardClasses,
81
+ ...disabled && { "aria-disabled": true },
82
+ ...clickable && { ...isAnchor ? { onClick: handleClick } : {
83
+ role: "button",
84
+ tabIndex: disabled ? -1 : 0,
85
+ onClick: handleClick,
86
+ onKeyDown: handleKeyDown,
87
+ "aria-disabled": disabled
88
+ } }
89
+ };
90
+ const { mediaChildren, contentChildren, mediaIsFirst } = useMemo(() => {
91
+ if (!horizontal) return {
92
+ mediaChildren: [],
93
+ contentChildren: [],
94
+ mediaIsFirst: false
95
+ };
96
+ const childArray = React.Children.toArray(children);
97
+ const isMedia = (child) => React.isValidElement(child) && child.type === CardMedia;
98
+ return {
99
+ mediaChildren: childArray.filter(isMedia),
100
+ contentChildren: childArray.filter((c) => !isMedia(c)),
101
+ mediaIsFirst: childArray.findIndex(isMedia) < childArray.findIndex((c) => !isMedia(c))
102
+ };
103
+ }, [children, horizontal]);
104
+ let renderedChildren = children;
105
+ if (horizontal) {
106
+ const contentWrapper = /* @__PURE__ */ jsx("div", {
107
+ className: `${blockClass}__content`,
108
+ children: contentChildren
109
+ });
110
+ renderedChildren = mediaIsFirst ? /* @__PURE__ */ jsxs(Fragment, { children: [mediaChildren, contentWrapper] }) : /* @__PURE__ */ jsxs(Fragment, { children: [contentWrapper, mediaChildren] });
111
+ }
112
+ return /* @__PURE__ */ jsx(CardContext.Provider, {
113
+ value: contextValue,
114
+ children: /* @__PURE__ */ jsxs(BaseComponent, {
115
+ ...cardProps,
116
+ children: [renderedChildren, clickable && /* @__PURE__ */ jsx("div", {
117
+ className: `${blockClass}__clickable-footer`,
118
+ "aria-hidden": "true",
119
+ children: /* @__PURE__ */ jsx(FooterIcon, { "aria-hidden": "true" })
120
+ })]
121
+ })
122
+ });
123
+ });
124
+ CardComponent.displayName = componentName;
125
+ /**
126
+ * -------
127
+ * Exports
128
+ * -------
129
+ */
130
+ const Header = CardHeader;
131
+ Header.displayName = "Card.Header";
132
+ const Body = CardBody;
133
+ Body.displayName = "Card.Body";
134
+ const Footer = CardFooter;
135
+ Footer.displayName = "Card.Footer";
136
+ const HeaderMedia = CardHeaderMedia;
137
+ HeaderMedia.displayName = "Card.HeaderMedia";
138
+ const Media = CardMedia;
139
+ Media.displayName = "Card.Media";
140
+ const Title = CardTitle;
141
+ Title.displayName = "Card.Title";
142
+ const TitleMedia = CardTitleMedia;
143
+ TitleMedia.displayName = "Card.TitleMedia";
144
+ const Actions = CardActions;
145
+ Actions.displayName = "Card.Actions";
146
+ const Action = CardAction;
147
+ Action.displayName = "Card.Action";
148
+ const Card = Object.assign(CardComponent, {
149
+ Header,
150
+ Body,
151
+ Footer,
152
+ HeaderMedia,
153
+ Media,
154
+ Title,
155
+ TitleMedia,
156
+ Actions,
157
+ Action
158
+ });
159
+ //#endregion
160
+ export { Card, Card as default, CardAction, CardActions, CardBody, CardFooter, CardHeader, CardHeaderMedia, CardMedia, CardTitle, CardTitleMedia };
@@ -0,0 +1,119 @@
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, { 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
+ * The underlying element or component to render the card as.
27
+ * Defaults to `'div'`. Use `'a'` or a router Link component for
28
+ * navigation cards when combined with `clickable`.
29
+ * @example <Card as="a" clickable href="/dashboard">...</Card>
30
+ * @example <Card as={RouterLink} clickable to="/dashboard">...</Card>
31
+ */
32
+ as?: React.ElementType;
33
+ /**
34
+ * Makes the entire card clickable. When true, the card gains interactive
35
+ * styles (hover, focus, active) and renders a built-in footer affordance
36
+ * with an arrow icon. Use `onClick` for action cards or `as="a"` with
37
+ * `href` for navigation cards.
38
+ */
39
+ clickable?: boolean;
40
+ /**
41
+ * Click handler for clickable cards. Only has effect when `clickable`
42
+ * is true.
43
+ */
44
+ onClick?: (event: React.MouseEvent) => void;
45
+ /**
46
+ * Keyboard event handler. Only has effect when `clickable` is true.
47
+ */
48
+ onKeyDown?: (event: React.KeyboardEvent) => void;
49
+ /**
50
+ * Disables the card and all interactive elements
51
+ */
52
+ disabled?: boolean;
53
+ /**
54
+ * Density variant: productive uses heading-compact-02, expressive uses heading-03
55
+ */
56
+ density?: 'productive' | 'expressive';
57
+ /**
58
+ * Optional decorator component (typically AILabel from Carbon).
59
+ * Renders in the top-right corner of the card header with a blue gradient border.
60
+ */
61
+ decorator?: ReactNode;
62
+ /**
63
+ * When true, the card renders in a horizontal layout: media on the left,
64
+ * header/body/footer stacked vertically on the right.
65
+ */
66
+ horizontal?: boolean;
67
+ /**
68
+ * Icon rendered in the built-in footer affordance of a clickable card.
69
+ * Only has effect when `clickable` is true. Defaults to ArrowRight.
70
+ * Pass any icon component from `@carbon/icons-react`.
71
+ * @example <Card clickable renderFooterIcon={Launch}>...</Card>
72
+ */
73
+ renderFooterIcon?: React.ElementType;
74
+ }
75
+ /**
76
+ * Props for CardHeader component
77
+ */
78
+ export type CardHeaderProps = CardBaseProps;
79
+ /**
80
+ * Props for CardBody component
81
+ */
82
+ export interface CardBodyProps extends CardBaseProps {
83
+ /**
84
+ * When true, removes all padding so content fills the body edge-to-edge.
85
+ * Use when the body contains a component (e.g. a table, chart, or image)
86
+ * that manages its own internal spacing.
87
+ */
88
+ isFlush?: boolean;
89
+ }
90
+ /**
91
+ * Props for CardFooter component
92
+ */
93
+ export type CardFooterProps = CardBaseProps;
94
+ /**
95
+ * Context value for Card
96
+ */
97
+ export interface CardContextValue {
98
+ /**
99
+ * Whether the card is clickable
100
+ */
101
+ clickable: boolean;
102
+ /**
103
+ * Whether the card is disabled
104
+ */
105
+ disabled: boolean;
106
+ /**
107
+ * Optional decorator component (typically AILabel) to be rendered by CardHeader
108
+ */
109
+ decorator?: ReactNode;
110
+ /**
111
+ * Whether the card is in horizontal layout mode
112
+ */
113
+ horizontal?: boolean;
114
+ /**
115
+ * Click handler forwarded from the Card root, available to child components
116
+ * (e.g. the built-in clickable footer affordance).
117
+ */
118
+ onClick?: (event: React.MouseEvent) => void;
119
+ }
@@ -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
+ 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,12 @@
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 { CardBodyProps } from './Card.types';
9
+ /**
10
+ * CardBody component - Body section of the card for free-form content
11
+ */
12
+ export declare const CardBody: React.ForwardRefExoticComponent<CardBodyProps & React.RefAttributes<HTMLDivElement>>;