@asyncapi/react-component
Version:
A React component for AsyncAPI specification.
36 lines • 2.29 kB
JavaScript
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
import React from 'react';
var HiChevronRight = function (props) {
if (props === void 0) { props = {}; }
return (React.createElement("svg", __assign({ stroke: "currentColor", fill: "currentColor", strokeWidth: "0", viewBox: "0 0 20 20", height: "1em", width: "1em", xmlns: "http://www.w3.org/2000/svg" }, props),
React.createElement("path", { fillRule: "evenodd", d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", clipRule: "evenodd" })));
};
export var CollapseButton = function (_a) {
var _b;
var chevronProps = _a.chevronProps, _c = _a.expanded, expanded = _c === void 0 ? false : _c, children = _a.children, rest = __rest(_a, ["chevronProps", "expanded", "children"]);
return (React.createElement("button", __assign({}, rest, { className: "focus:outline-none ".concat(rest.className), type: "button" }),
React.createElement("div", { className: "inline-block" }, children),
React.createElement(HiChevronRight, __assign({}, chevronProps, { className: "inline-block align-baseline cursor-pointer ml-0.5 -mb-1 w-5 h-5 transform transition-transform duration-150 ease-linear ".concat(expanded ? '-rotate-90' : '', " ").concat((_b = chevronProps === null || chevronProps === void 0 ? void 0 : chevronProps.className) !== null && _b !== void 0 ? _b : '') }))));
};
//# sourceMappingURL=CollapseButton.js.map