UNPKG

7.7 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.getStyles = exports.buttonStyles = void 0;
4var Styling_1 = require("../../Styling");
5var GlobalClassNames = {
6 root: 'ms-Nav',
7 linkText: 'ms-Nav-linkText',
8 compositeLink: 'ms-Nav-compositeLink',
9 link: 'ms-Nav-link',
10 chevronButton: 'ms-Nav-chevronButton',
11 chevronIcon: 'ms-Nav-chevron',
12 navItem: 'ms-Nav-navItem',
13 navItems: 'ms-Nav-navItems',
14 group: 'ms-Nav-group',
15 groupContent: 'ms-Nav-groupContent',
16};
17exports.buttonStyles = {
18 textContainer: {
19 overflow: 'hidden',
20 },
21 label: {
22 whiteSpace: 'nowrap',
23 textOverflow: 'ellipsis',
24 overflow: 'hidden',
25 },
26};
27var getStyles = function (props) {
28 var _a;
29 var className = props.className, theme = props.theme, isOnTop = props.isOnTop, isExpanded = props.isExpanded, isGroup = props.isGroup, isLink = props.isLink, isSelected = props.isSelected, isDisabled = props.isDisabled, isButtonEntry = props.isButtonEntry, _b = props.navHeight, navHeight = _b === void 0 ? 44 : _b, position = props.position, _c = props.leftPadding, leftPadding = _c === void 0 ? 20 : _c, _d = props.leftPaddingExpanded, leftPaddingExpanded = _d === void 0 ? 28 : _d, _e = props.rightPadding, rightPadding = _e === void 0 ? 20 : _e;
30 var palette = theme.palette, semanticColors = theme.semanticColors, fonts = theme.fonts;
31 var classNames = Styling_1.getGlobalClassNames(GlobalClassNames, theme);
32 return {
33 root: [
34 classNames.root,
35 className,
36 fonts.medium,
37 {
38 overflowY: 'auto',
39 userSelect: 'none',
40 WebkitOverflowScrolling: 'touch',
41 },
42 isOnTop && [
43 {
44 position: 'absolute',
45 },
46 Styling_1.AnimationClassNames.slideRightIn40,
47 ],
48 ],
49 linkText: [
50 classNames.linkText,
51 {
52 margin: '0 4px',
53 overflow: 'hidden',
54 verticalAlign: 'middle',
55 textAlign: 'left',
56 textOverflow: 'ellipsis',
57 },
58 ],
59 compositeLink: [
60 classNames.compositeLink,
61 {
62 display: 'block',
63 position: 'relative',
64 color: semanticColors.bodyText,
65 },
66 isExpanded && 'is-expanded',
67 isSelected && 'is-selected',
68 isDisabled && 'is-disabled',
69 isDisabled && {
70 color: semanticColors.disabledText,
71 },
72 ],
73 link: [
74 classNames.link,
75 Styling_1.getFocusStyle(theme),
76 {
77 display: 'block',
78 position: 'relative',
79 height: navHeight,
80 width: '100%',
81 lineHeight: navHeight + "px",
82 textDecoration: 'none',
83 cursor: 'pointer',
84 textOverflow: 'ellipsis',
85 whiteSpace: 'nowrap',
86 overflow: 'hidden',
87 paddingLeft: leftPadding,
88 paddingRight: rightPadding,
89 color: semanticColors.bodyText,
90 selectors: (_a = {},
91 _a[Styling_1.HighContrastSelector] = {
92 border: 0,
93 selectors: {
94 ':focus': {
95 border: '1px solid WindowText',
96 },
97 },
98 },
99 _a),
100 },
101 !isDisabled && {
102 selectors: {
103 '.ms-Nav-compositeLink:hover &': {
104 backgroundColor: semanticColors.bodyBackgroundHovered,
105 },
106 },
107 },
108 isSelected && {
109 color: semanticColors.bodyTextChecked,
110 fontWeight: Styling_1.FontWeights.semibold,
111 backgroundColor: semanticColors.bodyBackgroundChecked,
112 selectors: {
113 '&:after': {
114 borderLeft: "2px solid " + palette.themePrimary,
115 content: '""',
116 position: 'absolute',
117 top: 0,
118 right: 0,
119 bottom: 0,
120 left: 0,
121 pointerEvents: 'none',
122 },
123 },
124 },
125 isDisabled && {
126 color: semanticColors.disabledText,
127 },
128 isButtonEntry && {
129 color: palette.themePrimary,
130 },
131 ],
132 chevronButton: [
133 classNames.chevronButton,
134 Styling_1.getFocusStyle(theme),
135 fonts.small,
136 {
137 display: 'block',
138 textAlign: 'left',
139 lineHeight: navHeight + "px",
140 margin: '5px 0',
141 padding: "0px, " + rightPadding + "px, 0px, " + leftPaddingExpanded + "px",
142 border: 'none',
143 textOverflow: 'ellipsis',
144 whiteSpace: 'nowrap',
145 overflow: 'hidden',
146 cursor: 'pointer',
147 color: semanticColors.bodyText,
148 backgroundColor: 'transparent',
149 selectors: {
150 '&:visited': {
151 color: semanticColors.bodyText,
152 },
153 },
154 },
155 isGroup && {
156 fontSize: fonts.large.fontSize,
157 width: '100%',
158 height: navHeight,
159 borderBottom: "1px solid " + semanticColors.bodyDivider,
160 },
161 isLink && {
162 display: 'block',
163 width: leftPaddingExpanded - 2,
164 height: navHeight - 2,
165 position: 'absolute',
166 top: '1px',
167 left: position + "px",
168 zIndex: Styling_1.ZIndexes.Nav,
169 padding: 0,
170 margin: 0,
171 },
172 ],
173 chevronIcon: [
174 classNames.chevronIcon,
175 {
176 position: 'absolute',
177 left: '8px',
178 height: navHeight,
179 // inline-flex prevents the chevron from shifting with custom line height styles
180 display: 'inline-flex',
181 alignItems: 'center',
182 lineHeight: navHeight + "px",
183 fontSize: fonts.small.fontSize,
184 transition: 'transform .1s linear',
185 },
186 isExpanded && {
187 transform: 'rotate(-180deg)',
188 },
189 isLink && {
190 top: 0,
191 },
192 ],
193 navItem: [
194 classNames.navItem,
195 {
196 padding: 0,
197 },
198 ],
199 navItems: [
200 classNames.navItems,
201 {
202 listStyleType: 'none',
203 padding: 0,
204 margin: 0, // remove default <UL> styles
205 },
206 ],
207 group: [classNames.group, isExpanded && 'is-expanded'],
208 groupContent: [
209 classNames.groupContent,
210 {
211 display: 'none',
212 marginBottom: '40px',
213 },
214 Styling_1.AnimationClassNames.slideDownIn20,
215 isExpanded && {
216 display: 'block',
217 },
218 ],
219 };
220};
221exports.getStyles = getStyles;
222//# sourceMappingURL=Nav.styles.js.map
\No newline at end of file