@carbon/react
Version:
React components for the Carbon Design System
38 lines (30 loc) • 1.07 kB
JavaScript
/**
* Copyright IBM Corp. 2016, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
var PropTypes = require('prop-types');
var React = require('react');
var useIdPrefix = require('../../internal/useIdPrefix.js');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
function IdPrefix({
children,
prefix
}) {
return /*#__PURE__*/React__default["default"].createElement(useIdPrefix.IdPrefixContext.Provider, {
value: prefix
}, children);
}
IdPrefix.propTypes = {
children: PropTypes__default["default"].node,
/**
* The value used to prefix the auto-generated id placed on some DOM elements
*/
prefix: PropTypes__default["default"].string
};
exports.IdPrefix = IdPrefix;