@atlaskit/button
Version:
A button triggers an event or action. They let users know what will happen next.
62 lines (60 loc) • 3.25 kB
JavaScript
/* split-button.tsx generated by @compiled/babel-plugin v3.0.2 */
"use strict";
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SplitButton = void 0;
require("./split-button.compiled.css");
var React = _interopRequireWildcard(require("react"));
var _runtime = require("@compiled/react/runtime");
var _divider = require("./divider");
var _splitButtonContainer = require("./split-button-container");
var _splitButtonContext = require("./split-button-context");
var _utils = require("./utils");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var buttonStyles = {
primaryButton: "_traeidpf _anlpidpf _p9ykidpf _bepvidpf",
secondaryButton: "_1j4hidpf _1553idpf _1qgbidpf _y1n3idpf"
};
// TODO: Fill in the component {description} and ensure links point to the correct {packageName} location.
// Remove links that the component does not have (such as usage). If there are no links remove them all.
/**
* __Split Button__
*
* A split button lets people perform an action or choose from a small group of similar actions.
*
* - [Examples](https://atlassian.design/components/button/split-button/examples)
* - [Code](https://atlassian.design/components/button/split-button/code)
* - [Usage](https://atlassian.design/components/button/split-button/usage)
*/
var SplitButton = exports.SplitButton = function SplitButton(_ref) {
var children = _ref.children,
_ref$appearance = _ref.appearance,
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
_ref$spacing = _ref.spacing,
spacing = _ref$spacing === void 0 ? 'default' : _ref$spacing,
_ref$isDisabled = _ref.isDisabled,
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
var _getActions = (0, _utils.getActions)(children),
PrimaryAction = _getActions.PrimaryAction,
SecondaryAction = _getActions.SecondaryAction;
return /*#__PURE__*/React.createElement(_splitButtonContainer.SplitButtonContainer, {
appearance: appearance,
isDisabled: isDisabled
}, /*#__PURE__*/React.createElement(_splitButtonContext.SplitButtonContext.Provider, {
value: {
appearance: appearance,
spacing: spacing,
isDisabled: isDisabled
}
}, /*#__PURE__*/React.createElement("div", {
className: (0, _runtime.ax)([buttonStyles.primaryButton])
}, PrimaryAction), /*#__PURE__*/React.createElement(_divider.Divider, {
appearance: appearance,
spacing: spacing,
isDisabled: isDisabled
}), /*#__PURE__*/React.createElement("div", {
className: (0, _runtime.ax)([buttonStyles.secondaryButton])
}, SecondaryAction)));
};