UNPKG

11.4 kBJavaScriptView Raw
1"use strict";
2
3function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
5Object.defineProperty(exports, "__esModule", {
6 value: true
7});
8exports.StyledProfileBody = exports.StyledProfileSubtitle = exports.StyledProfileTitle = exports.StyledProfileLabelsContainer = exports.StyledProfileImg = exports.StyledProfileImgContainer = exports.StyledListItemProfile = exports.StyledListItem = exports.StyledListItemElement = exports.StyledListItemAnchor = exports.StyledOptgroupHeader = exports.StyledEmptyState = exports.StyledList = void 0;
9
10var React = _interopRequireWildcard(require("react"));
11
12var _index = require("../styles/index.js");
13
14var _constants = require("./constants.js");
15
16function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
17
18function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
20function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
21
22function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
23
24function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
25
26function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
27
28function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
29
30var StyledList = (0, _index.styled)('ul', function (_ref) {
31 var $theme = _ref.$theme,
32 $isFocusVisible = _ref.$isFocusVisible;
33 return {
34 backgroundColor: $theme.colors.menuFill,
35 position: 'relative',
36 marginTop: 0,
37 marginBottom: 0,
38 marginLeft: 0,
39 marginRight: 0,
40 paddingTop: $theme.sizing.scale300,
41 paddingBottom: $theme.sizing.scale300,
42 paddingLeft: 0,
43 paddingRight: 0,
44 borderTopLeftRadius: $theme.borders.popoverBorderRadius,
45 borderTopRightRadius: $theme.borders.popoverBorderRadius,
46 borderBottomRightRadius: $theme.borders.popoverBorderRadius,
47 borderBottomLeftRadius: $theme.borders.popoverBorderRadius,
48 boxShadow: $theme.lighting.shadow600,
49 overflow: 'auto',
50 ':focus': {
51 outline: $isFocusVisible ? "3px solid ".concat($theme.colors.accent) : 'none'
52 }
53 };
54});
55exports.StyledList = StyledList;
56StyledList.displayName = "StyledList";
57
58function getFontColor(props) {
59 if (props.$disabled) {
60 return props.$theme.colors.menuFontDisabled;
61 }
62
63 if (props.$isHighlighted && props.$isFocused) {
64 return props.$theme.colors.menuFontHighlighted;
65 }
66
67 if (props.$isHighlighted && !props.$isFocused) {
68 return props.$theme.colors.menuFontSelected;
69 }
70
71 return props.$theme.colors.menuFontDefault;
72}
73
74function getBackgroundColor(props) {
75 if (props.$disabled) {
76 return 'transparent';
77 }
78
79 if (props.$isHighlighted) {
80 return props.$theme.colors.menuFillHover;
81 }
82
83 return 'transparent';
84}
85
86var StyledEmptyState = (0, _index.styled)('li', function (props) {
87 var $theme = props.$theme,
88 $size = props.$size;
89 return _objectSpread({}, $size === _constants.OPTION_LIST_SIZE.compact ? $theme.typography.font100 : $theme.typography.font200, {
90 position: 'relative',
91 display: 'block',
92 color: $theme.colors.menuFontDisabled,
93 textAlign: 'center',
94 cursor: 'not-allowed',
95 backgroundColor: 'transparent',
96 marginBottom: 0,
97 paddingTop: $theme.sizing.scale800,
98 paddingBottom: $theme.sizing.scale800,
99 paddingRight: $theme.sizing.scale800,
100 paddingLeft: $theme.sizing.scale800
101 });
102});
103exports.StyledEmptyState = StyledEmptyState;
104StyledEmptyState.displayName = "StyledEmptyState";
105var StyledOptgroupHeader = (0, _index.styled)('li', function (props) {
106 var paddingX = props.$theme.sizing.scale300;
107 var paddingY = props.$theme.sizing.scale200;
108 return _objectSpread({}, props.$theme.typography.font250, {
109 color: props.$theme.colors.colorPrimary,
110 paddingTop: paddingY,
111 paddingBottom: paddingY,
112 paddingRight: paddingX,
113 paddingLeft: paddingX
114 });
115});
116exports.StyledOptgroupHeader = StyledOptgroupHeader;
117StyledOptgroupHeader.displayName = "StyledOptgroupHeader";
118var StyledListItemAnchor = (0, _index.styled)('a', function (props) {
119 return {
120 display: 'block',
121 color: getFontColor(props)
122 };
123});
124exports.StyledListItemAnchor = StyledListItemAnchor;
125StyledListItemAnchor.displayName = "StyledListItemAnchor";
126var StyledListItemElement = (0, _index.styled)('li', function (props) {
127 var $disabled = props.$disabled,
128 $theme = props.$theme,
129 $size = props.$size;
130 return _objectSpread({}, $size === _constants.OPTION_LIST_SIZE.compact ? $theme.typography.font100 : $theme.typography.font200, {
131 position: 'relative',
132 display: 'block',
133 color: getFontColor(props),
134 cursor: $disabled ? 'not-allowed' : 'pointer',
135 backgroundColor: getBackgroundColor(props),
136 transitionProperty: 'color, background-color',
137 transitionDuration: $theme.animation.timing200,
138 transitionTimingFunction: $theme.animation.easeOutCurve,
139 marginBottom: 0,
140 paddingTop: $size === _constants.OPTION_LIST_SIZE.compact ? $theme.sizing.scale100 : $theme.sizing.scale300,
141 paddingBottom: $size === _constants.OPTION_LIST_SIZE.compact ? $theme.sizing.scale100 : $theme.sizing.scale300,
142 paddingRight: $size === _constants.OPTION_LIST_SIZE.compact ? $theme.sizing.scale900 : $theme.sizing.scale600,
143 paddingLeft: $size === _constants.OPTION_LIST_SIZE.compact ? $theme.sizing.scale900 : $theme.sizing.scale600,
144 ':focus': {
145 outline: 'none'
146 }
147 });
148});
149exports.StyledListItemElement = StyledListItemElement;
150StyledListItemElement.displayName = "StyledListItemElement";
151var StyledListItem = (0, _index.withWrapper)(StyledListItemElement, function (Styled) {
152 return function StyledListItem(_ref2) {
153 var item = _ref2.item,
154 restProps = _objectWithoutProperties(_ref2, ["item"]);
155
156 return React.createElement(Styled, restProps);
157 };
158});
159exports.StyledListItem = StyledListItem;
160var StyledListItemProfile = (0, _index.styled)('li', function (_ref3) {
161 var $theme = _ref3.$theme;
162 return {
163 position: 'relative',
164 display: 'flex',
165 alignItems: 'center',
166 cursor: 'pointer',
167 paddingTop: $theme.sizing.scale300,
168 paddingBottom: $theme.sizing.scale300,
169 paddingRight: $theme.sizing.scale800,
170 paddingLeft: $theme.sizing.scale800,
171 transitionProperty: 'color, background-color',
172 transitionDuration: $theme.animation.timing200,
173 transitionTimingFunction: $theme.animation.easeOutCurve,
174 ':hover': {
175 backgroundColor: $theme.colors.menuFillHover
176 }
177 };
178});
179exports.StyledListItemProfile = StyledListItemProfile;
180StyledListItemProfile.displayName = "StyledListItemProfile";
181var StyledProfileImgContainer = (0, _index.styled)('div', {
182 width: '60px',
183 height: '60px',
184 display: 'flex',
185 justifyContent: 'center',
186 alignItems: 'center'
187});
188exports.StyledProfileImgContainer = StyledProfileImgContainer;
189StyledProfileImgContainer.displayName = "StyledProfileImgContainer";
190var StyledProfileImg = (0, _index.styled)('img', {
191 width: '100%',
192 height: '100%',
193 borderTopLeftRadius: '50%',
194 borderTopRightRadius: '50%',
195 borderBottomRightRadius: '50%',
196 borderBottomLeftRadius: '50%'
197});
198exports.StyledProfileImg = StyledProfileImg;
199StyledProfileImg.displayName = "StyledProfileImg";
200var StyledProfileLabelsContainer = (0, _index.styled)('div', function (_ref4) {
201 var $theme = _ref4.$theme;
202 return {
203 marginLeft: $theme.sizing.scale600,
204 alignSelf: $theme.direction === 'rtl' ? 'flex-end' : 'flex-start',
205 display: 'flex',
206 flexDirection: 'column'
207 };
208});
209exports.StyledProfileLabelsContainer = StyledProfileLabelsContainer;
210StyledProfileLabelsContainer.displayName = "StyledProfileLabelsContainer";
211var StyledProfileTitle = (0, _index.styled)('h6', function (_ref5) {
212 var $theme = _ref5.$theme;
213 return _objectSpread({}, $theme.typography.font350, {
214 color: $theme.colors.contentPrimary,
215 marginTop: 0,
216 marginBottom: 0,
217 marginLeft: 0,
218 marginRight: 0
219 });
220});
221exports.StyledProfileTitle = StyledProfileTitle;
222StyledProfileTitle.displayName = "StyledProfileTitle";
223var StyledProfileSubtitle = (0, _index.styled)('p', function (_ref6) {
224 var $theme = _ref6.$theme;
225 return _objectSpread({}, $theme.typography.font200, {
226 color: $theme.colors.contentPrimary,
227 marginTop: 0,
228 marginBottom: 0,
229 marginLeft: 0,
230 marginRight: 0
231 });
232});
233exports.StyledProfileSubtitle = StyledProfileSubtitle;
234StyledProfileSubtitle.displayName = "StyledProfileSubtitle";
235var StyledProfileBody = (0, _index.styled)('p', function (_ref7) {
236 var $theme = _ref7.$theme;
237 return _objectSpread({}, $theme.typography.font100, {
238 color: $theme.colors.contentPrimary,
239 marginTop: 0,
240 marginBottom: 0,
241 marginLeft: 0,
242 marginRight: 0
243 });
244});
245exports.StyledProfileBody = StyledProfileBody;
246StyledProfileBody.displayName = "StyledProfileBody";
\No newline at end of file