@carbon/ibm-products
Version:
Carbon for IBM Products
40 lines (38 loc) • 1.56 kB
JavaScript
/**
* Copyright IBM Corp. 2020, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import { __toESM } from "../../../_virtual/_rolldown/runtime.js";
import { require_classnames } from "../../../node_modules/classnames/index.js";
import { ActionSet } from "../../ActionSet/ActionSet.js";
import { TearsheetContext, blockClass } from "./context.js";
import React, { forwardRef, useContext } from "react";
//#region src/components/Tearsheet/next/TearsheetFooter.tsx
/**
* Copyright IBM Corp. 2025, 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
var import_classnames = /* @__PURE__ */ __toESM(require_classnames());
const TearsheetFooter = forwardRef(({ children, className, actions, buttonSize }, ref) => {
const { variant } = useContext(TearsheetContext);
const actionCount = actions?.length || 0;
return /* @__PURE__ */ React.createElement("div", {
className: (0, import_classnames.default)(`${blockClass}__footer`, className, {
[`${blockClass}__footer--three-actions`]: actionCount == 3,
[`${blockClass}__footer--many-actions`]: actionCount > 3
}),
ref
}, children, actions && actions.length > 0 && /* @__PURE__ */ React.createElement(ActionSet, {
actions,
buttonSize,
disableStacking: true,
size: variant == "wide" ? "2xl" : "lg"
}));
});
TearsheetFooter.displayName = "TearsheetFooter";
//#endregion
export { TearsheetFooter as default };