@uifabric/experiments
Version:
Experimental React components for building experiences for Microsoft 365.
108 lines • 4.05 kB
JavaScript
import { __assign } from "tslib";
import { getGlobalClassNames, getTheme, HighContrastSelector, getHighContrastNoAdjustStyle } from '@uifabric/styling';
var GlobalClassNames = {
root: 'ms-FloatingSuggestionsItem',
itemButton: 'ms-FloatingSuggestionsItem-itemButton',
closeButton: 'ms-FloatingSuggestionsItem-closeButton',
isSelected: 'ms-FloatingSuggestionsItem-isSelected',
displayText: 'ms-FloatingSuggestionsItem-displayText',
};
export var getStyles = function (props) {
var _a, _b, _c, _d, _e;
var theme = getTheme();
if (!theme) {
throw new Error('theme is undefined or null in FloatingSuggestionsItem getStyles function.');
}
var isSelected = props.isSelected;
var palette = theme.palette, fonts = theme.fonts;
var classNames = getGlobalClassNames(GlobalClassNames, theme);
return {
root: [
classNames.root,
{
display: 'flex',
alignItems: 'stretch',
boxSizing: 'border-box',
width: '100%',
position: 'relative',
overflow: 'hidden',
selectors: {
'&:hover': {
background: palette.neutralLighter,
},
'&:hover .ms-FloatingSuggestionsItem-closeButton': {
display: 'block',
},
'&:active, &:focus': {
background: palette.themeLight,
},
},
},
],
itemButton: [
classNames.itemButton,
{
width: '100%',
padding: '0px',
minWidth: '0',
height: '100%',
selectors: (_a = {},
_a[HighContrastSelector] = {
color: 'WindowText',
},
_a),
},
isSelected && [
classNames.isSelected,
{
background: palette.themeLighter,
selectors: (_b = {
':hover': (_c = {
background: palette.themeLight
},
_c[HighContrastSelector] = __assign({ background: 'Highlight', color: 'HighlightText' }, getHighContrastNoAdjustStyle()),
_c)
},
_b[HighContrastSelector] = __assign({ background: 'Highlight', color: 'HighlightText' }, getHighContrastNoAdjustStyle()),
_b),
},
],
],
closeButton: [
classNames.closeButton,
{
display: 'none',
padding: '0 4px',
height: 'auto',
width: 32,
selectors: {
':hover': (_d = {},
_d[HighContrastSelector] = __assign({ background: 'Window', color: 'WindowText' }, getHighContrastNoAdjustStyle()),
_d),
},
},
isSelected && [
classNames.isSelected,
{
background: palette.themeLighter,
selectors: (_e = {
':hover': {
background: palette.themeLight,
}
},
_e[HighContrastSelector] = __assign({ background: 'Highlight', color: 'HighlightText' }, getHighContrastNoAdjustStyle()),
_e),
},
],
],
displayText: [
classNames.displayText,
{
padding: '0 12px',
fontSize: fonts.medium.fontSize,
lineHeight: '40px',
},
],
};
};
//# sourceMappingURL=FloatingSuggestionsItem.styles.js.map