@atlaskit/tag-group
Version:
A tag group controls the layout and alignment for a collection of tags.
46 lines (45 loc) • 2.04 kB
JavaScript
/* index.tsx generated by @compiled/babel-plugin v3.0.4 */
import _typeof from "@babel/runtime/helpers/typeof";
import "./index.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import { Children, forwardRef, isValidElement } from 'react';
import ExitingPersistence from '@atlaskit/motion/exiting-persistence';
import { fg } from '@atlaskit/platform-feature-flags/fg';
var tagMotionCapability = Symbol.for('@atlaskit/tag/motion-capable');
var isMotionCapableTag = function isMotionCapableTag(child) {
if (! /*#__PURE__*/isValidElement(child)) {
return false;
}
var childType = child.type;
return (typeof childType === 'function' || _typeof(childType) === 'object' && childType !== null) && Reflect.get(childType, tagMotionCapability) === true;
};
var baseStyles = null;
var justifyStartStyles = null;
var justifyEndStyles = null;
/**
* __Tag group__
*
* A tag group controls the layout and alignment for a collection of tags.
*
* - [Examples](https://atlassian.design/components/tag-group/examples)
* - [Code](https://atlassian.design/components/tag-group/code)
* - [Usage](https://atlassian.design/components/tag-group/usage)
*/
var TagGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
var _ref$alignment = _ref.alignment,
alignment = _ref$alignment === void 0 ? 'start' : _ref$alignment,
titleId = _ref.titleId,
label = _ref.label,
children = _ref.children;
var isTagMotionEnabled = fg('platform-dst-motion-uplift-labels');
var shouldProvideMotionBoundary = isTagMotionEnabled && Children.toArray(children).every(isMotionCapableTag);
return /*#__PURE__*/React.createElement("div", {
role: "group",
ref: ref,
"aria-label": label,
"aria-labelledby": titleId,
className: ax(["_1e0c1txw _1bsb1osq _1n261g80", alignment === 'start' && "_1bah1y6m", alignment === 'end' && "_1bahesu3"])
}, shouldProvideMotionBoundary ? /*#__PURE__*/React.createElement(ExitingPersistence, null, children) : children);
});
export default TagGroup;