@carbon/ibm-products
Version:
Carbon for IBM Products
54 lines (47 loc) • 1.88 kB
JavaScript
/**
* Copyright IBM Corp. 2020, 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.
*/
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
import React__default from 'react';
import PropTypes from '../../_virtual/index.js';
import cx from 'classnames';
import { pkg } from '../../settings.js';
import { useWebTerminal } from './hooks/index.js';
// The block part of our conventional BEM class names (blockClass__E--M).
const componentName = 'WebTerminalContentWrapper';
const blockClass = `${pkg.prefix}--web-terminal-content-wrapper`;
let WebTerminalContentWrapper = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
let {
// The component props, in alphabetical order (for consistency).
children,
// Collect any other property values passed in.
...rest
} = _ref;
const {
open
} = useWebTerminal();
return /*#__PURE__*/React__default.createElement("div", _extends({
ref: ref,
className: cx([blockClass, {
[`${blockClass}--open`]: open
}])
}, rest), children);
});
// Return a placeholder if not released and not enabled by feature flag
WebTerminalContentWrapper = pkg.checkComponentEnabled(WebTerminalContentWrapper, componentName);
// The display name of the component, used by React. Note that displayName
// is used in preference to relying on function.name.
WebTerminalContentWrapper.displayName = componentName;
// The types and DocGen commentary for the component props,
// in alphabetical order (for consistency).
// See https://www.npmjs.com/package/prop-types#usage.
WebTerminalContentWrapper.propTypes = {
/**
* Pass in content as children.
*/
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
};
export { WebTerminalContentWrapper };