@momentum-ui/react-collaboration
Version:
Cisco Momentum UI Framework for React Collaboration Applications
54 lines • 2.46 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, { forwardRef } from 'react';
import classnames from 'classnames';
import ButtonSimple from '../ButtonSimple';
import Icon, { ICON_CONSTANTS } from '../Icon';
import { ICONS, STYLE } from './ButtonControl.constants';
import './ButtonControl.style.scss';
/**
* `<ControlButtons />` are used to control [close, maximize, minimize, etc] components [usually panels] they are assigned to.
*/
var ButtonControl = forwardRef(function (props, providedRef) {
var className = props.className, control = props.control, isCircular = props.isCircular, otherProps = __rest(props, ["className", "control", "isCircular"]);
var iconName = (ICONS[control] || 'not-found');
var iconProps = {
autoScale: true,
name: iconName,
weight: ICON_CONSTANTS.WEIGHTS.bold,
};
// Unique icon configurations, more variants will be added here once designed.
switch (iconName) {
case ICONS.favorite:
iconProps.weight = ICON_CONSTANTS.WEIGHTS.filled;
iconProps.fillColor = props.isDisabled
? 'var(--mds-color-theme-text-primary-disabled)'
: 'var(--mds-color-theme-text-warning-normal)';
break;
}
return (React.createElement(ButtonSimple, __assign({ ref: providedRef, className: classnames(STYLE.wrapper, className), "data-circular": isCircular, "data-disabled": props.isDisabled }, otherProps),
React.createElement(Icon, __assign({}, iconProps))));
});
ButtonControl.displayName = 'ButtonControl';
export default ButtonControl;
//# sourceMappingURL=ButtonControl.js.map