first commit

This commit is contained in:
Stefan Hacker
2026-04-03 09:38:48 +02:00
commit 37ad745546
47450 changed files with 3120798 additions and 0 deletions
@@ -0,0 +1,9 @@
import * as React from 'react';
import type { IButtonProps } from '../Button.types';
import type { JSXElement } from '@fluentui/utilities';
/**
* {@docCategory Button}
*/
export declare class ActionButton extends React.Component<IButtonProps, {}> {
render(): JSXElement;
}
@@ -0,0 +1,24 @@
define(["require", "exports", "tslib", "react", "../BaseButton", "../../../Utilities", "./ActionButton.styles"], function (require, exports, tslib_1, React, BaseButton_1, Utilities_1, ActionButton_styles_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActionButton = void 0;
/**
* {@docCategory Button}
*/
var ActionButton = /** @class */ (function (_super) {
tslib_1.__extends(ActionButton, _super);
function ActionButton() {
return _super !== null && _super.apply(this, arguments) || this;
}
ActionButton.prototype.render = function () {
var _a = this.props, styles = _a.styles, theme = _a.theme;
return (React.createElement(BaseButton_1.BaseButton, tslib_1.__assign({}, this.props, { variantClassName: "ms-Button--action ms-Button--command", styles: (0, ActionButton_styles_1.getStyles)(theme, styles), onRenderDescription: Utilities_1.nullRender })));
};
ActionButton = tslib_1.__decorate([
(0, Utilities_1.customizable)('ActionButton', ['theme', 'styles'], true)
], ActionButton);
return ActionButton;
}(React.Component));
exports.ActionButton = ActionButton;
});
//# sourceMappingURL=ActionButton.js.map
@@ -0,0 +1 @@
{"version":3,"file":"ActionButton.js","sourceRoot":"../src/","sources":["components/Button/ActionButton/ActionButton.tsx"],"names":[],"mappings":";;;;IAQA;;OAEG;IAEH;QAAkC,wCAAiC;QAAnE;;QAaA,CAAC;QAZQ,6BAAM,GAAb;YACQ,IAAA,KAAoB,IAAI,CAAC,KAAK,EAA5B,MAAM,YAAA,EAAE,KAAK,WAAe,CAAC;YAErC,OAAO,CACL,oBAAC,uBAAU,uBACL,IAAI,CAAC,KAAK,IACd,gBAAgB,EAAC,sCAAsC,EACvD,MAAM,EAAE,IAAA,+BAAS,EAAC,KAAM,EAAE,MAAM,CAAC,EACjC,mBAAmB,EAAE,sBAAU,IAC/B,CACH,CAAC;QACJ,CAAC;QAZU,YAAY;YADxB,IAAA,wBAAY,EAAC,cAAc,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC;WAC3C,YAAY,CAaxB;QAAD,mBAAC;KAAA,AAbD,CAAkC,KAAK,CAAC,SAAS,GAahD;IAbY,oCAAY","sourcesContent":["import * as React from 'react';\nimport { BaseButton } from '../BaseButton';\nimport { customizable, nullRender } from '../../../Utilities';\nimport { getStyles } from './ActionButton.styles';\nimport type { IButtonProps } from '../Button.types';\n\nimport type { JSXElement } from '@fluentui/utilities';\n\n/**\n * {@docCategory Button}\n */\n@customizable('ActionButton', ['theme', 'styles'], true)\nexport class ActionButton extends React.Component<IButtonProps, {}> {\n public render(): JSXElement {\n const { styles, theme } = this.props;\n\n return (\n <BaseButton\n {...this.props}\n variantClassName=\"ms-Button--action ms-Button--command\"\n styles={getStyles(theme!, styles)}\n onRenderDescription={nullRender}\n />\n );\n }\n}\n"]}
@@ -0,0 +1,3 @@
import type { IButtonStyles } from '../Button.types';
import type { ITheme } from '../../../Styling';
export declare const getStyles: (theme: ITheme, customStyles?: IButtonStyles) => IButtonStyles;
@@ -0,0 +1,75 @@
define(["require", "exports", "../../../Styling", "../../../Utilities", "../BaseButton.styles"], function (require, exports, Styling_1, Utilities_1, BaseButton_styles_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStyles = void 0;
var DEFAULT_BUTTON_HEIGHT = '40px';
var DEFAULT_PADDING = '0 4px';
exports.getStyles = (0, Utilities_1.memoizeFunction)(function (theme, customStyles) {
var _a, _b, _c;
var baseButtonStyles = (0, BaseButton_styles_1.getStyles)(theme);
var actionButtonStyles = {
root: (_a = {
padding: DEFAULT_PADDING,
height: DEFAULT_BUTTON_HEIGHT,
color: theme.palette.neutralPrimary,
backgroundColor: 'transparent',
border: '1px solid transparent'
},
_a[Styling_1.HighContrastSelector] = {
borderColor: 'Window',
},
_a),
rootHovered: (_b = {
color: theme.palette.themePrimary
},
_b[Styling_1.HighContrastSelector] = {
color: 'Highlight',
},
_b),
iconHovered: {
color: theme.palette.themePrimary,
},
rootPressed: {
color: theme.palette.black,
},
rootExpanded: {
color: theme.palette.themePrimary,
},
iconPressed: {
color: theme.palette.themeDarker,
},
rootDisabled: (_c = {
color: theme.palette.neutralTertiary,
backgroundColor: 'transparent',
borderColor: 'transparent'
},
_c[Styling_1.HighContrastSelector] = {
color: 'GrayText',
},
_c),
rootChecked: {
color: theme.palette.black,
},
iconChecked: {
color: theme.palette.themeDarker,
},
flexContainer: {
justifyContent: 'flex-start',
},
icon: {
color: theme.palette.themeDarkAlt,
},
iconDisabled: {
color: 'inherit',
},
menuIcon: {
color: theme.palette.neutralSecondary,
},
textContainer: {
flexGrow: 0,
},
};
return (0, Styling_1.concatStyleSets)(baseButtonStyles, actionButtonStyles, customStyles);
});
});
//# sourceMappingURL=ActionButton.styles.js.map
@@ -0,0 +1 @@
{"version":3,"file":"ActionButton.styles.js","sourceRoot":"../src/","sources":["components/Button/ActionButton/ActionButton.styles.ts"],"names":[],"mappings":";;;;IAMA,IAAM,qBAAqB,GAAG,MAAM,CAAC;IACrC,IAAM,eAAe,GAAG,OAAO,CAAC;IAEnB,QAAA,SAAS,GAAG,IAAA,2BAAe,EAAC,UAAC,KAAa,EAAE,YAA4B;;QACnF,IAAM,gBAAgB,GAAkB,IAAA,6BAAmB,EAAC,KAAK,CAAC,CAAC;QACnE,IAAM,kBAAkB,GAAkB;YACxC,IAAI;oBACF,OAAO,EAAE,eAAe;oBACxB,MAAM,EAAE,qBAAqB;oBAC7B,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;oBACnC,eAAe,EAAE,aAAa;oBAC9B,MAAM,EAAE,uBAAuB;;gBAC/B,GAAC,8BAAoB,IAAG;oBACtB,WAAW,EAAE,QAAQ;iBACtB;mBACF;YAED,WAAW;oBACT,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY;;gBACjC,GAAC,8BAAoB,IAAG;oBACtB,KAAK,EAAE,WAAW;iBACnB;mBACF;YAED,WAAW,EAAE;gBACX,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY;aAClC;YAED,WAAW,EAAE;gBACX,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;aAC3B;YAED,YAAY,EAAE;gBACZ,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY;aAClC;YAED,WAAW,EAAE;gBACX,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW;aACjC;YAED,YAAY;oBACV,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,eAAe;oBACpC,eAAe,EAAE,aAAa;oBAC9B,WAAW,EAAE,aAAa;;gBAC1B,GAAC,8BAAoB,IAAG;oBACtB,KAAK,EAAE,UAAU;iBAClB;mBACF;YAED,WAAW,EAAE;gBACX,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;aAC3B;YAED,WAAW,EAAE;gBACX,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW;aACjC;YAED,aAAa,EAAE;gBACb,cAAc,EAAE,YAAY;aAC7B;YAED,IAAI,EAAE;gBACJ,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,YAAY;aAClC;YAED,YAAY,EAAE;gBACZ,KAAK,EAAE,SAAS;aACjB;YAED,QAAQ,EAAE;gBACR,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,gBAAgB;aACtC;YAED,aAAa,EAAE;gBACb,QAAQ,EAAE,CAAC;aACZ;SACF,CAAC;QAEF,OAAO,IAAA,yBAAe,EAAC,gBAAgB,EAAE,kBAAkB,EAAE,YAAY,CAAE,CAAC;IAC9E,CAAC,CAAC,CAAC","sourcesContent":["import { concatStyleSets, HighContrastSelector } from '../../../Styling';\nimport { memoizeFunction } from '../../../Utilities';\nimport { getStyles as getBaseButtonStyles } from '../BaseButton.styles';\nimport type { IButtonStyles } from '../Button.types';\nimport type { ITheme } from '../../../Styling';\n\nconst DEFAULT_BUTTON_HEIGHT = '40px';\nconst DEFAULT_PADDING = '0 4px';\n\nexport const getStyles = memoizeFunction((theme: ITheme, customStyles?: IButtonStyles): IButtonStyles => {\n const baseButtonStyles: IButtonStyles = getBaseButtonStyles(theme);\n const actionButtonStyles: IButtonStyles = {\n root: {\n padding: DEFAULT_PADDING,\n height: DEFAULT_BUTTON_HEIGHT,\n color: theme.palette.neutralPrimary,\n backgroundColor: 'transparent',\n border: '1px solid transparent',\n [HighContrastSelector]: {\n borderColor: 'Window',\n },\n },\n\n rootHovered: {\n color: theme.palette.themePrimary,\n [HighContrastSelector]: {\n color: 'Highlight',\n },\n },\n\n iconHovered: {\n color: theme.palette.themePrimary,\n },\n\n rootPressed: {\n color: theme.palette.black,\n },\n\n rootExpanded: {\n color: theme.palette.themePrimary,\n },\n\n iconPressed: {\n color: theme.palette.themeDarker,\n },\n\n rootDisabled: {\n color: theme.palette.neutralTertiary,\n backgroundColor: 'transparent',\n borderColor: 'transparent',\n [HighContrastSelector]: {\n color: 'GrayText',\n },\n },\n\n rootChecked: {\n color: theme.palette.black,\n },\n\n iconChecked: {\n color: theme.palette.themeDarker,\n },\n\n flexContainer: {\n justifyContent: 'flex-start',\n },\n\n icon: {\n color: theme.palette.themeDarkAlt,\n },\n\n iconDisabled: {\n color: 'inherit',\n },\n\n menuIcon: {\n color: theme.palette.neutralSecondary,\n },\n\n textContainer: {\n flexGrow: 0,\n },\n };\n\n return concatStyleSets(baseButtonStyles, actionButtonStyles, customStyles)!;\n});\n"]}
@@ -0,0 +1,24 @@
import type { ITheme } from '../../Styling';
import type { IButtonStyles } from './Button.types';
export interface IButtonClassNames {
root?: string;
flexContainer?: string;
textContainer?: string;
icon?: string;
label?: string;
menuIcon?: string;
description?: string;
screenReaderText?: string;
}
export declare const ButtonGlobalClassNames: {
msButton: string;
msButtonHasMenu: string;
msButtonIcon: string;
msButtonMenuIcon: string;
msButtonLabel: string;
msButtonDescription: string;
msButtonScreenReaderText: string;
msButtonFlexContainer: string;
msButtonTextContainer: string;
};
export declare const getBaseButtonClassNames: (theme: ITheme, styles: IButtonStyles, className: string, variantClassName: string, iconClassName: string | undefined, menuIconClassName: string | undefined, disabled: boolean, hasMenu: boolean, checked: boolean, expanded: boolean, isSplit: boolean | undefined) => IButtonClassNames;
@@ -0,0 +1,96 @@
define(["require", "exports", "../../Utilities", "../../Styling"], function (require, exports, Utilities_1, Styling_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBaseButtonClassNames = exports.ButtonGlobalClassNames = void 0;
exports.ButtonGlobalClassNames = {
msButton: 'ms-Button',
msButtonHasMenu: 'ms-Button--hasMenu',
msButtonIcon: 'ms-Button-icon',
msButtonMenuIcon: 'ms-Button-menuIcon',
msButtonLabel: 'ms-Button-label',
msButtonDescription: 'ms-Button-description',
msButtonScreenReaderText: 'ms-Button-screenReaderText',
msButtonFlexContainer: 'ms-Button-flexContainer',
msButtonTextContainer: 'ms-Button-textContainer',
};
exports.getBaseButtonClassNames = (0, Utilities_1.memoizeFunction)(function (theme, styles, className, variantClassName, iconClassName, menuIconClassName, disabled, hasMenu, checked, expanded, isSplit) {
var _a, _b;
var classNames = (0, Styling_1.getGlobalClassNames)(exports.ButtonGlobalClassNames, theme || {});
var isExpanded = expanded && !isSplit;
return (0, Styling_1.mergeStyleSets)(styles.__shadowConfig__, {
root: [
classNames.msButton,
styles.root,
variantClassName,
checked && ['is-checked', styles.rootChecked],
isExpanded && [
'is-expanded',
styles.rootExpanded,
(_a = {},
_a[":hover .".concat(classNames.msButtonIcon)] = styles.iconExpandedHovered,
// menuIcon falls back to rootExpandedHovered to support original behavior
_a[":hover .".concat(classNames.msButtonMenuIcon)] = styles.menuIconExpandedHovered || styles.rootExpandedHovered,
_a[':hover'] = styles.rootExpandedHovered,
_a),
],
hasMenu && [exports.ButtonGlobalClassNames.msButtonHasMenu, styles.rootHasMenu],
disabled && ['is-disabled', styles.rootDisabled],
!disabled &&
!isExpanded &&
!checked && (_b = {
':hover': styles.rootHovered
},
_b[":hover .".concat(classNames.msButtonLabel)] = styles.labelHovered,
_b[":hover .".concat(classNames.msButtonIcon)] = styles.iconHovered,
_b[":hover .".concat(classNames.msButtonDescription)] = styles.descriptionHovered,
_b[":hover .".concat(classNames.msButtonMenuIcon)] = styles.menuIconHovered,
_b[':focus'] = styles.rootFocused,
_b[':active'] = styles.rootPressed,
_b[":active .".concat(classNames.msButtonIcon)] = styles.iconPressed,
_b[":active .".concat(classNames.msButtonDescription)] = styles.descriptionPressed,
_b[":active .".concat(classNames.msButtonMenuIcon)] = styles.menuIconPressed,
_b),
disabled && checked && [styles.rootCheckedDisabled],
!disabled &&
checked && {
':hover': styles.rootCheckedHovered,
':active': styles.rootCheckedPressed,
},
className,
],
flexContainer: [classNames.msButtonFlexContainer, styles.flexContainer],
textContainer: [classNames.msButtonTextContainer, styles.textContainer],
icon: [
classNames.msButtonIcon,
iconClassName,
styles.icon,
isExpanded && styles.iconExpanded,
checked && styles.iconChecked,
disabled && styles.iconDisabled,
],
label: [classNames.msButtonLabel, styles.label, checked && styles.labelChecked, disabled && styles.labelDisabled],
menuIcon: [
classNames.msButtonMenuIcon,
menuIconClassName,
styles.menuIcon,
checked && styles.menuIconChecked,
disabled && !isSplit && styles.menuIconDisabled,
!disabled &&
!isExpanded &&
!checked && {
':hover': styles.menuIconHovered,
':active': styles.menuIconPressed,
},
isExpanded && ['is-expanded', styles.menuIconExpanded],
],
description: [
classNames.msButtonDescription,
styles.description,
checked && styles.descriptionChecked,
disabled && styles.descriptionDisabled,
],
screenReaderText: [classNames.msButtonScreenReaderText, styles.screenReaderText],
});
});
});
//# sourceMappingURL=BaseButton.classNames.js.map
File diff suppressed because one or more lines are too long
+93
View File
@@ -0,0 +1,93 @@
import * as React from 'react';
import type { IFocusRectsContext } from '../../Utilities';
import type { IButtonProps, IButton } from './Button.types';
import type { JSXElement } from '@fluentui/utilities';
/**
* {@docCategory Button}
*/
export interface IBaseButtonProps extends IButtonProps {
baseClassName?: string;
variantClassName?: string;
}
/**
* {@docCategory Button}
*/
export interface IBaseButtonState {
menuHidden: boolean;
}
/**
* {@docCategory Button}
*/
export declare class BaseButton extends React.Component<IBaseButtonProps, IBaseButtonState> implements IButton {
private get _isSplitButton();
static defaultProps: Partial<IBaseButtonProps>;
static contextType: React.Context<IFocusRectsContext | undefined>;
context: IFocusRectsContext;
private _async;
private _events;
private _buttonElement;
private _splitButtonContainer;
private _mergedRef;
private _labelId;
private _descriptionId;
private _ariaDescriptionId;
private _classNames;
private _processingTouch;
private _lastTouchTimeoutId;
private _renderedVisibleMenu;
private _menuShouldFocusOnContainer;
private _menuShouldFocusOnMount;
private _getMemoizedMenuButtonKeytipProps;
constructor(props: IBaseButtonProps);
render(): JSXElement;
componentDidMount(): void;
componentDidUpdate(prevProps: IBaseButtonProps, prevState: IBaseButtonState): void;
componentWillUnmount(): void;
focus(): void;
dismissMenu(): void;
openMenu(shouldFocusOnContainer?: boolean, shouldFocusOnMount?: boolean): void;
private _onRenderContent;
/**
* Method to help determine if the menu's component tree should
* be rendered. It takes into account whether the menu is expanded,
* whether it is a persisted menu and whether it has been shown to the user.
*/
private _shouldRenderMenu;
private _onRenderIcon;
private _onRenderTextContents;
private _onRenderText;
private _hasText;
private _onRenderChildren;
private _onRenderDescription;
private _onRenderAriaDescription;
private _onRenderMenuIcon;
private _getMenuProps;
private _onRenderMenu;
private _onDismissMenu;
private _dismissMenu;
private _openMenu;
private _onToggleMenu;
private _onRenderSplitButtonContent;
private _onSplitContainerFocusCapture;
private _onSplitButtonPrimaryClick;
private _onRenderSplitButtonDivider;
private _onRenderSplitButtonMenuButton;
private _onKeyDown;
private _onKeyUp;
private _onKeyPress;
private _onMouseUp;
private _onMouseDown;
private _onClick;
private _onSplitButtonContainerKeyDown;
private _onMenuKeyDown;
private _onTouchStart;
private _onPointerDown;
private _handleTouchAndPointerEvent;
/**
* Returns if the user hits a valid keyboard key to open the menu
* @param ev - the keyboard event
* @returns True if user clicks on custom trigger key if enabled or alt + down arrow if not. False otherwise.
*/
private _isValidMenuOpenKey;
private _onMenuClick;
}
+623
View File
@@ -0,0 +1,623 @@
define(["require", "exports", "tslib", "react", "../../Utilities", "../../Icon", "../../common/DirectionalHint", "../../ContextualMenu", "./BaseButton.classNames", "./SplitButton/SplitButton.classNames", "../../KeytipData", "../../Utilities"], function (require, exports, tslib_1, React, Utilities_1, Icon_1, DirectionalHint_1, ContextualMenu_1, BaseButton_classNames_1, SplitButton_classNames_1, KeytipData_1, Utilities_2) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseButton = void 0;
var TouchIdleDelay = 500; /* ms */
var COMPONENT_NAME = 'BaseButton';
/**
* {@docCategory Button}
*/
var BaseButton = /** @class */ (function (_super) {
tslib_1.__extends(BaseButton, _super);
function BaseButton(props) {
var _this = _super.call(this, props) || this;
_this._buttonElement = React.createRef();
_this._splitButtonContainer = React.createRef();
_this._mergedRef = (0, Utilities_1.createMergedRef)();
_this._renderedVisibleMenu = false;
_this._getMemoizedMenuButtonKeytipProps = (0, Utilities_1.memoizeFunction)(function (keytipProps) {
return tslib_1.__assign(tslib_1.__assign({}, keytipProps), { hasMenu: true });
});
_this._onRenderIcon = function (buttonProps, defaultRender) {
var iconProps = _this.props.iconProps;
if (iconProps && (iconProps.iconName !== undefined || iconProps.imageProps)) {
var className = iconProps.className, imageProps = iconProps.imageProps, rest = tslib_1.__rest(iconProps, ["className", "imageProps"]);
// If the styles prop is specified as part of iconProps, fall back to regular Icon as FontIcon and ImageIcon
// do not have this prop.
if (iconProps.styles) {
return React.createElement(Icon_1.Icon, tslib_1.__assign({ className: (0, Utilities_1.css)(_this._classNames.icon, className), imageProps: imageProps }, rest));
}
if (iconProps.iconName) {
return React.createElement(Icon_1.FontIcon, tslib_1.__assign({ className: (0, Utilities_1.css)(_this._classNames.icon, className) }, rest));
}
if (imageProps) {
return React.createElement(Icon_1.ImageIcon, tslib_1.__assign({ className: (0, Utilities_1.css)(_this._classNames.icon, className), imageProps: imageProps }, rest));
}
}
return null;
};
_this._onRenderTextContents = function () {
var _a = _this.props, text = _a.text, children = _a.children,
// eslint-disable-next-line @typescript-eslint/no-deprecated
_b = _a.secondaryText,
// eslint-disable-next-line @typescript-eslint/no-deprecated
secondaryText = _b === void 0 ? _this.props.description : _b, _c = _a.onRenderText, onRenderText = _c === void 0 ? _this._onRenderText : _c, _d = _a.onRenderDescription, onRenderDescription = _d === void 0 ? _this._onRenderDescription : _d;
if (text || typeof children === 'string' || secondaryText) {
return (React.createElement("span", { className: _this._classNames.textContainer },
onRenderText(_this.props, _this._onRenderText),
onRenderDescription(_this.props, _this._onRenderDescription)));
}
return [onRenderText(_this.props, _this._onRenderText), onRenderDescription(_this.props, _this._onRenderDescription)];
};
_this._onRenderText = function () {
var text = _this.props.text;
var children = _this.props.children;
// For backwards compat, we should continue to take in the text content from children.
if (text === undefined && typeof children === 'string') {
text = children;
}
if (_this._hasText()) {
return (React.createElement("span", { key: _this._labelId, className: _this._classNames.label, id: _this._labelId }, text));
}
return null;
};
_this._onRenderChildren = function () {
var children = _this.props.children;
// If children is just a string, either it or the text will be rendered via onRenderLabel
// If children is another component, it will be rendered after text
if (typeof children === 'string') {
return null;
}
return children;
};
_this._onRenderDescription = function (props) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
var _a = props.secondaryText, secondaryText = _a === void 0 ? _this.props.description : _a;
// ms-Button-description is only shown when the button type is compound.
// In other cases it will not be displayed.
return secondaryText ? (React.createElement("span", { key: _this._descriptionId, className: _this._classNames.description, id: _this._descriptionId }, secondaryText)) : null;
};
_this._onRenderAriaDescription = function () {
var ariaDescription = _this.props.ariaDescription;
// If ariaDescription is given, descriptionId will be assigned to ariaDescriptionSpan,
// otherwise it will be assigned to descriptionSpan.
return ariaDescription ? (React.createElement("span", { className: _this._classNames.screenReaderText, id: _this._ariaDescriptionId }, ariaDescription)) : null;
};
_this._onRenderMenuIcon = function (props) {
var menuIconProps = _this.props.menuIconProps;
return React.createElement(Icon_1.FontIcon, tslib_1.__assign({ iconName: "ChevronDown" }, menuIconProps, { className: _this._classNames.menuIcon }));
};
_this._onRenderMenu = function (menuProps) {
var MenuType = _this.props.menuAs ? (0, Utilities_2.composeComponentAs)(_this.props.menuAs, ContextualMenu_1.ContextualMenu) : ContextualMenu_1.ContextualMenu;
return React.createElement(MenuType, tslib_1.__assign({}, menuProps));
};
_this._onDismissMenu = function (ev) {
var menuProps = _this.props.menuProps;
if (menuProps && menuProps.onDismiss) {
menuProps.onDismiss(ev);
}
if (!ev || !ev.defaultPrevented) {
_this._dismissMenu();
}
};
_this._dismissMenu = function () {
_this._menuShouldFocusOnMount = undefined;
_this._menuShouldFocusOnContainer = undefined;
_this.setState({ menuHidden: true });
};
_this._openMenu = function (shouldFocusOnContainer, shouldFocusOnMount) {
if (shouldFocusOnMount === void 0) { shouldFocusOnMount = true; }
if (_this.props.menuProps) {
_this._menuShouldFocusOnContainer = shouldFocusOnContainer;
_this._menuShouldFocusOnMount = shouldFocusOnMount;
_this._renderedVisibleMenu = true;
_this.setState({ menuHidden: false });
}
};
_this._onToggleMenu = function (shouldFocusOnContainer) {
var shouldFocusOnMount = true;
if (_this.props.menuProps && _this.props.menuProps.shouldFocusOnMount === false) {
shouldFocusOnMount = false;
}
_this.state.menuHidden ? _this._openMenu(shouldFocusOnContainer, shouldFocusOnMount) : _this._dismissMenu();
};
_this._onSplitContainerFocusCapture = function (ev) {
var container = _this._splitButtonContainer.current;
// If the target is coming from the portal we do not need to set focus on the container.
if (!container || (ev.target && (0, Utilities_1.portalContainsElement)(ev.target, container))) {
return;
}
// We should never be able to focus the individual buttons in a split button. Focus
// should always remain on the container.
container.focus();
};
_this._onSplitButtonPrimaryClick = function (ev) {
if (!_this.state.menuHidden) {
_this._dismissMenu();
}
// toggle split buttons need two separate targets, even for touch
var singleTouchTarget = _this._processingTouch && !_this.props.toggle;
if (!singleTouchTarget && _this.props.onClick) {
_this.props.onClick(ev);
}
else if (singleTouchTarget) {
_this._onMenuClick(ev);
}
};
_this._onKeyDown = function (ev) {
// explicity cancelling event so click won't fire after this
// eslint-disable-next-line @typescript-eslint/no-deprecated
if (_this.props.disabled && (ev.which === Utilities_1.KeyCodes.enter || ev.which === Utilities_1.KeyCodes.space)) {
ev.preventDefault();
ev.stopPropagation();
}
else if (!_this.props.disabled) {
if (_this.props.menuProps) {
_this._onMenuKeyDown(ev);
}
else if (_this.props.onKeyDown !== undefined) {
_this.props.onKeyDown(ev); // not cancelling event because it's not disabled
}
}
};
_this._onKeyUp = function (ev) {
if (!_this.props.disabled && _this.props.onKeyUp !== undefined) {
_this.props.onKeyUp(ev); // not cancelling event because it's not disabled
}
};
_this._onKeyPress = function (ev) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
if (!_this.props.disabled && _this.props.onKeyPress !== undefined) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
_this.props.onKeyPress(ev); // not cancelling event because it's not disabled
}
};
_this._onMouseUp = function (ev) {
if (!_this.props.disabled && _this.props.onMouseUp !== undefined) {
_this.props.onMouseUp(ev); // not cancelling event because it's not disabled
}
};
_this._onMouseDown = function (ev) {
if (!_this.props.disabled && _this.props.onMouseDown !== undefined) {
_this.props.onMouseDown(ev); // not cancelling event because it's not disabled
}
};
_this._onClick = function (ev) {
if (!_this.props.disabled) {
if (_this.props.menuProps) {
_this._onMenuClick(ev);
}
else if (_this.props.onClick !== undefined) {
_this.props.onClick(ev); // not cancelling event because it's not disabled
}
}
};
_this._onSplitButtonContainerKeyDown = function (ev) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
if (ev.which === Utilities_1.KeyCodes.enter || ev.which === Utilities_1.KeyCodes.space) {
if (_this._buttonElement.current) {
_this._buttonElement.current.click();
ev.preventDefault();
ev.stopPropagation();
}
}
else {
_this._onMenuKeyDown(ev);
}
};
_this._onMenuKeyDown = function (ev) {
var _a;
if (_this.props.disabled) {
return;
}
if (_this.props.onKeyDown) {
_this.props.onKeyDown(ev);
}
// eslint-disable-next-line @typescript-eslint/no-deprecated
var isUp = ev.which === Utilities_1.KeyCodes.up;
// eslint-disable-next-line @typescript-eslint/no-deprecated
var isDown = ev.which === Utilities_1.KeyCodes.down;
if (!ev.defaultPrevented && _this._isValidMenuOpenKey(ev)) {
var onMenuClick = _this.props.onMenuClick;
if (onMenuClick) {
onMenuClick(ev, _this.props);
}
_this._onToggleMenu(false);
ev.preventDefault();
ev.stopPropagation();
}
// eslint-disable-next-line @typescript-eslint/no-deprecated
if (ev.which === Utilities_1.KeyCodes.enter || ev.which === Utilities_1.KeyCodes.space) {
// We manually set the focus visibility to true if opening via Enter or Space to account for the scenario where
// a user clicks on the button, closes the menu and then opens it via keyboard. In this scenario our default logic
// for setting focus visibility is not triggered since there is no keyboard navigation present beforehand.
(0, Utilities_1.setFocusVisibility)(true, ev.target, (_a = _this.context) === null || _a === void 0 ? void 0 : _a.registeredProviders);
}
if (!(ev.altKey || ev.metaKey) && (isUp || isDown)) {
// Suppose a menu, with shouldFocusOnMount: false, is open, and user wants to keyboard to the menu items
// We need to re-render the menu with shouldFocusOnMount as true.
if (!_this.state.menuHidden && _this.props.menuProps) {
var currentShouldFocusOnMount = _this._menuShouldFocusOnMount !== undefined
? _this._menuShouldFocusOnMount
: _this.props.menuProps.shouldFocusOnMount;
if (!currentShouldFocusOnMount) {
ev.preventDefault();
ev.stopPropagation();
_this._menuShouldFocusOnMount = true;
_this.forceUpdate();
}
}
}
};
_this._onTouchStart = function () {
if (_this._isSplitButton &&
_this._splitButtonContainer.current &&
!('onpointerdown' in _this._splitButtonContainer.current)) {
_this._handleTouchAndPointerEvent();
}
};
_this._onMenuClick = function (ev) {
var _a = _this.props, onMenuClick = _a.onMenuClick, menuProps = _a.menuProps;
if (onMenuClick) {
onMenuClick(ev, _this.props);
}
// focus on the container by default when the menu is opened with a click event
// this differentiates from a keyboard interaction triggering the click event
var shouldFocusOnContainer = typeof (menuProps === null || menuProps === void 0 ? void 0 : menuProps.shouldFocusOnContainer) === 'boolean'
? menuProps.shouldFocusOnContainer
: ev.nativeEvent.pointerType === 'mouse';
if (!ev.defaultPrevented) {
_this._onToggleMenu(shouldFocusOnContainer);
ev.preventDefault();
ev.stopPropagation();
}
};
(0, Utilities_1.initializeComponentRef)(_this);
_this._async = new Utilities_1.Async(_this);
_this._events = new Utilities_1.EventGroup(_this);
(0, Utilities_1.warnConditionallyRequiredProps)(COMPONENT_NAME, props, ['menuProps', 'onClick'], 'split', _this.props.split);
(0, Utilities_1.warnDeprecations)(COMPONENT_NAME, props, {
rootProps: undefined,
description: 'secondaryText',
toggled: 'checked',
});
_this._labelId = (0, Utilities_1.getId)();
_this._descriptionId = (0, Utilities_1.getId)();
_this._ariaDescriptionId = (0, Utilities_1.getId)();
_this.state = {
menuHidden: true,
};
return _this;
}
Object.defineProperty(BaseButton.prototype, "_isSplitButton", {
get: function () {
return !!this.props.menuProps && !!this.props.onClick && this.props.split === true;
},
enumerable: false,
configurable: true
});
BaseButton.prototype.render = function () {
var _a;
var _b = this.props, ariaDescription = _b.ariaDescription, ariaLabel = _b.ariaLabel, ariaHidden = _b.ariaHidden, className = _b.className, disabled = _b.disabled, allowDisabledFocus = _b.allowDisabledFocus, primaryDisabled = _b.primaryDisabled,
// eslint-disable-next-line @typescript-eslint/no-deprecated
_c = _b.secondaryText,
// eslint-disable-next-line @typescript-eslint/no-deprecated
secondaryText = _c === void 0 ? this.props.description : _c, href = _b.href, iconProps = _b.iconProps, menuIconProps = _b.menuIconProps, styles = _b.styles, checked = _b.checked, variantClassName = _b.variantClassName, theme = _b.theme, toggle = _b.toggle, getClassNames = _b.getClassNames, role = _b.role;
var menuHidden = this.state.menuHidden;
// Button is disabled if the whole button (in case of splitButton is disabled) or if the primary action is disabled
var isPrimaryButtonDisabled = disabled || primaryDisabled;
this._classNames = getClassNames
? getClassNames(theme, className, variantClassName, iconProps && iconProps.className, menuIconProps && menuIconProps.className, isPrimaryButtonDisabled, checked, !menuHidden, !!this.props.menuProps, this.props.split, !!allowDisabledFocus)
: (0, BaseButton_classNames_1.getBaseButtonClassNames)(theme, styles, className, variantClassName, iconProps && iconProps.className, menuIconProps && menuIconProps.className, isPrimaryButtonDisabled, !!this.props.menuProps, checked, !menuHidden, this.props.split);
var _d = this, _ariaDescriptionId = _d._ariaDescriptionId, _labelId = _d._labelId, _descriptionId = _d._descriptionId;
// Anchor tag cannot be disabled hence in disabled state rendering
// anchor button as normal button
var renderAsAnchor = !isPrimaryButtonDisabled && !!href;
var tag = renderAsAnchor ? 'a' : 'button';
var nativeProps = (0, Utilities_1.getNativeProps)(
// eslint-disable-next-line @typescript-eslint/no-deprecated
(0, Utilities_1.assign)(renderAsAnchor ? {} : { type: 'button' }, this.props.rootProps, this.props), renderAsAnchor ? Utilities_1.anchorProperties : Utilities_1.buttonProperties, [
'disabled', // let disabled buttons be focused and styled as disabled.
]);
// Check for ariaLabel passed in via Button props, and fall back to aria-label passed in via native props
var resolvedAriaLabel = ariaLabel || nativeProps['aria-label'];
// Check for ariaDescription, secondaryText or aria-describedby in the native props to determine source of
// aria-describedby. Otherwise default to undefined so property does not appear in output.
var ariaDescribedBy = undefined;
if (ariaDescription) {
ariaDescribedBy = _ariaDescriptionId;
}
else if (secondaryText && this.props.onRenderDescription !== Utilities_1.nullRender) {
// for buttons like CompoundButton with a valid onRenderDescription, we need to set an ariaDescribedBy
// for buttons that do not render anything (via nullRender), we should not set an ariaDescribedBy
ariaDescribedBy = _descriptionId;
}
else if (nativeProps['aria-describedby']) {
ariaDescribedBy = nativeProps['aria-describedby'];
}
// If an explicit aria-labelledby is given, use that and we're done.
// If any kind of description is given (which will end up as an aria-describedby attribute)
// and no ariaLabel is specified, set the labelledby element.
// Otherwise, the button is labeled implicitly by the descendent text on the button (if it exists).
var ariaLabelledBy = undefined;
if (nativeProps['aria-labelledby']) {
ariaLabelledBy = nativeProps['aria-labelledby'];
}
else if (ariaDescribedBy && !resolvedAriaLabel) {
ariaLabelledBy = this._hasText() ? _labelId : undefined;
}
var dataIsFocusable = this.props['data-is-focusable'] === false || (disabled && !allowDisabledFocus) || this._isSplitButton
? false
: true;
var isCheckboxTypeRole = role === 'menuitemcheckbox' || role === 'checkbox';
// if isCheckboxTypeRole, always return a checked value.
// Otherwise only return checked value if toggle is set to true.
// This is because role="checkbox" always needs to have an aria-checked value
// but our checked prop only sets aria-pressed if we mark the button as a toggle="true"
var checkedOrPressedValue = isCheckboxTypeRole ? !!checked : toggle === true ? !!checked : undefined;
var buttonProps = (0, Utilities_1.assign)(nativeProps, (_a = {
className: this._classNames.root,
// eslint-disable-next-line @typescript-eslint/no-deprecated
ref: this._mergedRef(this.props.elementRef, this._buttonElement),
disabled: isPrimaryButtonDisabled && !allowDisabledFocus,
onKeyDown: this._onKeyDown,
onKeyPress: this._onKeyPress,
onKeyUp: this._onKeyUp,
onMouseDown: this._onMouseDown,
onMouseUp: this._onMouseUp,
onClick: this._onClick,
'aria-label': resolvedAriaLabel,
'aria-labelledby': ariaLabelledBy,
'aria-describedby': ariaDescribedBy,
'aria-disabled': isPrimaryButtonDisabled,
'data-is-focusable': dataIsFocusable
},
// aria-pressed attribute should only be present for toggle buttons
// aria-checked attribute should only be present for toggle buttons with checkbox type role
_a[isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed'] = checkedOrPressedValue,
_a));
if (ariaHidden) {
buttonProps['aria-hidden'] = true;
}
if (this._isSplitButton) {
return this._onRenderSplitButtonContent(tag, buttonProps);
}
else if (this.props.menuProps) {
var _e = this.props.menuProps.id, id = _e === void 0 ? "".concat(this._labelId, "-menu") : _e;
(0, Utilities_1.assign)(buttonProps, {
'aria-expanded': !menuHidden,
'aria-controls': !menuHidden ? id : null,
'aria-haspopup': true,
});
}
return this._onRenderContent(tag, buttonProps);
};
BaseButton.prototype.componentDidMount = function () {
// For split buttons, touching anywhere in the button should drop the dropdown, which should contain the
// primary action. This gives more hit target space for touch environments. We're setting the onpointerdown here,
// because React does not support Pointer events yet.
if (this._isSplitButton && this._splitButtonContainer.current) {
if ('onpointerdown' in this._splitButtonContainer.current) {
this._events.on(this._splitButtonContainer.current, 'pointerdown', this._onPointerDown, true);
}
if ('onpointerup' in this._splitButtonContainer.current && this.props.onPointerUp) {
this._events.on(this._splitButtonContainer.current, 'pointerup', this.props.onPointerUp, true);
}
}
};
BaseButton.prototype.componentDidUpdate = function (prevProps, prevState) {
// If Button's menu was closed, run onAfterMenuDismiss.
if (this.props.onAfterMenuDismiss && !prevState.menuHidden && this.state.menuHidden) {
this.props.onAfterMenuDismiss();
}
};
BaseButton.prototype.componentWillUnmount = function () {
this._async.dispose();
this._events.dispose();
};
BaseButton.prototype.focus = function () {
var _a, _b;
if (this._isSplitButton && this._splitButtonContainer.current) {
(0, Utilities_1.setFocusVisibility)(true, undefined, (_a = this.context) === null || _a === void 0 ? void 0 : _a.registeredProviders);
this._splitButtonContainer.current.focus();
}
else if (this._buttonElement.current) {
(0, Utilities_1.setFocusVisibility)(true, undefined, (_b = this.context) === null || _b === void 0 ? void 0 : _b.registeredProviders);
this._buttonElement.current.focus();
}
};
BaseButton.prototype.dismissMenu = function () {
this._dismissMenu();
};
BaseButton.prototype.openMenu = function (shouldFocusOnContainer, shouldFocusOnMount) {
this._openMenu(shouldFocusOnContainer, shouldFocusOnMount);
};
BaseButton.prototype._onRenderContent = function (tag, buttonProps) {
var _this = this;
var props = this.props;
var Tag = tag;
var menuIconProps = props.menuIconProps, menuProps = props.menuProps, _a = props.onRenderIcon, onRenderIcon = _a === void 0 ? this._onRenderIcon : _a, _b = props.onRenderAriaDescription, onRenderAriaDescription = _b === void 0 ? this._onRenderAriaDescription : _b, _c = props.onRenderChildren, onRenderChildren = _c === void 0 ? this._onRenderChildren : _c,
// eslint-disable-next-line @typescript-eslint/no-deprecated
_d = props.onRenderMenu,
// eslint-disable-next-line @typescript-eslint/no-deprecated
onRenderMenu = _d === void 0 ? this._onRenderMenu : _d, _e = props.onRenderMenuIcon, onRenderMenuIcon = _e === void 0 ? this._onRenderMenuIcon : _e, disabled = props.disabled;
var keytipProps = props.keytipProps;
if (keytipProps && menuProps) {
keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps);
}
var Button = function (keytipAttributes) { return (React.createElement(Tag, tslib_1.__assign({}, buttonProps, keytipAttributes),
React.createElement("span", { className: _this._classNames.flexContainer, "data-automationid": "splitbuttonprimary" },
onRenderIcon(props, _this._onRenderIcon),
_this._onRenderTextContents(),
onRenderAriaDescription(props, _this._onRenderAriaDescription),
onRenderChildren(props, _this._onRenderChildren),
!_this._isSplitButton &&
(menuProps || menuIconProps || _this.props.onRenderMenuIcon) &&
onRenderMenuIcon(_this.props, _this._onRenderMenuIcon),
menuProps &&
!menuProps.doNotLayer &&
_this._shouldRenderMenu() &&
onRenderMenu(_this._getMenuProps(menuProps), _this._onRenderMenu)))); };
var Content = keytipProps ? (
// If we're making a split button, we won't put the keytip here
React.createElement(KeytipData_1.KeytipData, { keytipProps: !this._isSplitButton ? keytipProps : undefined, ariaDescribedBy: buttonProps['aria-describedby'], disabled: disabled }, function (keytipAttributes) { return Button(keytipAttributes); })) : (Button());
if (menuProps && menuProps.doNotLayer) {
return (React.createElement(React.Fragment, null,
Content,
this._shouldRenderMenu() && onRenderMenu(this._getMenuProps(menuProps), this._onRenderMenu)));
}
return (React.createElement(React.Fragment, null,
Content,
React.createElement(Utilities_1.FocusRects, null)));
};
/**
* Method to help determine if the menu's component tree should
* be rendered. It takes into account whether the menu is expanded,
* whether it is a persisted menu and whether it has been shown to the user.
*/
BaseButton.prototype._shouldRenderMenu = function () {
var menuHidden = this.state.menuHidden;
// eslint-disable-next-line @typescript-eslint/no-deprecated
var _a = this.props, persistMenu = _a.persistMenu, renderPersistedMenuHiddenOnMount = _a.renderPersistedMenuHiddenOnMount;
if (!menuHidden) {
// Always should render a menu when it is expanded
return true;
}
else if (persistMenu && (this._renderedVisibleMenu || renderPersistedMenuHiddenOnMount)) {
// _renderedVisibleMenu ensures that the first rendering of
// the menu happens on-screen, as edge's scrollbar calculations are off if done while hidden.
return true;
}
return false;
};
BaseButton.prototype._hasText = function () {
// _onRenderTextContents and _onRenderText do not perform the same checks. Below is parity with what _onRenderText
// used to have before the refactor that introduced this function. _onRenderTextContents does not require props.
// text to be undefined in order for props.children to be used as a fallback.
// Purely a code maintainability/reuse issue, but logged as Issue #4979.
return this.props.text !== null && (this.props.text !== undefined || typeof this.props.children === 'string');
};
BaseButton.prototype._getMenuProps = function (menuProps) {
var persistMenu = this.props.persistMenu;
var menuHidden = this.state.menuHidden;
// the accessible menu label (accessible name) has a relationship to the button.
// If the menu props do not specify an explicit value for aria-label or aria-labelledBy,
// AND the button has text, we'll set the menu aria-labelledBy to the text element id.
if (!menuProps.ariaLabel && !menuProps.labelElementId && this._hasText()) {
menuProps = tslib_1.__assign(tslib_1.__assign({}, menuProps), { labelElementId: this._labelId });
}
return tslib_1.__assign(tslib_1.__assign({ id: this._labelId + '-menu', directionalHint: DirectionalHint_1.DirectionalHint.bottomLeftEdge }, menuProps), { shouldFocusOnContainer: this._menuShouldFocusOnContainer, shouldFocusOnMount: this._menuShouldFocusOnMount, hidden: persistMenu ? menuHidden : undefined, className: (0, Utilities_1.css)('ms-BaseButton-menuhost', menuProps.className), target: this._isSplitButton ? this._splitButtonContainer.current : this._buttonElement.current, onDismiss: this._onDismissMenu });
};
BaseButton.prototype._onRenderSplitButtonContent = function (tag, buttonProps) {
var _this = this;
var _a = this.props, _b = _a.styles, styles = _b === void 0 ? {} : _b, disabled = _a.disabled, allowDisabledFocus = _a.allowDisabledFocus, checked = _a.checked, getSplitButtonClassNames = _a.getSplitButtonClassNames, primaryDisabled = _a.primaryDisabled, menuProps = _a.menuProps, toggle = _a.toggle, role = _a.role, primaryActionButtonProps = _a.primaryActionButtonProps;
var keytipProps = this.props.keytipProps;
var menuHidden = this.state.menuHidden;
var classNames = getSplitButtonClassNames
? getSplitButtonClassNames(!!disabled, !menuHidden, !!checked, !!allowDisabledFocus)
: styles && (0, SplitButton_classNames_1.getSplitButtonClassNames)(styles, !!disabled, !menuHidden, !!checked, !!primaryDisabled);
(0, Utilities_1.assign)(buttonProps, {
onClick: undefined,
onPointerDown: undefined,
onPointerUp: undefined,
tabIndex: -1,
'data-is-focusable': false,
});
if (keytipProps && menuProps) {
keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps);
}
var containerProps = (0, Utilities_1.getNativeProps)(buttonProps, [], ['disabled']);
// Add additional props to apply on primary action button
if (primaryActionButtonProps) {
(0, Utilities_1.assign)(buttonProps, primaryActionButtonProps);
}
var SplitButton = function (keytipAttributes) { return (React.createElement("div", tslib_1.__assign({}, containerProps, { "data-ktp-target": keytipAttributes ? keytipAttributes['data-ktp-target'] : undefined, role: role ? role : 'button', "aria-disabled": disabled, "aria-haspopup": true, "aria-expanded": !menuHidden, "aria-pressed": toggle ? !!checked : undefined, "aria-describedby": (0, Utilities_1.mergeAriaAttributeValues)(buttonProps['aria-describedby'], keytipAttributes ? keytipAttributes['aria-describedby'] : undefined), className: classNames && classNames.splitButtonContainer, onKeyDown: _this._onSplitButtonContainerKeyDown, onTouchStart: _this._onTouchStart, ref: _this._splitButtonContainer, "data-is-focusable": true, onClick: !disabled && !primaryDisabled ? _this._onSplitButtonPrimaryClick : undefined, tabIndex: (!disabled && !primaryDisabled) || allowDisabledFocus ? 0 : undefined, "aria-roledescription": buttonProps['aria-roledescription'], onFocusCapture: _this._onSplitContainerFocusCapture }),
React.createElement("span", { style: { display: 'flex', width: '100%' } },
_this._onRenderContent(tag, buttonProps),
_this._onRenderSplitButtonMenuButton(classNames, keytipAttributes),
_this._onRenderSplitButtonDivider(classNames)))); };
return keytipProps ? (React.createElement(KeytipData_1.KeytipData, { keytipProps: keytipProps, disabled: disabled }, function (keytipAttributes) { return SplitButton(keytipAttributes); })) : (SplitButton());
};
BaseButton.prototype._onRenderSplitButtonDivider = function (classNames) {
if (classNames && classNames.divider) {
var onClick = function (ev) {
ev.stopPropagation();
};
return React.createElement("span", { className: classNames.divider, "aria-hidden": true, onClick: onClick });
}
return null;
};
BaseButton.prototype._onRenderSplitButtonMenuButton = function (classNames, keytipAttributes) {
var _a = this.props, allowDisabledFocus = _a.allowDisabledFocus, checked = _a.checked, disabled = _a.disabled, splitButtonMenuProps = _a.splitButtonMenuProps, splitButtonAriaLabel = _a.splitButtonAriaLabel, primaryDisabled = _a.primaryDisabled;
var menuHidden = this.state.menuHidden;
var menuIconProps = this.props.menuIconProps;
if (menuIconProps === undefined) {
menuIconProps = {
iconName: 'ChevronDown',
};
}
var splitButtonProps = tslib_1.__assign(tslib_1.__assign({}, splitButtonMenuProps), { styles: classNames, checked: checked, disabled: disabled, allowDisabledFocus: allowDisabledFocus, onClick: this._onMenuClick, menuProps: undefined, iconProps: tslib_1.__assign(tslib_1.__assign({}, menuIconProps), { className: this._classNames.menuIcon }), ariaLabel: splitButtonAriaLabel, 'aria-haspopup': true, 'aria-expanded': !menuHidden, 'data-is-focusable': false });
// Add data-ktp-execute-target to the split button if the keytip is defined
return (React.createElement(BaseButton, tslib_1.__assign({}, splitButtonProps, { "data-ktp-execute-target": keytipAttributes ? keytipAttributes['data-ktp-execute-target'] : keytipAttributes, onMouseDown: this._onMouseDown, tabIndex: primaryDisabled && !allowDisabledFocus ? 0 : -1 })));
};
BaseButton.prototype._onPointerDown = function (ev) {
var onPointerDown = this.props.onPointerDown;
if (onPointerDown) {
onPointerDown(ev);
}
if (ev.pointerType === 'touch') {
this._handleTouchAndPointerEvent();
ev.preventDefault();
ev.stopImmediatePropagation();
}
};
BaseButton.prototype._handleTouchAndPointerEvent = function () {
var _this = this;
// If we already have an existing timeout from a previous touch and pointer event
// cancel that timeout so we can set a new one.
if (this._lastTouchTimeoutId !== undefined) {
this._async.clearTimeout(this._lastTouchTimeoutId);
this._lastTouchTimeoutId = undefined;
}
this._processingTouch = true;
this._lastTouchTimeoutId = this._async.setTimeout(function () {
_this._processingTouch = false;
_this._lastTouchTimeoutId = undefined;
// Touch and pointer events don't focus the button naturally,
// so adding an imperative focus call to guarantee this behavior.
// Only focus the button if a splitbutton menu is not open
if (_this.state.menuHidden) {
_this.focus();
}
}, TouchIdleDelay);
};
/**
* Returns if the user hits a valid keyboard key to open the menu
* @param ev - the keyboard event
* @returns True if user clicks on custom trigger key if enabled or alt + down arrow if not. False otherwise.
*/
BaseButton.prototype._isValidMenuOpenKey = function (ev) {
if (this.props.menuTriggerKeyCode) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
return ev.which === this.props.menuTriggerKeyCode;
}
else if (this.props.menuProps) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
return ev.which === Utilities_1.KeyCodes.down && (ev.altKey || ev.metaKey);
}
// Note: When enter is pressed, we will let the event continue to propagate
// to trigger the onClick event on the button
return false;
};
BaseButton.defaultProps = {
baseClassName: 'ms-Button',
styles: {},
split: false,
};
// needed to access registeredProviders when manually setting focus visibility
BaseButton.contextType = Utilities_1.FocusRectsContext;
return BaseButton;
}(React.Component));
exports.BaseButton = BaseButton;
});
//# sourceMappingURL=BaseButton.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
import type { IButtonStyles } from './Button.types';
import type { ITheme } from '../../Styling';
/**
* Gets the base button styles. Note: because it is a base class to be used with the `mergeRules`
* helper, it should have values for all class names in the interface. This let `mergeRules` optimize
* mixing class names together.
*/
export declare const getStyles: (theme: ITheme) => IButtonStyles;
@@ -0,0 +1,110 @@
define(["require", "exports", "../../Utilities", "../../Styling"], function (require, exports, Utilities_1, Styling_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStyles = void 0;
var noOutline = {
outline: 0,
};
var iconStyle = function (fontSize) {
return {
fontSize: fontSize,
margin: '0 4px',
height: '16px',
lineHeight: '16px',
textAlign: 'center',
flexShrink: 0,
};
};
/**
* Gets the base button styles. Note: because it is a base class to be used with the `mergeRules`
* helper, it should have values for all class names in the interface. This let `mergeRules` optimize
* mixing class names together.
*/
exports.getStyles = (0, Utilities_1.memoizeFunction)(function (theme) {
var _a, _b;
var semanticColors = theme.semanticColors, effects = theme.effects, fonts = theme.fonts;
var border = semanticColors.buttonBorder;
var disabledBackground = semanticColors.disabledBackground;
var disabledText = semanticColors.disabledText;
var buttonHighContrastFocus = {
left: -2,
top: -2,
bottom: -2,
right: -2,
outlineColor: 'ButtonText',
};
return {
root: [
(0, Styling_1.getFocusStyle)(theme, { inset: 1, highContrastStyle: buttonHighContrastFocus, borderColor: 'transparent' }),
theme.fonts.medium,
{
border: '1px solid ' + border,
borderRadius: effects.roundedCorner2,
boxSizing: 'border-box',
cursor: 'pointer',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
padding: '0 16px',
textDecoration: 'none',
textAlign: 'center',
userSelect: 'none',
// IE11 workaround for preventing shift of child elements of a button when active.
':active > span': {
position: 'relative',
left: 0,
top: 0,
},
},
],
rootDisabled: [
(0, Styling_1.getFocusStyle)(theme, { inset: 1, highContrastStyle: buttonHighContrastFocus, borderColor: 'transparent' }),
{
backgroundColor: disabledBackground,
borderColor: disabledBackground,
color: disabledText,
cursor: 'default',
':hover': noOutline,
':focus': noOutline,
},
],
iconDisabled: (_a = {
color: disabledText
},
_a[Styling_1.HighContrastSelector] = {
color: 'GrayText',
},
_a),
menuIconDisabled: (_b = {
color: disabledText
},
_b[Styling_1.HighContrastSelector] = {
color: 'GrayText',
},
_b),
flexContainer: {
display: 'flex',
height: '100%',
flexWrap: 'nowrap',
justifyContent: 'center',
alignItems: 'center',
},
description: {
display: 'block',
},
textContainer: {
flexGrow: 1,
display: 'block',
},
icon: iconStyle(fonts.mediumPlus.fontSize),
menuIcon: iconStyle(fonts.small.fontSize),
label: {
margin: '0 4px',
lineHeight: '100%',
display: 'block',
},
screenReaderText: Styling_1.hiddenContentStyle,
};
});
});
//# sourceMappingURL=BaseButton.styles.js.map
File diff suppressed because one or more lines are too long
+12
View File
@@ -0,0 +1,12 @@
import * as React from 'react';
import type { IButtonProps } from './Button.types';
import type { JSXElement } from '@fluentui/utilities';
/**
* This class is deprecated. Use the individual *Button components instead.
* @deprecated Use the individual *Button components instead.
* {@docCategory Button}
*/
export declare class Button extends React.Component<IButtonProps, {}> {
constructor(props: IButtonProps);
render(): JSXElement;
}
+38
View File
@@ -0,0 +1,38 @@
define(["require", "exports", "tslib", "react", "../../Utilities", "./Button.types", "./DefaultButton/DefaultButton", "./ActionButton/ActionButton", "./CompoundButton/CompoundButton", "./IconButton/IconButton", "./PrimaryButton/PrimaryButton"], function (require, exports, tslib_1, React, Utilities_1, Button_types_1, DefaultButton_1, ActionButton_1, CompoundButton_1, IconButton_1, PrimaryButton_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Button = void 0;
/**
* This class is deprecated. Use the individual *Button components instead.
* @deprecated Use the individual *Button components instead.
* {@docCategory Button}
*/
var Button = /** @class */ (function (_super) {
tslib_1.__extends(Button, _super);
function Button(props) {
var _this = _super.call(this, props) || this;
(0, Utilities_1.warn)("The Button component has been deprecated. Use specific variants instead. " +
"(PrimaryButton, DefaultButton, IconButton, ActionButton, etc.)");
return _this;
}
Button.prototype.render = function () {
var props = this.props;
// eslint-disable-next-line @typescript-eslint/no-deprecated
switch (props.buttonType) {
case Button_types_1.ButtonType.command:
return React.createElement(ActionButton_1.ActionButton, tslib_1.__assign({}, props));
case Button_types_1.ButtonType.compound:
return React.createElement(CompoundButton_1.CompoundButton, tslib_1.__assign({}, props));
case Button_types_1.ButtonType.icon:
return React.createElement(IconButton_1.IconButton, tslib_1.__assign({}, props));
case Button_types_1.ButtonType.primary:
return React.createElement(PrimaryButton_1.PrimaryButton, tslib_1.__assign({}, props));
default:
return React.createElement(DefaultButton_1.DefaultButton, tslib_1.__assign({}, props));
}
};
return Button;
}(React.Component));
exports.Button = Button;
});
//# sourceMappingURL=Button.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Button.js","sourceRoot":"../src/","sources":["components/Button/Button.tsx"],"names":[],"mappings":";;;;IAaA;;;;OAIG;IACH;QAA4B,kCAAiC;QAC3D,gBAAY,KAAmB;YAC7B,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;YAEb,IAAA,gBAAI,EACF,2EAA2E;gBACzE,gEAAgE,CACnE,CAAC;;QACJ,CAAC;QAEM,uBAAM,GAAb;YACE,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YAEzB,4DAA4D;YAC5D,QAAQ,KAAK,CAAC,UAAU,EAAE,CAAC;gBACzB,KAAK,yBAAU,CAAC,OAAO;oBACrB,OAAO,oBAAC,2BAAY,uBAAK,KAAK,EAAI,CAAC;gBAErC,KAAK,yBAAU,CAAC,QAAQ;oBACtB,OAAO,oBAAC,+BAAc,uBAAK,KAAK,EAAI,CAAC;gBAEvC,KAAK,yBAAU,CAAC,IAAI;oBAClB,OAAO,oBAAC,uBAAU,uBAAK,KAAK,EAAI,CAAC;gBAEnC,KAAK,yBAAU,CAAC,OAAO;oBACrB,OAAO,oBAAC,6BAAa,uBAAK,KAAK,EAAI,CAAC;gBAEtC;oBACE,OAAO,oBAAC,6BAAa,uBAAK,KAAK,EAAI,CAAC;YACxC,CAAC;QACH,CAAC;QACH,aAAC;IAAD,CAAC,AA/BD,CAA4B,KAAK,CAAC,SAAS,GA+B1C;IA/BY,wBAAM","sourcesContent":["import * as React from 'react';\n\nimport { warn } from '../../Utilities';\nimport { ButtonType } from './Button.types';\nimport { DefaultButton } from './DefaultButton/DefaultButton';\nimport { ActionButton } from './ActionButton/ActionButton';\nimport { CompoundButton } from './CompoundButton/CompoundButton';\nimport { IconButton } from './IconButton/IconButton';\nimport { PrimaryButton } from './PrimaryButton/PrimaryButton';\nimport type { IButtonProps } from './Button.types';\n\nimport type { JSXElement } from '@fluentui/utilities';\n\n/**\n * This class is deprecated. Use the individual *Button components instead.\n * @deprecated Use the individual *Button components instead.\n * {@docCategory Button}\n */\nexport class Button extends React.Component<IButtonProps, {}> {\n constructor(props: IButtonProps) {\n super(props);\n\n warn(\n `The Button component has been deprecated. Use specific variants instead. ` +\n `(PrimaryButton, DefaultButton, IconButton, ActionButton, etc.)`,\n );\n }\n\n public render(): JSXElement {\n const props = this.props;\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n switch (props.buttonType) {\n case ButtonType.command:\n return <ActionButton {...props} />;\n\n case ButtonType.compound:\n return <CompoundButton {...props} />;\n\n case ButtonType.icon:\n return <IconButton {...props} />;\n\n case ButtonType.primary:\n return <PrimaryButton {...props} />;\n\n default:\n return <DefaultButton {...props} />;\n }\n }\n}\n"]}
@@ -0,0 +1,522 @@
import * as React from 'react';
import { BaseButton } from './BaseButton';
import { Button } from './Button';
import { KeyCodes } from '../../Utilities';
import type { IButtonClassNames } from './BaseButton.classNames';
import type { ISplitButtonClassNames } from './SplitButton/SplitButton.classNames';
import type { IRefObject, IRenderFunction, IComponentAs } from '../../Utilities';
import type { IContextualMenuProps } from '../../ContextualMenu';
import type { IIconProps } from '../../Icon';
import type { IShadowDomStyle, IStyle, ITheme } from '../../Styling';
import type { IKeytipProps } from '../../Keytip';
/**
* {@docCategory Button}
*/
export interface IButton {
/**
* Sets focus to the button.
*/
focus: () => void;
/**
* If there is a menu associated with this button and it is visible, this will dismiss the menu
*/
dismissMenu: () => void;
/**
* If there is a menu associated with this button and it is visible, this will open the menu.
* Params are optional overrides to the ones defined in `menuProps` to apply to just this instance of
* opening the menu.
*
* @param shouldFocusOnContainer - override to the ContextualMenu `shouldFocusOnContainer` prop.
* BaseButton implementation defaults to `undefined`.
* Avoid using `shouldFocusOnContainer` as it breaks the default focus behaviour when using
* assistive technologies.
* @param shouldFocusOnMount - override to the ContextualMenu `shouldFocusOnMount` prop.
* BaseButton implementation defaults to `true`.
*/
openMenu: (shouldFocusOnContainer?: boolean, shouldFocusOnMount?: boolean) => void;
}
/**
* {@docCategory Button}
*/
export interface IButtonProps extends React.AllHTMLAttributes<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement | BaseButton | Button | HTMLSpanElement> {
/**
* Optional callback to access the `IButton` interface. Use this instead of `ref` for accessing
* the public methods and properties of the component.
*/
componentRef?: IRefObject<IButton>;
/**
* Optional callback to access the root DOM element.
* @deprecated Temporary solution which will be replaced with ref in the V8 release.
*/
elementRef?: React.Ref<HTMLElement>;
/**
* If provided, this component will be rendered as an anchor.
* @defaultvalue ElementType.anchor
*/
href?: string;
/**
* Changes the visual presentation of the button to be emphasized.
* @defaultvalue false
*/
primary?: boolean;
/**
* Unique ID to identify the item. Typically a duplicate of key value.
*/
uniqueId?: string | number;
/**
* Whether the button is disabled
*/
disabled?: boolean;
/**
* Whether the button can have focus in disabled mode
*/
allowDisabledFocus?: boolean;
/**
* If set to true and this is a split button (`split` is true), the split button's primary action is disabled.
*/
primaryDisabled?: boolean;
/**
* Custom styling for individual elements within the button DOM.
*/
styles?: IButtonStyles;
/**
* Theme provided by HOC.
*/
theme?: ITheme;
/**
* Whether the button is checked. Should be used with the `toggle` attribute when creating a standalone on/off button.
*/
checked?: boolean;
/**
* Whether button is a toggle button with distinct on and off states. This should be true for buttons that permanently
* change state when a press event finishes, such as a volume mute button.
*/
toggle?: boolean;
/**
* If provided, additional class name to provide on the root element.
*/
className?: string;
/**
* The aria label of the button for the benefit of screen readers.
*/
ariaLabel?: string;
/**
* Detailed description of the button for the benefit of screen readers.
*
* Besides the compound button, other button types will need more information provided to screen reader.
*/
ariaDescription?: string;
/**
* If true, add an `aria-hidden` attribute instructing screen readers to ignore the element.
*/
ariaHidden?: boolean;
/**
* Text to render button label. If text is supplied, it will override any string in button children.
* Other children components will be passed through after the text.
*/
text?: string;
/**
* The props for the icon shown in the button.
*/
iconProps?: IIconProps;
/**
* Props for button menu. Providing this will default to showing the menu icon. See `menuIconProps` for overriding
* how the default icon looks. Providing this in addition to `onClick` and setting the `split` property to `true`
* will render a SplitButton.
*/
menuProps?: IContextualMenuProps;
/**
* Callback that runs after Button's contextual menu was closed (removed from the DOM)
*/
onAfterMenuDismiss?: () => void;
/**
* If set to true, and if `menuProps` and `onClick` are provided, the button will render as a SplitButton.
* @default false
*/
split?: boolean;
/**
* The props for the icon shown when providing a menu dropdown.
*/
menuIconProps?: IIconProps;
/**
* Accessible label for the dropdown chevron button if this button is split.
*/
splitButtonAriaLabel?: string;
/**
* Optional callback when menu is clicked.
*/
onMenuClick?: (ev?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>, button?: IButtonProps) => void;
/**
* Custom render function for the icon
*/
onRenderIcon?: IRenderFunction<IButtonProps>;
/**
* Custom render function for the label text.
*/
onRenderText?: IRenderFunction<IButtonProps>;
/**
* Custom render function for the description text.
*/
onRenderDescription?: IRenderFunction<IButtonProps>;
/**
* Custom render function for the aria description element.
*/
onRenderAriaDescription?: IRenderFunction<IButtonProps>;
/**
* Custom render function for rendering the button children.
*/
onRenderChildren?: IRenderFunction<IButtonProps>;
/**
* Custom render function for button menu icon
*/
onRenderMenuIcon?: IRenderFunction<IButtonProps>;
/**
* @deprecated Deprecated at v6.3.2, to be removed at \>= v7.0.0.
* Use `menuAs` instead.
*/
onRenderMenu?: IRenderFunction<IContextualMenuProps>;
/**
* Render a custom menu in place of the normal one.
*/
menuAs?: IComponentAs<IContextualMenuProps>;
/**
* Description of the action this button takes.
* Only used for compound buttons.
*/
secondaryText?: string;
/**
* @defaultvalue ButtonType.default
* @deprecated Deprecated at v1.2.3, to be removed at \>= v2.0.0.
* Use specific button component instead.
*/
buttonType?: ButtonType;
/**
* @deprecated Deprecated at v0.56.2, to be removed at \>= v1.0.0.
* Use native props on the Button itself instead.
* They will be mixed into the button/anchor element rendered by the component.
*/
rootProps?: React.ButtonHTMLAttributes<HTMLButtonElement> | React.AnchorHTMLAttributes<HTMLAnchorElement>;
/**
* @deprecated No longer used. Use `checked` if setting state.
*/
toggled?: boolean;
/**
* Any custom data the developer wishes to associate with the button.
*/
data?: any;
/**
* Method to provide the classnames to style a button.
* The default value for this prop is the `getClassnames` func defined in `BaseButton.classnames.ts`.
* @defaultvalue getBaseButtonClassNames
*/
getClassNames?: (theme: ITheme, className: string, variantClassName: string, iconClassName: string | undefined, menuIconClassName: string | undefined, disabled: boolean, checked: boolean, expanded: boolean, hasMenu: boolean, isSplit: boolean | undefined, allowDisabledFocus: boolean) => IButtonClassNames;
/**
* Method to provide the classnames to style a button.
* The default value for this prop is the `getClassnames` func defined in `BaseButton.classnames.ts`.
* @defaultvalue getBaseSplitButtonClassNames
*/
getSplitButtonClassNames?: (disabled: boolean, expanded: boolean, checked: boolean, allowDisabledFocus: boolean) => ISplitButtonClassNames;
/**
* Provides a custom KeyCode that can be used to open the button menu.
* A value of `null` can be provided to disable opening the button menu with a key press.
* @default KeyCodes.down
*/
menuTriggerKeyCode?: KeyCodes | null;
/**
* Optional keytip for this button
*/
keytipProps?: IKeytipProps;
/**
* Menu will not be created or destroyed when opened or closed, instead it
* will be hidden. This will improve perf of the menu opening but could potentially
* impact overall perf by having more elements in the dom. Should only be used
* when menu perf is important.
*
* Note: This may increase the amount of time it takes for the button itself to mount.
*/
persistMenu?: boolean;
/**
* If true, the persisted menu is rendered hidden when the button initially mounts.
* Non-persisted menus will not be in the component tree unless they are being shown.
*
* Note: This increases the time the button will take to mount, but
* can improve perceived menu open perf. when the user opens the menu.
*
* @defaultvalue `undefined`, equivalent to false
*
* @deprecated There is known bug in Edge when this prop is true where scrollbars
* overlap with the content when a menu is first rendered hidden.
* Please do not start using this. If you are already using this,
* please make sure that you are doing so only in non-Edge browsers.
* See: https://github.com/microsoft/fluentui/issues/9034
*/
renderPersistedMenuHiddenOnMount?: boolean;
/**
* Experimental prop that get passed into the menuButton that's rendered as part of
* split button. Anything passed in will likely need to have accompanying
* style changes.
*/
splitButtonMenuProps?: IButtonProps;
/**
* Style for the description text if applicable (for compound buttons).
* @deprecated Use `secondaryText` instead.
*/
description?: string;
/**
* yet unknown docs
*/
defaultRender?: any;
/**
* Optional props to be applied only to the primary action button of SplitButton and not to the
* overall SplitButton container
*/
primaryActionButtonProps?: IButtonProps;
}
/**
* {@docCategory Button}
*/
export declare enum ElementType {
/** `button` element. */
button = 0,
/** `a` element. */
anchor = 1
}
/**
* {@docCategory Button}
*/
export declare enum ButtonType {
normal = 0,
primary = 1,
hero = 2,
compound = 3,
command = 4,
icon = 5,
default = 6
}
/**
* {@docCategory Button}
*/
export interface IButtonStyles extends IShadowDomStyle {
/**
* Style for the root element in the default enabled, non-toggled state.
*/
root?: IStyle;
/**
* Style override for the root element in a checked state, layered on top of the root style.
*/
rootChecked?: IStyle;
/**
* Style override for the root element in a disabled state, layered on top of the root style.
*/
rootDisabled?: IStyle;
/**
* Style override applied to the root on hover in the default, enabled, non-toggled state.
*/
rootHovered?: IStyle;
/**
* Style override applied to the root on focus in the default, enabled, non-toggled state.
*/
rootFocused?: IStyle;
/**
* Style override applied to the root on pressed in the default, enabled, non-toggled state.
*/
rootPressed?: IStyle;
/**
* Style override applied to the root on when menu is expanded in the default, enabled, non-toggled state.
*/
rootExpanded?: IStyle;
/**
* Style override applied to the root on hover in a checked, enabled state
*/
rootCheckedHovered?: IStyle;
/**
* Style override applied to the root on pressed in a checked, enabled state
*/
rootCheckedPressed?: IStyle;
/**
* Style override applied to the root on hover in a checked, disabled state
*/
rootCheckedDisabled?: IStyle;
/**
* Style override applied to the root on hover in a expanded state on hover
*/
rootExpandedHovered?: IStyle;
/**
* Style override for the root element when it has a menu button, layered on top of the root style.
*/
rootHasMenu?: IStyle;
/**
* Style for the flexbox container within the root element.
*/
flexContainer?: IStyle;
/**
* Style for the text container within the flexbox container element (and contains the text and description).
*/
textContainer?: IStyle;
/**
* Style for the icon on the near side of the label.
*/
icon?: IStyle;
/**
* Style for the icon on the near side of the label on hover.
*/
iconHovered?: IStyle;
/**
* Style for the icon on the near side of the label when pressed.
*/
iconPressed?: IStyle;
/**
* Style for the icon on the near side of the label when expanded.
*/
iconExpanded?: IStyle;
/**
* Style for the icon on the near side of the label when expanded and hovered.
*/
iconExpandedHovered?: IStyle;
/**
* Style override for the icon when the button is disabled.
*/
iconDisabled?: IStyle;
/**
* Style override for the icon when the button is checked.
*/
iconChecked?: IStyle;
/**
* Style for the text content of the button.
*/
label?: IStyle;
/**
* Style override for the text content when the button is hovered.
*/
labelHovered?: IStyle;
/**
* Style override for the text content when the button is disabled.
*/
labelDisabled?: IStyle;
/**
* Style override for the text content when the button is checked.
*/
labelChecked?: IStyle;
/**
* Style for the menu chevron.
*/
menuIcon?: IStyle;
/**
* Style for the menu chevron on hover.
*/
menuIconHovered?: IStyle;
/**
* Style for the menu chevron when pressed.
*/
menuIconPressed?: IStyle;
/**
* Style for the menu chevron when expanded.
*/
menuIconExpanded?: IStyle;
/**
* Style for the menu chevron when expanded and hovered.
*/
menuIconExpandedHovered?: IStyle;
/**
* Style override for the menu chevron when the button is disabled.
*/
menuIconDisabled?: IStyle;
/**
* Style override for the menu chevron when the button is checked.
*/
menuIconChecked?: IStyle;
/**
* Style for the description text if applicable (for compound buttons).
*/
description?: IStyle;
/**
* Style for the description text if applicable (for compound buttons).
*/
secondaryText?: IStyle;
/**
* Style override for the description text when the button is hovered.
*/
descriptionHovered?: IStyle;
/**
* Style for the description text when the button is pressed.
*/
descriptionPressed?: IStyle;
/**
* Style override for the description text when the button is disabled.
*/
descriptionDisabled?: IStyle;
/**
* Style override for the description text when the button is checked.
*/
descriptionChecked?: IStyle;
/**
* Style override for the screen reader text.
*/
screenReaderText?: IStyle;
/**
* Style override for the container div around a SplitButton element
*/
splitButtonContainer?: IStyle;
/**
* Style for container div around a SplitButton element when the button is hovered.
*/
splitButtonContainerHovered?: IStyle;
/**
* Style for container div around a SplitButton element when the button is focused.
*/
splitButtonContainerFocused?: IStyle;
/**
* Style for container div around a SplitButton element when the button is checked.
*/
splitButtonContainerChecked?: IStyle;
/**
* Style for container div around a SplitButton element when the button is checked and hovered.
*/
splitButtonContainerCheckedHovered?: IStyle;
/**
* Style override for the container div around a SplitButton element in a disabled state
*/
splitButtonContainerDisabled?: IStyle;
/**
* Style override for the divider element that appears between the button and menu button
* for a split button.
*/
splitButtonDivider?: IStyle;
/**
* Style override for the divider element that appears between the button and menu button
* for a split button in a disabled state.
*/
splitButtonDividerDisabled?: IStyle;
/**
* Style override for the SplitButton menu button
*/
splitButtonMenuButton?: IStyle;
/**
* Style override for the SplitButton menu button element in a disabled state.
*/
splitButtonMenuButtonDisabled?: IStyle;
/**
* Style override for the SplitButton menu button element in a checked state
*/
splitButtonMenuButtonChecked?: IStyle;
/**
* Style override for the SplitButton menu button element in an expanded state
*/
splitButtonMenuButtonExpanded?: IStyle;
/**
* Style override for the SplitButton menu icon element
*/
splitButtonMenuIcon?: IStyle;
/**
* Style override for the SplitButton menu icon element in a disabled state
*/
splitButtonMenuIconDisabled?: IStyle;
/**
* Style override for the SplitButton FlexContainer.
*/
splitButtonFlexContainer?: IStyle;
/**
* Style override for the SplitButton when only primaryButton is in a disabled state
*/
splitButtonMenuFocused?: IStyle;
}
+29
View File
@@ -0,0 +1,29 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ButtonType = exports.ElementType = void 0;
/**
* {@docCategory Button}
*/
var ElementType;
(function (ElementType) {
/** `button` element. */
ElementType[ElementType["button"] = 0] = "button";
/** `a` element. */
ElementType[ElementType["anchor"] = 1] = "anchor";
})(ElementType || (exports.ElementType = ElementType = {}));
/**
* {@docCategory Button}
*/
var ButtonType;
(function (ButtonType) {
ButtonType[ButtonType["normal"] = 0] = "normal";
ButtonType[ButtonType["primary"] = 1] = "primary";
ButtonType[ButtonType["hero"] = 2] = "hero";
ButtonType[ButtonType["compound"] = 3] = "compound";
ButtonType[ButtonType["command"] = 4] = "command";
ButtonType[ButtonType["icon"] = 5] = "icon";
ButtonType[ButtonType["default"] = 6] = "default";
})(ButtonType || (exports.ButtonType = ButtonType = {}));
});
//# sourceMappingURL=Button.types.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
import type { IButtonStyles } from './Button.types';
import type { ITheme } from '../../Styling';
export declare function standardStyles(theme: ITheme): IButtonStyles;
export declare function primaryStyles(theme: ITheme): IButtonStyles;
+228
View File
@@ -0,0 +1,228 @@
define(["require", "exports", "tslib", "../../Styling", "../../Utilities"], function (require, exports, tslib_1, Styling_1, Utilities_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.standardStyles = standardStyles;
exports.primaryStyles = primaryStyles;
var splitButtonDividerBaseStyles = function () {
return {
position: 'absolute',
width: 1,
right: 31,
top: 8,
bottom: 8,
};
};
function standardStyles(theme) {
var _a, _b, _c, _d, _e;
var s = theme.semanticColors, p = theme.palette;
var buttonBackground = s.buttonBackground;
var buttonBackgroundPressed = s.buttonBackgroundPressed;
var buttonBackgroundHovered = s.buttonBackgroundHovered;
var buttonBackgroundDisabled = s.buttonBackgroundDisabled;
var buttonText = s.buttonText;
var buttonTextHovered = s.buttonTextHovered;
var buttonTextDisabled = s.buttonTextDisabled;
var buttonTextChecked = s.buttonTextChecked;
var buttonTextCheckedHovered = s.buttonTextCheckedHovered;
return {
root: {
backgroundColor: buttonBackground,
color: buttonText,
},
rootHovered: (_a = {
backgroundColor: buttonBackgroundHovered,
color: buttonTextHovered
},
_a[Styling_1.HighContrastSelector] = {
borderColor: 'Highlight',
color: 'Highlight',
},
_a),
rootPressed: {
backgroundColor: buttonBackgroundPressed,
color: buttonTextChecked,
},
rootExpanded: {
backgroundColor: buttonBackgroundPressed,
color: buttonTextChecked,
},
rootChecked: {
backgroundColor: buttonBackgroundPressed,
color: buttonTextChecked,
},
rootCheckedHovered: {
backgroundColor: buttonBackgroundPressed,
color: buttonTextCheckedHovered,
},
rootDisabled: (_b = {
color: buttonTextDisabled,
backgroundColor: buttonBackgroundDisabled
},
_b[Styling_1.HighContrastSelector] = {
color: 'GrayText',
borderColor: 'GrayText',
backgroundColor: 'Window',
},
_b),
// Split button styles
splitButtonContainer: (_c = {},
_c[Styling_1.HighContrastSelector] = {
border: 'none',
},
_c),
splitButtonMenuButton: {
color: p.white,
backgroundColor: 'transparent',
':hover': (_d = {
backgroundColor: p.neutralLight
},
_d[Styling_1.HighContrastSelector] = {
color: 'Highlight',
},
_d),
},
splitButtonMenuButtonDisabled: {
backgroundColor: s.buttonBackgroundDisabled,
':hover': {
backgroundColor: s.buttonBackgroundDisabled,
},
},
splitButtonDivider: tslib_1.__assign(tslib_1.__assign({}, splitButtonDividerBaseStyles()), (_e = { backgroundColor: p.neutralTertiaryAlt }, _e[Styling_1.HighContrastSelector] = {
backgroundColor: 'WindowText',
}, _e)),
splitButtonDividerDisabled: {
backgroundColor: theme.palette.neutralTertiaryAlt,
},
splitButtonMenuButtonChecked: {
backgroundColor: p.neutralQuaternaryAlt,
':hover': {
backgroundColor: p.neutralQuaternaryAlt,
},
},
splitButtonMenuButtonExpanded: {
backgroundColor: p.neutralQuaternaryAlt,
':hover': {
backgroundColor: p.neutralQuaternaryAlt,
},
},
splitButtonMenuIcon: {
color: s.buttonText,
},
splitButtonMenuIconDisabled: {
color: s.buttonTextDisabled,
},
};
}
function primaryStyles(theme) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
var p = theme.palette, s = theme.semanticColors;
return {
root: (_a = {
backgroundColor: s.primaryButtonBackground,
border: "1px solid ".concat(s.primaryButtonBackground),
color: s.primaryButtonText
},
_a[Styling_1.HighContrastSelector] = tslib_1.__assign({ color: 'Window', backgroundColor: 'WindowText', borderColor: 'WindowText' }, (0, Styling_1.getHighContrastNoAdjustStyle)()),
_a[".".concat(Utilities_1.IsFocusVisibleClassName, " &:focus, :host(.").concat(Utilities_1.IsFocusVisibleClassName, ") &:focus")] = {
':after': {
border: "none",
outlineColor: p.white,
},
},
_a),
rootHovered: (_b = {
backgroundColor: s.primaryButtonBackgroundHovered,
border: "1px solid ".concat(s.primaryButtonBackgroundHovered),
color: s.primaryButtonTextHovered
},
_b[Styling_1.HighContrastSelector] = {
color: 'Window',
backgroundColor: 'Highlight',
borderColor: 'Highlight',
},
_b),
rootPressed: (_c = {
backgroundColor: s.primaryButtonBackgroundPressed,
border: "1px solid ".concat(s.primaryButtonBackgroundPressed),
color: s.primaryButtonTextPressed
},
_c[Styling_1.HighContrastSelector] = tslib_1.__assign({ color: 'Window', backgroundColor: 'WindowText', borderColor: 'WindowText' }, (0, Styling_1.getHighContrastNoAdjustStyle)()),
_c),
rootExpanded: {
backgroundColor: s.primaryButtonBackgroundPressed,
color: s.primaryButtonTextPressed,
},
rootChecked: {
backgroundColor: s.primaryButtonBackgroundPressed,
color: s.primaryButtonTextPressed,
},
rootCheckedHovered: {
backgroundColor: s.primaryButtonBackgroundPressed,
color: s.primaryButtonTextPressed,
},
rootDisabled: (_d = {
color: s.primaryButtonTextDisabled,
backgroundColor: s.primaryButtonBackgroundDisabled
},
_d[Styling_1.HighContrastSelector] = {
color: 'GrayText',
borderColor: 'GrayText',
backgroundColor: 'Window',
},
_d),
// Split button styles
splitButtonContainer: (_e = {},
_e[Styling_1.HighContrastSelector] = {
border: 'none',
},
_e),
splitButtonDivider: tslib_1.__assign(tslib_1.__assign({}, splitButtonDividerBaseStyles()), (_f = { backgroundColor: p.white }, _f[Styling_1.HighContrastSelector] = {
backgroundColor: 'Window',
}, _f)),
splitButtonMenuButton: (_g = {
backgroundColor: s.primaryButtonBackground,
color: s.primaryButtonText
},
_g[Styling_1.HighContrastSelector] = {
backgroundColor: 'Canvas',
},
_g[':hover'] = (_h = {
backgroundColor: s.primaryButtonBackgroundHovered
},
_h[Styling_1.HighContrastSelector] = {
color: 'Highlight',
},
_h),
_g),
splitButtonMenuButtonDisabled: {
backgroundColor: s.primaryButtonBackgroundDisabled,
':hover': {
backgroundColor: s.primaryButtonBackgroundDisabled,
},
},
splitButtonMenuButtonChecked: {
backgroundColor: s.primaryButtonBackgroundPressed,
':hover': {
backgroundColor: s.primaryButtonBackgroundPressed,
},
},
splitButtonMenuButtonExpanded: {
backgroundColor: s.primaryButtonBackgroundPressed,
':hover': {
backgroundColor: s.primaryButtonBackgroundPressed,
},
},
splitButtonMenuIcon: {
color: s.primaryButtonText,
},
splitButtonMenuIconDisabled: (_j = {
color: p.neutralTertiary
},
_j[Styling_1.HighContrastSelector] = {
color: 'GrayText',
},
_j),
};
}
});
//# sourceMappingURL=ButtonThemes.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
import * as React from 'react';
import type { IButtonProps } from '../Button.types';
import type { JSXElement } from '@fluentui/utilities';
/**
* {@docCategory Button}
*/
export declare class CommandBarButton extends React.Component<IButtonProps, {}> {
render(): JSXElement;
}
@@ -0,0 +1,24 @@
define(["require", "exports", "tslib", "react", "../BaseButton", "../../../Utilities", "./CommandBarButton.styles"], function (require, exports, tslib_1, React, BaseButton_1, Utilities_1, CommandBarButton_styles_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommandBarButton = void 0;
/**
* {@docCategory Button}
*/
var CommandBarButton = /** @class */ (function (_super) {
tslib_1.__extends(CommandBarButton, _super);
function CommandBarButton() {
return _super !== null && _super.apply(this, arguments) || this;
}
CommandBarButton.prototype.render = function () {
var _a = this.props, styles = _a.styles, theme = _a.theme;
return (React.createElement(BaseButton_1.BaseButton, tslib_1.__assign({}, this.props, { variantClassName: "ms-Button--commandBar", styles: (0, CommandBarButton_styles_1.getStyles)(theme, styles), onRenderDescription: Utilities_1.nullRender })));
};
CommandBarButton = tslib_1.__decorate([
(0, Utilities_1.customizable)('CommandBarButton', ['theme', 'styles'], true)
], CommandBarButton);
return CommandBarButton;
}(React.Component));
exports.CommandBarButton = CommandBarButton;
});
//# sourceMappingURL=CommandBarButton.js.map
@@ -0,0 +1 @@
{"version":3,"file":"CommandBarButton.js","sourceRoot":"../src/","sources":["components/Button/CommandBarButton/CommandBarButton.tsx"],"names":[],"mappings":";;;;IAQA;;OAEG;IAEH;QAAsC,4CAAiC;QAAvE;;QAaA,CAAC;QAZQ,iCAAM,GAAb;YACQ,IAAA,KAAoB,IAAI,CAAC,KAAK,EAA5B,MAAM,YAAA,EAAE,KAAK,WAAe,CAAC;YAErC,OAAO,CACL,oBAAC,uBAAU,uBACL,IAAI,CAAC,KAAK,IACd,gBAAgB,EAAC,uBAAuB,EACxC,MAAM,EAAE,IAAA,mCAAS,EAAC,KAAM,EAAE,MAAM,CAAC,EACjC,mBAAmB,EAAE,sBAAU,IAC/B,CACH,CAAC;QACJ,CAAC;QAZU,gBAAgB;YAD5B,IAAA,wBAAY,EAAC,kBAAkB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC;WAC/C,gBAAgB,CAa5B;QAAD,uBAAC;KAAA,AAbD,CAAsC,KAAK,CAAC,SAAS,GAapD;IAbY,4CAAgB","sourcesContent":["import * as React from 'react';\nimport { BaseButton } from '../BaseButton';\nimport { customizable, nullRender } from '../../../Utilities';\nimport { getStyles } from './CommandBarButton.styles';\nimport type { IButtonProps } from '../Button.types';\n\nimport type { JSXElement } from '@fluentui/utilities';\n\n/**\n * {@docCategory Button}\n */\n@customizable('CommandBarButton', ['theme', 'styles'], true)\nexport class CommandBarButton extends React.Component<IButtonProps, {}> {\n public render(): JSXElement {\n const { styles, theme } = this.props;\n\n return (\n <BaseButton\n {...this.props}\n variantClassName=\"ms-Button--commandBar\"\n styles={getStyles(theme!, styles)}\n onRenderDescription={nullRender}\n />\n );\n }\n}\n"]}
@@ -0,0 +1,3 @@
import type { IButtonStyles } from '../Button.types';
import type { ITheme } from '../../../Styling';
export declare const getStyles: (theme: ITheme, customStyles?: IButtonStyles, focusInset?: string, focusColor?: string) => IButtonStyles;
@@ -0,0 +1,187 @@
define(["require", "exports", "tslib", "../../../Styling", "../../../Utilities", "../BaseButton.styles", "../SplitButton/SplitButton.styles", "../BaseButton.classNames"], function (require, exports, tslib_1, Styling_1, Utilities_1, BaseButton_styles_1, SplitButton_styles_1, BaseButton_classNames_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStyles = void 0;
exports.getStyles = (0, Utilities_1.memoizeFunction)(function (theme, customStyles, focusInset, focusColor) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
var baseButtonStyles = (0, BaseButton_styles_1.getStyles)(theme);
var baseSplitButtonStyles = (0, SplitButton_styles_1.getStyles)(theme);
var p = theme.palette, semanticColors = theme.semanticColors;
var commandButtonHighContrastFocus = {
left: 4,
top: 4,
bottom: 4,
right: 4,
border: 'none',
};
var commandButtonStyles = {
root: [
(0, Styling_1.getFocusStyle)(theme, {
inset: 2,
highContrastStyle: commandButtonHighContrastFocus,
borderColor: 'transparent',
}),
theme.fonts.medium,
(_a = {
minWidth: '40px',
backgroundColor: p.white,
color: p.neutralPrimary,
padding: '0 4px',
border: 'none',
borderRadius: 0
},
_a[Styling_1.HighContrastSelector] = {
border: 'none',
},
_a),
],
rootHovered: (_b = {
backgroundColor: p.neutralLighter,
color: p.neutralDark
},
_b[Styling_1.HighContrastSelector] = {
color: 'Highlight',
},
_b[".".concat(BaseButton_classNames_1.ButtonGlobalClassNames.msButtonIcon)] = {
color: p.themeDarkAlt,
},
_b[".".concat(BaseButton_classNames_1.ButtonGlobalClassNames.msButtonMenuIcon)] = {
color: p.neutralPrimary,
},
_b),
rootPressed: (_c = {
backgroundColor: p.neutralLight,
color: p.neutralDark
},
_c[".".concat(BaseButton_classNames_1.ButtonGlobalClassNames.msButtonIcon)] = {
color: p.themeDark,
},
_c[".".concat(BaseButton_classNames_1.ButtonGlobalClassNames.msButtonMenuIcon)] = {
color: p.neutralPrimary,
},
_c),
rootChecked: (_d = {
backgroundColor: p.neutralLight,
color: p.neutralDark
},
_d[".".concat(BaseButton_classNames_1.ButtonGlobalClassNames.msButtonIcon)] = {
color: p.themeDark,
},
_d[".".concat(BaseButton_classNames_1.ButtonGlobalClassNames.msButtonMenuIcon)] = {
color: p.neutralPrimary,
},
_d),
rootCheckedHovered: (_e = {
backgroundColor: p.neutralQuaternaryAlt
},
_e[".".concat(BaseButton_classNames_1.ButtonGlobalClassNames.msButtonIcon)] = {
color: p.themeDark,
},
_e[".".concat(BaseButton_classNames_1.ButtonGlobalClassNames.msButtonMenuIcon)] = {
color: p.neutralPrimary,
},
_e),
rootExpanded: (_f = {
backgroundColor: p.neutralLight,
color: p.neutralDark
},
_f[".".concat(BaseButton_classNames_1.ButtonGlobalClassNames.msButtonIcon)] = {
color: p.themeDark,
},
_f[".".concat(BaseButton_classNames_1.ButtonGlobalClassNames.msButtonMenuIcon)] = {
color: p.neutralPrimary,
},
_f),
rootExpandedHovered: {
backgroundColor: p.neutralQuaternaryAlt,
},
rootDisabled: (_g = {
backgroundColor: p.white
},
_g[".".concat(BaseButton_classNames_1.ButtonGlobalClassNames.msButtonIcon)] = (_h = {
color: semanticColors.disabledBodySubtext
},
_h[Styling_1.HighContrastSelector] = tslib_1.__assign({ color: 'GrayText' }, (0, Styling_1.getHighContrastNoAdjustStyle)()),
_h),
_g[Styling_1.HighContrastSelector] = tslib_1.__assign({ color: 'GrayText', backgroundColor: 'Window' }, (0, Styling_1.getHighContrastNoAdjustStyle)()),
_g),
// Split button styles
splitButtonContainer: (_j = {
height: '100%'
},
_j[Styling_1.HighContrastSelector] = {
border: 'none',
},
_j),
splitButtonDividerDisabled: (_k = {},
_k[Styling_1.HighContrastSelector] = {
backgroundColor: 'Window',
},
_k),
splitButtonDivider: {
backgroundColor: p.neutralTertiaryAlt,
},
splitButtonMenuButton: {
backgroundColor: p.white,
border: 'none',
borderTopRightRadius: '0',
borderBottomRightRadius: '0',
color: p.neutralSecondary,
':hover': (_l = {
backgroundColor: p.neutralLighter,
color: p.neutralDark
},
_l[Styling_1.HighContrastSelector] = {
color: 'Highlight',
},
_l[".".concat(BaseButton_classNames_1.ButtonGlobalClassNames.msButtonIcon)] = {
color: p.neutralPrimary,
},
_l),
':active': (_m = {
backgroundColor: p.neutralLight
},
_m[".".concat(BaseButton_classNames_1.ButtonGlobalClassNames.msButtonIcon)] = {
color: p.neutralPrimary,
},
_m),
},
splitButtonMenuButtonDisabled: (_o = {
backgroundColor: p.white
},
_o[Styling_1.HighContrastSelector] = tslib_1.__assign({ color: 'GrayText', border: 'none', backgroundColor: 'Window' }, (0, Styling_1.getHighContrastNoAdjustStyle)()),
_o),
splitButtonMenuButtonChecked: {
backgroundColor: p.neutralLight,
color: p.neutralDark,
':hover': {
backgroundColor: p.neutralQuaternaryAlt,
},
},
splitButtonMenuButtonExpanded: {
backgroundColor: p.neutralLight,
color: p.black,
':hover': {
backgroundColor: p.neutralQuaternaryAlt,
},
},
splitButtonMenuIcon: {
color: p.neutralPrimary,
},
splitButtonMenuIconDisabled: {
color: p.neutralTertiary,
},
label: {
fontWeight: 'normal', // theme.fontWeights.semibold,
},
icon: {
color: p.themePrimary,
},
menuIcon: {
color: p.neutralSecondary,
},
};
return (0, Styling_1.concatStyleSets)(baseButtonStyles, baseSplitButtonStyles, commandButtonStyles, customStyles);
});
});
//# sourceMappingURL=CommandBarButton.styles.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,5 @@
import { ActionButton } from '../ActionButton/ActionButton';
/**
* {@docCategory Button}
*/
export declare const CommandButton: typeof ActionButton;
@@ -0,0 +1,10 @@
define(["require", "exports", "../ActionButton/ActionButton"], function (require, exports, ActionButton_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommandButton = void 0;
/**
* {@docCategory Button}
*/
exports.CommandButton = ActionButton_1.ActionButton;
});
//# sourceMappingURL=CommandButton.js.map
@@ -0,0 +1 @@
{"version":3,"file":"CommandButton.js","sourceRoot":"../src/","sources":["components/Button/CommandButton/CommandButton.tsx"],"names":[],"mappings":";;;;IAEA;;OAEG;IACU,QAAA,aAAa,GAAG,2BAAY,CAAC","sourcesContent":["import { ActionButton } from '../ActionButton/ActionButton';\n\n/**\n * {@docCategory Button}\n */\nexport const CommandButton = ActionButton;\n"]}
@@ -0,0 +1,9 @@
import * as React from 'react';
import type { IButtonProps } from '../Button.types';
import type { JSXElement } from '@fluentui/utilities';
/**
* {@docCategory Button}
*/
export declare class CompoundButton extends React.Component<IButtonProps, {}> {
render(): JSXElement;
}
@@ -0,0 +1,24 @@
define(["require", "exports", "tslib", "react", "../BaseButton", "../../../Utilities", "./CompoundButton.styles"], function (require, exports, tslib_1, React, BaseButton_1, Utilities_1, CompoundButton_styles_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CompoundButton = void 0;
/**
* {@docCategory Button}
*/
var CompoundButton = /** @class */ (function (_super) {
tslib_1.__extends(CompoundButton, _super);
function CompoundButton() {
return _super !== null && _super.apply(this, arguments) || this;
}
CompoundButton.prototype.render = function () {
var _a = this.props, _b = _a.primary, primary = _b === void 0 ? false : _b, styles = _a.styles, theme = _a.theme;
return (React.createElement(BaseButton_1.BaseButton, tslib_1.__assign({}, this.props, { variantClassName: primary ? 'ms-Button--compoundPrimary' : 'ms-Button--compound', styles: (0, CompoundButton_styles_1.getStyles)(theme, styles, primary) })));
};
CompoundButton = tslib_1.__decorate([
(0, Utilities_1.customizable)('CompoundButton', ['theme', 'styles'], true)
], CompoundButton);
return CompoundButton;
}(React.Component));
exports.CompoundButton = CompoundButton;
});
//# sourceMappingURL=CompoundButton.js.map
@@ -0,0 +1 @@
{"version":3,"file":"CompoundButton.js","sourceRoot":"../src/","sources":["components/Button/CompoundButton/CompoundButton.tsx"],"names":[],"mappings":";;;;IAQA;;OAEG;IAEH;QAAoC,0CAAiC;QAArE;;QAWA,CAAC;QAVQ,+BAAM,GAAb;YACQ,IAAA,KAAqC,IAAI,CAAC,KAAK,EAA7C,eAAe,EAAf,OAAO,mBAAG,KAAK,KAAA,EAAE,MAAM,YAAA,EAAE,KAAK,WAAe,CAAC;YACtD,OAAO,CACL,oBAAC,uBAAU,uBACL,IAAI,CAAC,KAAK,IACd,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,qBAAqB,EAChF,MAAM,EAAE,IAAA,iCAAS,EAAC,KAAM,EAAE,MAAM,EAAE,OAAO,CAAC,IAC1C,CACH,CAAC;QACJ,CAAC;QAVU,cAAc;YAD1B,IAAA,wBAAY,EAAC,gBAAgB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC;WAC7C,cAAc,CAW1B;QAAD,qBAAC;KAAA,AAXD,CAAoC,KAAK,CAAC,SAAS,GAWlD;IAXY,wCAAc","sourcesContent":["import * as React from 'react';\nimport { BaseButton } from '../BaseButton';\nimport { customizable } from '../../../Utilities';\nimport { getStyles } from './CompoundButton.styles';\nimport type { IButtonProps } from '../Button.types';\n\nimport type { JSXElement } from '@fluentui/utilities';\n\n/**\n * {@docCategory Button}\n */\n@customizable('CompoundButton', ['theme', 'styles'], true)\nexport class CompoundButton extends React.Component<IButtonProps, {}> {\n public render(): JSXElement {\n const { primary = false, styles, theme } = this.props;\n return (\n <BaseButton\n {...this.props}\n variantClassName={primary ? 'ms-Button--compoundPrimary' : 'ms-Button--compound'}\n styles={getStyles(theme!, styles, primary)}\n />\n );\n }\n}\n"]}
@@ -0,0 +1,3 @@
import type { IButtonStyles } from '../Button.types';
import type { ITheme } from '../../../Styling';
export declare const getStyles: (theme: ITheme, customStyles?: IButtonStyles, primary?: boolean) => IButtonStyles;
@@ -0,0 +1,98 @@
define(["require", "exports", "tslib", "../../../Styling", "../../../Utilities", "../BaseButton.styles", "../SplitButton/SplitButton.styles", "../ButtonThemes"], function (require, exports, tslib_1, Styling_1, Utilities_1, BaseButton_styles_1, SplitButton_styles_1, ButtonThemes_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStyles = void 0;
exports.getStyles = (0, Utilities_1.memoizeFunction)(function (theme, customStyles, primary) {
var _a, _b, _c, _d, _e;
var fonts = theme.fonts, palette = theme.palette;
var baseButtonStyles = (0, BaseButton_styles_1.getStyles)(theme);
var splitButtonStyles = (0, SplitButton_styles_1.getStyles)(theme);
var compoundButtonStyles = {
root: {
maxWidth: '280px',
minHeight: '72px',
height: 'auto',
padding: '16px 12px',
},
flexContainer: {
flexDirection: 'row',
alignItems: 'flex-start',
minWidth: '100%',
margin: '',
},
textContainer: {
textAlign: 'left',
},
icon: {
fontSize: '2em',
lineHeight: '1em',
height: '1em',
margin: '0px 8px 0px 0px',
flexBasis: '1em',
flexShrink: '0',
},
label: {
margin: '0 0 5px',
lineHeight: '100%',
fontWeight: Styling_1.FontWeights.semibold,
},
description: [
fonts.small,
{
lineHeight: '100%',
},
],
};
var standardCompoundTheme = {
description: {
color: palette.neutralSecondary,
},
descriptionHovered: {
color: palette.neutralDark,
},
descriptionPressed: {
color: 'inherit',
},
descriptionChecked: {
color: 'inherit',
},
descriptionDisabled: {
color: 'inherit',
},
};
var primaryCompoundTheme = {
description: (_a = {
color: palette.white
},
_a[Styling_1.HighContrastSelector] = tslib_1.__assign({ backgroundColor: 'WindowText', color: 'Window' }, (0, Styling_1.getHighContrastNoAdjustStyle)()),
_a),
descriptionHovered: (_b = {
color: palette.white
},
_b[Styling_1.HighContrastSelector] = {
backgroundColor: 'Highlight',
color: 'Window',
},
_b),
descriptionPressed: (_c = {
color: 'inherit'
},
_c[Styling_1.HighContrastSelector] = tslib_1.__assign({ color: 'Window', backgroundColor: 'WindowText' }, (0, Styling_1.getHighContrastNoAdjustStyle)()),
_c),
descriptionChecked: (_d = {
color: 'inherit'
},
_d[Styling_1.HighContrastSelector] = tslib_1.__assign({ color: 'Window', backgroundColor: 'WindowText' }, (0, Styling_1.getHighContrastNoAdjustStyle)()),
_d),
descriptionDisabled: (_e = {
color: 'inherit'
},
_e[Styling_1.HighContrastSelector] = {
color: 'inherit',
},
_e),
};
return (0, Styling_1.concatStyleSets)(baseButtonStyles, compoundButtonStyles, primary ? (0, ButtonThemes_1.primaryStyles)(theme) : (0, ButtonThemes_1.standardStyles)(theme), primary ? primaryCompoundTheme : standardCompoundTheme, splitButtonStyles, customStyles);
});
});
//# sourceMappingURL=CompoundButton.styles.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
import * as React from 'react';
import type { IButtonProps } from '../Button.types';
import type { JSXElement } from '@fluentui/utilities';
/**
* {@docCategory Button}
*/
export declare class DefaultButton extends React.Component<IButtonProps, {}> {
render(): JSXElement;
}
@@ -0,0 +1,24 @@
define(["require", "exports", "tslib", "react", "../BaseButton", "../../../Utilities", "./DefaultButton.styles"], function (require, exports, tslib_1, React, BaseButton_1, Utilities_1, DefaultButton_styles_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultButton = void 0;
/**
* {@docCategory Button}
*/
var DefaultButton = /** @class */ (function (_super) {
tslib_1.__extends(DefaultButton, _super);
function DefaultButton() {
return _super !== null && _super.apply(this, arguments) || this;
}
DefaultButton.prototype.render = function () {
var _a = this.props, _b = _a.primary, primary = _b === void 0 ? false : _b, styles = _a.styles, theme = _a.theme;
return (React.createElement(BaseButton_1.BaseButton, tslib_1.__assign({}, this.props, { variantClassName: primary ? 'ms-Button--primary' : 'ms-Button--default', styles: (0, DefaultButton_styles_1.getStyles)(theme, styles, primary), onRenderDescription: Utilities_1.nullRender })));
};
DefaultButton = tslib_1.__decorate([
(0, Utilities_1.customizable)('DefaultButton', ['theme', 'styles'], true)
], DefaultButton);
return DefaultButton;
}(React.Component));
exports.DefaultButton = DefaultButton;
});
//# sourceMappingURL=DefaultButton.js.map
@@ -0,0 +1 @@
{"version":3,"file":"DefaultButton.js","sourceRoot":"../src/","sources":["components/Button/DefaultButton/DefaultButton.tsx"],"names":[],"mappings":";;;;IAQA;;OAEG;IAEH;QAAmC,yCAAiC;QAApE;;QAaA,CAAC;QAZQ,8BAAM,GAAb;YACQ,IAAA,KAAqC,IAAI,CAAC,KAAK,EAA7C,eAAe,EAAf,OAAO,mBAAG,KAAK,KAAA,EAAE,MAAM,YAAA,EAAE,KAAK,WAAe,CAAC;YAEtD,OAAO,CACL,oBAAC,uBAAU,uBACL,IAAI,CAAC,KAAK,IACd,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAoB,EACvE,MAAM,EAAE,IAAA,gCAAS,EAAC,KAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAC1C,mBAAmB,EAAE,sBAAU,IAC/B,CACH,CAAC;QACJ,CAAC;QAZU,aAAa;YADzB,IAAA,wBAAY,EAAC,eAAe,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC;WAC5C,aAAa,CAazB;QAAD,oBAAC;KAAA,AAbD,CAAmC,KAAK,CAAC,SAAS,GAajD;IAbY,sCAAa","sourcesContent":["import * as React from 'react';\nimport { BaseButton } from '../BaseButton';\nimport { customizable, nullRender } from '../../../Utilities';\nimport { getStyles } from './DefaultButton.styles';\nimport type { IButtonProps } from '../Button.types';\n\nimport type { JSXElement } from '@fluentui/utilities';\n\n/**\n * {@docCategory Button}\n */\n@customizable('DefaultButton', ['theme', 'styles'], true)\nexport class DefaultButton extends React.Component<IButtonProps, {}> {\n public render(): JSXElement {\n const { primary = false, styles, theme } = this.props;\n\n return (\n <BaseButton\n {...this.props}\n variantClassName={primary ? 'ms-Button--primary' : 'ms-Button--default'}\n styles={getStyles(theme!, styles, primary)}\n onRenderDescription={nullRender}\n />\n );\n }\n}\n"]}
@@ -0,0 +1,3 @@
import type { IButtonStyles } from '../Button.types';
import type { ITheme } from '../../../Styling';
export declare const getStyles: (theme: ITheme, customStyles?: IButtonStyles, primary?: boolean) => IButtonStyles;
@@ -0,0 +1,22 @@
define(["require", "exports", "../../../Styling", "../../../Utilities", "../BaseButton.styles", "../SplitButton/SplitButton.styles", "../ButtonThemes"], function (require, exports, Styling_1, Utilities_1, BaseButton_styles_1, SplitButton_styles_1, ButtonThemes_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStyles = void 0;
var DEFAULT_BUTTON_MIN_HEIGHT = '32px';
var DEFAULT_BUTTON_MIN_WIDTH = '80px';
exports.getStyles = (0, Utilities_1.memoizeFunction)(function (theme, customStyles, primary) {
var baseButtonStyles = (0, BaseButton_styles_1.getStyles)(theme);
var splitButtonStyles = (0, SplitButton_styles_1.getStyles)(theme);
var defaultButtonStyles = {
root: {
minWidth: DEFAULT_BUTTON_MIN_WIDTH,
minHeight: DEFAULT_BUTTON_MIN_HEIGHT,
},
label: {
fontWeight: Styling_1.FontWeights.semibold,
},
};
return (0, Styling_1.concatStyleSets)(baseButtonStyles, defaultButtonStyles, primary ? (0, ButtonThemes_1.primaryStyles)(theme) : (0, ButtonThemes_1.standardStyles)(theme), splitButtonStyles, customStyles);
});
});
//# sourceMappingURL=DefaultButton.styles.js.map
@@ -0,0 +1 @@
{"version":3,"file":"DefaultButton.styles.js","sourceRoot":"../src/","sources":["components/Button/DefaultButton/DefaultButton.styles.ts"],"names":[],"mappings":";;;;IASA,IAAM,yBAAyB,GAAG,MAAM,CAAC;IACzC,IAAM,wBAAwB,GAAG,MAAM,CAAC;IAE3B,QAAA,SAAS,GAAG,IAAA,2BAAe,EACtC,UAAC,KAAa,EAAE,YAA4B,EAAE,OAAiB;QAC7D,IAAM,gBAAgB,GAAkB,IAAA,6BAAmB,EAAC,KAAK,CAAC,CAAC;QACnE,IAAM,iBAAiB,GAAkB,IAAA,8BAAoB,EAAC,KAAK,CAAC,CAAC;QACrE,IAAM,mBAAmB,GAAkB;YACzC,IAAI,EAAE;gBACJ,QAAQ,EAAE,wBAAwB;gBAClC,SAAS,EAAE,yBAAyB;aACrC;YACD,KAAK,EAAE;gBACL,UAAU,EAAE,qBAAW,CAAC,QAAQ;aACjC;SACF,CAAC;QAEF,OAAO,IAAA,yBAAe,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,OAAO,CAAC,CAAC,CAAC,IAAA,4BAAa,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAA,6BAAc,EAAC,KAAK,CAAC,EACtD,iBAAiB,EACjB,YAAY,CACZ,CAAC;IACL,CAAC,CACF,CAAC","sourcesContent":["import { concatStyleSets, FontWeights } from '../../../Styling';\nimport { memoizeFunction } from '../../../Utilities';\nimport { getStyles as getBaseButtonStyles } from '../BaseButton.styles';\nimport { getStyles as getSplitButtonStyles } from '../SplitButton/SplitButton.styles';\n\nimport { primaryStyles, standardStyles } from '../ButtonThemes';\nimport type { IButtonStyles } from '../Button.types';\nimport type { ITheme } from '../../../Styling';\n\nconst DEFAULT_BUTTON_MIN_HEIGHT = '32px';\nconst DEFAULT_BUTTON_MIN_WIDTH = '80px';\n\nexport const getStyles = memoizeFunction(\n (theme: ITheme, customStyles?: IButtonStyles, primary?: boolean): IButtonStyles => {\n const baseButtonStyles: IButtonStyles = getBaseButtonStyles(theme);\n const splitButtonStyles: IButtonStyles = getSplitButtonStyles(theme);\n const defaultButtonStyles: IButtonStyles = {\n root: {\n minWidth: DEFAULT_BUTTON_MIN_WIDTH,\n minHeight: DEFAULT_BUTTON_MIN_HEIGHT,\n },\n label: {\n fontWeight: FontWeights.semibold,\n },\n };\n\n return concatStyleSets(\n baseButtonStyles,\n defaultButtonStyles,\n primary ? primaryStyles(theme) : standardStyles(theme),\n splitButtonStyles,\n customStyles,\n )!;\n },\n);\n"]}
@@ -0,0 +1,9 @@
import * as React from 'react';
import type { IButtonProps } from '../Button.types';
import type { JSXElement } from '@fluentui/utilities';
/**
* {@docCategory Button}
*/
export declare class IconButton extends React.Component<IButtonProps, {}> {
render(): JSXElement;
}
@@ -0,0 +1,24 @@
define(["require", "exports", "tslib", "react", "../BaseButton", "../../../Utilities", "./IconButton.styles"], function (require, exports, tslib_1, React, BaseButton_1, Utilities_1, IconButton_styles_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IconButton = void 0;
/**
* {@docCategory Button}
*/
var IconButton = /** @class */ (function (_super) {
tslib_1.__extends(IconButton, _super);
function IconButton() {
return _super !== null && _super.apply(this, arguments) || this;
}
IconButton.prototype.render = function () {
var _a = this.props, styles = _a.styles, theme = _a.theme;
return (React.createElement(BaseButton_1.BaseButton, tslib_1.__assign({}, this.props, { variantClassName: "ms-Button--icon", styles: (0, IconButton_styles_1.getStyles)(theme, styles), onRenderText: Utilities_1.nullRender, onRenderDescription: Utilities_1.nullRender })));
};
IconButton = tslib_1.__decorate([
(0, Utilities_1.customizable)('IconButton', ['theme', 'styles'], true)
], IconButton);
return IconButton;
}(React.Component));
exports.IconButton = IconButton;
});
//# sourceMappingURL=IconButton.js.map
@@ -0,0 +1 @@
{"version":3,"file":"IconButton.js","sourceRoot":"../src/","sources":["components/Button/IconButton/IconButton.tsx"],"names":[],"mappings":";;;;IAQA;;OAEG;IAEH;QAAgC,sCAAiC;QAAjE;;QAcA,CAAC;QAbQ,2BAAM,GAAb;YACQ,IAAA,KAAoB,IAAI,CAAC,KAAK,EAA5B,MAAM,YAAA,EAAE,KAAK,WAAe,CAAC;YAErC,OAAO,CACL,oBAAC,uBAAU,uBACL,IAAI,CAAC,KAAK,IACd,gBAAgB,EAAC,iBAAiB,EAClC,MAAM,EAAE,IAAA,6BAAS,EAAC,KAAM,EAAE,MAAM,CAAC,EACjC,YAAY,EAAE,sBAAU,EACxB,mBAAmB,EAAE,sBAAU,IAC/B,CACH,CAAC;QACJ,CAAC;QAbU,UAAU;YADtB,IAAA,wBAAY,EAAC,YAAY,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC;WACzC,UAAU,CActB;QAAD,iBAAC;KAAA,AAdD,CAAgC,KAAK,CAAC,SAAS,GAc9C;IAdY,gCAAU","sourcesContent":["import * as React from 'react';\nimport { BaseButton } from '../BaseButton';\nimport { customizable, nullRender } from '../../../Utilities';\nimport { getStyles } from './IconButton.styles';\nimport type { IButtonProps } from '../Button.types';\n\nimport type { JSXElement } from '@fluentui/utilities';\n\n/**\n * {@docCategory Button}\n */\n@customizable('IconButton', ['theme', 'styles'], true)\nexport class IconButton extends React.Component<IButtonProps, {}> {\n public render(): JSXElement {\n const { styles, theme } = this.props;\n\n return (\n <BaseButton\n {...this.props}\n variantClassName=\"ms-Button--icon\"\n styles={getStyles(theme!, styles)}\n onRenderText={nullRender}\n onRenderDescription={nullRender}\n />\n );\n }\n}\n"]}
@@ -0,0 +1,3 @@
import type { IButtonStyles } from '../Button.types';
import type { ITheme } from '../../../Styling';
export declare const getStyles: (theme: ITheme, customStyles?: IButtonStyles) => IButtonStyles;
@@ -0,0 +1,54 @@
define(["require", "exports", "../../../Styling", "../../../Utilities", "../BaseButton.styles", "../SplitButton/SplitButton.styles"], function (require, exports, Styling_1, Utilities_1, BaseButton_styles_1, SplitButton_styles_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStyles = void 0;
exports.getStyles = (0, Utilities_1.memoizeFunction)(function (theme, customStyles) {
var _a;
var baseButtonStyles = (0, BaseButton_styles_1.getStyles)(theme);
var splitButtonStyles = (0, SplitButton_styles_1.getStyles)(theme);
var palette = theme.palette, semanticColors = theme.semanticColors;
var iconButtonStyles = {
root: {
padding: '0 4px',
width: '32px',
height: '32px',
backgroundColor: 'transparent',
border: 'none',
color: semanticColors.link,
},
rootHovered: (_a = {
color: palette.themeDarkAlt,
backgroundColor: palette.neutralLighter
},
_a[Styling_1.HighContrastSelector] = {
borderColor: 'Highlight',
color: 'Highlight',
},
_a),
rootHasMenu: {
width: 'auto',
},
rootPressed: {
color: palette.themeDark,
backgroundColor: palette.neutralLight,
},
rootExpanded: {
color: palette.themeDark,
backgroundColor: palette.neutralLight,
},
rootChecked: {
color: palette.themeDark,
backgroundColor: palette.neutralLight,
},
rootCheckedHovered: {
color: palette.themeDark,
backgroundColor: palette.neutralQuaternaryAlt,
},
rootDisabled: {
color: palette.neutralTertiaryAlt,
},
};
return (0, Styling_1.concatStyleSets)(baseButtonStyles, iconButtonStyles, splitButtonStyles, customStyles);
});
});
//# sourceMappingURL=IconButton.styles.js.map
@@ -0,0 +1 @@
{"version":3,"file":"IconButton.styles.js","sourceRoot":"../src/","sources":["components/Button/IconButton/IconButton.styles.ts"],"names":[],"mappings":";;;;IAOa,QAAA,SAAS,GAAG,IAAA,2BAAe,EAAC,UAAC,KAAa,EAAE,YAA4B;;QACnF,IAAM,gBAAgB,GAAkB,IAAA,6BAAmB,EAAC,KAAK,CAAC,CAAC;QACnE,IAAM,iBAAiB,GAAkB,IAAA,8BAAoB,EAAC,KAAK,CAAC,CAAC;QAC7D,IAAA,OAAO,GAAqB,KAAK,QAA1B,EAAE,cAAc,GAAK,KAAK,eAAV,CAAW;QAC1C,IAAM,gBAAgB,GAAkB;YACtC,IAAI,EAAE;gBACJ,OAAO,EAAE,OAAO;gBAChB,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,MAAM;gBACd,eAAe,EAAE,aAAa;gBAC9B,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,cAAc,CAAC,IAAI;aAC3B;YAED,WAAW;oBACT,KAAK,EAAE,OAAO,CAAC,YAAY;oBAC3B,eAAe,EAAE,OAAO,CAAC,cAAc;;gBACvC,GAAC,8BAAoB,IAAG;oBACtB,WAAW,EAAE,WAAW;oBACxB,KAAK,EAAE,WAAW;iBACnB;mBACF;YAED,WAAW,EAAE;gBACX,KAAK,EAAE,MAAM;aACd;YAED,WAAW,EAAE;gBACX,KAAK,EAAE,OAAO,CAAC,SAAS;gBACxB,eAAe,EAAE,OAAO,CAAC,YAAY;aACtC;YAED,YAAY,EAAE;gBACZ,KAAK,EAAE,OAAO,CAAC,SAAS;gBACxB,eAAe,EAAE,OAAO,CAAC,YAAY;aACtC;YAED,WAAW,EAAE;gBACX,KAAK,EAAE,OAAO,CAAC,SAAS;gBACxB,eAAe,EAAE,OAAO,CAAC,YAAY;aACtC;YAED,kBAAkB,EAAE;gBAClB,KAAK,EAAE,OAAO,CAAC,SAAS;gBACxB,eAAe,EAAE,OAAO,CAAC,oBAAoB;aAC9C;YAED,YAAY,EAAE;gBACZ,KAAK,EAAE,OAAO,CAAC,kBAAkB;aAClC;SACF,CAAC;QAEF,OAAO,IAAA,yBAAe,EAAC,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,YAAY,CAAE,CAAC;IAC/F,CAAC,CAAC,CAAC","sourcesContent":["import { concatStyleSets, HighContrastSelector } from '../../../Styling';\nimport { memoizeFunction } from '../../../Utilities';\nimport { getStyles as getBaseButtonStyles } from '../BaseButton.styles';\nimport { getStyles as getSplitButtonStyles } from '../SplitButton/SplitButton.styles';\nimport type { IButtonStyles } from '../Button.types';\nimport type { ITheme } from '../../../Styling';\n\nexport const getStyles = memoizeFunction((theme: ITheme, customStyles?: IButtonStyles): IButtonStyles => {\n const baseButtonStyles: IButtonStyles = getBaseButtonStyles(theme);\n const splitButtonStyles: IButtonStyles = getSplitButtonStyles(theme);\n const { palette, semanticColors } = theme;\n const iconButtonStyles: IButtonStyles = {\n root: {\n padding: '0 4px',\n width: '32px',\n height: '32px',\n backgroundColor: 'transparent',\n border: 'none',\n color: semanticColors.link,\n },\n\n rootHovered: {\n color: palette.themeDarkAlt,\n backgroundColor: palette.neutralLighter,\n [HighContrastSelector]: {\n borderColor: 'Highlight',\n color: 'Highlight',\n },\n },\n\n rootHasMenu: {\n width: 'auto',\n },\n\n rootPressed: {\n color: palette.themeDark,\n backgroundColor: palette.neutralLight,\n },\n\n rootExpanded: {\n color: palette.themeDark,\n backgroundColor: palette.neutralLight,\n },\n\n rootChecked: {\n color: palette.themeDark,\n backgroundColor: palette.neutralLight,\n },\n\n rootCheckedHovered: {\n color: palette.themeDark,\n backgroundColor: palette.neutralQuaternaryAlt,\n },\n\n rootDisabled: {\n color: palette.neutralTertiaryAlt,\n },\n };\n\n return concatStyleSets(baseButtonStyles, iconButtonStyles, splitButtonStyles, customStyles)!;\n});\n"]}
@@ -0,0 +1,9 @@
import * as React from 'react';
import type { IButtonProps } from '../Button.types';
import type { JSXElement } from '@fluentui/utilities';
/**
* {@docCategory MessageBar}
*/
export declare class MessageBarButton extends React.Component<IButtonProps, {}> {
render(): JSXElement;
}
@@ -0,0 +1,24 @@
define(["require", "exports", "tslib", "react", "../DefaultButton/DefaultButton", "../../../Utilities", "./MessageBarButton.styles"], function (require, exports, tslib_1, React, DefaultButton_1, Utilities_1, MessageBarButton_styles_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MessageBarButton = void 0;
/**
* {@docCategory MessageBar}
*/
var MessageBarButton = /** @class */ (function (_super) {
tslib_1.__extends(MessageBarButton, _super);
function MessageBarButton() {
return _super !== null && _super.apply(this, arguments) || this;
}
MessageBarButton.prototype.render = function () {
var _a = this.props, styles = _a.styles, theme = _a.theme;
return React.createElement(DefaultButton_1.DefaultButton, tslib_1.__assign({}, this.props, { styles: (0, MessageBarButton_styles_1.getStyles)(theme, styles), onRenderDescription: Utilities_1.nullRender }));
};
MessageBarButton = tslib_1.__decorate([
(0, Utilities_1.customizable)('MessageBarButton', ['theme', 'styles'], true)
], MessageBarButton);
return MessageBarButton;
}(React.Component));
exports.MessageBarButton = MessageBarButton;
});
//# sourceMappingURL=MessageBarButton.js.map
@@ -0,0 +1 @@
{"version":3,"file":"MessageBarButton.js","sourceRoot":"../src/","sources":["components/Button/MessageBarButton/MessageBarButton.tsx"],"names":[],"mappings":";;;;IAQA;;OAEG;IAEH;QAAsC,4CAAiC;QAAvE;;QAMA,CAAC;QALQ,iCAAM,GAAb;YACQ,IAAA,KAAoB,IAAI,CAAC,KAAK,EAA5B,MAAM,YAAA,EAAE,KAAK,WAAe,CAAC;YAErC,OAAO,oBAAC,6BAAa,uBAAK,IAAI,CAAC,KAAK,IAAE,MAAM,EAAE,IAAA,mCAAS,EAAC,KAAM,EAAE,MAAM,CAAC,EAAE,mBAAmB,EAAE,sBAAU,IAAI,CAAC;QAC/G,CAAC;QALU,gBAAgB;YAD5B,IAAA,wBAAY,EAAC,kBAAkB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC;WAC/C,gBAAgB,CAM5B;QAAD,uBAAC;KAAA,AAND,CAAsC,KAAK,CAAC,SAAS,GAMpD;IANY,4CAAgB","sourcesContent":["import * as React from 'react';\nimport { DefaultButton } from '../DefaultButton/DefaultButton';\nimport { customizable, nullRender } from '../../../Utilities';\nimport { getStyles } from './MessageBarButton.styles';\nimport type { IButtonProps } from '../Button.types';\n\nimport type { JSXElement } from '@fluentui/utilities';\n\n/**\n * {@docCategory MessageBar}\n */\n@customizable('MessageBarButton', ['theme', 'styles'], true)\nexport class MessageBarButton extends React.Component<IButtonProps, {}> {\n public render(): JSXElement {\n const { styles, theme } = this.props;\n\n return <DefaultButton {...this.props} styles={getStyles(theme!, styles)} onRenderDescription={nullRender} />;\n }\n}\n"]}
@@ -0,0 +1,3 @@
import type { IButtonStyles } from '../Button.types';
import type { ITheme } from '../../../Styling';
export declare const getStyles: (theme: ITheme, customStyles?: IButtonStyles) => IButtonStyles;
@@ -0,0 +1,23 @@
define(["require", "exports", "../../../Styling", "../../../Utilities"], function (require, exports, Styling_1, Utilities_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStyles = void 0;
exports.getStyles = (0, Utilities_1.memoizeFunction)(function (theme, customStyles) {
return (0, Styling_1.concatStyleSets)({
root: [
(0, Styling_1.getFocusStyle)(theme, {
inset: 1,
highContrastStyle: {
outlineOffset: '-4px',
outline: '1px solid Window',
},
borderColor: 'transparent',
}),
{
height: 24,
},
],
}, customStyles);
});
});
//# sourceMappingURL=MessageBarButton.styles.js.map
@@ -0,0 +1 @@
{"version":3,"file":"MessageBarButton.styles.js","sourceRoot":"../src/","sources":["components/Button/MessageBarButton/MessageBarButton.styles.ts"],"names":[],"mappings":";;;;IAKa,QAAA,SAAS,GAAG,IAAA,2BAAe,EACtC,UAAC,KAAa,EAAE,YAA4B;QAC1C,OAAA,IAAA,yBAAe,EACb;YACE,IAAI,EAAE;gBACJ,IAAA,uBAAa,EAAC,KAAK,EAAE;oBACnB,KAAK,EAAE,CAAC;oBACR,iBAAiB,EAAE;wBACjB,aAAa,EAAE,MAAM;wBACrB,OAAO,EAAE,kBAAkB;qBAC5B;oBACD,WAAW,EAAE,aAAa;iBAC3B,CAAC;gBACF;oBACE,MAAM,EAAE,EAAE;iBACX;aACF;SACF,EACD,YAAY,CACb;IAjBD,CAiBC,CACJ,CAAC","sourcesContent":["import { concatStyleSets, getFocusStyle } from '../../../Styling';\nimport { memoizeFunction } from '../../../Utilities';\nimport type { IButtonStyles } from '../Button.types';\nimport type { ITheme } from '../../../Styling';\n\nexport const getStyles = memoizeFunction(\n (theme: ITheme, customStyles?: IButtonStyles): IButtonStyles =>\n concatStyleSets(\n {\n root: [\n getFocusStyle(theme, {\n inset: 1,\n highContrastStyle: {\n outlineOffset: '-4px',\n outline: '1px solid Window',\n },\n borderColor: 'transparent',\n }),\n {\n height: 24,\n },\n ],\n },\n customStyles,\n ),\n);\n"]}
@@ -0,0 +1,9 @@
import * as React from 'react';
import type { IButtonProps } from '../Button.types';
import type { JSXElement } from '@fluentui/utilities';
/**
* {@docCategory Button}
*/
export declare class PrimaryButton extends React.Component<IButtonProps, {}> {
render(): JSXElement;
}
@@ -0,0 +1,23 @@
define(["require", "exports", "tslib", "react", "../../../Utilities", "../DefaultButton/DefaultButton"], function (require, exports, tslib_1, React, Utilities_1, DefaultButton_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrimaryButton = void 0;
/**
* {@docCategory Button}
*/
var PrimaryButton = /** @class */ (function (_super) {
tslib_1.__extends(PrimaryButton, _super);
function PrimaryButton() {
return _super !== null && _super.apply(this, arguments) || this;
}
PrimaryButton.prototype.render = function () {
return React.createElement(DefaultButton_1.DefaultButton, tslib_1.__assign({}, this.props, { primary: true, onRenderDescription: Utilities_1.nullRender }));
};
PrimaryButton = tslib_1.__decorate([
(0, Utilities_1.customizable)('PrimaryButton', ['theme', 'styles'], true)
], PrimaryButton);
return PrimaryButton;
}(React.Component));
exports.PrimaryButton = PrimaryButton;
});
//# sourceMappingURL=PrimaryButton.js.map
@@ -0,0 +1 @@
{"version":3,"file":"PrimaryButton.js","sourceRoot":"../src/","sources":["components/Button/PrimaryButton/PrimaryButton.tsx"],"names":[],"mappings":";;;;IAOA;;OAEG;IAEH;QAAmC,yCAAiC;QAApE;;QAIA,CAAC;QAHQ,8BAAM,GAAb;YACE,OAAO,oBAAC,6BAAa,uBAAK,IAAI,CAAC,KAAK,IAAE,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,sBAAU,IAAI,CAAC;QAC3F,CAAC;QAHU,aAAa;YADzB,IAAA,wBAAY,EAAC,eAAe,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC;WAC5C,aAAa,CAIzB;QAAD,oBAAC;KAAA,AAJD,CAAmC,KAAK,CAAC,SAAS,GAIjD;IAJY,sCAAa","sourcesContent":["import * as React from 'react';\nimport { customizable, nullRender } from '../../../Utilities';\nimport { DefaultButton } from '../DefaultButton/DefaultButton';\nimport type { IButtonProps } from '../Button.types';\n\nimport type { JSXElement } from '@fluentui/utilities';\n\n/**\n * {@docCategory Button}\n */\n@customizable('PrimaryButton', ['theme', 'styles'], true)\nexport class PrimaryButton extends React.Component<IButtonProps, {}> {\n public render(): JSXElement {\n return <DefaultButton {...this.props} primary={true} onRenderDescription={nullRender} />;\n }\n}\n"]}
@@ -0,0 +1,12 @@
import type { IButtonStyles } from '../Button.types';
export interface ISplitButtonClassNames {
root?: string;
icon?: string;
splitButtonContainer?: string;
flexContainer?: string;
divider?: string;
}
export declare const SplitButtonGlobalClassNames: {
msSplitButtonDivider: string;
};
export declare const getSplitButtonClassNames: (styles: IButtonStyles, disabled: boolean, expanded: boolean, checked: boolean, primaryDisabled?: boolean) => ISplitButtonClassNames;
@@ -0,0 +1,35 @@
define(["require", "exports", "../../../Utilities", "../../../Styling"], function (require, exports, Utilities_1, Styling_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSplitButtonClassNames = exports.SplitButtonGlobalClassNames = void 0;
exports.SplitButtonGlobalClassNames = {
msSplitButtonDivider: 'ms-SplitButton-divider',
};
exports.getSplitButtonClassNames = (0, Utilities_1.memoizeFunction)(function (styles, disabled, expanded, checked, primaryDisabled) {
return {
root: (0, Styling_1.mergeStyles)(styles.splitButtonMenuButton, expanded && [styles.splitButtonMenuButtonExpanded], disabled && [styles.splitButtonMenuButtonDisabled], checked && !disabled && [styles.splitButtonMenuButtonChecked], primaryDisabled &&
!disabled && [
{
':focus': styles.splitButtonMenuFocused,
},
]),
splitButtonContainer: (0, Styling_1.mergeStyles)(styles.splitButtonContainer, !disabled &&
checked && [
styles.splitButtonContainerChecked,
{
':hover': styles.splitButtonContainerCheckedHovered,
},
], !disabled &&
!checked && [
{
':hover': styles.splitButtonContainerHovered,
':focus': styles.splitButtonContainerFocused,
},
], disabled && styles.splitButtonContainerDisabled),
icon: (0, Styling_1.mergeStyles)(styles.splitButtonMenuIcon, disabled && styles.splitButtonMenuIconDisabled, !disabled && primaryDisabled && styles.splitButtonMenuIcon),
flexContainer: (0, Styling_1.mergeStyles)(styles.splitButtonFlexContainer),
divider: (0, Styling_1.mergeStyles)(exports.SplitButtonGlobalClassNames.msSplitButtonDivider, styles.splitButtonDivider, (primaryDisabled || disabled) && styles.splitButtonDividerDisabled),
};
});
});
//# sourceMappingURL=SplitButton.classNames.js.map
@@ -0,0 +1 @@
{"version":3,"file":"SplitButton.classNames.js","sourceRoot":"../src/","sources":["components/Button/SplitButton/SplitButton.classNames.ts"],"names":[],"mappings":";;;;IAYa,QAAA,2BAA2B,GAAG;QACzC,oBAAoB,EAAE,wBAAwB;KAC/C,CAAC;IAEW,QAAA,wBAAwB,GAAG,IAAA,2BAAe,EACrD,UACE,MAAqB,EACrB,QAAiB,EACjB,QAAiB,EACjB,OAAgB,EAChB,eAAyB;QAEzB,OAAO;YACL,IAAI,EAAE,IAAA,qBAAW,EACf,MAAM,CAAC,qBAAqB,EAC5B,QAAQ,IAAI,CAAC,MAAM,CAAC,6BAA6B,CAAC,EAClD,QAAQ,IAAI,CAAC,MAAM,CAAC,6BAA6B,CAAC,EAClD,OAAO,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,EAC7D,eAAe;gBACb,CAAC,QAAQ,IAAI;gBACX;oBACE,QAAQ,EAAE,MAAM,CAAC,sBAAsB;iBACxC;aACF,CACJ;YAED,oBAAoB,EAAE,IAAA,qBAAW,EAC/B,MAAM,CAAC,oBAAoB,EAC3B,CAAC,QAAQ;gBACP,OAAO,IAAI;gBACT,MAAM,CAAC,2BAA2B;gBAClC;oBACE,QAAQ,EAAE,MAAM,CAAC,kCAAkC;iBACpD;aACF,EACH,CAAC,QAAQ;gBACP,CAAC,OAAO,IAAI;gBACV;oBACE,QAAQ,EAAE,MAAM,CAAC,2BAA2B;oBAC5C,QAAQ,EAAE,MAAM,CAAC,2BAA2B;iBAC7C;aACF,EACH,QAAQ,IAAI,MAAM,CAAC,4BAA4B,CAChD;YAED,IAAI,EAAE,IAAA,qBAAW,EACf,MAAM,CAAC,mBAAmB,EAC1B,QAAQ,IAAI,MAAM,CAAC,2BAA2B,EAC9C,CAAC,QAAQ,IAAI,eAAe,IAAI,MAAM,CAAC,mBAAmB,CAC3D;YAED,aAAa,EAAE,IAAA,qBAAW,EAAC,MAAM,CAAC,wBAAwB,CAAC;YAE3D,OAAO,EAAE,IAAA,qBAAW,EAClB,mCAA2B,CAAC,oBAAoB,EAChD,MAAM,CAAC,kBAAkB,EACzB,CAAC,eAAe,IAAI,QAAQ,CAAC,IAAI,MAAM,CAAC,0BAA0B,CACnE;SACF,CAAC;IACJ,CAAC,CACF,CAAC","sourcesContent":["import { memoizeFunction } from '../../../Utilities';\nimport { mergeStyles } from '../../../Styling';\nimport type { IButtonStyles } from '../Button.types';\n\nexport interface ISplitButtonClassNames {\n root?: string;\n icon?: string;\n splitButtonContainer?: string;\n flexContainer?: string;\n divider?: string;\n}\n\nexport const SplitButtonGlobalClassNames = {\n msSplitButtonDivider: 'ms-SplitButton-divider',\n};\n\nexport const getSplitButtonClassNames = memoizeFunction(\n (\n styles: IButtonStyles,\n disabled: boolean,\n expanded: boolean,\n checked: boolean,\n primaryDisabled?: boolean,\n ): ISplitButtonClassNames => {\n return {\n root: mergeStyles(\n styles.splitButtonMenuButton,\n expanded && [styles.splitButtonMenuButtonExpanded],\n disabled && [styles.splitButtonMenuButtonDisabled],\n checked && !disabled && [styles.splitButtonMenuButtonChecked],\n primaryDisabled &&\n !disabled && [\n {\n ':focus': styles.splitButtonMenuFocused,\n },\n ],\n ),\n\n splitButtonContainer: mergeStyles(\n styles.splitButtonContainer,\n !disabled &&\n checked && [\n styles.splitButtonContainerChecked,\n {\n ':hover': styles.splitButtonContainerCheckedHovered,\n },\n ],\n !disabled &&\n !checked && [\n {\n ':hover': styles.splitButtonContainerHovered,\n ':focus': styles.splitButtonContainerFocused,\n },\n ],\n disabled && styles.splitButtonContainerDisabled,\n ),\n\n icon: mergeStyles(\n styles.splitButtonMenuIcon,\n disabled && styles.splitButtonMenuIconDisabled,\n !disabled && primaryDisabled && styles.splitButtonMenuIcon,\n ),\n\n flexContainer: mergeStyles(styles.splitButtonFlexContainer),\n\n divider: mergeStyles(\n SplitButtonGlobalClassNames.msSplitButtonDivider,\n styles.splitButtonDivider,\n (primaryDisabled || disabled) && styles.splitButtonDividerDisabled,\n ),\n };\n },\n);\n"]}
@@ -0,0 +1,3 @@
import type { IButtonStyles } from '../Button.types';
import type { ITheme } from '../../../Styling';
export declare const getStyles: (theme: ITheme, customStyles?: IButtonStyles) => IButtonStyles;
@@ -0,0 +1,215 @@
define(["require", "exports", "tslib", "../../../Styling", "../../../Utilities"], function (require, exports, tslib_1, Styling_1, Utilities_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStyles = void 0;
exports.getStyles = (0, Utilities_1.memoizeFunction)(function (theme, customStyles) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
var effects = theme.effects, palette = theme.palette, semanticColors = theme.semanticColors;
var buttonHighContrastFocus = {
left: -2,
top: -2,
bottom: -2,
right: -2,
border: 'none',
};
var splitButtonDividerBaseStyles = {
position: 'absolute',
width: 1,
right: 31,
top: 8,
bottom: 8,
};
var splitButtonStyles = {
splitButtonContainer: [
(0, Styling_1.getFocusStyle)(theme, { highContrastStyle: buttonHighContrastFocus, inset: 2, pointerEvents: 'none' }),
{
display: 'inline-flex',
'.ms-Button--default': {
borderTopRightRadius: '0',
borderBottomRightRadius: '0',
borderRight: 'none',
flexGrow: '1',
},
'.ms-Button--primary': (_a = {
borderTopRightRadius: '0',
borderBottomRightRadius: '0',
border: 'none',
flexGrow: '1',
':hover': {
border: 'none',
},
':active': {
border: 'none',
}
},
_a[Styling_1.HighContrastSelector] = tslib_1.__assign(tslib_1.__assign({ color: 'WindowText', backgroundColor: 'Window', border: '1px solid WindowText', borderRightWidth: '0' }, (0, Styling_1.getHighContrastNoAdjustStyle)()), { ':hover': {
backgroundColor: 'Highlight',
border: '1px solid Highlight',
borderRightWidth: '0',
color: 'HighlightText',
}, ':active': {
border: '1px solid Highlight',
} }),
_a),
'.ms-Button--default + .ms-Button': (_b = {},
_b[Styling_1.HighContrastSelector] = {
border: '1px solid WindowText',
borderLeftWidth: '0',
':hover': {
backgroundColor: 'HighlightText',
borderColor: 'Highlight',
color: 'Highlight',
'.ms-Button-menuIcon': tslib_1.__assign({ backgroundColor: 'HighlightText', color: 'Highlight' }, (0, Styling_1.getHighContrastNoAdjustStyle)()),
},
},
_b),
'.ms-Button--default + .ms-Button[aria-expanded="true"]': (_c = {},
_c[Styling_1.HighContrastSelector] = {
backgroundColor: 'HighlightText',
borderColor: 'Highlight',
color: 'Highlight',
'.ms-Button-menuIcon': tslib_1.__assign({ backgroundColor: 'HighlightText', color: 'Highlight' }, (0, Styling_1.getHighContrastNoAdjustStyle)()),
},
_c),
'.ms-Button--primary + .ms-Button': (_d = {
border: 'none'
},
_d[Styling_1.HighContrastSelector] = {
border: '1px solid WindowText',
borderLeftWidth: '0',
':hover': {
borderLeftWidth: '0',
backgroundColor: 'Highlight',
borderColor: 'Highlight',
color: 'HighlightText',
'.ms-Button-menuIcon': tslib_1.__assign(tslib_1.__assign({}, (0, Styling_1.getHighContrastNoAdjustStyle)()), { color: 'HighlightText' }),
},
},
_d),
'.ms-Button--primary + .ms-Button[aria-expanded="true"]': (_e = {},
_e[Styling_1.HighContrastSelector] = tslib_1.__assign(tslib_1.__assign({ backgroundColor: 'Highlight', borderColor: 'Highlight', color: 'HighlightText' }, (0, Styling_1.getHighContrastNoAdjustStyle)()), { '.ms-Button-menuIcon': {
color: 'HighlightText',
} }),
_e),
'.ms-Button.is-disabled': (_f = {},
_f[Styling_1.HighContrastSelector] = {
color: 'GrayText',
borderColor: 'GrayText',
backgroundColor: 'Window',
},
_f),
},
],
splitButtonContainerHovered: {
'.ms-Button--default.is-disabled': (_g = {
backgroundColor: semanticColors.buttonBackgroundDisabled,
color: semanticColors.buttonTextDisabled
},
_g[Styling_1.HighContrastSelector] = {
color: 'GrayText',
borderColor: 'GrayText',
backgroundColor: 'Window',
},
_g),
'.ms-Button--primary.is-disabled': (_h = {
backgroundColor: semanticColors.primaryButtonBackgroundDisabled,
color: semanticColors.primaryButtonTextDisabled
},
_h[Styling_1.HighContrastSelector] = {
color: 'GrayText',
borderColor: 'GrayText',
backgroundColor: 'Window',
},
_h),
},
splitButtonContainerChecked: {
'.ms-Button--primary': (_j = {},
_j[Styling_1.HighContrastSelector] = tslib_1.__assign({ color: 'Window', backgroundColor: 'WindowText' }, (0, Styling_1.getHighContrastNoAdjustStyle)()),
_j),
},
splitButtonContainerCheckedHovered: {
'.ms-Button--primary': (_k = {},
_k[Styling_1.HighContrastSelector] = tslib_1.__assign({ color: 'Window', backgroundColor: 'WindowText' }, (0, Styling_1.getHighContrastNoAdjustStyle)()),
_k),
},
splitButtonContainerFocused: {
outline: 'none!important',
},
splitButtonMenuButton: (_l = {
padding: 6,
height: 'auto',
boxSizing: 'border-box',
borderRadius: 0,
borderTopRightRadius: effects.roundedCorner2,
borderBottomRightRadius: effects.roundedCorner2,
border: "1px solid ".concat(palette.neutralSecondaryAlt),
borderLeft: 'none',
outline: 'transparent',
userSelect: 'none',
display: 'inline-block',
textDecoration: 'none',
textAlign: 'center',
cursor: 'pointer',
verticalAlign: 'top',
width: 32,
marginLeft: -1,
marginTop: 0,
marginRight: 0,
marginBottom: 0
},
_l[Styling_1.HighContrastSelector] = {
'.ms-Button-menuIcon': {
color: 'WindowText',
},
},
_l),
splitButtonDivider: tslib_1.__assign(tslib_1.__assign({}, splitButtonDividerBaseStyles), (_m = {}, _m[Styling_1.HighContrastSelector] = {
backgroundColor: 'WindowText',
}, _m)),
splitButtonDividerDisabled: tslib_1.__assign(tslib_1.__assign({}, splitButtonDividerBaseStyles), (_o = {}, _o[Styling_1.HighContrastSelector] = {
backgroundColor: 'GrayText',
}, _o)),
splitButtonMenuButtonDisabled: (_p = {
pointerEvents: 'none',
border: 'none',
':hover': {
cursor: 'default',
},
'.ms-Button--primary': (_q = {},
_q[Styling_1.HighContrastSelector] = {
color: 'GrayText',
borderColor: 'GrayText',
backgroundColor: 'Window',
},
_q),
'.ms-Button-menuIcon': (_r = {},
_r[Styling_1.HighContrastSelector] = {
color: 'GrayText',
},
_r)
},
_p[Styling_1.HighContrastSelector] = {
color: 'GrayText',
border: '1px solid GrayText',
backgroundColor: 'Window',
},
_p),
splitButtonFlexContainer: {
display: 'flex',
height: '100%',
flexWrap: 'nowrap',
justifyContent: 'center',
alignItems: 'center',
},
splitButtonContainerDisabled: (_s = {
outline: 'none',
border: 'none'
},
_s[Styling_1.HighContrastSelector] = tslib_1.__assign({ color: 'GrayText', borderColor: 'GrayText', backgroundColor: 'Window' }, (0, Styling_1.getHighContrastNoAdjustStyle)()),
_s),
splitButtonMenuFocused: tslib_1.__assign({}, (0, Styling_1.getFocusStyle)(theme, { highContrastStyle: buttonHighContrastFocus, inset: 2 })),
};
return (0, Styling_1.concatStyleSets)(splitButtonStyles, customStyles);
});
});
//# sourceMappingURL=SplitButton.styles.js.map
File diff suppressed because one or more lines are too long
+14
View File
@@ -0,0 +1,14 @@
export * from './BaseButton';
export * from './Button.types';
export * from './Button';
export * from './ActionButton/ActionButton';
export * from './CommandBarButton/CommandBarButton';
export * from './CommandButton/CommandButton';
export * from './CompoundButton/CompoundButton';
export * from './DefaultButton/DefaultButton';
export * from './MessageBarButton/MessageBarButton';
export * from './PrimaryButton/PrimaryButton';
export * from './IconButton/IconButton';
export * from './SplitButton/SplitButton.classNames';
export { ButtonGlobalClassNames } from './BaseButton.classNames';
export type { IButtonClassNames } from './BaseButton.classNames';
+19
View File
@@ -0,0 +1,19 @@
define(["require", "exports", "tslib", "./BaseButton", "./Button.types", "./Button", "./ActionButton/ActionButton", "./CommandBarButton/CommandBarButton", "./CommandButton/CommandButton", "./CompoundButton/CompoundButton", "./DefaultButton/DefaultButton", "./MessageBarButton/MessageBarButton", "./PrimaryButton/PrimaryButton", "./IconButton/IconButton", "./SplitButton/SplitButton.classNames", "./BaseButton.classNames"], function (require, exports, tslib_1, BaseButton_1, Button_types_1, Button_1, ActionButton_1, CommandBarButton_1, CommandButton_1, CompoundButton_1, DefaultButton_1, MessageBarButton_1, PrimaryButton_1, IconButton_1, SplitButton_classNames_1, BaseButton_classNames_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ButtonGlobalClassNames = void 0;
tslib_1.__exportStar(BaseButton_1, exports);
tslib_1.__exportStar(Button_types_1, exports);
tslib_1.__exportStar(Button_1, exports);
tslib_1.__exportStar(ActionButton_1, exports);
tslib_1.__exportStar(CommandBarButton_1, exports);
tslib_1.__exportStar(CommandButton_1, exports);
tslib_1.__exportStar(CompoundButton_1, exports);
tslib_1.__exportStar(DefaultButton_1, exports);
tslib_1.__exportStar(MessageBarButton_1, exports);
tslib_1.__exportStar(PrimaryButton_1, exports);
tslib_1.__exportStar(IconButton_1, exports);
tslib_1.__exportStar(SplitButton_classNames_1, exports);
Object.defineProperty(exports, "ButtonGlobalClassNames", { enumerable: true, get: function () { return BaseButton_classNames_1.ButtonGlobalClassNames; } });
});
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Button/index.ts"],"names":[],"mappings":";;;;IAAA,4CAA6B;IAC7B,8CAA+B;IAC/B,wCAAyB;IACzB,8CAA4C;IAC5C,kDAAoD;IACpD,+CAA8C;IAC9C,gDAAgD;IAChD,+CAA8C;IAC9C,kDAAoD;IACpD,+CAA8C;IAC9C,4CAAwC;IACxC,wDAAqD;IAC5C,+HAAA,sBAAsB,OAAA","sourcesContent":["export * from './BaseButton';\nexport * from './Button.types';\nexport * from './Button';\nexport * from './ActionButton/ActionButton';\nexport * from './CommandBarButton/CommandBarButton';\nexport * from './CommandButton/CommandButton';\nexport * from './CompoundButton/CompoundButton';\nexport * from './DefaultButton/DefaultButton';\nexport * from './MessageBarButton/MessageBarButton';\nexport * from './PrimaryButton/PrimaryButton';\nexport * from './IconButton/IconButton';\nexport * from './SplitButton/SplitButton.classNames';\nexport { ButtonGlobalClassNames } from './BaseButton.classNames';\nexport type { IButtonClassNames } from './BaseButton.classNames';\n"]}