Repository URL to install this package:
|
Version:
4.0.59 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const exotic_1 = require("exotic");
const classnames_1 = tslib_1.__importDefault(require("classnames"));
const Empty_1 = require("../../../atoms/Empty");
const MaterialIcon_1 = require("../../../atoms/MaterialIcon");
const AccordionHeader_1 = require("../AccordionHeader");
const styled_1 = require("./styled");
const deps_1 = require("./deps");
function defaultRenderTitle(props) {
const title = deps_1.toTitle(props);
return react_1.default.createElement(styled_1.Title, {
key: "title",
"aria-level": props.ariaLevel
}, title);
}
exports.defaultRenderTitle = defaultRenderTitle;
function defaultRenderIcon(props) {
const {
isActive,
isPlusMinus
} = props;
if (isPlusMinus === true) {
return react_1.default.createElement(MaterialIcon_1.MaterialIcon, {
type: isActive ? 'minus' : 'plus'
});
} else {
return react_1.default.createElement(MaterialIcon_1.MaterialIcon, {
type: isActive ? 'up' : 'down'
});
}
}
exports.defaultRenderIcon = defaultRenderIcon;
function defaultRenderBox(props) {
const {
shouldShowArrowIcon,
renderTitle,
renderIcon
} = props,
remainingProps = tslib_1.__rest(props, ["shouldShowArrowIcon", "renderTitle", "renderIcon"]);
const defaultIcon = shouldShowArrowIcon === true ? exotic_1.isFunction(renderIcon) && renderIcon(remainingProps) : react_1.default.createElement(Empty_1.Empty, null);
return react_1.default.createElement(styled_1.TitleSpan, null, exotic_1.isFunction(renderTitle) && renderTitle(remainingProps), defaultIcon);
}
exports.defaultRenderBox = defaultRenderBox;
function defaultRenderWrapper(props) {
const {
isDisabled,
isActive,
children,
onClick,
text,
title
} = props; // @todo - into styled
const className = classnames_1.default({
title: true,
down: isActive,
disable: isDisabled
});
return react_1.default.createElement(AccordionHeader_1.AccordionHeader, {
key: "accordion-header",
className: className,
"aria-expanded": isActive,
"data-qa": props['data-qa'],
onClick: onClick,
"aria-label": text || title
}, children);
}
exports.defaultRenderWrapper = defaultRenderWrapper; //# sourceMappingURL=renderProps.js.map