@react-md/app-bar
Version:
This small package implments the AppBar spec in material design.
87 lines • 4.03 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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppBarAction = void 0;
var react_1 = __importStar(require("react"));
var button_1 = require("@react-md/button");
var useActionClassName_1 = require("./useActionClassName");
/**
* This component is really just a simple wrapper for the `Button` component
* that adds a few additional styles to prevent the button from shrinking when
* an `AppBar` has a lot of content. It also will automatically add spacing
* either before or after this button when the `first` or `last` props are
* provided.
*/
exports.AppBarAction = (0, react_1.forwardRef)(function AppBarAction(_a, ref) {
var className = _a.className, _b = _a.first, first = _b === void 0 ? false : _b, _c = _a.last, last = _c === void 0 ? false : _c, children = _a.children, inheritColor = _a.inheritColor, floating = _a.floating, _d = _a.theme, theme = _d === void 0 ? floating ? "secondary" : "clear" : _d, _e = _a.buttonType, buttonType = _e === void 0 ? "icon" : _e, props = __rest(_a, ["className", "first", "last", "children", "inheritColor", "floating", "theme", "buttonType"]);
return (react_1.default.createElement(button_1.Button, __assign({}, props, { theme: theme, buttonType: buttonType, floating: floating, ref: ref, className: (0, useActionClassName_1.useActionClassName)({ first: first, last: last, inheritColor: inheritColor, className: className }) }), children));
});
/* istanbul ignore next */
if (process.env.NODE_ENV !== "production") {
try {
var PropTypes = require("prop-types");
exports.AppBarAction.propTypes = {
className: PropTypes.string,
children: PropTypes.node,
first: PropTypes.bool,
last: PropTypes.bool,
theme: PropTypes.oneOf([
"primary",
"secondary",
"warning",
"error",
"clear",
]),
buttonType: PropTypes.oneOf(["text", "icon"]),
floating: PropTypes.oneOf([
"top-left",
"top-right",
"bottom-left",
"bottom-right",
]),
inheritColor: PropTypes.bool,
};
}
catch (e) { }
}
//# sourceMappingURL=AppBarAction.js.map