您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

934 行
36 KiB

  1. "use strict";
  2. function _interopDefault(ex) {
  3. return ex && "object" == typeof ex && "default" in ex ? ex.default : ex;
  4. }
  5. var React = require("react"), React__default = _interopDefault(React), core = require("@emotion/core"), reactDom = require("react-dom"), PropTypes = _interopDefault(require("prop-types")), utils = require("./utils-2db2ca57.cjs.prod.js"), _css = _interopDefault(require("@emotion/css")), AutosizeInput = _interopDefault(require("react-input-autosize"));
  6. function _extends() {
  7. return (_extends = Object.assign || function(target) {
  8. for (var i = 1; i < arguments.length; i++) {
  9. var source = arguments[i];
  10. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  11. }
  12. return target;
  13. }).apply(this, arguments);
  14. }
  15. function _inheritsLoose(subClass, superClass) {
  16. subClass.prototype = Object.create(superClass.prototype), subClass.prototype.constructor = subClass,
  17. subClass.__proto__ = superClass;
  18. }
  19. function getMenuPlacement(_ref) {
  20. var maxHeight = _ref.maxHeight, menuEl = _ref.menuEl, minHeight = _ref.minHeight, placement = _ref.placement, shouldScroll = _ref.shouldScroll, isFixedPosition = _ref.isFixedPosition, spacing = _ref.theme.spacing, scrollParent = utils.getScrollParent(menuEl), defaultState = {
  21. placement: "bottom",
  22. maxHeight: maxHeight
  23. };
  24. if (!menuEl || !menuEl.offsetParent) return defaultState;
  25. var scrollHeight = scrollParent.getBoundingClientRect().height, _menuEl$getBoundingCl = menuEl.getBoundingClientRect(), menuBottom = _menuEl$getBoundingCl.bottom, menuHeight = _menuEl$getBoundingCl.height, menuTop = _menuEl$getBoundingCl.top, containerTop = menuEl.offsetParent.getBoundingClientRect().top, viewHeight = window.innerHeight, scrollTop = utils.getScrollTop(scrollParent), marginBottom = parseInt(getComputedStyle(menuEl).marginBottom, 10), marginTop = parseInt(getComputedStyle(menuEl).marginTop, 10), viewSpaceAbove = containerTop - marginTop, viewSpaceBelow = viewHeight - menuTop, scrollSpaceAbove = viewSpaceAbove + scrollTop, scrollSpaceBelow = scrollHeight - scrollTop - menuTop, scrollDown = menuBottom - viewHeight + scrollTop + marginBottom, scrollUp = scrollTop + menuTop - marginTop;
  26. switch (placement) {
  27. case "auto":
  28. case "bottom":
  29. if (viewSpaceBelow >= menuHeight) return {
  30. placement: "bottom",
  31. maxHeight: maxHeight
  32. };
  33. if (scrollSpaceBelow >= menuHeight && !isFixedPosition) return shouldScroll && utils.animatedScrollTo(scrollParent, scrollDown, 160),
  34. {
  35. placement: "bottom",
  36. maxHeight: maxHeight
  37. };
  38. if (!isFixedPosition && scrollSpaceBelow >= minHeight || isFixedPosition && viewSpaceBelow >= minHeight) return shouldScroll && utils.animatedScrollTo(scrollParent, scrollDown, 160),
  39. {
  40. placement: "bottom",
  41. maxHeight: isFixedPosition ? viewSpaceBelow - marginBottom : scrollSpaceBelow - marginBottom
  42. };
  43. if ("auto" === placement || isFixedPosition) {
  44. var _constrainedHeight = maxHeight, spaceAbove = isFixedPosition ? viewSpaceAbove : scrollSpaceAbove;
  45. return spaceAbove >= minHeight && (_constrainedHeight = Math.min(spaceAbove - marginBottom - spacing.controlHeight, maxHeight)),
  46. {
  47. placement: "top",
  48. maxHeight: _constrainedHeight
  49. };
  50. }
  51. if ("bottom" === placement) return utils.scrollTo(scrollParent, scrollDown), {
  52. placement: "bottom",
  53. maxHeight: maxHeight
  54. };
  55. break;
  56. case "top":
  57. if (viewSpaceAbove >= menuHeight) return {
  58. placement: "top",
  59. maxHeight: maxHeight
  60. };
  61. if (scrollSpaceAbove >= menuHeight && !isFixedPosition) return shouldScroll && utils.animatedScrollTo(scrollParent, scrollUp, 160),
  62. {
  63. placement: "top",
  64. maxHeight: maxHeight
  65. };
  66. if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) {
  67. var _constrainedHeight2 = maxHeight;
  68. return (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) && (_constrainedHeight2 = isFixedPosition ? viewSpaceAbove - marginTop : scrollSpaceAbove - marginTop),
  69. shouldScroll && utils.animatedScrollTo(scrollParent, scrollUp, 160), {
  70. placement: "top",
  71. maxHeight: _constrainedHeight2
  72. };
  73. }
  74. return {
  75. placement: "bottom",
  76. maxHeight: maxHeight
  77. };
  78. default:
  79. throw new Error('Invalid placement provided "' + placement + '".');
  80. }
  81. return defaultState;
  82. }
  83. function alignToControl(placement) {
  84. return placement ? {
  85. bottom: "top",
  86. top: "bottom"
  87. }[placement] : "bottom";
  88. }
  89. var coercePlacement = function(p) {
  90. return "auto" === p ? "bottom" : p;
  91. }, menuCSS = function(_ref2) {
  92. var _ref3, placement = _ref2.placement, _ref2$theme = _ref2.theme, borderRadius = _ref2$theme.borderRadius, spacing = _ref2$theme.spacing, colors = _ref2$theme.colors;
  93. return (_ref3 = {
  94. label: "menu"
  95. })[alignToControl(placement)] = "100%", _ref3.backgroundColor = colors.neutral0,
  96. _ref3.borderRadius = borderRadius, _ref3.boxShadow = "0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",
  97. _ref3.marginBottom = spacing.menuGutter, _ref3.marginTop = spacing.menuGutter, _ref3.position = "absolute",
  98. _ref3.width = "100%", _ref3.zIndex = 1, _ref3;
  99. }, MenuPlacer = function(_Component) {
  100. function MenuPlacer() {
  101. for (var _this, _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
  102. return (_this = _Component.call.apply(_Component, [ this ].concat(args)) || this).state = {
  103. maxHeight: _this.props.maxMenuHeight,
  104. placement: null
  105. }, _this.getPlacement = function(ref) {
  106. var _this$props = _this.props, minMenuHeight = _this$props.minMenuHeight, maxMenuHeight = _this$props.maxMenuHeight, menuPlacement = _this$props.menuPlacement, menuPosition = _this$props.menuPosition, menuShouldScrollIntoView = _this$props.menuShouldScrollIntoView, theme = _this$props.theme, getPortalPlacement = _this.context.getPortalPlacement;
  107. if (ref) {
  108. var isFixedPosition = "fixed" === menuPosition, state = getMenuPlacement({
  109. maxHeight: maxMenuHeight,
  110. menuEl: ref,
  111. minHeight: minMenuHeight,
  112. placement: menuPlacement,
  113. shouldScroll: menuShouldScrollIntoView && !isFixedPosition,
  114. isFixedPosition: isFixedPosition,
  115. theme: theme
  116. });
  117. getPortalPlacement && getPortalPlacement(state), _this.setState(state);
  118. }
  119. }, _this.getUpdatedProps = function() {
  120. var menuPlacement = _this.props.menuPlacement, placement = _this.state.placement || coercePlacement(menuPlacement);
  121. return _extends({}, _this.props, {
  122. placement: placement,
  123. maxHeight: _this.state.maxHeight
  124. });
  125. }, _this;
  126. }
  127. return _inheritsLoose(MenuPlacer, _Component), MenuPlacer.prototype.render = function() {
  128. return (0, this.props.children)({
  129. ref: this.getPlacement,
  130. placerProps: this.getUpdatedProps()
  131. });
  132. }, MenuPlacer;
  133. }(React.Component);
  134. MenuPlacer.contextTypes = {
  135. getPortalPlacement: PropTypes.func
  136. };
  137. var Menu = function(props) {
  138. var children = props.children, className = props.className, cx = props.cx, getStyles = props.getStyles, innerRef = props.innerRef, innerProps = props.innerProps;
  139. return core.jsx("div", _extends({
  140. css: getStyles("menu", props),
  141. className: cx({
  142. menu: !0
  143. }, className)
  144. }, innerProps, {
  145. ref: innerRef
  146. }), children);
  147. }, menuListCSS = function(_ref4) {
  148. var maxHeight = _ref4.maxHeight, baseUnit = _ref4.theme.spacing.baseUnit;
  149. return {
  150. maxHeight: maxHeight,
  151. overflowY: "auto",
  152. paddingBottom: baseUnit,
  153. paddingTop: baseUnit,
  154. position: "relative",
  155. WebkitOverflowScrolling: "touch"
  156. };
  157. }, MenuList = function(props) {
  158. var children = props.children, className = props.className, cx = props.cx, getStyles = props.getStyles, isMulti = props.isMulti, innerRef = props.innerRef;
  159. return core.jsx("div", {
  160. css: getStyles("menuList", props),
  161. className: cx({
  162. "menu-list": !0,
  163. "menu-list--is-multi": isMulti
  164. }, className),
  165. ref: innerRef
  166. }, children);
  167. }, noticeCSS = function(_ref5) {
  168. var _ref5$theme = _ref5.theme, baseUnit = _ref5$theme.spacing.baseUnit;
  169. return {
  170. color: _ref5$theme.colors.neutral40,
  171. padding: 2 * baseUnit + "px " + 3 * baseUnit + "px",
  172. textAlign: "center"
  173. };
  174. }, noOptionsMessageCSS = noticeCSS, loadingMessageCSS = noticeCSS, NoOptionsMessage = function(props) {
  175. var children = props.children, className = props.className, cx = props.cx, getStyles = props.getStyles, innerProps = props.innerProps;
  176. return core.jsx("div", _extends({
  177. css: getStyles("noOptionsMessage", props),
  178. className: cx({
  179. "menu-notice": !0,
  180. "menu-notice--no-options": !0
  181. }, className)
  182. }, innerProps), children);
  183. };
  184. NoOptionsMessage.defaultProps = {
  185. children: "No options"
  186. };
  187. var LoadingMessage = function(props) {
  188. var children = props.children, className = props.className, cx = props.cx, getStyles = props.getStyles, innerProps = props.innerProps;
  189. return core.jsx("div", _extends({
  190. css: getStyles("loadingMessage", props),
  191. className: cx({
  192. "menu-notice": !0,
  193. "menu-notice--loading": !0
  194. }, className)
  195. }, innerProps), children);
  196. };
  197. LoadingMessage.defaultProps = {
  198. children: "Loading..."
  199. };
  200. var menuPortalCSS = function(_ref6) {
  201. var rect = _ref6.rect, offset = _ref6.offset, position = _ref6.position;
  202. return {
  203. left: rect.left,
  204. position: position,
  205. top: offset,
  206. width: rect.width,
  207. zIndex: 1
  208. };
  209. }, MenuPortal = function(_Component2) {
  210. function MenuPortal() {
  211. for (var _this2, _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) args[_key2] = arguments[_key2];
  212. return (_this2 = _Component2.call.apply(_Component2, [ this ].concat(args)) || this).state = {
  213. placement: null
  214. }, _this2.getPortalPlacement = function(_ref7) {
  215. var placement = _ref7.placement;
  216. placement !== coercePlacement(_this2.props.menuPlacement) && _this2.setState({
  217. placement: placement
  218. });
  219. }, _this2;
  220. }
  221. _inheritsLoose(MenuPortal, _Component2);
  222. var _proto2 = MenuPortal.prototype;
  223. return _proto2.getChildContext = function() {
  224. return {
  225. getPortalPlacement: this.getPortalPlacement
  226. };
  227. }, _proto2.render = function() {
  228. var _this$props2 = this.props, appendTo = _this$props2.appendTo, children = _this$props2.children, controlElement = _this$props2.controlElement, menuPlacement = _this$props2.menuPlacement, position = _this$props2.menuPosition, getStyles = _this$props2.getStyles, isFixed = "fixed" === position;
  229. if (!appendTo && !isFixed || !controlElement) return null;
  230. var placement = this.state.placement || coercePlacement(menuPlacement), rect = utils.getBoundingClientObj(controlElement), scrollDistance = isFixed ? 0 : window.pageYOffset, state = {
  231. offset: rect[placement] + scrollDistance,
  232. position: position,
  233. rect: rect
  234. }, menuWrapper = core.jsx("div", {
  235. css: getStyles("menuPortal", state)
  236. }, children);
  237. return appendTo ? reactDom.createPortal(menuWrapper, appendTo) : menuWrapper;
  238. }, MenuPortal;
  239. }(React.Component);
  240. MenuPortal.childContextTypes = {
  241. getPortalPlacement: PropTypes.func
  242. };
  243. var isArray = Array.isArray, keyList = Object.keys, hasProp = Object.prototype.hasOwnProperty;
  244. function equal(a, b) {
  245. if (a === b) return !0;
  246. if (a && b && "object" == typeof a && "object" == typeof b) {
  247. var i, length, key, arrA = isArray(a), arrB = isArray(b);
  248. if (arrA && arrB) {
  249. if ((length = a.length) != b.length) return !1;
  250. for (i = length; 0 != i--; ) if (!equal(a[i], b[i])) return !1;
  251. return !0;
  252. }
  253. if (arrA != arrB) return !1;
  254. var dateA = a instanceof Date, dateB = b instanceof Date;
  255. if (dateA != dateB) return !1;
  256. if (dateA && dateB) return a.getTime() == b.getTime();
  257. var regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
  258. if (regexpA != regexpB) return !1;
  259. if (regexpA && regexpB) return a.toString() == b.toString();
  260. var keys = keyList(a);
  261. if ((length = keys.length) !== keyList(b).length) return !1;
  262. for (i = length; 0 != i--; ) if (!hasProp.call(b, keys[i])) return !1;
  263. for (i = length; 0 != i--; ) if (!("_owner" === (key = keys[i]) && a.$$typeof || equal(a[key], b[key]))) return !1;
  264. return !0;
  265. }
  266. return a != a && b != b;
  267. }
  268. function exportedEqual(a, b) {
  269. try {
  270. return equal(a, b);
  271. } catch (error) {
  272. if (error.message && error.message.match(/stack|recursion/i)) return console.warn("Warning: react-fast-compare does not handle circular references.", error.name, error.message),
  273. !1;
  274. throw error;
  275. }
  276. }
  277. function _extends$1() {
  278. return (_extends$1 = Object.assign || function(target) {
  279. for (var i = 1; i < arguments.length; i++) {
  280. var source = arguments[i];
  281. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  282. }
  283. return target;
  284. }).apply(this, arguments);
  285. }
  286. var containerCSS = function(_ref) {
  287. var isDisabled = _ref.isDisabled;
  288. return {
  289. label: "container",
  290. direction: _ref.isRtl ? "rtl" : null,
  291. pointerEvents: isDisabled ? "none" : null,
  292. position: "relative"
  293. };
  294. }, SelectContainer = function(props) {
  295. var children = props.children, className = props.className, cx = props.cx, getStyles = props.getStyles, innerProps = props.innerProps, isDisabled = props.isDisabled, isRtl = props.isRtl;
  296. return core.jsx("div", _extends$1({
  297. css: getStyles("container", props),
  298. className: cx({
  299. "--is-disabled": isDisabled,
  300. "--is-rtl": isRtl
  301. }, className)
  302. }, innerProps), children);
  303. }, valueContainerCSS = function(_ref2) {
  304. var spacing = _ref2.theme.spacing;
  305. return {
  306. alignItems: "center",
  307. display: "flex",
  308. flex: 1,
  309. flexWrap: "wrap",
  310. padding: spacing.baseUnit / 2 + "px " + 2 * spacing.baseUnit + "px",
  311. WebkitOverflowScrolling: "touch",
  312. position: "relative",
  313. overflow: "hidden"
  314. };
  315. }, ValueContainer = function(props) {
  316. var children = props.children, className = props.className, cx = props.cx, isMulti = props.isMulti, getStyles = props.getStyles, hasValue = props.hasValue;
  317. return core.jsx("div", {
  318. css: getStyles("valueContainer", props),
  319. className: cx({
  320. "value-container": !0,
  321. "value-container--is-multi": isMulti,
  322. "value-container--has-value": hasValue
  323. }, className)
  324. }, children);
  325. }, indicatorsContainerCSS = function() {
  326. return {
  327. alignItems: "center",
  328. alignSelf: "stretch",
  329. display: "flex",
  330. flexShrink: 0
  331. };
  332. }, IndicatorsContainer = function(props) {
  333. var children = props.children, className = props.className, cx = props.cx, getStyles = props.getStyles;
  334. return core.jsx("div", {
  335. css: getStyles("indicatorsContainer", props),
  336. className: cx({
  337. indicators: !0
  338. }, className)
  339. }, children);
  340. };
  341. function _templateObject() {
  342. var data = _taggedTemplateLiteralLoose([ "\n 0%, 80%, 100% { opacity: 0; }\n 40% { opacity: 1; }\n" ]);
  343. return _templateObject = function() {
  344. return data;
  345. }, data;
  346. }
  347. function _taggedTemplateLiteralLoose(strings, raw) {
  348. return raw || (raw = strings.slice(0)), strings.raw = raw, strings;
  349. }
  350. function _extends$2() {
  351. return (_extends$2 = Object.assign || function(target) {
  352. for (var i = 1; i < arguments.length; i++) {
  353. var source = arguments[i];
  354. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  355. }
  356. return target;
  357. }).apply(this, arguments);
  358. }
  359. function _objectWithoutPropertiesLoose(source, excluded) {
  360. if (null == source) return {};
  361. var key, i, target = {}, sourceKeys = Object.keys(source);
  362. for (i = 0; i < sourceKeys.length; i++) key = sourceKeys[i], excluded.indexOf(key) >= 0 || (target[key] = source[key]);
  363. return target;
  364. }
  365. var _ref2 = {
  366. name: "19bqh2r",
  367. styles: "display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0;"
  368. }, Svg = function(_ref) {
  369. var size = _ref.size, props = _objectWithoutPropertiesLoose(_ref, [ "size" ]);
  370. return core.jsx("svg", _extends$2({
  371. height: size,
  372. width: size,
  373. viewBox: "0 0 20 20",
  374. "aria-hidden": "true",
  375. focusable: "false",
  376. css: _ref2
  377. }, props));
  378. }, CrossIcon = function(props) {
  379. return core.jsx(Svg, _extends$2({
  380. size: 20
  381. }, props), core.jsx("path", {
  382. d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"
  383. }));
  384. }, DownChevron = function(props) {
  385. return core.jsx(Svg, _extends$2({
  386. size: 20
  387. }, props), core.jsx("path", {
  388. d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
  389. }));
  390. }, baseCSS = function(_ref3) {
  391. var isFocused = _ref3.isFocused, _ref3$theme = _ref3.theme, baseUnit = _ref3$theme.spacing.baseUnit, colors = _ref3$theme.colors;
  392. return {
  393. label: "indicatorContainer",
  394. color: isFocused ? colors.neutral60 : colors.neutral20,
  395. display: "flex",
  396. padding: 2 * baseUnit,
  397. transition: "color 150ms",
  398. ":hover": {
  399. color: isFocused ? colors.neutral80 : colors.neutral40
  400. }
  401. };
  402. }, dropdownIndicatorCSS = baseCSS, DropdownIndicator = function(props) {
  403. var children = props.children, className = props.className, cx = props.cx, getStyles = props.getStyles, innerProps = props.innerProps;
  404. return core.jsx("div", _extends$2({}, innerProps, {
  405. css: getStyles("dropdownIndicator", props),
  406. className: cx({
  407. indicator: !0,
  408. "dropdown-indicator": !0
  409. }, className)
  410. }), children || core.jsx(DownChevron, null));
  411. }, clearIndicatorCSS = baseCSS, ClearIndicator = function(props) {
  412. var children = props.children, className = props.className, cx = props.cx, getStyles = props.getStyles, innerProps = props.innerProps;
  413. return core.jsx("div", _extends$2({}, innerProps, {
  414. css: getStyles("clearIndicator", props),
  415. className: cx({
  416. indicator: !0,
  417. "clear-indicator": !0
  418. }, className)
  419. }), children || core.jsx(CrossIcon, null));
  420. }, indicatorSeparatorCSS = function(_ref4) {
  421. var isDisabled = _ref4.isDisabled, _ref4$theme = _ref4.theme, baseUnit = _ref4$theme.spacing.baseUnit, colors = _ref4$theme.colors;
  422. return {
  423. label: "indicatorSeparator",
  424. alignSelf: "stretch",
  425. backgroundColor: isDisabled ? colors.neutral10 : colors.neutral20,
  426. marginBottom: 2 * baseUnit,
  427. marginTop: 2 * baseUnit,
  428. width: 1
  429. };
  430. }, IndicatorSeparator = function(props) {
  431. var className = props.className, cx = props.cx, getStyles = props.getStyles, innerProps = props.innerProps;
  432. return core.jsx("span", _extends$2({}, innerProps, {
  433. css: getStyles("indicatorSeparator", props),
  434. className: cx({
  435. "indicator-separator": !0
  436. }, className)
  437. }));
  438. }, loadingDotAnimations = core.keyframes(_templateObject()), loadingIndicatorCSS = function(_ref5) {
  439. var isFocused = _ref5.isFocused, size = _ref5.size, _ref5$theme = _ref5.theme, colors = _ref5$theme.colors, baseUnit = _ref5$theme.spacing.baseUnit;
  440. return {
  441. label: "loadingIndicator",
  442. color: isFocused ? colors.neutral60 : colors.neutral20,
  443. display: "flex",
  444. padding: 2 * baseUnit,
  445. transition: "color 150ms",
  446. alignSelf: "center",
  447. fontSize: size,
  448. lineHeight: 1,
  449. marginRight: size,
  450. textAlign: "center",
  451. verticalAlign: "middle"
  452. };
  453. }, LoadingDot = function(_ref6) {
  454. var delay = _ref6.delay, offset = _ref6.offset;
  455. return core.jsx("span", {
  456. css: _css({
  457. animation: loadingDotAnimations + " 1s ease-in-out " + delay + "ms infinite;",
  458. backgroundColor: "currentColor",
  459. borderRadius: "1em",
  460. display: "inline-block",
  461. marginLeft: offset ? "1em" : null,
  462. height: "1em",
  463. verticalAlign: "top",
  464. width: "1em"
  465. }, "")
  466. });
  467. }, LoadingIndicator = function(props) {
  468. var className = props.className, cx = props.cx, getStyles = props.getStyles, innerProps = props.innerProps, isRtl = props.isRtl;
  469. return core.jsx("div", _extends$2({}, innerProps, {
  470. css: getStyles("loadingIndicator", props),
  471. className: cx({
  472. indicator: !0,
  473. "loading-indicator": !0
  474. }, className)
  475. }), core.jsx(LoadingDot, {
  476. delay: 0,
  477. offset: isRtl
  478. }), core.jsx(LoadingDot, {
  479. delay: 160,
  480. offset: !0
  481. }), core.jsx(LoadingDot, {
  482. delay: 320,
  483. offset: !isRtl
  484. }));
  485. };
  486. function _extends$3() {
  487. return (_extends$3 = Object.assign || function(target) {
  488. for (var i = 1; i < arguments.length; i++) {
  489. var source = arguments[i];
  490. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  491. }
  492. return target;
  493. }).apply(this, arguments);
  494. }
  495. LoadingIndicator.defaultProps = {
  496. size: 4
  497. };
  498. var css = function(_ref) {
  499. var isDisabled = _ref.isDisabled, isFocused = _ref.isFocused, _ref$theme = _ref.theme, colors = _ref$theme.colors, borderRadius = _ref$theme.borderRadius, spacing = _ref$theme.spacing;
  500. return {
  501. label: "control",
  502. alignItems: "center",
  503. backgroundColor: isDisabled ? colors.neutral5 : colors.neutral0,
  504. borderColor: isDisabled ? colors.neutral10 : isFocused ? colors.primary : colors.neutral20,
  505. borderRadius: borderRadius,
  506. borderStyle: "solid",
  507. borderWidth: 1,
  508. boxShadow: isFocused ? "0 0 0 1px " + colors.primary : null,
  509. cursor: "default",
  510. display: "flex",
  511. flexWrap: "wrap",
  512. justifyContent: "space-between",
  513. minHeight: spacing.controlHeight,
  514. outline: "0 !important",
  515. position: "relative",
  516. transition: "all 100ms",
  517. "&:hover": {
  518. borderColor: isFocused ? colors.primary : colors.neutral30
  519. }
  520. };
  521. }, Control = function(props) {
  522. var children = props.children, cx = props.cx, getStyles = props.getStyles, className = props.className, isDisabled = props.isDisabled, isFocused = props.isFocused, innerRef = props.innerRef, innerProps = props.innerProps, menuIsOpen = props.menuIsOpen;
  523. return core.jsx("div", _extends$3({
  524. ref: innerRef,
  525. css: getStyles("control", props),
  526. className: cx({
  527. control: !0,
  528. "control--is-disabled": isDisabled,
  529. "control--is-focused": isFocused,
  530. "control--menu-is-open": menuIsOpen
  531. }, className)
  532. }, innerProps), children);
  533. };
  534. function _objectWithoutPropertiesLoose$1(source, excluded) {
  535. if (null == source) return {};
  536. var key, i, target = {}, sourceKeys = Object.keys(source);
  537. for (i = 0; i < sourceKeys.length; i++) key = sourceKeys[i], excluded.indexOf(key) >= 0 || (target[key] = source[key]);
  538. return target;
  539. }
  540. function _extends$4() {
  541. return (_extends$4 = Object.assign || function(target) {
  542. for (var i = 1; i < arguments.length; i++) {
  543. var source = arguments[i];
  544. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  545. }
  546. return target;
  547. }).apply(this, arguments);
  548. }
  549. var groupCSS = function(_ref) {
  550. var spacing = _ref.theme.spacing;
  551. return {
  552. paddingBottom: 2 * spacing.baseUnit,
  553. paddingTop: 2 * spacing.baseUnit
  554. };
  555. }, Group = function(props) {
  556. var children = props.children, className = props.className, cx = props.cx, getStyles = props.getStyles, Heading = props.Heading, headingProps = props.headingProps, label = props.label, theme = props.theme, selectProps = props.selectProps;
  557. return core.jsx("div", {
  558. css: getStyles("group", props),
  559. className: cx({
  560. group: !0
  561. }, className)
  562. }, core.jsx(Heading, _extends$4({}, headingProps, {
  563. selectProps: selectProps,
  564. theme: theme,
  565. getStyles: getStyles,
  566. cx: cx
  567. }), label), core.jsx("div", null, children));
  568. }, groupHeadingCSS = function(_ref2) {
  569. var spacing = _ref2.theme.spacing;
  570. return {
  571. label: "group",
  572. color: "#999",
  573. cursor: "default",
  574. display: "block",
  575. fontSize: "75%",
  576. fontWeight: "500",
  577. marginBottom: "0.25em",
  578. paddingLeft: 3 * spacing.baseUnit,
  579. paddingRight: 3 * spacing.baseUnit,
  580. textTransform: "uppercase"
  581. };
  582. }, GroupHeading = function(props) {
  583. var className = props.className, cx = props.cx, getStyles = props.getStyles, theme = props.theme, cleanProps = (props.selectProps,
  584. _objectWithoutPropertiesLoose$1(props, [ "className", "cx", "getStyles", "theme", "selectProps" ]));
  585. return core.jsx("div", _extends$4({
  586. css: getStyles("groupHeading", _extends$4({
  587. theme: theme
  588. }, cleanProps)),
  589. className: cx({
  590. "group-heading": !0
  591. }, className)
  592. }, cleanProps));
  593. };
  594. function _extends$5() {
  595. return (_extends$5 = Object.assign || function(target) {
  596. for (var i = 1; i < arguments.length; i++) {
  597. var source = arguments[i];
  598. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  599. }
  600. return target;
  601. }).apply(this, arguments);
  602. }
  603. function _objectWithoutPropertiesLoose$2(source, excluded) {
  604. if (null == source) return {};
  605. var key, i, target = {}, sourceKeys = Object.keys(source);
  606. for (i = 0; i < sourceKeys.length; i++) key = sourceKeys[i], excluded.indexOf(key) >= 0 || (target[key] = source[key]);
  607. return target;
  608. }
  609. var inputCSS = function(_ref) {
  610. var isDisabled = _ref.isDisabled, _ref$theme = _ref.theme, spacing = _ref$theme.spacing, colors = _ref$theme.colors;
  611. return {
  612. margin: spacing.baseUnit / 2,
  613. paddingBottom: spacing.baseUnit / 2,
  614. paddingTop: spacing.baseUnit / 2,
  615. visibility: isDisabled ? "hidden" : "visible",
  616. color: colors.neutral80
  617. };
  618. }, inputStyle = function(isHidden) {
  619. return {
  620. label: "input",
  621. background: 0,
  622. border: 0,
  623. fontSize: "inherit",
  624. opacity: isHidden ? 0 : 1,
  625. outline: 0,
  626. padding: 0,
  627. color: "inherit"
  628. };
  629. }, Input = function(_ref2) {
  630. var className = _ref2.className, cx = _ref2.cx, getStyles = _ref2.getStyles, innerRef = _ref2.innerRef, isHidden = _ref2.isHidden, isDisabled = _ref2.isDisabled, theme = _ref2.theme, props = (_ref2.selectProps,
  631. _objectWithoutPropertiesLoose$2(_ref2, [ "className", "cx", "getStyles", "innerRef", "isHidden", "isDisabled", "theme", "selectProps" ]));
  632. return core.jsx("div", {
  633. css: getStyles("input", _extends$5({
  634. theme: theme
  635. }, props))
  636. }, core.jsx(AutosizeInput, _extends$5({
  637. className: cx({
  638. input: !0
  639. }, className),
  640. inputRef: innerRef,
  641. inputStyle: inputStyle(isHidden),
  642. disabled: isDisabled
  643. }, props)));
  644. };
  645. function _extends$6() {
  646. return (_extends$6 = Object.assign || function(target) {
  647. for (var i = 1; i < arguments.length; i++) {
  648. var source = arguments[i];
  649. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  650. }
  651. return target;
  652. }).apply(this, arguments);
  653. }
  654. var multiValueCSS = function(_ref) {
  655. var _ref$theme = _ref.theme, spacing = _ref$theme.spacing, borderRadius = _ref$theme.borderRadius;
  656. return {
  657. label: "multiValue",
  658. backgroundColor: _ref$theme.colors.neutral10,
  659. borderRadius: borderRadius / 2,
  660. display: "flex",
  661. margin: spacing.baseUnit / 2,
  662. minWidth: 0
  663. };
  664. }, multiValueLabelCSS = function(_ref2) {
  665. var _ref2$theme = _ref2.theme, borderRadius = _ref2$theme.borderRadius, colors = _ref2$theme.colors, cropWithEllipsis = _ref2.cropWithEllipsis;
  666. return {
  667. borderRadius: borderRadius / 2,
  668. color: colors.neutral80,
  669. fontSize: "85%",
  670. overflow: "hidden",
  671. padding: 3,
  672. paddingLeft: 6,
  673. textOverflow: cropWithEllipsis ? "ellipsis" : null,
  674. whiteSpace: "nowrap"
  675. };
  676. }, multiValueRemoveCSS = function(_ref3) {
  677. var _ref3$theme = _ref3.theme, spacing = _ref3$theme.spacing, borderRadius = _ref3$theme.borderRadius, colors = _ref3$theme.colors;
  678. return {
  679. alignItems: "center",
  680. borderRadius: borderRadius / 2,
  681. backgroundColor: _ref3.isFocused && colors.dangerLight,
  682. display: "flex",
  683. paddingLeft: spacing.baseUnit,
  684. paddingRight: spacing.baseUnit,
  685. ":hover": {
  686. backgroundColor: colors.dangerLight,
  687. color: colors.danger
  688. }
  689. };
  690. }, MultiValueGeneric = function(_ref4) {
  691. var children = _ref4.children, innerProps = _ref4.innerProps;
  692. return core.jsx("div", innerProps, children);
  693. }, MultiValueContainer = MultiValueGeneric, MultiValueLabel = MultiValueGeneric;
  694. function MultiValueRemove(_ref5) {
  695. var children = _ref5.children, innerProps = _ref5.innerProps;
  696. return core.jsx("div", innerProps, children || core.jsx(CrossIcon, {
  697. size: 14
  698. }));
  699. }
  700. var MultiValue = function(props) {
  701. var children = props.children, className = props.className, components = props.components, cx = props.cx, data = props.data, getStyles = props.getStyles, innerProps = props.innerProps, isDisabled = props.isDisabled, removeProps = props.removeProps, selectProps = props.selectProps, Container = components.Container, Label = components.Label, Remove = components.Remove;
  702. return core.jsx(core.ClassNames, null, (function(_ref6) {
  703. var css = _ref6.css, emotionCx = _ref6.cx;
  704. return core.jsx(Container, {
  705. data: data,
  706. innerProps: _extends$6({}, innerProps, {
  707. className: emotionCx(css(getStyles("multiValue", props)), cx({
  708. "multi-value": !0,
  709. "multi-value--is-disabled": isDisabled
  710. }, className))
  711. }),
  712. selectProps: selectProps
  713. }, core.jsx(Label, {
  714. data: data,
  715. innerProps: {
  716. className: emotionCx(css(getStyles("multiValueLabel", props)), cx({
  717. "multi-value__label": !0
  718. }, className))
  719. },
  720. selectProps: selectProps
  721. }, children), core.jsx(Remove, {
  722. data: data,
  723. innerProps: _extends$6({
  724. className: emotionCx(css(getStyles("multiValueRemove", props)), cx({
  725. "multi-value__remove": !0
  726. }, className))
  727. }, removeProps),
  728. selectProps: selectProps
  729. }));
  730. }));
  731. };
  732. function _extends$7() {
  733. return (_extends$7 = Object.assign || function(target) {
  734. for (var i = 1; i < arguments.length; i++) {
  735. var source = arguments[i];
  736. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  737. }
  738. return target;
  739. }).apply(this, arguments);
  740. }
  741. MultiValue.defaultProps = {
  742. cropWithEllipsis: !0
  743. };
  744. var optionCSS = function(_ref) {
  745. var isDisabled = _ref.isDisabled, isFocused = _ref.isFocused, isSelected = _ref.isSelected, _ref$theme = _ref.theme, spacing = _ref$theme.spacing, colors = _ref$theme.colors;
  746. return {
  747. label: "option",
  748. backgroundColor: isSelected ? colors.primary : isFocused ? colors.primary25 : "transparent",
  749. color: isDisabled ? colors.neutral20 : isSelected ? colors.neutral0 : "inherit",
  750. cursor: "default",
  751. display: "block",
  752. fontSize: "inherit",
  753. padding: 2 * spacing.baseUnit + "px " + 3 * spacing.baseUnit + "px",
  754. width: "100%",
  755. userSelect: "none",
  756. WebkitTapHighlightColor: "rgba(0, 0, 0, 0)",
  757. ":active": {
  758. backgroundColor: !isDisabled && (isSelected ? colors.primary : colors.primary50)
  759. }
  760. };
  761. }, Option = function(props) {
  762. var children = props.children, className = props.className, cx = props.cx, getStyles = props.getStyles, isDisabled = props.isDisabled, isFocused = props.isFocused, isSelected = props.isSelected, innerRef = props.innerRef, innerProps = props.innerProps;
  763. return core.jsx("div", _extends$7({
  764. css: getStyles("option", props),
  765. className: cx({
  766. option: !0,
  767. "option--is-disabled": isDisabled,
  768. "option--is-focused": isFocused,
  769. "option--is-selected": isSelected
  770. }, className),
  771. ref: innerRef
  772. }, innerProps), children);
  773. };
  774. function _extends$8() {
  775. return (_extends$8 = Object.assign || function(target) {
  776. for (var i = 1; i < arguments.length; i++) {
  777. var source = arguments[i];
  778. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  779. }
  780. return target;
  781. }).apply(this, arguments);
  782. }
  783. var placeholderCSS = function(_ref) {
  784. var _ref$theme = _ref.theme, spacing = _ref$theme.spacing;
  785. return {
  786. label: "placeholder",
  787. color: _ref$theme.colors.neutral50,
  788. marginLeft: spacing.baseUnit / 2,
  789. marginRight: spacing.baseUnit / 2,
  790. position: "absolute",
  791. top: "50%",
  792. transform: "translateY(-50%)"
  793. };
  794. }, Placeholder = function(props) {
  795. var children = props.children, className = props.className, cx = props.cx, getStyles = props.getStyles, innerProps = props.innerProps;
  796. return core.jsx("div", _extends$8({
  797. css: getStyles("placeholder", props),
  798. className: cx({
  799. placeholder: !0
  800. }, className)
  801. }, innerProps), children);
  802. };
  803. function _extends$9() {
  804. return (_extends$9 = Object.assign || function(target) {
  805. for (var i = 1; i < arguments.length; i++) {
  806. var source = arguments[i];
  807. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  808. }
  809. return target;
  810. }).apply(this, arguments);
  811. }
  812. var css$1 = function(_ref) {
  813. var isDisabled = _ref.isDisabled, _ref$theme = _ref.theme, spacing = _ref$theme.spacing, colors = _ref$theme.colors;
  814. return {
  815. label: "singleValue",
  816. color: isDisabled ? colors.neutral40 : colors.neutral80,
  817. marginLeft: spacing.baseUnit / 2,
  818. marginRight: spacing.baseUnit / 2,
  819. maxWidth: "calc(100% - " + 2 * spacing.baseUnit + "px)",
  820. overflow: "hidden",
  821. position: "absolute",
  822. textOverflow: "ellipsis",
  823. whiteSpace: "nowrap",
  824. top: "50%",
  825. transform: "translateY(-50%)"
  826. };
  827. }, SingleValue = function(props) {
  828. var children = props.children, className = props.className, cx = props.cx, getStyles = props.getStyles, isDisabled = props.isDisabled, innerProps = props.innerProps;
  829. return core.jsx("div", _extends$9({
  830. css: getStyles("singleValue", props),
  831. className: cx({
  832. "single-value": !0,
  833. "single-value--is-disabled": isDisabled
  834. }, className)
  835. }, innerProps), children);
  836. };
  837. function _extends$a() {
  838. return (_extends$a = Object.assign || function(target) {
  839. for (var i = 1; i < arguments.length; i++) {
  840. var source = arguments[i];
  841. for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
  842. }
  843. return target;
  844. }).apply(this, arguments);
  845. }
  846. var components = {
  847. ClearIndicator: ClearIndicator,
  848. Control: Control,
  849. DropdownIndicator: DropdownIndicator,
  850. DownChevron: DownChevron,
  851. CrossIcon: CrossIcon,
  852. Group: Group,
  853. GroupHeading: GroupHeading,
  854. IndicatorsContainer: IndicatorsContainer,
  855. IndicatorSeparator: IndicatorSeparator,
  856. Input: Input,
  857. LoadingIndicator: LoadingIndicator,
  858. Menu: Menu,
  859. MenuList: MenuList,
  860. MenuPortal: MenuPortal,
  861. LoadingMessage: LoadingMessage,
  862. NoOptionsMessage: NoOptionsMessage,
  863. MultiValue: MultiValue,
  864. MultiValueContainer: MultiValueContainer,
  865. MultiValueLabel: MultiValueLabel,
  866. MultiValueRemove: MultiValueRemove,
  867. Option: Option,
  868. Placeholder: Placeholder,
  869. SelectContainer: SelectContainer,
  870. SingleValue: SingleValue,
  871. ValueContainer: ValueContainer
  872. }, defaultComponents = function(props) {
  873. return _extends$a({}, components, props.components);
  874. };
  875. exports.MenuPlacer = MenuPlacer, exports.clearIndicatorCSS = clearIndicatorCSS,
  876. exports.components = components, exports.containerCSS = containerCSS, exports.css = css,
  877. exports.css$1 = css$1, exports.defaultComponents = defaultComponents, exports.dropdownIndicatorCSS = dropdownIndicatorCSS,
  878. exports.exportedEqual = exportedEqual, exports.groupCSS = groupCSS, exports.groupHeadingCSS = groupHeadingCSS,
  879. exports.indicatorSeparatorCSS = indicatorSeparatorCSS, exports.indicatorsContainerCSS = indicatorsContainerCSS,
  880. exports.inputCSS = inputCSS, exports.loadingIndicatorCSS = loadingIndicatorCSS,
  881. exports.loadingMessageCSS = loadingMessageCSS, exports.menuCSS = menuCSS, exports.menuListCSS = menuListCSS,
  882. exports.menuPortalCSS = menuPortalCSS, exports.multiValueCSS = multiValueCSS, exports.multiValueLabelCSS = multiValueLabelCSS,
  883. exports.multiValueRemoveCSS = multiValueRemoveCSS, exports.noOptionsMessageCSS = noOptionsMessageCSS,
  884. exports.optionCSS = optionCSS, exports.placeholderCSS = placeholderCSS, exports.valueContainerCSS = valueContainerCSS;