office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
225 lines • 8.15 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Styling_1 = require("../../Styling");
var Utilities_1 = require("../../Utilities");
var _getDisabledStyles = Utilities_1.memoizeFunction(function (theme) {
var semanticColors = theme.semanticColors;
var SpinButtonTextColorDisabled = semanticColors.disabledText;
var SpinButtonBackgroundColorDisabled = semanticColors.disabledBackground;
return {
backgroundColor: SpinButtonBackgroundColorDisabled,
borderColor: 'transparent',
pointerEvents: 'none',
cursor: 'default',
color: SpinButtonTextColorDisabled,
selectors: (_a = {},
_a[Styling_1.HighContrastSelector] = {
color: 'GrayText'
},
_a)
};
var _a;
});
exports.getArrowButtonStyles = Utilities_1.memoizeFunction(function (theme, isUpArrow, customSpecificArrowStyles) {
var semanticColors = theme.semanticColors;
var ArrowButtonTextColor = semanticColors.buttonText;
var ArrowButtonTextColorHovered = semanticColors.buttonTextHovered;
var ArrowButtonTextColorPressed = semanticColors.buttonTextChecked;
var ArrowButtonBackgroundHovered = semanticColors.buttonBackgroundHovered;
var ArrowButtonBackgroundPressed = semanticColors.buttonBackgroundChecked;
var defaultArrowButtonStyles = {
root: {
outline: 'none',
display: 'block',
height: '50%',
width: '14px',
padding: '0',
backgroundColor: 'transparent',
textAlign: 'center',
cursor: 'default',
color: ArrowButtonTextColor
},
rootHovered: {
backgroundColor: ArrowButtonBackgroundHovered,
color: ArrowButtonTextColorHovered
},
rootChecked: {
backgroundColor: ArrowButtonBackgroundPressed,
color: ArrowButtonTextColorPressed,
selectors: (_a = {},
_a[Styling_1.HighContrastSelector] = {
backgroundColor: 'Highlight',
color: 'HighlightText'
},
_a)
},
rootPressed: {
backgroundColor: ArrowButtonBackgroundPressed,
color: ArrowButtonTextColorPressed,
selectors: (_b = {},
_b[Styling_1.HighContrastSelector] = {
backgroundColor: 'Highlight',
color: 'HighlightText'
},
_b)
},
rootDisabled: {
opacity: 0.5,
selectors: (_c = {},
_c[Styling_1.HighContrastSelector] = {
color: 'GrayText',
opacity: 1
},
_c)
},
icon: {
fontSize: '6px',
marginTop: '0',
marginRight: '0',
marginBottom: '0',
marginLeft: '0'
}
};
// No specific styles needed as of now.
var defaultUpArrowButtonStyles = {};
var defaultDownArrowButtonStyles = {};
return Styling_1.concatStyleSets(defaultArrowButtonStyles, isUpArrow ? defaultUpArrowButtonStyles : defaultDownArrowButtonStyles, customSpecificArrowStyles);
var _a, _b, _c;
});
exports.getStyles = Utilities_1.memoizeFunction(function (theme, customStyles) {
var palette = theme.palette, semanticColors = theme.semanticColors;
var SpinButtonRootBorderColor = semanticColors.inputBorder;
var SpinButtonRootBorderColorHovered = semanticColors.inputBorderHovered;
var SpinButtonRootBorderColorFocused = semanticColors.inputFocusBorderAlt;
var SpinButtonTextColorDisabled = semanticColors.disabledText;
var SpinButtonInputTextColor = semanticColors.bodyText;
var SpinButtonInputTextColorSelected = palette.white;
var SpinButtonInputBackgroundColorSelected = palette.themePrimary;
var SpinButtonIconDisabledColor = semanticColors.disabledText;
var defaultStyles = {
root: {
outline: 'none',
fontSize: Styling_1.FontSizes.medium,
width: '100%',
minWidth: '86px'
},
labelWrapper: {
display: 'inline-flex'
},
labelWrapperStart: {
float: 'left',
marginRight: '10px'
},
labelWrapperEnd: {
float: 'right',
marginLeft: '10px'
},
labelWrapperTop: {
marginBottom: '10px'
},
labelWrapperBottom: {
marginTop: '10px'
},
icon: {
padding: '2px 5px',
fontSize: '20px'
},
iconDisabled: {
color: SpinButtonIconDisabledColor
},
label: {
pointerEvents: 'none',
padding: '2px 0'
},
labelDisabled: {
cursor: 'default',
color: SpinButtonTextColorDisabled,
selectors: (_a = {},
_a[Styling_1.HighContrastSelector] = {
color: 'GrayText'
},
_a)
},
spinButtonWrapper: {
display: 'flex',
boxSizing: 'border-box',
height: '32px',
minWidth: '86px',
borderWidth: '1px',
borderStyle: 'solid',
borderColor: SpinButtonRootBorderColor
},
spinButtonWrapperTopBottom: {
width: '100%'
},
spinButtonWrapperHovered: {
borderColor: SpinButtonRootBorderColorHovered,
outline: '2px dashed transparent',
selectors: (_b = {},
_b[Styling_1.HighContrastSelector] = {
borderColor: 'Highlight',
outline: 'none'
},
_b)
},
spinButtonWrapperFocused: {
borderColor: SpinButtonRootBorderColorFocused,
outline: '2px dashed transparent',
selectors: (_c = {},
_c[Styling_1.HighContrastSelector] = {
borderColor: 'Highlight',
outline: 'none'
},
_c)
},
spinButtonWrapperDisabled: _getDisabledStyles(theme),
input: {
boxSizing: 'border-box',
boxShadow: 'none',
borderStyle: 'none',
marginTop: '0',
marginRight: '0',
marginBottom: '0',
marginLeft: '0',
fontSize: Styling_1.FontSizes.medium,
color: SpinButtonInputTextColor,
height: '100%',
padding: '0 12px',
outline: '0',
textOverflow: 'ellipsis',
display: 'block',
float: 'left',
width: 'calc(100% - 14px)',
minWidth: '72px',
overflow: 'hidden',
cursor: 'text',
userSelect: 'text'
},
inputTextSelected: {
backgroundColor: SpinButtonInputBackgroundColorSelected,
color: SpinButtonInputTextColorSelected,
selectors: (_d = {},
_d[Styling_1.HighContrastSelector] = {
backgroundColor: 'Highlight',
borderColor: 'Highlight',
color: 'HighlightText'
},
_d)
},
inputDisabled: _getDisabledStyles(theme),
arrowButtonsContainer: {
outline: 'none',
fontSize: '12px',
display: 'block',
float: 'left',
height: '100%',
cursor: 'default',
padding: '0',
boxSizing: 'border-box'
},
arrowButtonsContainerDisabled: _getDisabledStyles(theme)
};
return Styling_1.concatStyleSets(defaultStyles, customStyles);
var _a, _b, _c, _d;
});
//# sourceMappingURL=SpinButton.styles.js.map