@wordpress/components
Version:
UI components for WordPress.
52 lines (47 loc) • 1.35 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.ColorIndicator = void 0;
var _clsx = _interopRequireDefault(require("clsx"));
var _element = require("@wordpress/element");
var _jsxRuntime = require("react/jsx-runtime");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnforwardedColorIndicator(props, forwardedRef) {
const {
className,
colorValue,
...additionalProps
} = props;
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
className: (0, _clsx.default)('component-color-indicator', className),
style: {
background: colorValue
},
ref: forwardedRef,
...additionalProps
});
}
/**
* ColorIndicator is a React component that renders a specific color in a
* circle. It's often used to summarize a collection of used colors in a child
* component.
*
* ```jsx
* import { ColorIndicator } from '@wordpress/components';
*
* const MyColorIndicator = () => <ColorIndicator colorValue="#0073aa" />;
* ```
*/
const ColorIndicator = exports.ColorIndicator = (0, _element.forwardRef)(UnforwardedColorIndicator);
var _default = exports.default = ColorIndicator;
//# sourceMappingURL=index.js.map