/** @jsxRuntime classic */
/** @jsx createElement */
import { Icon } from '@framework/components/icon';
import { createElement, Fragment } from '@framework/renderer';
import { ButtonBase } from './button';
import { MbscButtonOptions } from './button.types.public';
import '../../base.scss';
import './button.scss';
export function template(s: MbscButtonOptions, inst: ButtonBase, content: any): any {
const {
ariaLabel,
children,
className,
color,
endIcon,
endIconSrc,
endIconSvg,
hasChildren,
hidden,
icon,
iconSrc,
iconSvg,
ripple,
rtl,
role,
startIcon,
startIconSrc,
startIconSvg,
tag,
tabIndex,
theme,
themeVariant,
variant,
...other
} = inst.props;
// Need to use props here, otherwise all inherited settings will be included in ...other,
// which will end up on the native element, resulting in invalid DOM
const props = {
'aria-label': ariaLabel,
className: inst._cssClass,
ref: inst._setEl,
...other,
};
const inner = (
{inst._isIconOnly && }
{inst._hasStartIcon && }
{content}
{inst._hasEndIcon && }
);
if (s.tag === 'span') {
return (
{inner}
);
}
if (s.tag === 'a') {
return (
{inner}
);
}
return (
);
}
/**
* The Button component.
*
* Usage:
*
* ```
*
* ```
*/
export class Button extends ButtonBase {
protected _template(s: MbscButtonOptions): any {
return template(s, this, s.children);
}
}