UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

55 lines 2.77 kB
define(["require", "exports", "../../Utilities", "../../Styling", "../../utilities/positioning"], function (require, exports, Utilities_1, Styling_1, positioning_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getClassNames = Utilities_1.memoizeFunction(function (styles, disabled, isFocused, keyboardSpinDirection, labelPosition) { if (labelPosition === void 0) { labelPosition = positioning_1.Position.start; } return { root: Styling_1.mergeStyles(styles.root), labelWrapper: Styling_1.mergeStyles(styles.labelWrapper, _getStyleForLabelBasedOnPosition(labelPosition, styles)), icon: Styling_1.mergeStyles(styles.icon), label: Styling_1.mergeStyles(styles.label), spinButtonWrapper: Styling_1.mergeStyles(styles.spinButtonWrapper, _getStyleForRootBasedOnPosition(labelPosition, styles), !disabled && [ { ':hover': styles.spinButtonWrapperHovered }, isFocused && { // This is to increase the specifity of the focus styles // and make it equal to that of the hover styles. '&&': styles.spinButtonWrapperFocused } ], disabled && styles.spinButtonWrapperDisabled), input: Styling_1.mergeStyles('ms-spinButton-input', styles.input, !disabled && { '::selection': styles.inputTextSelected }, disabled && styles.inputDisabled), arrowBox: Styling_1.mergeStyles(styles.arrowButtonsContainer, disabled && styles.arrowButtonsContainerDisabled), }; }); /** * Returns the Style corresponding to the label position */ function _getStyleForLabelBasedOnPosition(labelPosition, styles) { switch (labelPosition) { case positioning_1.Position.start: return styles.labelWrapperStart; case positioning_1.Position.end: return styles.labelWrapperEnd; case positioning_1.Position.top: return styles.labelWrapperTop; case positioning_1.Position.bottom: return styles.labelWrapperBottom; } } /** * Returns the Style corresponding to the label position */ function _getStyleForRootBasedOnPosition(labelPosition, styles) { switch (labelPosition) { case positioning_1.Position.top: case positioning_1.Position.bottom: return styles.spinButtonWrapperTopBottom; default: return {}; } } }); //# sourceMappingURL=SpinButton.classNames.js.map