gather-content-ui
Version:
GatherContent UI Library
53 lines (51 loc) • 3.5 kB
JavaScript
;
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.WorkflowStepMeta = WorkflowStepMeta;
var _react = _interopRequireWildcard(require("react"));
var _reactSpring = require("react-spring");
var easings = _interopRequireWildcard(require("d3-ease"));
var _workflowStepProvider = require("./workflowStepProvider");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
// @ts-expect-error TS(7016): Could not find a declaration file for module 'd3-e... Remove this comment to see the full error message
function WorkflowStepMeta(_ref) {
var _hiddenActionsRef$cur;
var children = _ref.children,
actions = _ref.actions;
var _useContext = (0, _react.useContext)(_workflowStepProvider.WorkflowStepContext),
showActions = _useContext.showActions,
openDropdowns = _useContext.openDropdowns;
var hiddenActionsRef = (0, _react.useRef)(null);
var keepActionsShown = showActions || openDropdowns.length;
var maxWidth = hiddenActionsRef.current ? // @ts-expect-error TS(2339): Property 'offsetWidth' does not exist on type 'nev... Remove this comment to see the full error message
"".concat(hiddenActionsRef.current.offsetWidth, "px") : "0px";
var actionStyles = (0, _reactSpring.useSpring)({
width: keepActionsShown ? maxWidth : "0px",
opacity: keepActionsShown ? 1 : 0,
config: {
duration: keepActionsShown ? 100 : 300,
easing: easings.easeCubic
}
});
return /*#__PURE__*/_react["default"].createElement("div", {
className: "gui-workflow-step__meta-container"
}, /*#__PURE__*/_react["default"].createElement("div", {
className: "invisible absolute",
ref: hiddenActionsRef
}, actions), /*#__PURE__*/_react["default"].createElement("div", {
className: "gui-workflow-step__meta"
}, children), /*#__PURE__*/_react["default"].createElement(_reactSpring.animated.div, {
className: "relative flex items-center",
style: actionStyles
}, /*#__PURE__*/_react["default"].createElement("div", {
style: {
// @ts-expect-error TS(2339): Property 'offsetWidth' does not exist on type 'nev... Remove this comment to see the full error message
width: (_hiddenActionsRef$cur = hiddenActionsRef.current) === null || _hiddenActionsRef$cur === void 0 ? void 0 : _hiddenActionsRef$cur.offsetWidth
},
className: "absolute l-0"
}, actions)));
}
//# sourceMappingURL=workflowStepMeta.js.map