@carbon/react 1.114.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.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +2640 -1163
- package/es/components/BigNumber/BigNumber.d.ts +82 -0
- package/es/components/BigNumber/BigNumberSkeleton.d.ts +16 -0
- package/es/components/BigNumber/constants.d.ts +19 -0
- package/es/components/BigNumber/index.d.ts +9 -0
- package/es/components/Card/Card.d.ts +1 -1
- package/es/components/Card/Card.js +19 -7
- package/es/components/Card/Card.types.d.ts +38 -7
- package/es/components/Card/CardActions.js +1 -1
- package/es/components/Card/CardBody.d.ts +2 -1
- package/es/components/Card/CardBody.js +3 -2
- package/es/components/Card/CardFooter.d.ts +5 -1
- package/es/components/Card/CardFooter.js +13 -2
- package/es/components/Card/CardTitle.d.ts +1 -1
- package/es/components/DatePicker/DatePicker.d.ts +1 -1
- package/es/components/DatePicker/plugins/rangePlugin.d.ts +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +11 -5
- package/es/components/FormLabel/FormLabel.d.ts +2 -2
- package/es/components/FormLabel/FormLabel.js +1 -1
- package/es/components/Tabs/Tabs.js +13 -2
- package/es/components/Tile/Tile.js +1 -1
- package/es/index.d.ts +2 -1
- package/es/index.js +1 -1
- package/es/internal/DisplayBox.d.ts +14 -0
- package/es/internal/getSupportedLocale.d.ts +12 -0
- package/lib/components/BigNumber/BigNumber.d.ts +82 -0
- package/lib/components/BigNumber/BigNumberSkeleton.d.ts +16 -0
- package/lib/components/BigNumber/constants.d.ts +19 -0
- package/lib/components/BigNumber/index.d.ts +9 -0
- package/lib/components/Card/Card.d.ts +1 -1
- package/lib/components/Card/Card.js +19 -7
- package/lib/components/Card/Card.types.d.ts +38 -7
- package/lib/components/Card/CardActions.js +1 -1
- package/lib/components/Card/CardBody.d.ts +2 -1
- package/lib/components/Card/CardBody.js +3 -2
- package/lib/components/Card/CardFooter.d.ts +5 -1
- package/lib/components/Card/CardFooter.js +13 -2
- package/lib/components/Card/CardTitle.d.ts +1 -1
- package/lib/components/DatePicker/DatePicker.d.ts +1 -1
- package/lib/components/DatePicker/plugins/rangePlugin.d.ts +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +11 -5
- package/lib/components/FormLabel/FormLabel.d.ts +2 -2
- package/lib/components/FormLabel/FormLabel.js +1 -1
- package/lib/components/Tabs/Tabs.js +13 -2
- package/lib/components/Tile/Tile.js +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +1 -1
- package/lib/internal/DisplayBox.d.ts +14 -0
- package/lib/internal/getSupportedLocale.d.ts +12 -0
- package/package.json +20 -20
- package/scss/_border-radius.scss +9 -0
- package/scss/components/OptionsTile/_index.scss +5 -0
- package/scss/components/OptionsTile/_options-tile.scss +5 -0
- package/scss/components/big-number/_big-number.scss +9 -0
- package/scss/components/big-number/_index.scss +9 -0
- package/scss/components/coachmark/_coachmark.scss +5 -0
- package/scss/components/coachmark/_index.scss +5 -0
- package/scss/components/edit-in-place/_edit-in-place.scss +5 -0
- package/scss/components/edit-in-place/_index.scss +5 -0
- package/scss/components/full-page-error/_full-page-error.scss +5 -0
- package/scss/components/full-page-error/_index.scss +5 -0
- package/scss/components/interstitial-screen/_index.scss +6 -0
- package/scss/components/interstitial-screen/_interstitial-screen.scss +12 -0
- package/scss/components/scroll-gradient/_index.scss +9 -0
- package/scss/components/scroll-gradient/_scroll-gradient.scss +9 -0
- package/scss/components/user-avatar/_index.scss +9 -0
- package/scss/components/user-avatar/_user-avatar.scss +9 -0
- package/telemetry.yml +91 -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';
|
|
@@ -17,7 +17,7 @@ import { CardActions } from './CardActions';
|
|
|
17
17
|
import { CardAction } from './CardAction';
|
|
18
18
|
export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>> & {
|
|
19
19
|
Header: React.ForwardRefExoticComponent<import("./Card.types").CardBaseProps & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
-
Body: React.ForwardRefExoticComponent<import("./Card.types").
|
|
20
|
+
Body: React.ForwardRefExoticComponent<import("./Card.types").CardBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
21
|
Footer: React.ForwardRefExoticComponent<import("./Card.types").CardBaseProps & React.RefAttributes<HTMLDivElement>>;
|
|
22
22
|
HeaderMedia: {
|
|
23
23
|
({ children, className, ...rest }: import("./CardHeaderMedia").CardHeaderMediaProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -20,6 +20,7 @@ import { CardAction } from "./CardAction.js";
|
|
|
20
20
|
import React, { forwardRef, isValidElement, useCallback, useMemo } from "react";
|
|
21
21
|
import cx from "classnames";
|
|
22
22
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
+
import { ArrowRight } from "@carbon/icons-react";
|
|
23
24
|
//#region src/components/Card/Card.tsx
|
|
24
25
|
/**
|
|
25
26
|
* Copyright IBM Corp. 2026
|
|
@@ -31,19 +32,23 @@ const componentName = "Card";
|
|
|
31
32
|
/**
|
|
32
33
|
* Card component - Root container for composable card
|
|
33
34
|
*/
|
|
34
|
-
const CardComponent = forwardRef(({ clickable = false, onClick, onKeyDown, disabled = false, density = "productive", decorator, horizontal = false, className, children, ...rest }, ref) => {
|
|
35
|
+
const CardComponent = forwardRef(({ as, clickable = false, onClick, onKeyDown, disabled = false, density = "productive", decorator, horizontal = false, renderFooterIcon: FooterIcon = ArrowRight, className, children, ...rest }, ref) => {
|
|
35
36
|
const blockClass = `${usePrefix()}--card`;
|
|
36
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.");
|
|
37
40
|
const contextValue = useMemo(() => ({
|
|
38
41
|
clickable,
|
|
39
42
|
disabled,
|
|
40
43
|
decorator,
|
|
41
|
-
horizontal
|
|
44
|
+
horizontal,
|
|
45
|
+
onClick
|
|
42
46
|
}), [
|
|
43
47
|
clickable,
|
|
44
48
|
disabled,
|
|
45
49
|
decorator,
|
|
46
|
-
horizontal
|
|
50
|
+
horizontal,
|
|
51
|
+
onClick
|
|
47
52
|
]);
|
|
48
53
|
const handleKeyDown = useCallback((event) => {
|
|
49
54
|
if (clickable && !disabled && (event.key === "Enter" || event.key === " ")) {
|
|
@@ -67,17 +72,20 @@ const CardComponent = forwardRef(({ clickable = false, onClick, onKeyDown, disab
|
|
|
67
72
|
[`${blockClass}--has-ai-label`]: hasAILabel,
|
|
68
73
|
[`${blockClass}--horizontal`]: horizontal
|
|
69
74
|
});
|
|
75
|
+
const BaseComponent = as ?? "div";
|
|
76
|
+
const isAnchor = BaseComponent === "a";
|
|
70
77
|
const cardProps = {
|
|
71
78
|
...rest,
|
|
72
79
|
ref,
|
|
73
80
|
className: cardClasses,
|
|
74
|
-
...
|
|
81
|
+
...disabled && { "aria-disabled": true },
|
|
82
|
+
...clickable && { ...isAnchor ? { onClick: handleClick } : {
|
|
75
83
|
role: "button",
|
|
76
84
|
tabIndex: disabled ? -1 : 0,
|
|
77
85
|
onClick: handleClick,
|
|
78
86
|
onKeyDown: handleKeyDown,
|
|
79
87
|
"aria-disabled": disabled
|
|
80
|
-
}
|
|
88
|
+
} }
|
|
81
89
|
};
|
|
82
90
|
const { mediaChildren, contentChildren, mediaIsFirst } = useMemo(() => {
|
|
83
91
|
if (!horizontal) return {
|
|
@@ -103,9 +111,13 @@ const CardComponent = forwardRef(({ clickable = false, onClick, onKeyDown, disab
|
|
|
103
111
|
}
|
|
104
112
|
return /* @__PURE__ */ jsx(CardContext.Provider, {
|
|
105
113
|
value: contextValue,
|
|
106
|
-
children: /* @__PURE__ */
|
|
114
|
+
children: /* @__PURE__ */ jsxs(BaseComponent, {
|
|
107
115
|
...cardProps,
|
|
108
|
-
children: renderedChildren
|
|
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
|
+
})]
|
|
109
121
|
})
|
|
110
122
|
});
|
|
111
123
|
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import { ReactNode } from 'react';
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
8
8
|
/**
|
|
9
9
|
* Base props shared across card components
|
|
10
10
|
*/
|
|
@@ -23,17 +23,29 @@ export interface CardBaseProps {
|
|
|
23
23
|
*/
|
|
24
24
|
export interface CardProps extends CardBaseProps {
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
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.
|
|
27
38
|
*/
|
|
28
39
|
clickable?: boolean;
|
|
29
40
|
/**
|
|
30
|
-
* Click handler for clickable cards
|
|
41
|
+
* Click handler for clickable cards. Only has effect when `clickable`
|
|
42
|
+
* is true.
|
|
31
43
|
*/
|
|
32
|
-
onClick?: (event: React.MouseEvent
|
|
44
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
33
45
|
/**
|
|
34
|
-
* Keyboard event handler
|
|
46
|
+
* Keyboard event handler. Only has effect when `clickable` is true.
|
|
35
47
|
*/
|
|
36
|
-
onKeyDown?: (event: React.KeyboardEvent
|
|
48
|
+
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
37
49
|
/**
|
|
38
50
|
* Disables the card and all interactive elements
|
|
39
51
|
*/
|
|
@@ -52,6 +64,13 @@ export interface CardProps extends CardBaseProps {
|
|
|
52
64
|
* header/body/footer stacked vertically on the right.
|
|
53
65
|
*/
|
|
54
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;
|
|
55
74
|
}
|
|
56
75
|
/**
|
|
57
76
|
* Props for CardHeader component
|
|
@@ -60,7 +79,14 @@ export type CardHeaderProps = CardBaseProps;
|
|
|
60
79
|
/**
|
|
61
80
|
* Props for CardBody component
|
|
62
81
|
*/
|
|
63
|
-
export
|
|
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
|
+
}
|
|
64
90
|
/**
|
|
65
91
|
* Props for CardFooter component
|
|
66
92
|
*/
|
|
@@ -85,4 +111,9 @@ export interface CardContextValue {
|
|
|
85
111
|
* Whether the card is in horizontal layout mode
|
|
86
112
|
*/
|
|
87
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;
|
|
88
119
|
}
|
|
@@ -73,7 +73,7 @@ const CardActions = ({ children, className, overflowMenuLabel = "More actions",
|
|
|
73
73
|
style: { position: "relative" },
|
|
74
74
|
children: /* @__PURE__ */ jsx(OverflowMenu, {
|
|
75
75
|
size: "sm",
|
|
76
|
-
|
|
76
|
+
label: overflowMenuLabel,
|
|
77
77
|
children: hiddenItems.map((item) => /* @__PURE__ */ jsx(MenuItem, {
|
|
78
78
|
label: item.label || "Action",
|
|
79
79
|
onClick: () => {
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
+
import { CardBodyProps } from './Card.types';
|
|
8
9
|
/**
|
|
9
10
|
* CardBody component - Body section of the card for free-form content
|
|
10
11
|
*/
|
|
11
|
-
export declare const CardBody: React.ForwardRefExoticComponent<
|
|
12
|
+
export declare const CardBody: React.ForwardRefExoticComponent<CardBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -20,8 +20,9 @@ const componentName = "CardBody";
|
|
|
20
20
|
/**
|
|
21
21
|
* CardBody component - Body section of the card for free-form content
|
|
22
22
|
*/
|
|
23
|
-
const CardBody = forwardRef(({ className, children, ...rest }, ref) => {
|
|
24
|
-
const
|
|
23
|
+
const CardBody = forwardRef(({ className, children, isFlush = false, ...rest }, ref) => {
|
|
24
|
+
const prefix = usePrefix();
|
|
25
|
+
const bodyClasses = cx(`${prefix}--card__body`, className, { [`${prefix}--card__body--flush`]: isFlush });
|
|
25
26
|
return /* @__PURE__ */ jsx("div", {
|
|
26
27
|
...rest,
|
|
27
28
|
ref,
|
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
/**
|
|
9
|
-
* CardFooter component - Footer section of the card
|
|
9
|
+
* CardFooter component - Footer section of the card.
|
|
10
|
+
*
|
|
11
|
+
* Not supported inside a `clickable` card. A clickable card renders its own
|
|
12
|
+
* built-in footer affordance automatically. Use the `renderFooterIcon` prop on
|
|
13
|
+
* `Card` to customize the icon.
|
|
10
14
|
*/
|
|
11
15
|
export declare const CardFooter: React.ForwardRefExoticComponent<import("./Card.types").CardBaseProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { usePrefix } from "../../internal/usePrefix.js";
|
|
9
|
+
import { useCardContext } from "./CardContext.js";
|
|
9
10
|
import { forwardRef } from "react";
|
|
10
11
|
import cx from "classnames";
|
|
11
12
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -18,10 +19,20 @@ import { jsx } from "react/jsx-runtime";
|
|
|
18
19
|
*/
|
|
19
20
|
const componentName = "CardFooter";
|
|
20
21
|
/**
|
|
21
|
-
* CardFooter component - Footer section of the card
|
|
22
|
+
* CardFooter component - Footer section of the card.
|
|
23
|
+
*
|
|
24
|
+
* Not supported inside a `clickable` card. A clickable card renders its own
|
|
25
|
+
* built-in footer affordance automatically. Use the `renderFooterIcon` prop on
|
|
26
|
+
* `Card` to customize the icon.
|
|
22
27
|
*/
|
|
23
28
|
const CardFooter = forwardRef(({ className, children, ...rest }, ref) => {
|
|
24
|
-
const
|
|
29
|
+
const prefix = usePrefix();
|
|
30
|
+
const { clickable } = useCardContext();
|
|
31
|
+
if (clickable) {
|
|
32
|
+
console.error("[Card] `Card.Footer` cannot be used inside a `clickable` card. A clickable card renders its own footer affordance automatically. Use the `renderFooterIcon` prop on `Card` to customize the icon.");
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const footerClasses = cx(`${prefix}--card__footer`, className);
|
|
25
36
|
return /* @__PURE__ */ jsx("div", {
|
|
26
37
|
...rest,
|
|
27
38
|
ref,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React, { ReactNode } from 'react';
|
|
8
|
-
export interface CardTitleProps {
|
|
8
|
+
export interface CardTitleProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
9
|
/**
|
|
10
10
|
* Provide the contents of the CardTitle.
|
|
11
11
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, { type ReactNode } from 'react';
|
|
8
8
|
import flatpickr from 'flatpickr';
|
|
9
|
-
import { DateLimit, DateOption } from 'flatpickr/dist/types/options';
|
|
9
|
+
import type { DateLimit, DateOption } from 'flatpickr/dist/types/options';
|
|
10
10
|
import { type SupportedLocale } from './DatePickerLocales';
|
|
11
11
|
export type DatePickerTypes = 'simple' | 'single' | 'range';
|
|
12
12
|
export interface DatePickerProps {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { type Config } from 'flatpickr/dist/plugins/rangePlugin';
|
|
8
|
-
import { Instance } from 'flatpickr/dist/types/instance';
|
|
8
|
+
import type { Instance } from 'flatpickr/dist/types/instance';
|
|
9
9
|
/**
|
|
10
10
|
* @param config Plugin configuration.
|
|
11
11
|
* @returns An extension of Flatpickr `rangePlugin` that does the following:
|
|
@@ -53,13 +53,13 @@ function FileUploaderDropContainer({ accept = [], className, id, disabled, label
|
|
|
53
53
|
return acc.concat([curr]);
|
|
54
54
|
}, []);
|
|
55
55
|
}
|
|
56
|
-
const
|
|
57
|
-
if (!files.length) return
|
|
58
|
-
return
|
|
56
|
+
const getAddedFiles = (files) => {
|
|
57
|
+
if (!files.length) return [];
|
|
58
|
+
return validateFiles(multiple ? files : [files[0]]);
|
|
59
59
|
};
|
|
60
60
|
const handleChange = (event) => {
|
|
61
61
|
const files = [...event.target.files ?? []];
|
|
62
|
-
return
|
|
62
|
+
return onAddFiles(event, { addedFiles: getAddedFiles(files) });
|
|
63
63
|
};
|
|
64
64
|
const handleDrop = (event) => {
|
|
65
65
|
const items = [...event.dataTransfer.items ?? []];
|
|
@@ -70,7 +70,13 @@ function FileUploaderDropContainer({ accept = [], className, id, disabled, label
|
|
|
70
70
|
if (file) acc.push(file);
|
|
71
71
|
return acc;
|
|
72
72
|
}, []) : [...event.dataTransfer.files];
|
|
73
|
-
|
|
73
|
+
const addedFiles = getAddedFiles(files);
|
|
74
|
+
if (inputRef.current) try {
|
|
75
|
+
const dataTransfer = new DataTransfer();
|
|
76
|
+
addedFiles.forEach((file) => dataTransfer.items.add(file));
|
|
77
|
+
inputRef.current.files = dataTransfer.files;
|
|
78
|
+
} catch {}
|
|
79
|
+
return onAddFiles(event, { addedFiles });
|
|
74
80
|
};
|
|
75
81
|
const handleClick = () => {
|
|
76
82
|
if (!disabled) inputRef.current?.click();
|
|
@@ -16,7 +16,7 @@ export interface FormLabelProps extends Omit<React.LabelHTMLAttributes<HTMLLabel
|
|
|
16
16
|
*/
|
|
17
17
|
className?: string;
|
|
18
18
|
/**
|
|
19
|
-
* Provide a unique id for the given
|
|
19
|
+
* Provide a unique id for the given `FormLabel`
|
|
20
20
|
*/
|
|
21
21
|
id?: string;
|
|
22
22
|
}
|
|
@@ -32,7 +32,7 @@ declare namespace FormLabel {
|
|
|
32
32
|
*/
|
|
33
33
|
className: PropTypes.Requireable<string>;
|
|
34
34
|
/**
|
|
35
|
-
* Provide a unique id for the given
|
|
35
|
+
* Provide a unique id for the given `FormLabel`
|
|
36
36
|
*/
|
|
37
37
|
id: PropTypes.Requireable<string>;
|
|
38
38
|
};
|
|
@@ -193,6 +193,7 @@ function TabList({ activation = "automatic", "aria-label": label, children, clas
|
|
|
193
193
|
const ref = useRef(null);
|
|
194
194
|
const previousButton = useRef(null);
|
|
195
195
|
const nextButton = useRef(null);
|
|
196
|
+
const resizeAnimationFrame = useRef(null);
|
|
196
197
|
const [isScrollable, setIsScrollable] = useState(false);
|
|
197
198
|
const [scrollLeft, setScrollLeft] = useState(0);
|
|
198
199
|
const hasSecondaryLabelTabs = contained && Children.toArray(children).some((child) => isComponentElement(child, Tab) && typeof child.props.secondaryLabel !== "undefined");
|
|
@@ -298,9 +299,19 @@ function TabList({ activation = "automatic", "aria-label": label, children, clas
|
|
|
298
299
|
const element = containerRef.current;
|
|
299
300
|
if (!element) return;
|
|
300
301
|
updateOverflowState();
|
|
301
|
-
const resizeObserver = new ResizeObserver(
|
|
302
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
303
|
+
if (resizeAnimationFrame.current !== null) cancelAnimationFrame(resizeAnimationFrame.current);
|
|
304
|
+
resizeAnimationFrame.current = requestAnimationFrame(() => {
|
|
305
|
+
resizeAnimationFrame.current = null;
|
|
306
|
+
updateOverflowState();
|
|
307
|
+
});
|
|
308
|
+
});
|
|
302
309
|
resizeObserver.observe(element);
|
|
303
310
|
return () => {
|
|
311
|
+
if (resizeAnimationFrame.current !== null) {
|
|
312
|
+
cancelAnimationFrame(resizeAnimationFrame.current);
|
|
313
|
+
resizeAnimationFrame.current = null;
|
|
314
|
+
}
|
|
304
315
|
resizeObserver.disconnect();
|
|
305
316
|
};
|
|
306
317
|
}, [updateOverflowState]);
|
|
@@ -861,7 +872,7 @@ const IconTab = React.forwardRef(({ badgeIndicator, children, className: customC
|
|
|
861
872
|
className: `${prefix}--icon-tooltip`,
|
|
862
873
|
enterDelayMs,
|
|
863
874
|
label,
|
|
864
|
-
leaveDelayMs,
|
|
875
|
+
leaveDelayMs: leaveDelayMs ?? 0,
|
|
865
876
|
children: /* @__PURE__ */ jsx(Tab, {
|
|
866
877
|
className: classNames,
|
|
867
878
|
ref,
|
|
@@ -197,7 +197,7 @@ ClickableTile.propTypes = {
|
|
|
197
197
|
*/
|
|
198
198
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
199
199
|
};
|
|
200
|
-
const SelectableTile = React.forwardRef(({ children, className, decorator, disabled, id, light, onClick = () => {}, onChange = () => {}, onKeyDown = () => {}, selected = false, tabIndex = 0, title
|
|
200
|
+
const SelectableTile = React.forwardRef(({ children, className, decorator, disabled, id, light, onClick = () => {}, onChange = () => {}, onKeyDown = () => {}, selected = false, tabIndex = 0, title, slug, hasRoundedCorners, ...rest }, ref) => {
|
|
201
201
|
const prefix = usePrefix();
|
|
202
202
|
const clickHandler = onClick;
|
|
203
203
|
const keyDownHandler = onKeyDown;
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import './feature-flags';
|
|
8
8
|
import './internal/warnAboutDeprecatedReactVersion';
|
|
9
9
|
export * from './components/Accordion';
|
|
10
|
+
export type { BigNumberProps as preview__BigNumberProps } from './components/BigNumber';
|
|
10
11
|
export * from './components/AccordionItem';
|
|
11
12
|
export * from './components/AspectRatio';
|
|
12
13
|
export * from './components/Breadcrumb';
|
package/es/index.js
CHANGED
|
@@ -246,7 +246,7 @@ import AISkeletonText from "./components/AISkeleton/AISkeletonText.js";
|
|
|
246
246
|
import { GlobalTheme, Theme, ThemeContext, usePrefersDarkScheme, useTheme } from "./components/Theme/index.js";
|
|
247
247
|
//#region src/index.ts
|
|
248
248
|
/**
|
|
249
|
-
* Copyright IBM Corp. 2016,
|
|
249
|
+
* Copyright IBM Corp. 2016, 2026
|
|
250
250
|
*
|
|
251
251
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
252
252
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022, 2022
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { type ReactNode } from 'react';
|
|
8
|
+
interface DisplayBoxProps {
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
msg?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare const DisplayBox: ({ children, className, msg }: DisplayBoxProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Returns the provided locale if it is supported by the runtime's
|
|
9
|
+
* `Intl.NumberFormat`, otherwise falls back to the provided fallback
|
|
10
|
+
* (or `'en-US'` when no fallback is given).
|
|
11
|
+
*/
|
|
12
|
+
export declare function getSupportedLocale(locale: string | undefined, fallback?: string): string;
|
|
@@ -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>>;
|