1 | import 'core-js/modules/es.function.name';
|
2 | import _extends from '@babel/runtime-corejs3/helpers/extends';
|
3 | import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
4 | import React, { useContext, useState, useRef, Children, useCallback, useEffect, useReducer } from 'react';
|
5 | import PropTypes from 'prop-types';
|
6 | import styled, { ThemeContext, css, createGlobalStyle, ThemeProvider, withTheme, keyframes } from 'styled-components';
|
7 | import _noop from 'lodash/noop';
|
8 | import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
9 | import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
10 | import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
11 | import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
12 | import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
13 | import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
14 | import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
15 | import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
16 | import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
17 | import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
18 | import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
19 | import _spliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/splice';
|
20 | import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/index-of';
|
21 | import _toConsumableArray from '@babel/runtime-corejs3/helpers/toConsumableArray';
|
22 | import AnimateHeight from 'react-animate-height';
|
23 | import ReactDOM from 'react-dom';
|
24 | import { Manager, Reference, Popper } from 'react-popper';
|
25 | import Transition from 'react-transition-group/Transition';
|
26 | import tinycolor from 'tinycolor2';
|
27 | import 'get-root-node-polyfill/implement';
|
28 | import _setTimeout from '@babel/runtime-corejs3/core-js-stable/set-timeout';
|
29 | import _setInterval from '@babel/runtime-corejs3/core-js-stable/set-interval';
|
30 | import { useRootClose } from 'react-overlays';
|
31 | import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
32 | import _taggedTemplateLiteral from '@babel/runtime-corejs3/helpers/taggedTemplateLiteral';
|
33 | import _debounce from 'lodash/debounce';
|
34 | import ReactModal from 'react-modal';
|
35 | import 'core-js/modules/es.regexp.exec';
|
36 | import 'core-js/modules/es.string.replace';
|
37 | import _Object$assign from '@babel/runtime-corejs3/core-js-stable/object/assign';
|
38 | import _everyInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/every';
|
39 | import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
40 | import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
41 | import 'regenerator-runtime/runtime';
|
42 | import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
|
43 | import _findIndex from 'lodash/findIndex';
|
44 | import _parseInt from '@babel/runtime-corejs3/core-js-stable/parse-int';
|
45 | import 'core-js/modules/es.object.to-string';
|
46 | import 'core-js/modules/es.regexp.to-string';
|
47 | import _Reflect$construct from '@babel/runtime-corejs3/core-js-stable/reflect/construct';
|
48 | import _classCallCheck from '@babel/runtime-corejs3/helpers/classCallCheck';
|
49 | import _createClass from '@babel/runtime-corejs3/helpers/createClass';
|
50 | import _assertThisInitialized from '@babel/runtime-corejs3/helpers/assertThisInitialized';
|
51 | import _inherits from '@babel/runtime-corejs3/helpers/inherits';
|
52 | import _possibleConstructorReturn from '@babel/runtime-corejs3/helpers/possibleConstructorReturn';
|
53 | import _getPrototypeOf from '@babel/runtime-corejs3/helpers/getPrototypeOf';
|
54 | import MaskedInput from 'react-text-mask';
|
55 | import createautoCorrectedDatePipe from 'text-mask-addons/dist/createAutoCorrectedDatePipe';
|
56 | import createNumberMask from 'text-mask-addons/dist/createNumberMask';
|
57 | import _fillInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/fill';
|
58 | import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
59 | import _omit from 'lodash/omit';
|
60 | import _pick from 'lodash/pick';
|
61 | import { parse, isValid, format, isAfter, isBefore } from 'date-fns';
|
62 | import ReactDatePicker from 'react-datepicker';
|
63 | import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/slice';
|
64 | import _parseInt$1 from 'lodash/parseInt';
|
65 | import _isFinite from 'lodash/isFinite';
|
66 | import _findIndexInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find-index';
|
67 | import formatMessage from 'format-message';
|
68 | import 'core-js/modules/es.symbol';
|
69 | import 'core-js/modules/es.symbol.description';
|
70 | import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
|
71 |
|
72 | var regular = {
|
73 | 'im-icon-accessibility': '600',
|
74 | 'im-icon-add': '601',
|
75 | 'im-icon-add-circle': '602',
|
76 | 'im-icon-agent': '603',
|
77 | 'im-icon-align-center': '604',
|
78 | 'im-icon-align-justify': '605',
|
79 | 'im-icon-align-left': '606',
|
80 | 'im-icon-align-right': '607',
|
81 | 'im-icon-archive': '608',
|
82 | 'im-icon-arrow-down': '609',
|
83 | 'im-icon-arrow-left': '60a',
|
84 | 'im-icon-arrow-right': '60b',
|
85 | 'im-icon-arrow-up': '60c',
|
86 | 'im-icon-asterisk': '60d',
|
87 | 'im-icon-attachment': '60e',
|
88 | 'im-icon-bell': '60f',
|
89 | 'im-icon-bicycle': '610',
|
90 | 'im-icon-bold': '611',
|
91 | 'im-icon-book': '612',
|
92 | 'im-icon-bookmark': '613',
|
93 | 'im-icon-boy': '614',
|
94 | 'im-icon-briefcase': '615',
|
95 | 'im-icon-bullhorn': '616',
|
96 | 'im-icon-calendar': '617',
|
97 | 'im-icon-camera': '618',
|
98 | 'im-icon-certificate': '619',
|
99 | 'im-icon-check-document': '61a',
|
100 | 'im-icon-checkbox': '61b',
|
101 | 'im-icon-checkbox-checked': '61c',
|
102 | 'im-icon-chevron-down': '61d',
|
103 | 'im-icon-chevron-left': '61e',
|
104 | 'im-icon-chevron-right': '61f',
|
105 | 'im-icon-chevron-up': '620',
|
106 | 'im-icon-circle-arrow-down': '621',
|
107 | 'im-icon-circle-arrow-left': '622',
|
108 | 'im-icon-circle-arrow-right': '623',
|
109 | 'im-icon-circle-arrow-up': '624',
|
110 | 'im-icon-cog': '625',
|
111 | 'im-icon-comment': '626',
|
112 | 'im-icon-copy': '627',
|
113 | 'im-icon-cut': '628',
|
114 | 'im-icon-dashboard': '629',
|
115 | 'im-icon-discussion': '62a',
|
116 | 'im-icon-dollar-sign': '62b',
|
117 | 'im-icon-double-chevron-down': '62c',
|
118 | 'im-icon-double-chevron-left': '62d',
|
119 | 'im-icon-double-chevron-right': '62e',
|
120 | 'im-icon-double-chevron-up': '62f',
|
121 | 'im-icon-download': '630',
|
122 | 'im-icon-download-alt': '631',
|
123 | 'im-icon-edit': '632',
|
124 | 'im-icon-edit-document': '633',
|
125 | 'im-icon-element-block': '634',
|
126 | 'im-icon-element-page': '635',
|
127 | 'im-icon-element-section': '636',
|
128 | 'im-icon-envelope': '637',
|
129 | 'im-icon-exclamation': '638',
|
130 | 'im-icon-exclamation-circle': '639',
|
131 | 'im-icon-exclamation-sign': '63a',
|
132 | 'im-icon-export': '63b',
|
133 | 'im-icon-external-link': '63c',
|
134 | 'im-icon-eye-closed': '63d',
|
135 | 'im-icon-eye-open': '63e',
|
136 | 'im-icon-federal': '63f',
|
137 | 'im-icon-file': '640',
|
138 | 'im-icon-file-open': '641',
|
139 | 'im-icon-fill': '642',
|
140 | 'im-icon-film': '643',
|
141 | 'im-icon-fire': '644',
|
142 | 'im-icon-flag-empty': '645',
|
143 | 'im-icon-flag-filled': '646',
|
144 | 'im-icon-flash': '647',
|
145 | 'im-icon-folder-close': '648',
|
146 | 'im-icon-folder-open': '649',
|
147 | 'im-icon-folder-up-level': '64a',
|
148 | 'im-icon-font': '64b',
|
149 | 'im-icon-form-agreement': '64c',
|
150 | 'im-icon-form-checkbox': '64d',
|
151 | 'im-icon-form-dropdown': '64e',
|
152 | 'im-icon-form-number': '64f',
|
153 | 'im-icon-form-radio': '650',
|
154 | 'im-icon-form-text': '651',
|
155 | 'im-icon-form-text-box': '652',
|
156 | 'im-icon-fullscreen': '653',
|
157 | 'im-icon-funnel': '654',
|
158 | 'im-icon-girl': '655',
|
159 | 'im-icon-globe': '656',
|
160 | 'im-icon-hand-down': '657',
|
161 | 'im-icon-hand-left': '658',
|
162 | 'im-icon-hand-right': '659',
|
163 | 'im-icon-hand-up': '65a',
|
164 | 'im-icon-health': '65b',
|
165 | 'im-icon-heart-empty': '65c',
|
166 | 'im-icon-heart-filled': '65d',
|
167 | 'im-icon-history': '65e',
|
168 | 'im-icon-home': '65f',
|
169 | 'im-icon-hourglass': '660',
|
170 | 'im-icon-household': '661',
|
171 | 'im-icon-inbox': '662',
|
172 | 'im-icon-indent-left': '663',
|
173 | 'im-icon-indent-right': '664',
|
174 | 'im-icon-info': '665',
|
175 | 'im-icon-info-circle': '666',
|
176 | 'im-icon-italic': '667',
|
177 | 'im-icon-leaf': '668',
|
178 | 'im-icon-list': '669',
|
179 | 'im-icon-list-numbered': '66a',
|
180 | 'im-icon-list-thumbnails': '66b',
|
181 | 'im-icon-list-unordered': '66c',
|
182 | 'im-icon-lock': '66d',
|
183 | 'im-icon-lock-open': '66e',
|
184 | 'im-icon-log-in': '66f',
|
185 | 'im-icon-log-out': '670',
|
186 | 'im-icon-man': '671',
|
187 | 'im-icon-map-marker': '672',
|
188 | 'im-icon-medical': '673',
|
189 | 'im-icon-menu-btn': '674',
|
190 | 'im-icon-minus': '675',
|
191 | 'im-icon-minus-circle': '676',
|
192 | 'im-icon-move': '677',
|
193 | 'im-icon-new-window': '678',
|
194 | 'im-icon-no-symbol': '679',
|
195 | 'im-icon-non-smoker': '67a',
|
196 | 'im-icon-ok': '67b',
|
197 | 'im-icon-ok-circle': '67c',
|
198 | 'im-icon-options-horizontal': '67d',
|
199 | 'im-icon-options-vertical': '67e',
|
200 | 'im-icon-paragraph': '67f',
|
201 | 'im-icon-paste': '680',
|
202 | 'im-icon-phone': '681',
|
203 | 'im-icon-picture': '682',
|
204 | 'im-icon-piggy-bank': '683',
|
205 | 'im-icon-play-circle': '684',
|
206 | 'im-icon-power': '685',
|
207 | 'im-icon-print': '686',
|
208 | 'im-icon-push-pin': '687',
|
209 | 'im-icon-question': '688',
|
210 | 'im-icon-question-circle': '689',
|
211 | 'im-icon-random': '68a',
|
212 | 'im-icon-read-message': '68b',
|
213 | 'im-icon-redo': '68c',
|
214 | 'im-icon-refresh': '68d',
|
215 | 'im-icon-remove': '68e',
|
216 | 'im-icon-remove-circle': '68f',
|
217 | 'im-icon-repeat': '690',
|
218 | 'im-icon-resize-full': '691',
|
219 | 'im-icon-resize-horizontal': '692',
|
220 | 'im-icon-resize-small': '693',
|
221 | 'im-icon-resize-vertical': '694',
|
222 | 'im-icon-retweet': '695',
|
223 | 'im-icon-road': '696',
|
224 | 'im-icon-rx': '697',
|
225 | 'im-icon-save': '698',
|
226 | 'im-icon-screenshot': '699',
|
227 | 'im-icon-search': '69a',
|
228 | 'im-icon-share': '69b',
|
229 | 'im-icon-shopping-cart': '69c',
|
230 | 'im-icon-smoker': '69d',
|
231 | 'im-icon-sort': '69e',
|
232 | 'im-icon-sort-alpha': '69f',
|
233 | 'im-icon-sort-alpha-reverse': '6a0',
|
234 | 'im-icon-sort-ascending': '6a1',
|
235 | 'im-icon-sort-descending': '6a2',
|
236 | 'im-icon-sort-num': '6a3',
|
237 | 'im-icon-sort-num-reverse': '6a4',
|
238 | 'im-icon-speak-to-expert': '6a5',
|
239 | 'im-icon-star-empty': '6a6',
|
240 | 'im-icon-star-filled': '6a7',
|
241 | 'im-icon-stats': '6a8',
|
242 | 'im-icon-switch': '6a9',
|
243 | 'im-icon-tag': '6aa',
|
244 | 'im-icon-tags': '6ab',
|
245 | 'im-icon-tasks': '6ac',
|
246 | 'im-icon-text-color': '6ad',
|
247 | 'im-icon-text-height': '6ae',
|
248 | 'im-icon-text-size': '6af',
|
249 | 'im-icon-text-width': '6b0',
|
250 | 'im-icon-thumbnails': '6b1',
|
251 | 'im-icon-thumbnails-large': '6b2',
|
252 | 'im-icon-thumbs-down': '6b3',
|
253 | 'im-icon-thumbs-up': '6b4',
|
254 | 'im-icon-time': '6b5',
|
255 | 'im-icon-transfer': '6b6',
|
256 | 'im-icon-trash': '6b7',
|
257 | 'im-icon-umbrella': '6b8',
|
258 | 'im-icon-undo': '6b9',
|
259 | 'im-icon-upload': '6ba',
|
260 | 'im-icon-user': '6bb',
|
261 | 'im-icon-user-shield': '6bc',
|
262 | 'im-icon-users': '6bd',
|
263 | 'im-icon-video': '6be',
|
264 | 'im-icon-voice-check': '6bf',
|
265 | 'im-icon-wallet': '6c0',
|
266 | 'im-icon-woman': '6c1',
|
267 | 'im-icon-wrench': '6c2',
|
268 | 'im-icon-zoom-in': '6c3',
|
269 | 'im-icon-zoom-out': '6c4',
|
270 | 'im-icon-keyhole-shield': '6c5',
|
271 | 'im-icon-security-checked': '6c6',
|
272 | 'im-icon-underline': '6c7',
|
273 | 'im-icon-header': '6c8',
|
274 | 'im-icon-hyperlink': '6c9',
|
275 | 'im-icon-money': '6ca',
|
276 | 'im-icon-profit': '6cb',
|
277 | 'im-icon-cash-in-hand': '6cc',
|
278 | 'im-icon-paycheque': '6cd',
|
279 | 'im-icon-rod-of-asclepius': '6ce',
|
280 | 'im-icon-tooth': '6cf',
|
281 | 'im-icon-speech-bubble': '6d0',
|
282 | 'im-icon-phone-analog': '6d1',
|
283 | 'im-icon-map-with-marker': '6d2',
|
284 | 'im-icon-sms': '6d3',
|
285 | 'im-icon-mailbox-closed-flag-down': '6d4',
|
286 | 'im-icon-moleskine': '6d5',
|
287 | 'im-icon-alarm-clock': '6d6',
|
288 | 'im-icon-stethoscope': '6d7',
|
289 | 'im-icon-compass': '6d8',
|
290 | 'im-icon-exit': '6d9',
|
291 | 'im-icon-logout-rounded-left': '6da',
|
292 | 'im-icon-bot': '6db',
|
293 | 'im-icon-calculator': '6dc',
|
294 | 'im-icon-divide': '6dd',
|
295 | 'im-icon-clinic': '6de',
|
296 | 'im-icon-hospital-3': '6df',
|
297 | 'im-icon-trust': '6e0',
|
298 | 'im-icon-clear-filters': '6e1',
|
299 | 'im-icon-glasses': '6e2',
|
300 | 'im-icon-purchase-order': '6e3',
|
301 | 'im-icon-urgent-message': '6e4',
|
302 | 'im-icon-desktop': '6e5',
|
303 | 'im-icon-confusion': '6e6',
|
304 | 'im-icon-idea': '6e7',
|
305 | 'im-icon-spouse': '6e8',
|
306 | 'im-icon-play': '6e9',
|
307 | 'im-icon-pause': '6ea',
|
308 | 'im-icon-skip-to-start': '6eb',
|
309 | 'im-icon-reply-arrow': '6ec'
|
310 | };
|
311 |
|
312 | var StyledIcon = styled.i(["display:inline-block;font-family:bds-func-icons !important;font-size:", ";font-style:normal;font-weight:inherit;font-variant:normal;line-height:1;speak:none;text-decoration:none;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;vertical-align:text-bottom;&:before{content:\"\\e", "\";}"], function (props) {
|
313 | return props.fontSize;
|
314 | }, function (props) {
|
315 | return props.content;
|
316 | });
|
317 |
|
318 | function Icon(_ref) {
|
319 | var name = _ref.name,
|
320 | size = _ref.size,
|
321 | other = _objectWithoutProperties(_ref, ["name", "size"]);
|
322 |
|
323 | var iconName = "im-icon-".concat(name);
|
324 | var styledIconProps = {
|
325 | content: regular[iconName],
|
326 | fontSize: size !== undefined ? "".concat(size, "px") : 'inherit'
|
327 | };
|
328 | return (
|
329 |
|
330 | React.createElement(StyledIcon, _extends({
|
331 | "aria-hidden": true
|
332 | }, styledIconProps, other))
|
333 | );
|
334 | }
|
335 |
|
336 | Icon.propTypes = process.env.NODE_ENV !== "production" ? {
|
337 |
|
338 | name: PropTypes.string.isRequired,
|
339 |
|
340 |
|
341 | size: PropTypes.number
|
342 | } : {};
|
343 | Icon.defaultProps = {
|
344 | size: undefined
|
345 | };
|
346 |
|
347 | var _StyledDiv = styled("div")(function (p) {
|
348 | return {
|
349 | alignItems: 'center',
|
350 | display: 'flex',
|
351 | height: p._css,
|
352 | justifyContent: 'center',
|
353 | width: p._css2
|
354 | };
|
355 | });
|
356 |
|
357 | var _StyledImg = styled("img")({
|
358 | height: 'auto',
|
359 | maxWidth: '100%'
|
360 | });
|
361 |
|
362 | function FullColorIcon(_ref) {
|
363 | var name = _ref.name,
|
364 | size = _ref.size,
|
365 | props = _objectWithoutProperties(_ref, ["name", "size"]);
|
366 |
|
367 | return (
|
368 |
|
369 | React.createElement(_StyledDiv, _extends({}, props, {
|
370 | _css: size,
|
371 | _css2: size
|
372 | }),
|
373 |
|
374 | React.createElement(_StyledImg, {
|
375 | src: "https://bdaim-webexcdn-p.azureedge.net/es-assets/images/full-color-icons/".concat(name, ".svg"),
|
376 | alt: "".concat(name, " icon")
|
377 | }))
|
378 | );
|
379 | }
|
380 | FullColorIcon.propTypes = process.env.NODE_ENV !== "production" ? {
|
381 |
|
382 | name: PropTypes.string.isRequired,
|
383 |
|
384 |
|
385 | size: PropTypes.number
|
386 | } : {};
|
387 | FullColorIcon.defaultProps = {
|
388 | size: undefined
|
389 | };
|
390 |
|
391 | var useTheme = function useTheme() {
|
392 | return useContext(ThemeContext);
|
393 | };
|
394 |
|
395 |
|
396 |
|
397 | function screenReaderOnly(Component) {
|
398 | var ScreenReaderOnly = styled(Component)(["position:absolute !important;left:-10000px;width:1px;height:1px;overflow:hidden;"]);
|
399 | return ScreenReaderOnly;
|
400 | }
|
401 |
|
402 | var DismissButtonBase = styled.button(["background-color:transparent;border:0;cursor:pointer;display:flex;font-weight:bold;opacity:0.2;padding:0;&:hover,&:focus{opacity:0.5;}"]);
|
403 | var ScreenReaderText = screenReaderOnly('span');
|
404 | var DismissButton =
|
405 |
|
406 | React.forwardRef(function DismissButton(props, ref) {
|
407 | return (
|
408 |
|
409 | React.createElement(DismissButtonBase, _extends({
|
410 | "aria-label": "Close",
|
411 | type: "button"
|
412 | }, props, {
|
413 | ref: ref
|
414 | }),
|
415 |
|
416 | React.createElement(Icon, {
|
417 | name: "remove"
|
418 | }),
|
419 |
|
420 | React.createElement(ScreenReaderText, null, "Close"))
|
421 | );
|
422 | });
|
423 |
|
424 | function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { keys.push.apply(keys, _Object$getOwnPropertySymbols(object)); } if (enumerableOnly) keys = _filterInstanceProperty(keys).call(keys, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
425 |
|
426 | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys(source, true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys(source)).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
427 | var NotificationIcon = styled(Icon)(["align-self:start;color:", ";display:none;@media (min-width:", "){display:inline;margin-right:8px;}"], function (props) {
|
428 | return props.iconColor;
|
429 | }, function (props) {
|
430 | return props.alwaysShowIcon ? 0 : props.theme.screenSize.tablet;
|
431 | });
|
432 | var Dismiss = styled(DismissButton)(["align-self:start;color:", ";font-weight:normal;opacity:0.8;i{font-size:27px;}"], function (props) {
|
433 | return props.color.textColor;
|
434 | });
|
435 | var ContentWrapper = styled.div(["align-self:center;flex-grow:1;word-break:break-word;"]);
|
436 |
|
437 | function NotificationContent(props) {
|
438 | var includeIcon = props.includeIcon,
|
439 | isDismissable = props.isDismissable,
|
440 | onDismiss = props.onDismiss,
|
441 | children = props.children,
|
442 | iconName = props.iconName,
|
443 | iconColor = props.iconColor,
|
444 | color = props.color,
|
445 | dismissNotification = props.dismissNotification,
|
446 | alwaysShowIcon = props.alwaysShowIcon,
|
447 | rest = _objectWithoutProperties(props, ["includeIcon", "isDismissable", "onDismiss", "children", "iconName", "iconColor", "color", "dismissNotification", "alwaysShowIcon"]);
|
448 |
|
449 | function dismiss() {
|
450 | onDismiss();
|
451 | dismissNotification();
|
452 | }
|
453 |
|
454 | return (
|
455 |
|
456 | React.createElement(React.Fragment, null, includeIcon &&
|
457 |
|
458 | React.createElement(NotificationIcon, {
|
459 | name: iconName,
|
460 | iconColor: iconColor,
|
461 | size: 28,
|
462 | alwaysShowIcon: alwaysShowIcon
|
463 | }),
|
464 |
|
465 | React.createElement(ContentWrapper, rest, children), isDismissable &&
|
466 |
|
467 | React.createElement(Dismiss, {
|
468 | onClick: dismiss,
|
469 | color: color
|
470 | }))
|
471 | );
|
472 | }
|
473 |
|
474 | var Notification = styled.div(["align-items:center;background-color:", ";border-radius:2px;color:", ";display:flex;margin-bottom:25px;padding:15px;", " button[aria-expanded]{color:", ";}"], function (props) {
|
475 | return props.variant.bgColor;
|
476 | }, function (props) {
|
477 | return props.variant.textColor;
|
478 | }, function (props) {
|
479 | return props.restyleAnchors ? "\n a {\n color: ".concat(props.variant.textColor, ";\n text-decoration: underline;\n\n &:hover {\n text-decoration: none;\n }\n }\n ") : "";
|
480 | }, function (props) {
|
481 | return props.variant.textColor;
|
482 | });
|
483 | function useNotification() {
|
484 | var styleType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'base';
|
485 | return function BaseNotification(_ref) {
|
486 | var role = _ref.role,
|
487 | type = _ref.type,
|
488 | children = _ref.children,
|
489 | className = _ref.className,
|
490 | style = _ref.style,
|
491 | _ref$restyleAnchors = _ref.restyleAnchors,
|
492 | restyleAnchors = _ref$restyleAnchors === void 0 ? true : _ref$restyleAnchors,
|
493 | rest = _objectWithoutProperties(_ref, ["role", "type", "children", "className", "style", "restyleAnchors"]);
|
494 |
|
495 | var theme = useTheme();
|
496 | var color = theme.notificationStyles[type][styleType];
|
497 | var iconName = theme.validationIconName[type];
|
498 | var iconColor = styleType === 'base' ? theme.colors.white : theme.colors[type];
|
499 |
|
500 | var notificationContentProps = _objectSpread({
|
501 | color: color,
|
502 | iconName: iconName,
|
503 | iconColor: iconColor,
|
504 | role: role
|
505 | }, rest);
|
506 |
|
507 | var _useState = useState(false),
|
508 | _useState2 = _slicedToArray(_useState, 2),
|
509 | isDismissed = _useState2[0],
|
510 | setIsDismissed = _useState2[1];
|
511 |
|
512 | function dismissNotification() {
|
513 | setIsDismissed(true);
|
514 | }
|
515 |
|
516 | return !isDismissed &&
|
517 |
|
518 | React.createElement(Notification, {
|
519 | variant: color,
|
520 | className: className,
|
521 | style: style,
|
522 | restyleAnchors: restyleAnchors
|
523 | },
|
524 |
|
525 | React.createElement(NotificationContent, _extends({
|
526 | dismissNotification: dismissNotification
|
527 | }, notificationContentProps), children));
|
528 | };
|
529 | }
|
530 |
|
531 | var DefaultNotification = useNotification();
|
532 |
|
533 | function Notification$1(props) {
|
534 | return (
|
535 |
|
536 | React.createElement(DefaultNotification, props)
|
537 | );
|
538 | }
|
539 |
|
540 | Notification$1.propTypes = process.env.NODE_ENV !== "production" ? {
|
541 |
|
542 | type: PropTypes.oneOf(['success', 'info', 'warning', 'danger', 'advisor']).isRequired,
|
543 |
|
544 |
|
545 | includeIcon: PropTypes.bool,
|
546 |
|
547 |
|
548 | isDismissable: PropTypes.bool,
|
549 | role: PropTypes.oneOf(['dialog', 'alert']),
|
550 |
|
551 |
|
552 | onDismiss: PropTypes.func,
|
553 | children: PropTypes.node,
|
554 |
|
555 |
|
556 | alwaysShowIcon: PropTypes.bool
|
557 | } : {};
|
558 | Notification$1.defaultProps = {
|
559 | includeIcon: false,
|
560 | isDismissable: false,
|
561 | children: null,
|
562 | role: 'dialog',
|
563 | onDismiss: _noop,
|
564 | alwaysShowIcon: false
|
565 | };
|
566 |
|
567 | var Notification$2 = useNotification('light');
|
568 |
|
569 | function LightNotification(props) {
|
570 | return (
|
571 |
|
572 | React.createElement(Notification$2, props)
|
573 | );
|
574 | }
|
575 |
|
576 | LightNotification.propTypes = process.env.NODE_ENV !== "production" ? {
|
577 |
|
578 | type: PropTypes.oneOf(['success', 'info', 'warning', 'danger', 'advisor']).isRequired,
|
579 |
|
580 |
|
581 | includeIcon: PropTypes.bool,
|
582 |
|
583 |
|
584 | isDismissable: PropTypes.bool,
|
585 | role: PropTypes.oneOf(['dialog', 'alert']),
|
586 |
|
587 |
|
588 | onDismiss: PropTypes.func,
|
589 | children: PropTypes.node,
|
590 |
|
591 |
|
592 | alwaysShowIcon: PropTypes.bool
|
593 | } : {};
|
594 | LightNotification.defaultProps = {
|
595 | includeIcon: false,
|
596 | isDismissable: false,
|
597 | children: null,
|
598 | role: 'dialog',
|
599 | onDismiss: _noop,
|
600 | alwaysShowIcon: false
|
601 | };
|
602 |
|
603 | var Notification$3 = useNotification('messageOnly');
|
604 |
|
605 | function MessageNotification(props) {
|
606 | return (
|
607 |
|
608 | React.createElement(Notification$3, props)
|
609 | );
|
610 | }
|
611 |
|
612 | MessageNotification.propTypes = process.env.NODE_ENV !== "production" ? {
|
613 |
|
614 | type: PropTypes.oneOf(['success', 'info', 'warning', 'danger', 'advisor']).isRequired,
|
615 |
|
616 |
|
617 | includeIcon: PropTypes.bool,
|
618 |
|
619 |
|
620 | isDismissable: PropTypes.bool,
|
621 | role: PropTypes.oneOf(['dialog', 'alert']),
|
622 |
|
623 |
|
624 | onDismiss: PropTypes.func,
|
625 | children: PropTypes.node,
|
626 |
|
627 |
|
628 | alwaysShowIcon: PropTypes.bool
|
629 | } : {};
|
630 | MessageNotification.defaultProps = {
|
631 | includeIcon: false,
|
632 | isDismissable: false,
|
633 | children: null,
|
634 | role: 'dialog',
|
635 | onDismiss: _noop,
|
636 | alwaysShowIcon: false
|
637 | };
|
638 |
|
639 | var propTypes = process.env.NODE_ENV !== "production" ? {
|
640 | emphasizedText: PropTypes.string,
|
641 | text: PropTypes.string.isRequired
|
642 | } : {};
|
643 | var defaultProps = {
|
644 | emphasizedText: undefined
|
645 | };
|
646 | function InlineMessage(_ref) {
|
647 | var emphasizedText = _ref.emphasizedText,
|
648 | text = _ref.text;
|
649 | return (
|
650 |
|
651 | React.createElement("span", null, emphasizedText !== undefined ?
|
652 |
|
653 | React.createElement("strong", null, emphasizedText) : null, ' ', text)
|
654 | );
|
655 | }
|
656 | InlineMessage.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
657 | InlineMessage.defaultProps = defaultProps;
|
658 | function Message(_ref2) {
|
659 | var emphasizedText = _ref2.emphasizedText,
|
660 | text = _ref2.text;
|
661 | return (
|
662 |
|
663 | React.createElement("span", null, emphasizedText !== undefined ?
|
664 |
|
665 | React.createElement(React.Fragment, null,
|
666 |
|
667 | React.createElement("strong", null, emphasizedText),
|
668 |
|
669 | React.createElement("br", null)) : null, text)
|
670 | );
|
671 | }
|
672 | Message.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
673 | Message.defaultProps = defaultProps;
|
674 |
|
675 | var DrawerContext =
|
676 |
|
677 | React.createContext({});
|
678 |
|
679 | var HeadingBase = styled.h1(["background-color:", ";border-bottom:", ";color:", ";font-family:'Source Sans Pro','Segoe UI',Segoe,Calibri,Tahoma,sans-serif;font-size:", ";font-weight:300;line-height:1.1;margin-bottom:0.45em;margin-top:0;padding-bottom:", ";padding:", ";small{font-size:", ";line-height:1;}@media (min-width:", "){font-size:", ";}"], function (props) {
|
680 | return props.isKnockoutStyle && props.theme.colors.primary;
|
681 | }, function (props) {
|
682 | return props.underlineColor && "2px solid ".concat(props.underlineColor, ";");
|
683 | }, function (props) {
|
684 | return props.isKnockoutStyle ? 'white' : 'inherit';
|
685 | }, function (props) {
|
686 | return props.theme.font.headingMobile[props.adjustedSize];
|
687 | }, function (props) {
|
688 | return props.underlineColor && '0.22em';
|
689 | }, function (props) {
|
690 | return props.isKnockoutStyle && '20px 15px';
|
691 | }, function (props) {
|
692 | return props.adjustedSize > 3 ? '75%' : '65%';
|
693 | }, function (props) {
|
694 | return props.theme.screenSize.tablet;
|
695 | }, function (props) {
|
696 | return props.theme.font.headingDesktop[props.adjustedSize];
|
697 | });
|
698 |
|
699 | function Heading(_ref) {
|
700 | var children = _ref.children,
|
701 | level = _ref.level,
|
702 | size = _ref.size,
|
703 | isKnockoutStyle = _ref.isKnockoutStyle,
|
704 | underlineColor = _ref.underlineColor,
|
705 | other = _objectWithoutProperties(_ref, ["children", "level", "size", "isKnockoutStyle", "underlineColor"]);
|
706 |
|
707 | var adjustedSize = size || level;
|
708 | var hLevel = "h".concat(level);
|
709 | return (
|
710 |
|
711 | React.createElement(HeadingBase, _extends({
|
712 | as: hLevel,
|
713 | adjustedSize: adjustedSize,
|
714 | isKnockoutStyle: isKnockoutStyle,
|
715 | underlineColor: underlineColor
|
716 | }, other), children)
|
717 | );
|
718 | }
|
719 |
|
720 | Heading.propTypes = process.env.NODE_ENV !== "production" ? {
|
721 | children: PropTypes.node,
|
722 |
|
723 |
|
724 | level: PropTypes.oneOf([1, 2, 3, 4, 5, 6]).isRequired,
|
725 |
|
726 |
|
727 | size: PropTypes.oneOf([1, 2, 3, 4, 5, 6]),
|
728 |
|
729 |
|
730 | isKnockoutStyle: PropTypes.bool,
|
731 |
|
732 |
|
733 | underlineColor: PropTypes.string
|
734 | } : {};
|
735 | Heading.defaultProps = {
|
736 | children: undefined,
|
737 | size: undefined,
|
738 | isKnockoutStyle: false,
|
739 | underlineColor: null
|
740 | };
|
741 | var PageHeading = function PageHeading(props) {
|
742 | return (
|
743 |
|
744 | React.createElement(Heading, _extends({
|
745 | isKnockoutStyle: true,
|
746 | level: 1
|
747 | }, props))
|
748 | );
|
749 | };
|
750 |
|
751 | function generateAlphaName() {
|
752 | var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
753 | var text = '';
|
754 |
|
755 | for (var i = 0; i < 6; i++) {
|
756 | text += possible.charAt(Math.floor(Math.random() * possible.length));
|
757 | }
|
758 |
|
759 | return text;
|
760 | }
|
761 |
|
762 | function useUniqueId(providedId) {
|
763 | var idRef = useRef(providedId || generateAlphaName());
|
764 | return idRef.current;
|
765 | }
|
766 |
|
767 | var PanelWrapper = styled.div(["border-bottom:1px solid ", ";"], function (props) {
|
768 | return props.theme.colors.gray3;
|
769 | });
|
770 | var PanelButton = styled.button(["background:none;border:0;color:", ";cursor:pointer;display:flex;font-size:18px;justify-content:space-between;padding:10px 15px;width:100%;@media (hover:hover),(-ms-high-contrast:none){&:hover{background-color:", ";color:", ";}}"], function (props) {
|
771 | return props.theme.colors.primary;
|
772 | }, function (props) {
|
773 | return props.theme.colors.gray2;
|
774 | }, function (props) {
|
775 | return props.theme.brandColors.brandPrimary1;
|
776 | });
|
777 | var PanelIcon = styled(Icon)(["margin-right:0.4em;position:relative;top:-2px;"]);
|
778 | var PanelBody = styled(function (_ref) {
|
779 | var noPadding = _ref.noPadding,
|
780 | rest = _objectWithoutProperties(_ref, ["noPadding"]);
|
781 |
|
782 | return (
|
783 |
|
784 | React.createElement(AnimateHeight, rest)
|
785 | );
|
786 | })(["background-color:", ";color:", ";> div{border-bottom:4px solid ", ";padding:", ";}"], function (props) {
|
787 | return props.theme.colors.white;
|
788 | }, function (props) {
|
789 | return props.theme.colors.gray9;
|
790 | }, function (props) {
|
791 | return props.theme.colors.gray3;
|
792 | }, function (props) {
|
793 | return props.noPadding ? '0' : '10px 10px 10px 40px';
|
794 | });
|
795 |
|
796 | function DrawerPanel(props) {
|
797 | var children = props.children,
|
798 | isOpen = props.isOpen,
|
799 | noPadding = props.noPadding,
|
800 | onItemClick = props.onItemClick,
|
801 | title = props.title,
|
802 | titleAside = props.titleAside,
|
803 | headingLevel = props.headingLevel,
|
804 | other = _objectWithoutProperties(props, ["children", "isOpen", "noPadding", "onItemClick", "title", "titleAside", "headingLevel"]);
|
805 |
|
806 | var _React$useContext = React.useContext(DrawerContext),
|
807 | openedIconName = _React$useContext.openedIconName,
|
808 | closedIconName = _React$useContext.closedIconName;
|
809 |
|
810 | var headingAriaId = "".concat(useUniqueId(other.id), "-heading");
|
811 | var regionAriaId = "".concat(useUniqueId(other.id), "-region");
|
812 | return (
|
813 |
|
814 | React.createElement(PanelWrapper, other,
|
815 |
|
816 | React.createElement("div", {
|
817 | id: headingAriaId,
|
818 | role: "heading",
|
819 | "aria-level": headingLevel
|
820 | },
|
821 |
|
822 | React.createElement(PanelButton, {
|
823 | "aria-expanded": isOpen,
|
824 | "aria-controls": regionAriaId,
|
825 | onClick: function onClick() {
|
826 | return onItemClick();
|
827 | }
|
828 | },
|
829 |
|
830 | React.createElement("span", null,
|
831 |
|
832 | React.createElement(PanelIcon, {
|
833 | name: isOpen ? openedIconName : closedIconName
|
834 | }), title), titleAside &&
|
835 |
|
836 | React.createElement("aside", null, titleAside))),
|
837 |
|
838 | React.createElement(PanelBody, {
|
839 | "aria-labelledby": headingAriaId,
|
840 | duration: 300,
|
841 | height: isOpen ? 'auto' : 0,
|
842 | id: regionAriaId,
|
843 | noPadding: noPadding,
|
844 | role: "region"
|
845 | }, children))
|
846 | );
|
847 | }
|
848 |
|
849 | DrawerPanel.propTypes = process.env.NODE_ENV !== "production" ? {
|
850 | children: PropTypes.any.isRequired,
|
851 |
|
852 |
|
853 | title: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.node]).isRequired,
|
854 |
|
855 |
|
856 | titleAside: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
857 |
|
858 |
|
859 | isOpen: PropTypes.bool,
|
860 |
|
861 |
|
862 | noPadding: PropTypes.bool,
|
863 |
|
864 |
|
865 | headingLevel: Heading.propTypes.level,
|
866 |
|
867 |
|
868 | onItemClick: PropTypes.func
|
869 | } : {};
|
870 | DrawerPanel.defaultProps = {
|
871 | isOpen: false,
|
872 | noPadding: false,
|
873 | titleAside: undefined,
|
874 | headingLevel: 2,
|
875 | onItemClick: _noop
|
876 | };
|
877 |
|
878 | function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { keys.push.apply(keys, _Object$getOwnPropertySymbols(object)); } if (enumerableOnly) keys = _filterInstanceProperty(keys).call(keys, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
879 |
|
880 | function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys$1(source, true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys$1(source)).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
881 | var StyledDrawer = styled.div(["background-color:", ";border-top:1px solid ", ";box-shadow:0 1px 1px ", ";margin-bottom:25px;"], function (props) {
|
882 | return props.theme.colors.white;
|
883 | }, function (props) {
|
884 | return props.theme.colors.gray3;
|
885 | }, function (props) {
|
886 | return props.theme.colors.boxShadowLight;
|
887 | });
|
888 |
|
889 | function Drawer(props) {
|
890 | var activeKeys = props.activeKeys,
|
891 | children = props.children,
|
892 | closedIconName = props.closedIconName,
|
893 | isAccordion = props.isAccordion,
|
894 | onActiveKeysChanged = props.onActiveKeysChanged,
|
895 | openedIconName = props.openedIconName,
|
896 | other = _objectWithoutProperties(props, ["activeKeys", "children", "closedIconName", "isAccordion", "onActiveKeysChanged", "openedIconName"]);
|
897 |
|
898 | function _onItemClick(key) {
|
899 | var nextActiveKeys = _toConsumableArray(activeKeys);
|
900 |
|
901 | if (isAccordion) {
|
902 | nextActiveKeys = nextActiveKeys[0] === key ? [] : [key];
|
903 | } else {
|
904 | var index = _indexOfInstanceProperty(nextActiveKeys).call(nextActiveKeys, key);
|
905 |
|
906 | var isOpen = index > -1;
|
907 |
|
908 | if (isOpen) {
|
909 | _spliceInstanceProperty(nextActiveKeys).call(nextActiveKeys, index, 1);
|
910 | } else {
|
911 | nextActiveKeys.push(key);
|
912 | }
|
913 | }
|
914 |
|
915 | onActiveKeysChanged(nextActiveKeys);
|
916 | }
|
917 |
|
918 | return (
|
919 |
|
920 | React.createElement(DrawerContext.Provider, {
|
921 | value: {
|
922 | openedIconName: openedIconName,
|
923 | closedIconName: closedIconName
|
924 | }
|
925 | },
|
926 |
|
927 | React.createElement(StyledDrawer, other, _mapInstanceProperty(Children).call(Children, children, function (child, index) {
|
928 | if (child) {
|
929 |
|
930 | var key = child && child.key || String(index + 1);
|
931 | var isOpen = false;
|
932 |
|
933 | if (isAccordion) {
|
934 | isOpen = activeKeys[0] === key;
|
935 | } else {
|
936 | isOpen = _indexOfInstanceProperty(activeKeys).call(activeKeys, key) > -1;
|
937 | }
|
938 |
|
939 | var childProps = _objectSpread$1(_objectSpread$1({}, child.props), {}, {
|
940 | key: key,
|
941 | isOpen: isOpen,
|
942 | onItemClick: function onItemClick() {
|
943 | return _onItemClick(key);
|
944 | }
|
945 | });
|
946 |
|
947 | return (
|
948 |
|
949 | React.cloneElement(child, childProps)
|
950 | );
|
951 | }
|
952 |
|
953 | return null;
|
954 | })))
|
955 | );
|
956 | }
|
957 |
|
958 | Drawer.propTypes = process.env.NODE_ENV !== "production" ? {
|
959 |
|
960 | activeKeys: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
961 |
|
962 |
|
963 | children: PropTypes.node,
|
964 |
|
965 |
|
966 | closedIconName: PropTypes.string,
|
967 |
|
968 |
|
969 | isAccordion: PropTypes.bool,
|
970 |
|
971 |
|
972 | onActiveKeysChanged: PropTypes.func.isRequired,
|
973 |
|
974 |
|
975 | openedIconName: PropTypes.string
|
976 | } : {};
|
977 | Drawer.defaultProps = {
|
978 | activeKeys: [],
|
979 | isAccordion: false,
|
980 | closedIconName: 'add',
|
981 | openedIconName: 'minus',
|
982 | children: undefined
|
983 | };
|
984 | Drawer.Panel = DrawerPanel;
|
985 |
|
986 | var OrientationContext =
|
987 | React.createContext('stacked');
|
988 |
|
989 | var FieldsetBase = styled.div(["display:flex;flex-wrap:wrap;flex-direction:column;margin-bottom:25px;width:100%;> *:last-child{margin-bottom:0;}", ";"], function (props) {
|
990 | return props.orientation === 'inline' && css(["@media (min-width:", "){align-items:baseline;flex-direction:row;}"], props.theme.screenSize.tablet);
|
991 | });
|
992 | var Legend = styled.div(["color:", ";flex:0 0 auto;font-size:21.6px;line-height:", ";margin:0 0 10px 0;width:100%;"], function (props) {
|
993 | return props.theme.colors.black;
|
994 | }, function (props) {
|
995 | return props.theme.font.baseLineHeight;
|
996 | });
|
997 |
|
998 | function Fieldset(props) {
|
999 | var legendContent = props.legendContent,
|
1000 | children = props.children,
|
1001 | other = _objectWithoutProperties(props, ["legendContent", "children"]);
|
1002 |
|
1003 | var legendId = legendContent ? generateAlphaName() : undefined;
|
1004 | var orientation = React.useContext(OrientationContext);
|
1005 | return (
|
1006 |
|
1007 | React.createElement(FieldsetBase, _extends({
|
1008 | role: "group",
|
1009 | "aria-labelledby": legendId,
|
1010 | orientation: orientation
|
1011 | }, other), legendContent &&
|
1012 |
|
1013 | React.createElement(Legend, {
|
1014 | id: legendId
|
1015 | }, legendContent), children)
|
1016 | );
|
1017 | }
|
1018 |
|
1019 | Fieldset.propTypes = process.env.NODE_ENV !== "production" ? {
|
1020 |
|
1021 | legendContent: PropTypes.node,
|
1022 | children: PropTypes.node
|
1023 | } : {};
|
1024 | Fieldset.defaultProps = {
|
1025 | legendContent: null,
|
1026 | children: undefined
|
1027 | };
|
1028 | Fieldset.Legend = Legend;
|
1029 |
|
1030 | function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { keys.push.apply(keys, _Object$getOwnPropertySymbols(object)); } if (enumerableOnly) keys = _filterInstanceProperty(keys).call(keys, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
1031 |
|
1032 | function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys$2(source, true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys$2(source)).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
1033 |
|
1034 | var Fade = function Fade(_ref) {
|
1035 | var children = _ref.children,
|
1036 | duration = _ref.duration,
|
1037 | opacity = _ref.opacity,
|
1038 | otherProps = _objectWithoutProperties(_ref, ["children", "duration", "opacity"]);
|
1039 |
|
1040 | var transitionStyles = {
|
1041 | transition: "opacity ".concat(duration, "ms linear"),
|
1042 | opacity: 0
|
1043 | };
|
1044 | var stateStyles = {
|
1045 | entering: {
|
1046 | opacity: opacity
|
1047 | },
|
1048 | entered: {
|
1049 | opacity: opacity
|
1050 | }
|
1051 | };
|
1052 | return (
|
1053 |
|
1054 | React.createElement(Transition, _extends({}, otherProps, {
|
1055 | timeout: duration
|
1056 | }), function (state, innerProps) {
|
1057 | return (
|
1058 |
|
1059 | React.cloneElement(children, _objectSpread$2(_objectSpread$2({}, innerProps), {}, {
|
1060 | style: _objectSpread$2(_objectSpread$2(_objectSpread$2({}, children.props.style), transitionStyles), stateStyles[state])
|
1061 | }))
|
1062 | );
|
1063 | })
|
1064 | );
|
1065 | };
|
1066 |
|
1067 | Fade.propTypes = process.env.NODE_ENV !== "production" ? {
|
1068 | children: PropTypes.any.isRequired,
|
1069 | duration: PropTypes.number,
|
1070 | opacity: PropTypes.number
|
1071 | } : {};
|
1072 | Fade.defaultProps = {
|
1073 | duration: 150,
|
1074 | opacity: 1
|
1075 | };
|
1076 |
|
1077 | function darken(color, percent) {
|
1078 | return tinycolor(color).darken(percent).toHexString();
|
1079 | }
|
1080 | function getTextColor(bgColor) {
|
1081 | var darkestColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'black';
|
1082 | var lightestColor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'white';
|
1083 | return tinycolor.readability(darkestColor, bgColor) > 10 ? darkestColor : lightestColor;
|
1084 | }
|
1085 |
|
1086 | var StyledButton = styled.button(["background-color:transparent;border:none;box-shadow:none;cursor:pointer;color:", ";font-size:inherit;line-height:", ";padding:0;text-decoration:underline;&:hover,&:focus,&:active{color:", ";text-decoration:none;}&:active{box-shadow:none;}&[disabled]:hover{color:", ";text-decoration:underline;}"], function (props) {
|
1087 | return props.variant.textColor;
|
1088 | }, function (props) {
|
1089 | return props.theme.font.baseLineHeight;
|
1090 | }, function (props) {
|
1091 | return darken(props.variant.textColor, 10);
|
1092 | }, function (props) {
|
1093 | return props.variant.textColor;
|
1094 | });
|
1095 | var LinkButton =
|
1096 |
|
1097 | React.forwardRef(function LinkButton(props, ref) {
|
1098 | var children = props.children,
|
1099 | styleType = props.styleType,
|
1100 | other = _objectWithoutProperties(props, ["children", "styleType"]);
|
1101 |
|
1102 | var theme = useTheme();
|
1103 | var variant = theme.buttonStyles.linkButton.variant[styleType];
|
1104 | return (
|
1105 |
|
1106 | React.createElement(StyledButton, _extends({
|
1107 | ref: ref,
|
1108 | variant: variant,
|
1109 | type: "button"
|
1110 | }, other), children)
|
1111 | );
|
1112 | });
|
1113 | LinkButton.propTypes = process.env.NODE_ENV !== "production" ? {
|
1114 | children: PropTypes.node.isRequired,
|
1115 |
|
1116 |
|
1117 | styleType: PropTypes.string
|
1118 | } : {};
|
1119 | LinkButton.defaultProps = {
|
1120 | styleType: 'default'
|
1121 | };
|
1122 |
|
1123 | var StyledButton$1 = styled(LinkButton)(["text-decoration:", ";&:hover,:focus{text-decoration:", ";}"], function (props) {
|
1124 | return props.suppressUnderline ? 'none' : "".concat(props.variant.textColor, " dashed underline");
|
1125 | }, function (props) {
|
1126 | return props.suppressUnderline ? 'none' : "".concat(props.variant.textColor, " solid underline");
|
1127 | });
|
1128 | var PopoverLink =
|
1129 |
|
1130 | React.forwardRef(function PopoverLink(props, ref) {
|
1131 | var children = props.children,
|
1132 | styleType = props.styleType,
|
1133 | suppressUnderline = props.suppressUnderline,
|
1134 | other = _objectWithoutProperties(props, ["children", "styleType", "suppressUnderline"]);
|
1135 |
|
1136 | var theme = useTheme();
|
1137 | var variant = theme.buttonStyles.linkButton.variant[styleType];
|
1138 | return (
|
1139 |
|
1140 | React.createElement(StyledButton$1, _extends({
|
1141 | ref: ref,
|
1142 | variant: variant,
|
1143 | suppressUnderline: suppressUnderline
|
1144 | }, other), children)
|
1145 | );
|
1146 | });
|
1147 | PopoverLink.propTypes = process.env.NODE_ENV !== "production" ? {
|
1148 | children: PropTypes.node.isRequired,
|
1149 |
|
1150 |
|
1151 | styleType: PropTypes.string,
|
1152 |
|
1153 |
|
1154 | suppressUnderline: PropTypes.bool
|
1155 | } : {};
|
1156 | PopoverLink.defaultProps = {
|
1157 | styleType: 'primary',
|
1158 | suppressUnderline: false
|
1159 | };
|
1160 |
|
1161 | function useRootNode(initialRoot) {
|
1162 | var _useState = useState(initialRoot),
|
1163 | _useState2 = _slicedToArray(_useState, 2),
|
1164 | rootNode = _useState2[0],
|
1165 | setRootNode = _useState2[1];
|
1166 |
|
1167 | var nodeRef = useCallback(function (node) {
|
1168 | if (!node) return;
|
1169 | var foundRoot = node.getRootNode();
|
1170 | var targetNode = foundRoot.body || foundRoot;
|
1171 | if (initialRoot !== targetNode) setRootNode(targetNode);
|
1172 | }, []);
|
1173 | return [rootNode, nodeRef];
|
1174 | }
|
1175 | function useRootNodeLocator(initialRoot) {
|
1176 | var _useRootNode = useRootNode(initialRoot),
|
1177 | _useRootNode2 = _slicedToArray(_useRootNode, 2),
|
1178 | rootNode = _useRootNode2[0],
|
1179 | rootNodeRef = _useRootNode2[1];
|
1180 |
|
1181 | var RootNodeInput = useCallback(function () {
|
1182 | return (
|
1183 |
|
1184 | React.createElement("input", {
|
1185 | type: "hidden",
|
1186 | ref: rootNodeRef
|
1187 | })
|
1188 | );
|
1189 | }, []);
|
1190 | return [rootNode, RootNodeInput];
|
1191 | }
|
1192 |
|
1193 | var TooltipBase = styled.div(["position:absolute;z-index:999;"]);
|
1194 | var TooltipInner = styled.div(["background-color:", ";border-radius:2px;color:", ";font-family:'Source Sans Pro','Segoe UI',Segoe,Calibri,Tahoma,sans-serif;font-size:15px;line-height:", ";max-width:250px;padding:3px 8px;text-align:left;"], function (props) {
|
1195 | return props.theme.colors.primary;
|
1196 | }, function (props) {
|
1197 | return props.theme.colors.white;
|
1198 | }, function (props) {
|
1199 | return props.theme.font.baseLineHeight;
|
1200 | });
|
1201 | var TooltipArrowBase = styled.div(["border-color:transparent;border-style:solid;height:0;position:absolute;width:0;"]);
|
1202 | var TooltipTop = styled(TooltipBase)(["padding:5px 0;"]);
|
1203 | var TooltipRight = styled(TooltipBase)(["padding:0 5px;"]);
|
1204 | var TooltipBottom = styled(TooltipBase)(["padding:5px 0;"]);
|
1205 | var TooltipLeft = styled(TooltipBase)(["padding:0 5px;"]);
|
1206 | var TooltipArrowTop = styled(TooltipArrowBase)(["border-top-color:", ";border-width:5px 5px 0;bottom:0;"], function (props) {
|
1207 | return props.theme.colors.primary;
|
1208 | });
|
1209 | var TooltipArrowRight = styled(TooltipArrowBase)(["border-right-color:", ";border-width:5px 5px 5px 0;left:0;"], function (props) {
|
1210 | return props.theme.colors.primary;
|
1211 | });
|
1212 | var TooltipArrowBottom = styled(TooltipArrowBase)(["border-bottom-color:", ";border-width:0 5px 5px;top:0;"], function (props) {
|
1213 | return props.theme.colors.primary;
|
1214 | });
|
1215 | var TooltipArrowLeft = styled(TooltipArrowBase)(["border-left-color:", ";border-width:5px 0 5px 5px;right:0;"], function (props) {
|
1216 | return props.theme.colors.primary;
|
1217 | });
|
1218 | var ScreenReaderContent = screenReaderOnly('div');
|
1219 |
|
1220 | function Tooltip(props) {
|
1221 | var _useState = useState(false),
|
1222 | _useState2 = _slicedToArray(_useState, 2),
|
1223 | show = _useState2[0],
|
1224 | setShow = _useState2[1];
|
1225 |
|
1226 | var name = props.name,
|
1227 | disableHover = props.disableHover,
|
1228 | disableFocus = props.disableFocus,
|
1229 | position = props.position,
|
1230 | content = props.content,
|
1231 | styleType = props.styleType,
|
1232 | children = props.children,
|
1233 | other = _objectWithoutProperties(props, ["name", "disableHover", "disableFocus", "position", "content", "styleType", "children"]);
|
1234 |
|
1235 | var TooltipStyled;
|
1236 | var TooltipArrow;
|
1237 | var tooltipId = name ? "es-tooltip__".concat(name) : undefined;
|
1238 |
|
1239 | var _useRootNode = useRootNode(document.body),
|
1240 | _useRootNode2 = _slicedToArray(_useRootNode, 2),
|
1241 | rootNode = _useRootNode2[0],
|
1242 | rootNodeRef = _useRootNode2[1];
|
1243 |
|
1244 | switch (position) {
|
1245 | case 'right':
|
1246 | TooltipStyled = TooltipRight;
|
1247 | TooltipArrow = TooltipArrowRight;
|
1248 | break;
|
1249 |
|
1250 | case 'bottom':
|
1251 | TooltipStyled = TooltipBottom;
|
1252 | TooltipArrow = TooltipArrowBottom;
|
1253 | break;
|
1254 |
|
1255 | case 'left':
|
1256 | TooltipStyled = TooltipLeft;
|
1257 | TooltipArrow = TooltipArrowLeft;
|
1258 | break;
|
1259 |
|
1260 | default:
|
1261 | TooltipStyled = TooltipTop;
|
1262 | TooltipArrow = TooltipArrowTop;
|
1263 | break;
|
1264 | }
|
1265 |
|
1266 | function showTooltip() {
|
1267 | setShow(true);
|
1268 | }
|
1269 |
|
1270 | function hideTooltip() {
|
1271 | setShow(false);
|
1272 | }
|
1273 |
|
1274 | function toggleShow() {
|
1275 | setShow(!show);
|
1276 | }
|
1277 |
|
1278 | function closeOnEscape(event) {
|
1279 | if (event.keyCode === 27) {
|
1280 | setShow(false);
|
1281 | }
|
1282 | }
|
1283 |
|
1284 | var descriptionId = "".concat(useUniqueId(other.id), "-description");
|
1285 | return (
|
1286 |
|
1287 | React.createElement(Manager, null,
|
1288 |
|
1289 | React.createElement(Reference, null, function (_ref) {
|
1290 | var _ref2 = _ref.ref;
|
1291 | return (
|
1292 |
|
1293 | React.createElement(PopoverLink, {
|
1294 | ref: function ref(el) {
|
1295 | _ref2(el);
|
1296 |
|
1297 | rootNodeRef(el);
|
1298 | },
|
1299 | onBlur: hideTooltip,
|
1300 | onFocus: !disableFocus ? showTooltip : undefined,
|
1301 | onMouseEnter: !disableHover ? showTooltip : undefined,
|
1302 | onMouseLeave: !disableHover ? hideTooltip : undefined,
|
1303 | onKeyDown: closeOnEscape,
|
1304 | onClick: toggleShow,
|
1305 | "aria-describedby": descriptionId,
|
1306 | styleType: styleType
|
1307 | }, children)
|
1308 | );
|
1309 | }),
|
1310 |
|
1311 | React.createElement(ScreenReaderContent, {
|
1312 | id: descriptionId
|
1313 | }, content),
|
1314 |
|
1315 | ReactDOM.createPortal(
|
1316 |
|
1317 | React.createElement(Popper, {
|
1318 | placement: position
|
1319 | }, function (_ref3) {
|
1320 | var ref = _ref3.ref,
|
1321 | style = _ref3.style,
|
1322 | placement = _ref3.placement,
|
1323 | arrowProps = _ref3.arrowProps;
|
1324 | return (
|
1325 |
|
1326 | React.createElement(Fade, {
|
1327 | in: show,
|
1328 | mountOnEnter: true,
|
1329 | unmountOnExit: true
|
1330 | },
|
1331 |
|
1332 | React.createElement(TooltipStyled, _extends({
|
1333 | ref: ref,
|
1334 | role: "tooltip",
|
1335 | id: tooltipId,
|
1336 | style: style,
|
1337 | "aria-live": "polite"
|
1338 | }, other),
|
1339 |
|
1340 | React.createElement(TooltipArrow, {
|
1341 | ref: arrowProps.ref,
|
1342 | style: arrowProps.style
|
1343 | }),
|
1344 |
|
1345 | React.createElement(TooltipInner, null, content)))
|
1346 | );
|
1347 | }), rootNode))
|
1348 | );
|
1349 | }
|
1350 |
|
1351 | Tooltip.propTypes = process.env.NODE_ENV !== "production" ? {
|
1352 | name: PropTypes.string.isRequired,
|
1353 | children: PropTypes.any.isRequired,
|
1354 |
|
1355 |
|
1356 | content: PropTypes.node.isRequired,
|
1357 |
|
1358 |
|
1359 | position: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
1360 |
|
1361 |
|
1362 | disableHover: PropTypes.bool,
|
1363 |
|
1364 |
|
1365 | disableFocus: PropTypes.bool,
|
1366 |
|
1367 |
|
1368 | styleType: PropTypes.string
|
1369 | } : {};
|
1370 | Tooltip.defaultProps = {
|
1371 | position: 'top',
|
1372 | disableHover: false,
|
1373 | disableFocus: false,
|
1374 | styleType: undefined
|
1375 | };
|
1376 |
|
1377 | var StyledButton$2 = styled.button(["background-color:", ";border:2px solid transparent;border-color:", ";border-bottom-left-radius:", ";border-bottom-right-radius:", ";border-top-left-radius:", ";border-top-right-radius:", ";box-sizing:border-box;color:", ";cursor:pointer;display:", ";font-family:inherit;font-size:", ";font-weight:", ";line-height:", ";min-width:100px;padding-bottom:", ";padding-left:", ";padding-right:", ";padding-top:", ";position:relative;text-align:center;text-decoration:none;text-transform:", ";transition:color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out;user-select:none;vertical-align:middle;white-space:nowrap;width:", ";@media (min-width:", "){display:", ";width:", ";}@media (hover:hover),(-ms-high-contrast:none){&:hover{color:", ";background-color:", ";border-color:", ";text-decoration:none;}}&:focus{color:", ";background-color:", ";border-color:", ";box-shadow:0 1px 1px rgba(0,0,0,0.075),0 0 0 0.2rem ", ";outline:0;}&:active,&.pressed{color:", ";background-color:", ";border-color:", ";box-shadow:inset 0 3px 5px rgba(0,0,0,0.25);}&:active:focus,&.pressed:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,0.25),0 0 0 0.2rem ", ";}&[disabled]{color:#ccc;cursor:not-allowed;background-color:#e6e6e6;border-color:#e6e6e6;&:hover{background-color:#e6e6e6;border-color:#e6e6e6;color:#ccc;}> *{pointer-events:none;}}"], function (props) {
|
1378 | return props.colors.bgColor;
|
1379 | }, function (props) {
|
1380 | return props.colors.bgColor;
|
1381 | }, function (props) {
|
1382 | return props.borderRadii.bottomLeft;
|
1383 | }, function (props) {
|
1384 | return props.borderRadii.bottomRight;
|
1385 | }, function (props) {
|
1386 | return props.borderRadii.topLeft;
|
1387 | }, function (props) {
|
1388 | return props.borderRadii.topRight;
|
1389 | }, function (props) {
|
1390 | return props.colors.textColor;
|
1391 | }, function (props) {
|
1392 | return props.mobileBlock ? 'block' : 'inline-block';
|
1393 | }, function (props) {
|
1394 | return props.buttonSize.fontSize;
|
1395 | }, function (props) {
|
1396 | return props.buttonSize.fontWeight || 'normal';
|
1397 | }, function (props) {
|
1398 | return props.buttonSize.lineHeight ? props.buttonSize.lineHeight : props.theme.font.baseLineHeight;
|
1399 | }, function (props) {
|
1400 | return props.buttonSize.paddingBottom;
|
1401 | }, function (props) {
|
1402 | return props.buttonSize.paddingSides;
|
1403 | }, function (props) {
|
1404 | return props.buttonSize.paddingSides;
|
1405 | }, function (props) {
|
1406 | return props.buttonSize.paddingTop;
|
1407 | }, function (props) {
|
1408 | return props.buttonSize.textTransform ? props.buttonSize.textTransform : 'none';
|
1409 | }, function (props) {
|
1410 | return props.mobileBlock ? '100%' : 'auto';
|
1411 | }, function (props) {
|
1412 | return props.theme.screenSize.tablet;
|
1413 | }, function (props) {
|
1414 | return props.block ? 'block' : 'inline-block';
|
1415 | }, function (props) {
|
1416 | return props.block ? '100%' : 'auto';
|
1417 | }, function (props) {
|
1418 | return props.colors.hoverTextColor;
|
1419 | }, function (props) {
|
1420 | return props.colors.hoverBgColor;
|
1421 | }, function (props) {
|
1422 | return props.colors.hoverBorderColor;
|
1423 | }, function (props) {
|
1424 | return props.colors.hoverTextColor;
|
1425 | }, function (props) {
|
1426 | return props.colors.hoverBgColor;
|
1427 | }, function (props) {
|
1428 | return props.colors.hoverBorderColor;
|
1429 | }, function (props) {
|
1430 | return props.colors.focusBoxShadowColor;
|
1431 | }, function (props) {
|
1432 | return props.colors.activeTextColor;
|
1433 | }, function (props) {
|
1434 | return props.colors.activeBgColor;
|
1435 | }, function (props) {
|
1436 | return props.colors.activeBorderColor;
|
1437 | }, function (props) {
|
1438 | return props.colors.focusBoxShadowColor;
|
1439 | });
|
1440 | var Button =
|
1441 |
|
1442 | React.forwardRef(function Button(_ref, ref) {
|
1443 | var children = _ref.children,
|
1444 | styleType = _ref.styleType,
|
1445 | size = _ref.size,
|
1446 | block = _ref.block,
|
1447 | mobileBlock = _ref.mobileBlock,
|
1448 | flatLeftEdge = _ref.flatLeftEdge,
|
1449 | flatRightEdge = _ref.flatRightEdge,
|
1450 | other = _objectWithoutProperties(_ref, ["children", "styleType", "size", "block", "mobileBlock", "flatLeftEdge", "flatRightEdge"]);
|
1451 |
|
1452 | var theme = useTheme();
|
1453 | var buttonSize = theme.buttonStyles.button.size[size];
|
1454 | var variant = theme.buttonStyles.button.variant[styleType];
|
1455 | var isInheritedStyle = styleType === 'inherited';
|
1456 | var mobileBlockSetting = flatLeftEdge || flatRightEdge ? false : mobileBlock;
|
1457 | var defaultRadius = buttonSize.borderRadius;
|
1458 | var borderRadii = {
|
1459 | topLeft: flatLeftEdge ? 0 : defaultRadius,
|
1460 | topRight: flatRightEdge ? 0 : defaultRadius,
|
1461 | bottomRight: flatRightEdge ? 0 : defaultRadius,
|
1462 | bottomLeft: flatLeftEdge ? 0 : defaultRadius
|
1463 | };
|
1464 |
|
1465 | function getButtonColors() {
|
1466 | if (isInheritedStyle) {
|
1467 | return {
|
1468 | bgColor: 'inherited',
|
1469 | textColor: 'inherited',
|
1470 | borderColor: 'inherited',
|
1471 | hoverBgColor: 'inherited',
|
1472 | focusBoxShadowColor: theme.colors.gray4,
|
1473 | activeBgColor: 'inherited',
|
1474 | activeTextColor: 'inherited',
|
1475 | activeBorderColor: 'inherited',
|
1476 | hoverTextColor: 'inherited'
|
1477 | };
|
1478 | }
|
1479 |
|
1480 | var focusBoxShadowColor = tinycolor.mix(variant.bgColor, theme.colors.black, 14);
|
1481 | focusBoxShadowColor.setAlpha(0.5);
|
1482 | var calculatedButtonColors = {
|
1483 | bgColor: variant.bgColor,
|
1484 | textColor: getTextColor(variant.bgColor),
|
1485 | borderColor: variant.bgColor,
|
1486 | hoverBgColor: darken(variant.bgColor, 7.5),
|
1487 | hoverBorderColor: darken(variant.bgColor, 9.9),
|
1488 | focusBoxShadowColor: focusBoxShadowColor.toRgbString()
|
1489 | };
|
1490 | calculatedButtonColors.activeBgColor = darken(calculatedButtonColors.hoverBgColor, 2.5);
|
1491 | calculatedButtonColors.activeTextColor = getTextColor(calculatedButtonColors.activeBgColor);
|
1492 | calculatedButtonColors.activeBorderColor = darken(calculatedButtonColors.hoverBgColor, 5);
|
1493 | calculatedButtonColors.hoverTextColor = getTextColor(calculatedButtonColors.hoverBgColor);
|
1494 | return calculatedButtonColors;
|
1495 | }
|
1496 |
|
1497 | var buttonColors = getButtonColors();
|
1498 | return (
|
1499 |
|
1500 | React.createElement(StyledButton$2, _extends({
|
1501 | type: "button",
|
1502 | block: block,
|
1503 | mobileBlock: mobileBlockSetting,
|
1504 | buttonSize: buttonSize,
|
1505 | colors: buttonColors,
|
1506 | ref: ref,
|
1507 | borderRadii: borderRadii
|
1508 | }, other), children)
|
1509 | );
|
1510 | });
|
1511 | Button.propTypes = process.env.NODE_ENV !== "production" ? {
|
1512 | children: PropTypes.node.isRequired,
|
1513 |
|
1514 |
|
1515 | styleType: PropTypes.string,
|
1516 | size: PropTypes.oneOf(['lg', 'default', 'sm', 'xs']),
|
1517 |
|
1518 |
|
1519 | block: PropTypes.bool,
|
1520 |
|
1521 |
|
1522 | mobileBlock: PropTypes.bool,
|
1523 |
|
1524 |
|
1525 | flatLeftEdge: PropTypes.bool,
|
1526 |
|
1527 |
|
1528 | flatRightEdge: PropTypes.bool
|
1529 | } : {};
|
1530 | Button.defaultProps = {
|
1531 | styleType: 'default',
|
1532 | block: false,
|
1533 | mobileBlock: true,
|
1534 | size: 'default',
|
1535 | flatLeftEdge: false,
|
1536 | flatRightEdge: false
|
1537 | };
|
1538 |
|
1539 | var PopperBox = styled.div(["border:1px solid rgba(0,0,0,0.3);box-shadow:0 5px 10px rgba(0,0,0,0.3);border-radius:2px;margin:", "px;max-width:350px;min-width:270px;position:absolute;text-align:center;z-index:99999;"], function (props) {
|
1540 | return props.arrowSize.marginSize;
|
1541 | });
|
1542 | var Arrow = styled.div(["position:absolute;&::before,&::after{border:solid transparent;content:'';position:absolute;}&[data-placement*='bottom']{top:0;left:0;margin-top:-", "px;&::before{border-width:", ";border-color:transparent;border-bottom-color:", ";margin-left:-", "px;}&::after{border-width:", ";border-color:transparent;border-bottom-color:", ";margin-left:-", "px;}}&[data-placement*='top']{&::before{border-width:", "px;border-color:transparent;border-top-color:", ";margin-left:-", "px;}&::after{border-width:", "px;border-color:transparent;border-top-color:", ";margin-left:-", "px;}}&[data-placement*='right']{margin-left:-", "px;&::before{border-width:", ";border-color:transparent;border-right-color:", ";margin-top:-", "px;}&::after{border-width:", ";border-color:transparent;border-right-color:", ";margin-top:-", "px;}}&[data-placement*='left']{right:0;&::before{border-width:", "px;border-color:transparent;border-left-color:", ";margin-top:-", "px;}&::after{border-width:", "px;border-color:transparent;border-left-color:", ";margin-top:-", "px;}}"], function (props) {
|
1543 | return props.arrowSize.size;
|
1544 | }, function (props) {
|
1545 | return props.arrowSize.bottomBorderWidth;
|
1546 | }, function (props) {
|
1547 | return props.arrowSize.borderColor;
|
1548 | }, function (props) {
|
1549 | return props.arrowSize.borderSize;
|
1550 | }, function (props) {
|
1551 | return props.arrowSize.bottomWidth;
|
1552 | }, function (props) {
|
1553 | return props.hasTitle ? props.theme.colors.primary : props.theme.colors.white;
|
1554 | }, function (props) {
|
1555 | return props.arrowSize.size;
|
1556 | }, function (props) {
|
1557 | return props.arrowSize.borderSize;
|
1558 | }, function (props) {
|
1559 | return props.arrowSize.borderColor;
|
1560 | }, function (props) {
|
1561 | return props.arrowSize.borderSize;
|
1562 | }, function (props) {
|
1563 | return props.arrowSize.size;
|
1564 | }, function (props) {
|
1565 | return props.theme.colors.white;
|
1566 | }, function (props) {
|
1567 | return props.arrowSize.size;
|
1568 | }, function (props) {
|
1569 | return props.arrowSize.size;
|
1570 | }, function (props) {
|
1571 | return props.arrowSize.rightBorderWidth;
|
1572 | }, function (props) {
|
1573 | return props.arrowSize.borderColor;
|
1574 | }, function (props) {
|
1575 | return props.arrowSize.borderSize;
|
1576 | }, function (props) {
|
1577 | return props.arrowSize.rightWidth;
|
1578 | }, function (props) {
|
1579 | return props.theme.colors.white;
|
1580 | }, function (props) {
|
1581 | return props.arrowSize.size;
|
1582 | }, function (props) {
|
1583 | return props.arrowSize.borderSize;
|
1584 | }, function (props) {
|
1585 | return props.arrowSize.borderColor;
|
1586 | }, function (props) {
|
1587 | return props.arrowSize.borderSize;
|
1588 | }, function (props) {
|
1589 | return props.arrowSize.size;
|
1590 | }, function (props) {
|
1591 | return props.theme.colors.white;
|
1592 | }, function (props) {
|
1593 | return props.arrowSize.size;
|
1594 | });
|
1595 | var arrowSizes = {
|
1596 | sm: {
|
1597 | size: '5',
|
1598 | borderSize: '6',
|
1599 | marginSize: '10',
|
1600 | bottomWidth: '0 5px 5px',
|
1601 | bottomBorderWidth: '0 6px 5px',
|
1602 | rightWidth: '5px 5px 5px 0',
|
1603 | rightBorderWidth: '6px 5px 6px 0',
|
1604 | borderColor: 'rgba(0, 0, 0, 0.3)'
|
1605 | },
|
1606 | md: {
|
1607 | size: '10',
|
1608 | borderSize: '11',
|
1609 | marginSize: '15',
|
1610 | bottomWidth: '0 10px 10px',
|
1611 | bottomBorderWidth: '0 11px 10px',
|
1612 | rightWidth: '10px 10px 10px 0',
|
1613 | rightBorderWidth: '11px 10px 11px 0',
|
1614 | borderColor: 'rgba(0, 0, 0, 0.3)'
|
1615 | },
|
1616 | lg: {
|
1617 | size: '20',
|
1618 | borderSize: '21',
|
1619 | marginSize: '30',
|
1620 | bottomWidth: '0 20px 20px',
|
1621 | bottomBorderWidth: '0 21px 20px',
|
1622 | rightWidth: '20px 20px 20px 0',
|
1623 | rightBorderWidth: '21px 20px 21px 0',
|
1624 | borderColor: 'rgba(0, 0, 0, 0.3)'
|
1625 | },
|
1626 | none: {
|
1627 | size: '0',
|
1628 | borderSize: '0',
|
1629 | marginSize: '10'
|
1630 | }
|
1631 | };
|
1632 |
|
1633 | function getArrowValues(size) {
|
1634 | switch (size) {
|
1635 | case 'sm':
|
1636 | return arrowSizes.sm;
|
1637 |
|
1638 | case 'lg':
|
1639 | return arrowSizes.lg;
|
1640 |
|
1641 | case 'none':
|
1642 | return arrowSizes.none;
|
1643 |
|
1644 | default:
|
1645 | return arrowSizes.md;
|
1646 | }
|
1647 | }
|
1648 |
|
1649 | function Popup(props) {
|
1650 | var name = props.name,
|
1651 | trigger = props.trigger,
|
1652 | children = props.children,
|
1653 | position = props.position,
|
1654 | arrowSize = props.arrowSize,
|
1655 | hasTitle = props.hasTitle,
|
1656 | transitionIn = props.transitionIn,
|
1657 | transitionTimeout = props.transitionTimeout,
|
1658 | disableFlipping = props.disableFlipping,
|
1659 | popperRef = props.popperRef,
|
1660 | enableEvents = props.enableEvents,
|
1661 | strategy = props.strategy;
|
1662 | var arrowValues = getArrowValues(arrowSize);
|
1663 |
|
1664 | var _useRootNode = useRootNode(document.body),
|
1665 | _useRootNode2 = _slicedToArray(_useRootNode, 2),
|
1666 | rootNode = _useRootNode2[0],
|
1667 | rootNodeRef = _useRootNode2[1];
|
1668 |
|
1669 | return (
|
1670 |
|
1671 | React.createElement(Manager, null,
|
1672 |
|
1673 | React.createElement(Reference, null, function (_ref) {
|
1674 | var _ref2 = _ref.ref;
|
1675 | return (
|
1676 |
|
1677 | React.createElement("div", {
|
1678 | className: "".concat(name, "-popper__trigger"),
|
1679 | ref: function ref(el) {
|
1680 | _ref2(el);
|
1681 |
|
1682 | rootNodeRef(el);
|
1683 | }
|
1684 | }, trigger)
|
1685 | );
|
1686 | }),
|
1687 |
|
1688 | ReactDOM.createPortal(
|
1689 |
|
1690 | React.createElement(Popper, {
|
1691 | className: "".concat(name, "-popper"),
|
1692 | placement: position,
|
1693 | modifiers: {
|
1694 | preventOverflow: {
|
1695 | boundariesElement: document.body
|
1696 | },
|
1697 | flip: {
|
1698 | enabled: !disableFlipping,
|
1699 | behavior: ['left', 'right', 'top', 'bottom', 'top']
|
1700 | }
|
1701 | },
|
1702 | innerRef: popperRef,
|
1703 | eventsEnabled: enableEvents,
|
1704 | positionFixed: strategy === 'fixed'
|
1705 | }, function (_ref3) {
|
1706 | var ref = _ref3.ref,
|
1707 | style = _ref3.style,
|
1708 | placement = _ref3.placement,
|
1709 | arrowProps = _ref3.arrowProps;
|
1710 | return (
|
1711 |
|
1712 | React.createElement(Fade, {
|
1713 | in: transitionIn,
|
1714 | duration: transitionTimeout,
|
1715 | mountOnEnter: true,
|
1716 | unmountOnExit: true
|
1717 | },
|
1718 |
|
1719 | React.createElement(PopperBox, {
|
1720 | ref: ref,
|
1721 | style: style,
|
1722 | arrowSize: arrowValues
|
1723 | }, children,
|
1724 |
|
1725 | React.createElement(Arrow, {
|
1726 | ref: arrowProps.ref,
|
1727 | "data-placement": placement,
|
1728 | style: arrowProps.style,
|
1729 | arrowSize: arrowValues,
|
1730 | hasTitle: hasTitle
|
1731 | })))
|
1732 | );
|
1733 | }), rootNode))
|
1734 | );
|
1735 | }
|
1736 |
|
1737 | Popup.propTypes = process.env.NODE_ENV !== "production" ? {
|
1738 | name: PropTypes.string,
|
1739 | trigger: PropTypes.node,
|
1740 | children: PropTypes.node,
|
1741 | position: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
1742 | arrowSize: PropTypes.oneOf(['sm', 'lg', 'none', 'default']),
|
1743 | transitionIn: PropTypes.bool,
|
1744 | transitionTimeout: PropTypes.number,
|
1745 | hasTitle: PropTypes.bool,
|
1746 | disableFlipping: PropTypes.bool,
|
1747 | popperRef: PropTypes.func,
|
1748 | enableEvents: PropTypes.bool,
|
1749 | strategy: PropTypes.oneOf(['absolute', 'fixed'])
|
1750 | } : {};
|
1751 | Popup.defaultProps = {
|
1752 | name: '',
|
1753 | trigger: undefined,
|
1754 | children: undefined,
|
1755 | position: 'bottom',
|
1756 | arrowSize: 'default',
|
1757 | transitionIn: false,
|
1758 | transitionTimeout: 150,
|
1759 | hasTitle: false,
|
1760 | disableFlipping: false,
|
1761 | popperRef: undefined,
|
1762 | enableEvents: true,
|
1763 | strategy: 'absolute'
|
1764 | };
|
1765 |
|
1766 | var RootCloseWrapper = function RootCloseWrapper(_ref) {
|
1767 | var children = _ref.children,
|
1768 | onRootClose = _ref.onRootClose,
|
1769 | disabled = _ref.disabled,
|
1770 | className = _ref.className;
|
1771 | var ref = useRef();
|
1772 | useRootClose(ref, onRootClose, {
|
1773 | disabled: disabled
|
1774 | });
|
1775 | return (
|
1776 |
|
1777 | React.createElement("div", {
|
1778 | ref: ref,
|
1779 | className: "root-close-wrapper ".concat(className)
|
1780 | }, children)
|
1781 | );
|
1782 | };
|
1783 |
|
1784 | var Container = styled.div(["display:inline-block;"]);
|
1785 | var PopoverHeader = styled.div(["background-color:", ";color:", ";display:flex;justify-content:space-between;line-height:", ";outline:none;"], function (props) {
|
1786 | return props.hasTitle ? props.theme.colors.primary : props.theme.colors.white;
|
1787 | }, function (props) {
|
1788 | return props.theme.colors.white;
|
1789 | }, function (props) {
|
1790 | return props.theme.font.baseLineHeight;
|
1791 | });
|
1792 | var TitleBar = styled.h3(["flex:1 1;font-size:18px;margin:0;padding:8px 14px;text-align:left;"]);
|
1793 | var PopoverBody = styled.div(["background:", ";color:", ";font-size:18px;font-weight:normal;line-height:", ";padding:", ";text-align:right;"], function (props) {
|
1794 | return props.theme.colors.white;
|
1795 | }, function (props) {
|
1796 | return props.theme.colors.gray9;
|
1797 | }, function (props) {
|
1798 | return props.theme.font.baseLineHeight;
|
1799 | }, function (props) {
|
1800 | return props.hasAltCloseWithNoTitle ? '0 14px 8px' : '8px 14px';
|
1801 | });
|
1802 | var PopoverContent = styled.div(["margin-bottom:", ";text-align:left;"], function (props) {
|
1803 | return props.showCloseButton ? '8px' : '0';
|
1804 | });
|
1805 | var PopoverCloseButton = styled(Button)(["display:inline-block;margin:5px 0;width:auto;"]);
|
1806 | var AltCloseButton = styled(DismissButton)(["color:", ";flex:0 1;margin-left:auto;padding:8px;"], function (props) {
|
1807 | return props.hasTitle ? props.theme.colors.white : props.theme.colors.black;
|
1808 | });
|
1809 | var CloseHelpText = styled.span(["color:transparent;flex:none;height:1px;outline:0;width:1px;"]);
|
1810 |
|
1811 | function Popover(props) {
|
1812 | var name = props.name,
|
1813 | title = props.title,
|
1814 | content = props.content,
|
1815 | placement = props.placement,
|
1816 | arrowSize = props.arrowSize,
|
1817 | renderTrigger = props.renderTrigger,
|
1818 | hasCloseButton = props.hasCloseButton,
|
1819 | hasAltCloseButton = props.hasAltCloseButton,
|
1820 | disableRootClose = props.disableRootClose,
|
1821 | disableFlipping = props.disableFlipping,
|
1822 | enableEvents = props.enableEvents,
|
1823 | strategy = props.strategy;
|
1824 | var hasTitle = title !== undefined;
|
1825 | var hasAltCloseWithNoTitle = !hasTitle && hasAltCloseButton;
|
1826 | var showCloseButton = hasCloseButton && !hasAltCloseButton;
|
1827 | var isFirstRun = useRef(true);
|
1828 | var triggerBtnRef = useRef(null);
|
1829 |
|
1830 | var _popperRef = useRef(null);
|
1831 |
|
1832 | var contentRef = useRef(null);
|
1833 | var escMsgRef = useRef(null);
|
1834 | var closeBtnRef = useRef(null);
|
1835 | var timeoutRef = useRef(null);
|
1836 |
|
1837 | var _useState = useState(false),
|
1838 | _useState2 = _slicedToArray(_useState, 2),
|
1839 | isOpen = _useState2[0],
|
1840 | setIsOpen = _useState2[1];
|
1841 |
|
1842 | function toggleShow(event) {
|
1843 | event.preventDefault();
|
1844 | event.stopPropagation();
|
1845 | setIsOpen(!isOpen);
|
1846 | }
|
1847 |
|
1848 | function hidePopover(event) {
|
1849 | if (isOpen) {
|
1850 | if (event.type !== 'click') {
|
1851 | triggerBtnRef.current.focus();
|
1852 | }
|
1853 |
|
1854 | setIsOpen(false);
|
1855 | }
|
1856 | }
|
1857 |
|
1858 | function hidePopOnScroll() {
|
1859 | _setInterval(function () {
|
1860 | if (_popperRef.current) {
|
1861 | var bounds = _popperRef.current.getBoundingClientRect();
|
1862 |
|
1863 | var inViewport = bounds.top >= 0 && bounds.bottom <= window.innerHeight;
|
1864 |
|
1865 | if (!inViewport && isOpen) {
|
1866 | setIsOpen(false);
|
1867 | }
|
1868 | }
|
1869 | }, 100);
|
1870 | }
|
1871 |
|
1872 | useEffect(function () {
|
1873 | if (isFirstRun.current) {
|
1874 | isFirstRun.current = false;
|
1875 | return;
|
1876 | }
|
1877 |
|
1878 | if (timeoutRef.current !== null) {
|
1879 | clearTimeout(timeoutRef.current);
|
1880 | }
|
1881 |
|
1882 | if (isOpen) {
|
1883 | timeoutRef.current = _setTimeout(function () {
|
1884 | if (closeBtnRef.current) {
|
1885 | closeBtnRef.current.focus();
|
1886 | } else if (escMsgRef.current) {
|
1887 | escMsgRef.current.focus();
|
1888 | }
|
1889 | }, 100);
|
1890 | } else {
|
1891 | triggerBtnRef.current.focus();
|
1892 | }
|
1893 | }, [isOpen]);
|
1894 | useEffect(function () {
|
1895 | if (isOpen) {
|
1896 | window.addEventListener('scroll', hidePopOnScroll);
|
1897 | }
|
1898 |
|
1899 | return function () {
|
1900 | return window.removeEventListener('scroll', hidePopOnScroll);
|
1901 | };
|
1902 | }, [isOpen]);
|
1903 | var closeButton =
|
1904 |
|
1905 | React.createElement(PopoverCloseButton, {
|
1906 | onClick: toggleShow,
|
1907 | ref: closeBtnRef
|
1908 | }, "Close");
|
1909 | var altCloseButton =
|
1910 |
|
1911 | React.createElement(AltCloseButton, {
|
1912 | "aria-label": "Close",
|
1913 | hasTitle: hasTitle,
|
1914 | onClick: toggleShow,
|
1915 | ref: closeBtnRef
|
1916 | });
|
1917 | return (
|
1918 |
|
1919 | React.createElement(Container, null,
|
1920 |
|
1921 | React.createElement(Popup, {
|
1922 | name: name,
|
1923 | trigger: renderTrigger({
|
1924 | ref: triggerBtnRef,
|
1925 | toggleShow: toggleShow,
|
1926 | isOpen: isOpen
|
1927 | }),
|
1928 | position: placement,
|
1929 | arrowSize: arrowSize,
|
1930 | transitionIn: isOpen,
|
1931 | hasTitle: hasTitle,
|
1932 | disableFlipping: disableFlipping,
|
1933 | popperRef: function popperRef(elem) {
|
1934 | _popperRef.current = elem;
|
1935 | },
|
1936 | enableEvents: enableEvents,
|
1937 | strategy: strategy
|
1938 | },
|
1939 |
|
1940 | React.createElement(RootCloseWrapper, {
|
1941 | onRootClose: hidePopover,
|
1942 | disabled: disableRootClose
|
1943 | },
|
1944 |
|
1945 | React.createElement("div", {
|
1946 | role: "dialog",
|
1947 | ref: contentRef
|
1948 | },
|
1949 |
|
1950 | React.createElement(PopoverHeader, {
|
1951 | hasTitle: hasTitle
|
1952 | }, hasTitle &&
|
1953 |
|
1954 | React.createElement(TitleBar, null, title), hasAltCloseButton && altCloseButton,
|
1955 |
|
1956 | React.createElement(CloseHelpText, {
|
1957 | tabIndex: -1,
|
1958 | ref: escMsgRef,
|
1959 | "aria-label": "Press escape to close the Popover"
|
1960 | })),
|
1961 |
|
1962 | React.createElement(PopoverBody, {
|
1963 | hasAltCloseWithNoTitle: hasAltCloseWithNoTitle
|
1964 | },
|
1965 |
|
1966 | React.createElement(PopoverContent, {
|
1967 | showCloseButton: showCloseButton
|
1968 | }, content), showCloseButton && closeButton)))))
|
1969 | );
|
1970 | }
|
1971 |
|
1972 | Popover.propTypes = process.env.NODE_ENV !== "production" ? {
|
1973 |
|
1974 | name: PropTypes.string.isRequired,
|
1975 |
|
1976 |
|
1977 | title: PropTypes.string,
|
1978 |
|
1979 |
|
1980 | content: PropTypes.node.isRequired,
|
1981 |
|
1982 |
|
1983 | placement: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
1984 |
|
1985 |
|
1986 | arrowSize: PropTypes.oneOf(['sm', 'lg', 'none', 'default']),
|
1987 |
|
1988 |
|
1989 | disableRootClose: PropTypes.bool,
|
1990 |
|
1991 |
|
1992 | hasCloseButton: PropTypes.bool,
|
1993 |
|
1994 |
|
1995 | hasAltCloseButton: PropTypes.bool,
|
1996 |
|
1997 |
|
1998 | renderTrigger: PropTypes.func.isRequired,
|
1999 |
|
2000 |
|
2001 | disableFlipping: PropTypes.bool,
|
2002 |
|
2003 |
|
2004 | enableEvents: PropTypes.bool,
|
2005 |
|
2006 |
|
2007 | strategy: PropTypes.oneOf(['absolute', 'fixed'])
|
2008 | } : {};
|
2009 | Popover.defaultProps = {
|
2010 | placement: 'bottom',
|
2011 | arrowSize: 'default',
|
2012 | disableRootClose: false,
|
2013 | hasCloseButton: false,
|
2014 | hasAltCloseButton: false,
|
2015 | disableFlipping: false,
|
2016 | title: undefined,
|
2017 | enableEvents: true,
|
2018 | strategy: 'absolute'
|
2019 | };
|
2020 |
|
2021 | var useDisableBodyScroll = function useDisableBodyScroll(shouldDisableScroll) {
|
2022 | useEffect(function () {
|
2023 | var newStyle = 'overflow: hidden;';
|
2024 |
|
2025 | var getCurrentStyle = function getCurrentStyle() {
|
2026 | return document.body.getAttribute('style') || '';
|
2027 | };
|
2028 |
|
2029 | var scrollDisabled = false;
|
2030 |
|
2031 | var disableScroll = function disableScroll() {
|
2032 | var _context;
|
2033 |
|
2034 | scrollDisabled = true;
|
2035 | document.body.setAttribute('style', _concatInstanceProperty(_context = "".concat(getCurrentStyle(), " ")).call(_context, newStyle));
|
2036 | };
|
2037 |
|
2038 | var enableScroll = function enableScroll() {
|
2039 | if (!scrollDisabled) return;
|
2040 | scrollDisabled = false;
|
2041 | document.body.setAttribute('style',
|
2042 | getCurrentStyle().replace(newStyle, ''));
|
2043 | };
|
2044 |
|
2045 | if (shouldDisableScroll) {
|
2046 | disableScroll();
|
2047 | } else {
|
2048 | enableScroll();
|
2049 | }
|
2050 |
|
2051 | return enableScroll;
|
2052 | }, [shouldDisableScroll]);
|
2053 | };
|
2054 |
|
2055 | var ModalContext =
|
2056 |
|
2057 | React.createContext({});
|
2058 |
|
2059 | var Header = styled.div(["align-items:baseline;background-color:", ";border-bottom:2px solid ", ";box-sizing:border-box;color:", ";display:flex;font-size:26px;justify-content:space-between;padding:15px;.small &{@media (min-width:", "){position:static;width:unset;}}.medium &{@media (min-width:", "){position:static;width:unset;}}.large &{@media (min-width:", "){position:static;width:unset;}}"], function (props) {
|
2060 | return props.theme.colors.white;
|
2061 | }, function (props) {
|
2062 | return props.theme.brandColors.primary3;
|
2063 | }, function (props) {
|
2064 | return props.theme.colors.gray9;
|
2065 | }, function (props) {
|
2066 | return props.theme.screenSize.phone;
|
2067 | }, function (props) {
|
2068 | return props.theme.screenSize.tablet;
|
2069 | }, function (props) {
|
2070 | return props.theme.screenSize.desktop;
|
2071 | });
|
2072 | var Title = styled(Heading)(["margin:0;"]);
|
2073 | var DismissModal = styled(DismissButton)(["align-self:center;color:", ";font-size:18px;"], function (props) {
|
2074 | return props.theme.colors.black;
|
2075 | });
|
2076 |
|
2077 | function ModalHeader(props) {
|
2078 | var hideCloseButton = props.hideCloseButton,
|
2079 | children = props.children,
|
2080 | level = props.level,
|
2081 | otherProps = _objectWithoutProperties(props, ["hideCloseButton", "children", "level"]);
|
2082 |
|
2083 | var _useContext = useContext(ModalContext),
|
2084 | onHide = _useContext.onHide,
|
2085 | ariaId = _useContext.ariaId;
|
2086 |
|
2087 | return (
|
2088 |
|
2089 | React.createElement(Header, otherProps,
|
2090 |
|
2091 | React.createElement(Title, {
|
2092 | id: ariaId,
|
2093 | level: level
|
2094 | }, children), !hideCloseButton &&
|
2095 |
|
2096 | React.createElement(DismissModal, {
|
2097 | onClick: onHide
|
2098 | }))
|
2099 | );
|
2100 | }
|
2101 |
|
2102 | ModalHeader.propTypes = process.env.NODE_ENV !== "production" ? {
|
2103 |
|
2104 | hideCloseButton: PropTypes.bool,
|
2105 | children: PropTypes.any,
|
2106 | level: PropTypes.oneOf([1, 2, 3, 4, 5, 6]),
|
2107 | ref: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
2108 | current: PropTypes.any
|
2109 | })])
|
2110 | } : {};
|
2111 | ModalHeader.defaultProps = {
|
2112 | hideCloseButton: false,
|
2113 | children: undefined,
|
2114 | level: 4,
|
2115 | ref: null
|
2116 | };
|
2117 |
|
2118 | var ModalBody = styled.div(["color:", ";padding:15px;.small &{@media (min-width:", "){margin-top:unset;}}.medium &{@media (min-width:", "){margin-top:unset;}}.large &{@media (min-width:", "){margin-top:unset;}}"], function (props) {
|
2119 | return props.theme.colors.gray9;
|
2120 | }, function (props) {
|
2121 | return props.theme.screenSize.phone;
|
2122 | }, function (props) {
|
2123 | return props.theme.screenSize.tablet;
|
2124 | }, function (props) {
|
2125 | return props.theme.screenSize.desktop;
|
2126 | });
|
2127 |
|
2128 | var ModalFooter = styled.div(["align-items:baseline;display:flex;padding:15px 15px 55px;text-align:right;button{width:auto;}@media (min-width:", "){padding:15px 15px 19px;}"], function (props) {
|
2129 | return props.theme.screenSize.tablet;
|
2130 | });
|
2131 |
|
2132 | function _templateObject() {
|
2133 | var data = _taggedTemplateLiteral(["\n .", " {\n .background-overlay {\n bottom: 0;\n background-color: ", ";\n\n left: 0;\n max-height: 100%;\n overflow-y: auto;\n position: fixed;\n right: 0;\n top: 0;\n transition: background-color ", "ms linear;\n z-index: 1030;\n -webkit-overflow-scrolling: touch;\n\n &.ReactModal__Overlay--after-open {\n ", "\n\n &.ReactModal__Overlay--before-close {\n background-color: ", ";\n }\n }\n }\n\n .modal-content {\n background-clip: padding-box;\n background-color: ", ";\n border-radius: 3px;\n box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);\n font-family: 'Source Sans Pro', 'Segoe UI', Segoe, Calibri, Tahoma, sans-serif;\n font-size: ", ";\n margin: 0.5rem;\n outline: 0;\n opacity: 0;\n position: absolute;\n left: 0;\n transform: translateY(0);\n transition:\n transform ", "ms ease-out ", "ms,\n opacity ", "ms ease-out ", "ms;\n ", ";\n\n &.ReactModal__Content--after-open {\n opacity: 1;\n ", ";\n\n &.ReactModal__Content--before-close {\n opacity: 0;\n ", ";\n }\n }\n\n &.small {\n @media (min-width: ", ") {\n position: relative;\n margin: ", "px auto;\n width: ", ";\n }\n }\n\n &.medium {\n @media (min-width: ", ") {\n position: relative;\n margin: ", "px auto;\n width: ", ";\n }\n }\n\n &.large {\n @media (min-width: ", ") {\n position: relative;\n margin: ", "px auto;\n width: ", ";\n }\n }\n }\n }\n"]);
|
2134 |
|
2135 | _templateObject = function _templateObject() {
|
2136 | return data;
|
2137 | };
|
2138 |
|
2139 | return data;
|
2140 | }
|
2141 | var modalSize = {
|
2142 | small: '300px',
|
2143 | medium: '600px',
|
2144 | large: '900px'
|
2145 | };
|
2146 | var animationTimeMs = 300;
|
2147 |
|
2148 | var getModalMargin = function getModalMargin(windowHeight, modalHeight) {
|
2149 | var fullMargin = windowHeight - modalHeight;
|
2150 | var thirdTopMargin = fullMargin / 3;
|
2151 | return Math.max(thirdTopMargin, 50);
|
2152 | };
|
2153 |
|
2154 | var ModalStyles = createGlobalStyle(_templateObject(), function (_ref) {
|
2155 | var theme = _ref.theme;
|
2156 | return theme.portalClassName;
|
2157 | }, function (props) {
|
2158 | var color = tinycolor(props.theme.colors.gray9);
|
2159 | color.setAlpha(0);
|
2160 | return color.toRgbString();
|
2161 | }, function () {
|
2162 | return animationTimeMs / 2;
|
2163 | }, function (props) {
|
2164 | if (!props.showBackdrop) return '';
|
2165 | var color = tinycolor(props.theme.colors.gray9);
|
2166 | color.setAlpha(0.5);
|
2167 | return "background-color: ".concat(color.toRgbString(), ";");
|
2168 | }, function (props) {
|
2169 | var color = tinycolor(props.theme.colors.gray9);
|
2170 | color.setAlpha(0);
|
2171 | return color.toRgbString();
|
2172 | }, function (props) {
|
2173 | return props.theme.colors.white;
|
2174 | }, function (props) {
|
2175 | return props.theme.font.baseFontSize;
|
2176 | }, function () {
|
2177 | return animationTimeMs;
|
2178 | }, function () {
|
2179 | return animationTimeMs / 4;
|
2180 | }, function () {
|
2181 | return animationTimeMs;
|
2182 | }, function () {
|
2183 | return animationTimeMs / 4;
|
2184 | }, function (props) {
|
2185 | return props.showAnimation ? "\n transform: translateY(-50px);\n " : '';
|
2186 | }, function (props) {
|
2187 | return props.showAnimation ? "\n transform: translateY(0);\n " : '';
|
2188 | }, function (props) {
|
2189 | return props.showAnimation ? "\n transform: translateY(-50px);\n " : '';
|
2190 | }, function (props) {
|
2191 | return props.theme.screenSize.phone;
|
2192 | }, function (_ref2) {
|
2193 | var theme = _ref2.theme;
|
2194 | return getModalMargin(theme.windowHeight, theme.modalHeight);
|
2195 | }, modalSize.small, function (props) {
|
2196 | return props.theme.screenSize.tablet;
|
2197 | }, function (_ref3) {
|
2198 | var theme = _ref3.theme;
|
2199 | return getModalMargin(theme.windowHeight, theme.modalHeight);
|
2200 | }, modalSize.medium, function (props) {
|
2201 | return props.theme.screenSize.desktop;
|
2202 | }, function (_ref4) {
|
2203 | var theme = _ref4.theme;
|
2204 | return getModalMargin(theme.windowHeight, theme.modalHeight);
|
2205 | }, modalSize.large);
|
2206 |
|
2207 | function Modal(_ref5) {
|
2208 | var _context;
|
2209 |
|
2210 | var animation = _ref5.animation,
|
2211 | backdrop = _ref5.backdrop,
|
2212 | children = _ref5.children,
|
2213 | escapeExits = _ref5.escapeExits,
|
2214 | onEnter = _ref5.onEnter,
|
2215 | onExit = _ref5.onExit,
|
2216 | onHide = _ref5.onHide,
|
2217 | show = _ref5.show,
|
2218 | size = _ref5.size,
|
2219 | parentSelector = _ref5.parentSelector,
|
2220 | className = _ref5.className,
|
2221 | overlayRef = _ref5.overlayRef,
|
2222 | contentRef = _ref5.contentRef,
|
2223 | other = _objectWithoutProperties(_ref5, ["animation", "backdrop", "children", "escapeExits", "onEnter", "onExit", "onHide", "show", "size", "parentSelector", "className", "overlayRef", "contentRef"]);
|
2224 |
|
2225 | var ariaId = useUniqueId(other.id);
|
2226 | var portalClassName = "ReactModalPortal-".concat(useUniqueId());
|
2227 |
|
2228 | var _useRootNodeLocator = useRootNodeLocator(document.body),
|
2229 | _useRootNodeLocator2 = _slicedToArray(_useRootNodeLocator, 2),
|
2230 | rootNode = _useRootNodeLocator2[0],
|
2231 | RootNodeLocator = _useRootNodeLocator2[1];
|
2232 |
|
2233 | var _useState = useState(300),
|
2234 | _useState2 = _slicedToArray(_useState, 2),
|
2235 | modalHeight = _useState2[0],
|
2236 | setModalHeight = _useState2[1];
|
2237 |
|
2238 | var _useState3 = useState(show),
|
2239 | _useState4 = _slicedToArray(_useState3, 2),
|
2240 | shouldShow = _useState4[0],
|
2241 | setShouldShow = _useState4[1];
|
2242 |
|
2243 | var _useState5 = useState(window.innerHeight),
|
2244 | _useState6 = _slicedToArray(_useState5, 2),
|
2245 | windowHeight = _useState6[0],
|
2246 | setWindowHeight = _useState6[1];
|
2247 |
|
2248 | var modalRef = useRef(null);
|
2249 | var innerContentRef = useRef(null);
|
2250 |
|
2251 | var callRef = function callRef(ref, element) {
|
2252 | if (ref) {
|
2253 | if (typeof ref === 'function') {
|
2254 | ref(element);
|
2255 | } else {
|
2256 |
|
2257 | ref.current = element;
|
2258 | }
|
2259 | }
|
2260 | };
|
2261 |
|
2262 | var setContentRef = useCallback(function (contentElement) {
|
2263 | callRef(contentRef, contentElement);
|
2264 | innerContentRef.current = contentElement;
|
2265 | });
|
2266 | var modalHeightRef = useCallback(function (modalElement) {
|
2267 | callRef(overlayRef, modalElement);
|
2268 | var newHeight = 0;
|
2269 |
|
2270 | if (modalElement) {
|
2271 | modalRef.current = modalElement;
|
2272 | newHeight = modalElement.offsetHeight;
|
2273 | }
|
2274 |
|
2275 | if (innerContentRef.current) {
|
2276 | var contRefHeight = innerContentRef.current.offsetHeight;
|
2277 | if (contRefHeight < newHeight) newHeight = contRefHeight;
|
2278 | }
|
2279 |
|
2280 | setModalHeight(newHeight);
|
2281 | });
|
2282 | var modalParentSelector = parentSelector || useCallback(function () {
|
2283 | return rootNode;
|
2284 | }, [rootNode]);
|
2285 | useEffect(function () {
|
2286 | if (!animation || show) {
|
2287 | setShouldShow(show);
|
2288 | return _noop;
|
2289 | }
|
2290 |
|
2291 | var mounted = true;
|
2292 |
|
2293 | _setTimeout(function () {
|
2294 | if (!mounted) return;
|
2295 | setShouldShow(false);
|
2296 | }, animationTimeMs);
|
2297 |
|
2298 | return function () {
|
2299 | mounted = false;
|
2300 | };
|
2301 | }, [show, animation]);
|
2302 | useEffect(function () {
|
2303 | var setHeight = _debounce(function () {
|
2304 | return setWindowHeight(window.innerHeight);
|
2305 | }, 100);
|
2306 |
|
2307 | window.addEventListener('resize', setHeight);
|
2308 | return function () {
|
2309 | return window.removeEventListener('resize', setHeight);
|
2310 | };
|
2311 | }, []);
|
2312 | useEffect(function () {
|
2313 | if (modalRef.current && modalRef.current.scroll) {
|
2314 | modalRef.current.scroll(0, 0);
|
2315 | }
|
2316 | }, [modalRef.current]);
|
2317 | useDisableBodyScroll(show);
|
2318 | var shouldCloseOnOverlayClick = backdrop !== 'static' && backdrop;
|
2319 | return (
|
2320 |
|
2321 | React.createElement(ThemeProvider, {
|
2322 | theme: {
|
2323 | modalHeight: modalHeight,
|
2324 | windowHeight: windowHeight,
|
2325 | portalClassName: portalClassName
|
2326 | }
|
2327 | },
|
2328 |
|
2329 | React.createElement(RootNodeLocator, null), shouldShow ?
|
2330 |
|
2331 | React.createElement(ModalStyles, {
|
2332 | showAnimation: animation,
|
2333 | showBackdrop: backdrop
|
2334 | }) : null,
|
2335 |
|
2336 | React.createElement(ModalContext.Provider, {
|
2337 | value: {
|
2338 | onHide: onHide,
|
2339 | ariaId: ariaId
|
2340 | }
|
2341 | },
|
2342 |
|
2343 | React.createElement(ReactModal, _extends({
|
2344 | portalClassName: portalClassName,
|
2345 | className: _concatInstanceProperty(_context = "".concat(className, " ")).call(_context, size, " modal-content"),
|
2346 | overlayClassName: "background-overlay",
|
2347 | closeTimeoutMS: animation ? animationTimeMs : null,
|
2348 | isOpen: show,
|
2349 | aria: {
|
2350 | labelledby: ariaId
|
2351 | },
|
2352 | shouldCloseOnOverlayClick: shouldCloseOnOverlayClick,
|
2353 | onRequestClose: onHide,
|
2354 | onAfterOpen: onEnter,
|
2355 | onAfterClose: onExit,
|
2356 | shouldCloseOnEsc: escapeExits,
|
2357 | parentSelector: modalParentSelector,
|
2358 | contentRef: setContentRef,
|
2359 | overlayRef: modalHeightRef
|
2360 | }, other), children)))
|
2361 | );
|
2362 | }
|
2363 |
|
2364 | Modal.propTypes = process.env.NODE_ENV !== "production" ? {
|
2365 |
|
2366 | animation: PropTypes.bool,
|
2367 |
|
2368 | |
2369 |
|
2370 |
|
2371 |
|
2372 | backdrop: PropTypes.oneOf(['static', true, false]),
|
2373 |
|
2374 | |
2375 |
|
2376 |
|
2377 |
|
2378 | children: PropTypes.any,
|
2379 |
|
2380 |
|
2381 | escapeExits: PropTypes.bool,
|
2382 |
|
2383 |
|
2384 | onEnter: PropTypes.func,
|
2385 |
|
2386 |
|
2387 | onExit: PropTypes.func,
|
2388 |
|
2389 | |
2390 |
|
2391 |
|
2392 |
|
2393 | onHide: PropTypes.func,
|
2394 |
|
2395 |
|
2396 | show: PropTypes.bool,
|
2397 |
|
2398 |
|
2399 | size: PropTypes.oneOf(['small', 'medium', 'large']),
|
2400 |
|
2401 |
|
2402 | parentSelector: PropTypes.func,
|
2403 | className: PropTypes.string,
|
2404 | overlayRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
2405 | current: PropTypes.any
|
2406 | })]),
|
2407 | contentRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
2408 | current: PropTypes.any
|
2409 | })])
|
2410 | } : {};
|
2411 | Modal.defaultProps = {
|
2412 | animation: true,
|
2413 | backdrop: true,
|
2414 | escapeExits: true,
|
2415 | onEnter: _noop,
|
2416 | onExit: _noop,
|
2417 | onHide: _noop,
|
2418 | show: false,
|
2419 | size: 'medium',
|
2420 | children: undefined,
|
2421 | parentSelector: null,
|
2422 | className: null,
|
2423 | overlayRef: null,
|
2424 | contentRef: null
|
2425 | };
|
2426 | Modal.Header = ModalHeader;
|
2427 | Modal.Body = ModalBody;
|
2428 | Modal.Footer = ModalFooter;
|
2429 |
|
2430 | var ModalButtonContainer = styled.div(["display:flex;flex-direction:column;justify-content:flex-end;width:100%;@media (min-width:", "){flex-direction:row;}"], function (props) {
|
2431 | return props.theme.screenSize.tablet;
|
2432 | });
|
2433 |
|
2434 | function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { keys.push.apply(keys, _Object$getOwnPropertySymbols(object)); } if (enumerableOnly) keys = _filterInstanceProperty(keys).call(keys, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
2435 |
|
2436 | function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys$3(source, true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys$3(source)).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
2437 |
|
2438 | function _templateObject$1() {
|
2439 | var data = _taggedTemplateLiteral(["\n .ReactModal__Overlay--after-open {\n background-color: rgba(0,0,0,0.5) !important;\n }\n\n .ReactModal__Overlay--before-close {\n background-color: rgba(0,0,0,0) !important;\n }\n"]);
|
2440 |
|
2441 | _templateObject$1 = function _templateObject() {
|
2442 | return data;
|
2443 | };
|
2444 |
|
2445 | return data;
|
2446 | }
|
2447 | var PaneBase = styled(ReactModal)(["background:", ";box-shadow:0 8px 8px ", ";display:flex;flex-direction:column;height:100%;min-width:100px;transition:transform 0.5s;width:100%;will-change:transform;&:focus{outline-style:none;}@media (min-width:", "){width:", ";}"], function (props) {
|
2448 | return props.theme.colors.white;
|
2449 | }, function (props) {
|
2450 | return props.theme.colors.boxShadowDark;
|
2451 | }, function (props) {
|
2452 | return props.theme.screenSize.tablet;
|
2453 | }, function (props) {
|
2454 | return props.theme.screenSize.tablet;
|
2455 | });
|
2456 | var PaneRight = styled(PaneBase)(["margin-left:auto;transform:translateX(100%);&.ReactModal__Content--after-open{transform:translateX(0%);}&.ReactModal__Content--before-close{transform:translateX(100%);}"]);
|
2457 | var PaneLeft = styled(PaneBase)(["margin-right:auto;transform:translateX(-100%);&.ReactModal__Content--after-open{transform:translateX(0%);}&.ReactModal__Content--before-close{transform:translateX(-100%);}"]);
|
2458 | var PaneBottom = styled(PaneBase)(["height:90vh;margin-top:10vh;transform:translateY(100%);&.ReactModal__Content--after-open{transform:translateY(0%);}&.ReactModal__Content--before-close{transform:translateY(100%);}"]);
|
2459 | var Header$1 = styled.div(["align-items:center;background-color:", ";color:", ";display:flex;flex:0 0 64px;height:64px;"], function (props) {
|
2460 | return props.theme.colors.primary;
|
2461 | }, function (props) {
|
2462 | return props.theme.colors.white;
|
2463 | });
|
2464 | var CloseLink = styled(LinkButton)(["cursor:pointer;opacity:0.7;padding:16px;"]);
|
2465 | var TitleWrapper = styled.div(["display:flex;flex:1;flex-direction:column;min-width:0;"]);
|
2466 | var TitleText = styled(Heading)(["margin:0;max-width:80%;overflow:hidden;padding:1px;text-overflow:ellipsis;white-space:nowrap;"]);
|
2467 | var SubTitle = styled.div(["font-size:12px;margin-top:2px;"]);
|
2468 | var Content = styled.div(["flex:1 1 auto;overflow-y:auto;padding:1.5em;position:relative;"]);
|
2469 | var ScreenReaderText$1 = screenReaderOnly('span');
|
2470 | var defaultStyles = {
|
2471 | overlay: {
|
2472 | backgroundColor: 'rgba(0,0,0,0)',
|
2473 | top: '0',
|
2474 | left: '0',
|
2475 | right: '0',
|
2476 | bottom: '0',
|
2477 | position: 'fixed',
|
2478 | zIndex: '1000',
|
2479 | transition: 'background-color 0.5s'
|
2480 | },
|
2481 | content: {}
|
2482 | };
|
2483 | var GlobalPaneStyles = createGlobalStyle(_templateObject$1());
|
2484 |
|
2485 | function getPane(direction) {
|
2486 | switch (direction) {
|
2487 | case 'bottom':
|
2488 | return PaneBottom;
|
2489 |
|
2490 | case 'left':
|
2491 | return PaneLeft;
|
2492 |
|
2493 | default:
|
2494 | return PaneRight;
|
2495 | }
|
2496 | }
|
2497 |
|
2498 | function SlidingPane(_ref) {
|
2499 | var isOpen = _ref.isOpen,
|
2500 | title = _ref.title,
|
2501 | subTitle = _ref.subTitle,
|
2502 | shouldCloseOnEsc = _ref.shouldCloseOnEsc,
|
2503 | onRequestClose = _ref.onRequestClose,
|
2504 | onAfterOpen = _ref.onAfterOpen,
|
2505 | children = _ref.children,
|
2506 | closeIcon = _ref.closeIcon,
|
2507 | closeIconScreenReaderText = _ref.closeIconScreenReaderText,
|
2508 | from = _ref.from,
|
2509 | headingLevel = _ref.headingLevel,
|
2510 | headingSize = _ref.headingSize,
|
2511 | closeTimeout = _ref.closeTimeout,
|
2512 | overlayStyles = _ref.overlayStyles,
|
2513 | contentStyles = _ref.contentStyles,
|
2514 | appElement = _ref.appElement,
|
2515 | parentSelector = _ref.parentSelector,
|
2516 | rest = _objectWithoutProperties(_ref, ["isOpen", "title", "subTitle", "shouldCloseOnEsc", "onRequestClose", "onAfterOpen", "children", "closeIcon", "closeIconScreenReaderText", "from", "headingLevel", "headingSize", "closeTimeout", "overlayStyles", "contentStyles", "appElement", "parentSelector"]);
|
2517 |
|
2518 | var _useRootNodeLocator = useRootNodeLocator(document.body),
|
2519 | _useRootNodeLocator2 = _slicedToArray(_useRootNodeLocator, 2),
|
2520 | rootNode = _useRootNodeLocator2[0],
|
2521 | RootNodeLocator = _useRootNodeLocator2[1];
|
2522 |
|
2523 | useDisableBodyScroll(isOpen);
|
2524 | var modalParentSelector = parentSelector || useCallback(function () {
|
2525 | return rootNode;
|
2526 | }, [rootNode]);
|
2527 | var Pane = getPane(from);
|
2528 | var styles = {
|
2529 | overlay: _objectSpread$3(_objectSpread$3({}, defaultStyles.overlay), overlayStyles),
|
2530 | content: _objectSpread$3(_objectSpread$3({}, defaultStyles.content), contentStyles)
|
2531 | };
|
2532 |
|
2533 | if (appElement) {
|
2534 | Pane.setAppElement(appElement);
|
2535 | } else {
|
2536 | _Object$assign(rest, {
|
2537 | ariaHideApp: false
|
2538 | });
|
2539 | }
|
2540 |
|
2541 | return (
|
2542 |
|
2543 | React.createElement(React.Fragment, null,
|
2544 |
|
2545 | React.createElement(GlobalPaneStyles, null),
|
2546 |
|
2547 | React.createElement(RootNodeLocator, null),
|
2548 |
|
2549 | React.createElement(Pane, _extends({
|
2550 | style: styles,
|
2551 | closeTimeoutMS: closeTimeout,
|
2552 | isOpen: isOpen,
|
2553 | onAfterOpen: onAfterOpen,
|
2554 | onRequestClose: onRequestClose,
|
2555 | shouldCloseOnEsc: shouldCloseOnEsc,
|
2556 | contentLabel: "Modal \"".concat(title, "\""),
|
2557 | parentSelector: modalParentSelector
|
2558 | }, rest),
|
2559 |
|
2560 | React.createElement(Header$1, null,
|
2561 |
|
2562 | React.createElement(CloseLink, {
|
2563 | onClick: onRequestClose
|
2564 | }, closeIcon ||
|
2565 |
|
2566 | React.createElement(Icon, {
|
2567 | name: "remove",
|
2568 | size: 34
|
2569 | }),
|
2570 |
|
2571 | React.createElement(ScreenReaderText$1, null, closeIconScreenReaderText)),
|
2572 |
|
2573 | React.createElement(TitleWrapper, null,
|
2574 |
|
2575 | React.createElement(TitleText, {
|
2576 | level: headingLevel,
|
2577 | size: headingSize
|
2578 | }, title),
|
2579 |
|
2580 | React.createElement(SubTitle, null, subTitle))),
|
2581 |
|
2582 | React.createElement(Content, null, children)))
|
2583 | );
|
2584 | }
|
2585 | SlidingPane.propTypes = process.env.NODE_ENV !== "production" ? {
|
2586 | isOpen: PropTypes.bool.isRequired,
|
2587 | title: PropTypes.any,
|
2588 | subTitle: PropTypes.any,
|
2589 | shouldCloseOnEsc: PropTypes.bool,
|
2590 | onRequestClose: PropTypes.func,
|
2591 | onAfterOpen: PropTypes.func,
|
2592 | children: PropTypes.any.isRequired,
|
2593 | from: PropTypes.oneOf(['left', 'right', 'bottom']),
|
2594 | closeIcon: PropTypes.any,
|
2595 | closeIconScreenReaderText: PropTypes.string,
|
2596 | headingLevel: Heading.propTypes.level,
|
2597 | headingSize: Heading.propTypes.size,
|
2598 | closeTimeout: PropTypes.number,
|
2599 | overlayStyles: PropTypes.object,
|
2600 | contentStyles: PropTypes.object,
|
2601 |
|
2602 | |
2603 |
|
2604 | appElement: PropTypes.string,
|
2605 | parentSelector: PropTypes.func
|
2606 | } : {};
|
2607 | SlidingPane.defaultProps = {
|
2608 |
|
2609 | closeTimeout: 500,
|
2610 | from: 'right',
|
2611 | headingLevel: 2,
|
2612 | headingSize: 3,
|
2613 | shouldCloseOnEsc: true,
|
2614 | title: undefined,
|
2615 | subTitle: undefined,
|
2616 | onRequestClose: _noop,
|
2617 | onAfterOpen: _noop,
|
2618 | closeIcon: undefined,
|
2619 | closeIconScreenReaderText: 'Close',
|
2620 | overlayStyles: {},
|
2621 | contentStyles: {},
|
2622 | appElement: undefined,
|
2623 | parentSelector: null
|
2624 | };
|
2625 |
|
2626 | var StyledButton$3 = styled.button(["background-color:", ";border:2px solid ", ";border-radius:", ";box-sizing:border-box;color:", ";cursor:pointer;display:block;font-family:inherit;font-size:", ";font-weight:", ";line-height:", ";min-width:100px;outline:none;padding-bottom:", ";padding-left:", ";padding-right:", ";padding-top:", ";text-align:center;text-decoration:none;text-transform:", ";transition:color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out;user-select:none;vertical-align:middle;white-space:nowrap;width:100%;@media (min-width:", "){display:", ";width:", ";}&:focus{box-shadow:0 0 0 0.2rem ", ";}@media (hover:hover),(-ms-high-contrast:none){&:hover{background-color:", ";color:", ";}}&:active,&.pressed{background-color:", ";color:", ";}&.pressed{box-shadow:inset 0 3px 5px rgba(0,0,0,0.25);}&:active:focus,&.pressed:focus{box-shadow:inset 0 3px 5px rgba(0,0,0,0.25),0 0 0 0.2rem ", ";}&[disabled]{background-color:#e6e6e6;border-color:#e6e6e6;color:#ccc;cursor:not-allowed;&:hover{background-color:#e6e6e6;border-color:#e6e6e6;color:#ccc;}> *{pointer-events:none;}}"], function (props) {
|
2627 | return props.colors.bgColor;
|
2628 | }, function (props) {
|
2629 | return props.colors.textColor;
|
2630 | }, function (props) {
|
2631 | return props.buttonSize.borderRadius;
|
2632 | }, function (props) {
|
2633 | return props.colors.textColor;
|
2634 | }, function (props) {
|
2635 | return props.buttonSize.fontSize;
|
2636 | }, function (props) {
|
2637 | return props.buttonSize.fontWeight || 'normal';
|
2638 | }, function (props) {
|
2639 | return props.buttonSize.lineHeight || props.theme.font.baseLineHeight;
|
2640 | }, function (props) {
|
2641 | return props.buttonSize.paddingBottom;
|
2642 | }, function (props) {
|
2643 | return props.buttonSize.paddingSides;
|
2644 | }, function (props) {
|
2645 | return props.buttonSize.paddingSides;
|
2646 | }, function (props) {
|
2647 | return props.buttonSize.paddingTop;
|
2648 | }, function (props) {
|
2649 | return props.buttonSize.textTransform ? props.buttonSize.textTransform : 'none';
|
2650 | }, function (props) {
|
2651 | return props.theme.screenSize.tablet;
|
2652 | }, function (props) {
|
2653 | return props.block ? 'block' : 'inline-block';
|
2654 | }, function (props) {
|
2655 | return props.block ? '100%' : 'auto';
|
2656 | }, function (props) {
|
2657 | return props.colors.focusBoxShadowColor;
|
2658 | }, function (props) {
|
2659 | return props.colors.textColor;
|
2660 | }, function (props) {
|
2661 | return props.colors.hoverTextColor;
|
2662 | }, function (props) {
|
2663 | return props.colors.textColor;
|
2664 | }, function (props) {
|
2665 | return props.colors.hoverTextColor;
|
2666 | }, function (props) {
|
2667 | return props.colors.focusBoxShadowColor;
|
2668 | });
|
2669 | var OutlineButton =
|
2670 |
|
2671 | React.forwardRef(function OutlineButton(props, ref) {
|
2672 | var children = props.children,
|
2673 | styleType = props.styleType,
|
2674 | size = props.size,
|
2675 | block = props.block,
|
2676 | other = _objectWithoutProperties(props, ["children", "styleType", "size", "block"]);
|
2677 |
|
2678 | var theme = useTheme();
|
2679 | var buttonSize = theme.buttonStyles.outlineButton.size[size];
|
2680 | var variant = theme.buttonStyles.outlineButton.variant[styleType];
|
2681 | var isInheritedStyle = styleType === 'inherited';
|
2682 | var focusBoxShadowColor = tinycolor.mix(variant.bgColor, theme.colors.black, 14);
|
2683 | focusBoxShadowColor.setAlpha(0.5);
|
2684 | var buttonColors = {
|
2685 | textColor: isInheritedStyle ? 'inherited' : variant.bgColor,
|
2686 | bgColor: isInheritedStyle ? 'inherited' : theme.colors.white,
|
2687 | hoverTextColor: isInheritedStyle ? 'inherited' : theme.colors.white,
|
2688 | focusBoxShadowColor: isInheritedStyle ? theme.colors.gray4 : focusBoxShadowColor.toRgbString()
|
2689 | };
|
2690 | return (
|
2691 |
|
2692 | React.createElement(StyledButton$3, _extends({
|
2693 | ref: ref,
|
2694 | block: block,
|
2695 | buttonSize: buttonSize,
|
2696 | colors: buttonColors,
|
2697 | type: "button"
|
2698 | }, other), children)
|
2699 | );
|
2700 | });
|
2701 | OutlineButton.propTypes = process.env.NODE_ENV !== "production" ? {
|
2702 | children: PropTypes.node.isRequired,
|
2703 |
|
2704 |
|
2705 | styleType: PropTypes.string,
|
2706 | size: PropTypes.oneOf(['lg', 'default', 'sm', 'xs']),
|
2707 |
|
2708 |
|
2709 | block: PropTypes.bool
|
2710 | } : {};
|
2711 | OutlineButton.defaultProps = {
|
2712 | styleType: 'default',
|
2713 | block: false,
|
2714 | size: 'default'
|
2715 | };
|
2716 |
|
2717 | function ToggleButton(props) {
|
2718 | var theme = useTheme();
|
2719 |
|
2720 | var _useState = useState(props.isPressed),
|
2721 | _useState2 = _slicedToArray(_useState, 2),
|
2722 | isPressed = _useState2[0],
|
2723 | setIsPressed = _useState2[1];
|
2724 |
|
2725 | var prevPressedProp = useRef(props.isPressed);
|
2726 |
|
2727 | if (prevPressedProp.current !== props.isPressed) {
|
2728 | prevPressedProp.current = props.isPressed;
|
2729 | setIsPressed(props.isPressed);
|
2730 | }
|
2731 |
|
2732 | function toggleButton(event) {
|
2733 | setIsPressed(!isPressed);
|
2734 | props.onClick(event);
|
2735 | }
|
2736 |
|
2737 | var styleType = props.styleType,
|
2738 | size = props.size,
|
2739 | block = props.block,
|
2740 | isOutline = props.isOutline,
|
2741 | buttonProps = _objectWithoutProperties(props, ["styleType", "size", "block", "isOutline"]);
|
2742 |
|
2743 | var ToggleButtonType = isOutline ? OutlineButton : Button;
|
2744 | var styles = isOutline ? theme.buttonStyles.outlineButton : theme.buttonStyles.button;
|
2745 | return (
|
2746 |
|
2747 | React.createElement(ToggleButtonType, _extends({}, buttonProps, {
|
2748 | onClick: toggleButton,
|
2749 | styleType: styleType,
|
2750 | size: size,
|
2751 | block: block,
|
2752 | isOutline: isOutline,
|
2753 | className: isPressed ? "".concat(buttonProps.className || '', " pressed") : buttonProps.className,
|
2754 | variant: styles.variant[styleType],
|
2755 | "aria-pressed": isPressed
|
2756 | }), props.children)
|
2757 | );
|
2758 | }
|
2759 |
|
2760 | ToggleButton.propTypes = process.env.NODE_ENV !== "production" ? {
|
2761 | onClick: PropTypes.func.isRequired,
|
2762 | children: PropTypes.node.isRequired,
|
2763 | styleType: PropTypes.string,
|
2764 | size: PropTypes.oneOf(['lg', 'default', 'sm', 'xs']),
|
2765 | block: PropTypes.bool,
|
2766 | isOutline: PropTypes.bool,
|
2767 | isPressed: PropTypes.bool
|
2768 | } : {};
|
2769 | ToggleButton.defaultProps = {
|
2770 | styleType: 'default',
|
2771 | size: 'default',
|
2772 | block: false,
|
2773 | isOutline: false,
|
2774 | isPressed: false
|
2775 | };
|
2776 |
|
2777 | var InlineContext =
|
2778 |
|
2779 | React.createContext(false);
|
2780 |
|
2781 | var StyledPanel = styled.div(["background-color:", ";display:", ";position:absolute;z-index:999;"], function (props) {
|
2782 | return props.theme.colors.gray2;
|
2783 | }, function (props) {
|
2784 | return props.isOpen ? 'block' : 'none';
|
2785 | });
|
2786 | var StyledDismissButton = styled(DismissButton)(["margin-left:auto;margin-right:4px;"]);
|
2787 | var Header$2 = styled.header(["align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between;padding-bottom:", ";padding-left:11px;padding-right:5px;padding-top:", ";"], function (props) {
|
2788 | return props.hasHeaderContent ? '10px' : '0';
|
2789 | }, function (props) {
|
2790 | return props.hasHeaderContent ? '5px' : '0';
|
2791 | });
|
2792 | var StyledChildrenContainer = styled.div(["display:flex;flex-direction:", ";flex-wrap:wrap;"], function (props) {
|
2793 | return props.inline ? 'row' : 'column';
|
2794 | });
|
2795 |
|
2796 | function MenuPanel(props) {
|
2797 | function onEscape(_ref) {
|
2798 | var keyCode = _ref.keyCode;
|
2799 |
|
2800 | if (keyCode === 27) {
|
2801 | props.onClose();
|
2802 | }
|
2803 | }
|
2804 |
|
2805 | useEffect(function () {
|
2806 | document.addEventListener('keydown', onEscape);
|
2807 | return function removeKeydownListener() {
|
2808 | document.removeEventListener('keydown', onEscape);
|
2809 | };
|
2810 | });
|
2811 |
|
2812 | var children = props.children,
|
2813 | headerContent = props.headerContent,
|
2814 | isOpen = props.isOpen,
|
2815 | onClose = props.onClose,
|
2816 | other = _objectWithoutProperties(props, ["children", "headerContent", "isOpen", "onClose"]);
|
2817 |
|
2818 | var hasHeaderContent = !!headerContent;
|
2819 | var inline = useContext(InlineContext);
|
2820 | return (
|
2821 |
|
2822 | React.createElement(StyledPanel, _extends({
|
2823 | isOpen: isOpen
|
2824 | }, other),
|
2825 |
|
2826 | React.createElement(Header$2, {
|
2827 | hasHeaderContent: hasHeaderContent
|
2828 | }, hasHeaderContent &&
|
2829 |
|
2830 | React.createElement("span", null, headerContent),
|
2831 |
|
2832 | React.createElement(StyledDismissButton, {
|
2833 | onClick: onClose
|
2834 | })),
|
2835 |
|
2836 | React.createElement(StyledChildrenContainer, {
|
2837 | inline: inline
|
2838 | }, children))
|
2839 | );
|
2840 | }
|
2841 |
|
2842 | MenuPanel.propTypes = process.env.NODE_ENV !== "production" ? {
|
2843 | children: PropTypes.any.isRequired,
|
2844 | headerContent: PropTypes.node,
|
2845 | isOpen: PropTypes.bool,
|
2846 | onClose: PropTypes.func.isRequired
|
2847 | } : {};
|
2848 | MenuPanel.defaultProps = {
|
2849 | headerContent: null,
|
2850 | isOpen: false
|
2851 | };
|
2852 |
|
2853 | var StyledMenuSection = styled.section(["padding-top:", ";padding-bottom:", ";border-bottom:", ";"], function (props) {
|
2854 | return !props.isFirst && !props.inline && !props.isOnlySection ? '20px' : '0px';
|
2855 | }, function (props) {
|
2856 | return props.isLast ? '0px' : '20px';
|
2857 | }, function (props) {
|
2858 | return !props.isLast && !props.inline ? "1px solid ".concat(props.theme.colors.gray5) : 'none';
|
2859 | });
|
2860 | var StyledHeader = styled.header(["padding-left:10px;"]);
|
2861 | var StyledChildrenContainer$1 = styled.section(["padding:15px 20px 0px 20px;"]);
|
2862 |
|
2863 | function MenuSection(props) {
|
2864 | var title = props.title,
|
2865 | children = props.children,
|
2866 | isLast = props.isLast,
|
2867 | isFirst = props.isFirst,
|
2868 | isOnlySection = props.isOnlySection,
|
2869 | other = _objectWithoutProperties(props, ["title", "children", "isLast", "isFirst", "isOnlySection"]);
|
2870 |
|
2871 | var inline = useContext(InlineContext);
|
2872 | return (
|
2873 |
|
2874 | React.createElement(StyledMenuSection, _extends({
|
2875 | isLast: isLast,
|
2876 | isFirst: isFirst,
|
2877 | inline: inline,
|
2878 | isOnlySection: isOnlySection
|
2879 | }, other), title &&
|
2880 |
|
2881 | React.createElement(StyledHeader, {
|
2882 | "aria-label": title
|
2883 | }, title), children &&
|
2884 |
|
2885 | React.createElement(StyledChildrenContainer$1, null, children))
|
2886 | );
|
2887 | }
|
2888 |
|
2889 | MenuSection.propTypes = process.env.NODE_ENV !== "production" ? {
|
2890 | title: PropTypes.string,
|
2891 | children: PropTypes.any,
|
2892 | isLast: PropTypes.bool,
|
2893 | isFirst: PropTypes.bool,
|
2894 | isOnlySection: PropTypes.bool
|
2895 | } : {};
|
2896 | MenuSection.defaultProps = {
|
2897 | title: undefined,
|
2898 | children: undefined,
|
2899 | isLast: false,
|
2900 | isFirst: false,
|
2901 | isOnlySection: false
|
2902 | };
|
2903 |
|
2904 | var Backdrop = styled.div(["background-color:black;bottom:0;cursor:auto;left:0;opacity:0.5;position:fixed;right:0;top:0;z-index:auto;display:", ";"], function (props) {
|
2905 | return props.isMenuOpen ? 'inherit' : 'none';
|
2906 | });
|
2907 |
|
2908 | function Menu(props) {
|
2909 | var _useState = useState(false),
|
2910 | _useState2 = _slicedToArray(_useState, 2),
|
2911 | isMenuOpen = _useState2[0],
|
2912 | setIsMenuOpen = _useState2[1];
|
2913 |
|
2914 | function toggleMenu() {
|
2915 | setIsMenuOpen(!isMenuOpen);
|
2916 | }
|
2917 |
|
2918 | function closeMenu() {
|
2919 | setIsMenuOpen(false);
|
2920 | }
|
2921 |
|
2922 | var inline = props.inline,
|
2923 | children = props.children,
|
2924 | buttonContent = props.buttonContent,
|
2925 | openButtonType = props.openButtonType,
|
2926 | rootClose = props.rootClose,
|
2927 | hasBackdrop = props.hasBackdrop,
|
2928 | headerContent = props.headerContent,
|
2929 | other = _objectWithoutProperties(props, ["inline", "children", "buttonContent", "openButtonType", "rootClose", "hasBackdrop", "headerContent"]);
|
2930 |
|
2931 | return (
|
2932 |
|
2933 | React.createElement(RootCloseWrapper, {
|
2934 | onRootClose: closeMenu,
|
2935 | disabled: !rootClose
|
2936 | },
|
2937 |
|
2938 | React.createElement("div", other, hasBackdrop &&
|
2939 |
|
2940 | React.createElement(Backdrop, {
|
2941 | isMenuOpen: isMenuOpen,
|
2942 | onClick: closeMenu
|
2943 | }),
|
2944 |
|
2945 | React.createElement(ToggleButton, {
|
2946 | onClick: toggleMenu,
|
2947 | isPressed: isMenuOpen,
|
2948 | styleType: openButtonType,
|
2949 | "aria-expanded": isMenuOpen
|
2950 | }, buttonContent),
|
2951 |
|
2952 | React.createElement(InlineContext.Provider, {
|
2953 | value: inline
|
2954 | },
|
2955 |
|
2956 | React.createElement(MenuPanel, {
|
2957 | headerContent: headerContent,
|
2958 | isOpen: isMenuOpen,
|
2959 | onClose: closeMenu
|
2960 | }, children))))
|
2961 | );
|
2962 | }
|
2963 |
|
2964 | Menu.MenuSection = MenuSection;
|
2965 | Menu.propTypes = process.env.NODE_ENV !== "production" ? {
|
2966 | children: PropTypes.any.isRequired,
|
2967 | buttonContent: PropTypes.any.isRequired,
|
2968 | openButtonType: PropTypes.string,
|
2969 | rootClose: PropTypes.bool,
|
2970 | inline: PropTypes.bool,
|
2971 | hasBackdrop: PropTypes.bool,
|
2972 | headerContent: PropTypes.node
|
2973 | } : {};
|
2974 | Menu.defaultProps = {
|
2975 | rootClose: false,
|
2976 | openButtonType: 'default',
|
2977 | inline: false,
|
2978 | hasBackdrop: false,
|
2979 | headerContent: undefined
|
2980 | };
|
2981 |
|
2982 | var TabButton = styled.button(["background-color:", ";border:1px solid ", ";box-shadow:", ";color:", ";display:inline-block;font-size:inherit;line-height:", ";padding:10px;text-align:left;z-index:1;&:focus{outline:none;}@media (min-width:", "){background-color:", ";border:", ";border-bottom-color:", ";box-shadow:none;color:", ";padding:10px 15px;margin:0 2px 0px 0;&:hover,&:focus{background-color:", ";}}"], function (props) {
|
2983 | return props.selected ? props.theme.colors.white : props.theme.colors.gray2;
|
2984 | }, function (props) {
|
2985 | return props.theme.colors.gray4;
|
2986 | }, function (props) {
|
2987 | return props.selected ? '0 6px 12px rgba(0, 0, 0, 0.175)' : 'none';
|
2988 | }, function (props) {
|
2989 | return props.selected ? props.theme.colors.black : props.theme.colors.primary;
|
2990 | }, function (props) {
|
2991 | return props.theme.font.baseLineHeight;
|
2992 | }, function (props) {
|
2993 | return props.theme.screenSize.desktop;
|
2994 | }, function (props) {
|
2995 | return props.theme.colors.white;
|
2996 | }, function (props) {
|
2997 | return props.selected ? "1px solid ".concat(props.theme.colors.gray4) : '1px solid transparent';
|
2998 | }, function (props) {
|
2999 | return props.selected ? ' transparent' : "".concat(props.theme.colors.gray4);
|
3000 | }, function (props) {
|
3001 | return props.selected ? props.theme.colors.black : props.theme.colors.primary;
|
3002 | }, function (props) {
|
3003 | return props.selected ? props.theme.colors.white : props.theme.colors.gray2;
|
3004 | });
|
3005 | var AriaAnnouncer = screenReaderOnly('div');
|
3006 |
|
3007 | function Tab(_ref) {
|
3008 | var _context;
|
3009 |
|
3010 | var name = _ref.name,
|
3011 | selected = _ref.selected,
|
3012 | action = _ref.action,
|
3013 | children = _ref.children,
|
3014 | simpleName = _ref.simpleName,
|
3015 | announcerText = _ref.announcerText,
|
3016 | props = _objectWithoutProperties(_ref, ["name", "selected", "action", "children", "simpleName", "announcerText"]);
|
3017 |
|
3018 | return (
|
3019 |
|
3020 | React.createElement(TabButton, _extends({
|
3021 | onClick: function onClick() {
|
3022 | return action(name, children, simpleName, announcerText);
|
3023 | },
|
3024 | selected: selected,
|
3025 | "aria-label": "".concat(simpleName || name, " tab"),
|
3026 | "aria-selected": selected,
|
3027 | role: "tab"
|
3028 | }, props), selected && (simpleName.length > 0 || announcerText.length > 0) &&
|
3029 |
|
3030 | React.createElement(AriaAnnouncer, {
|
3031 | id: "announcer",
|
3032 | "aria-live": "assertive"
|
3033 | }, _concatInstanceProperty(_context = "".concat(simpleName, " ")).call(_context, announcerText)), name)
|
3034 | );
|
3035 | }
|
3036 |
|
3037 | Tab.propTypes = process.env.NODE_ENV !== "production" ? {
|
3038 | |
3039 |
|
3040 |
|
3041 | name: PropTypes.node.isRequired,
|
3042 |
|
3043 | |
3044 |
|
3045 |
|
3046 | selected: PropTypes.bool,
|
3047 |
|
3048 | |
3049 |
|
3050 |
|
3051 | action: PropTypes.func,
|
3052 |
|
3053 | |
3054 |
|
3055 |
|
3056 | children: PropTypes.node,
|
3057 |
|
3058 | |
3059 |
|
3060 |
|
3061 | simpleName: PropTypes.string,
|
3062 |
|
3063 | |
3064 |
|
3065 |
|
3066 | announcerText: PropTypes.string
|
3067 | } : {};
|
3068 | Tab.defaultProps = {
|
3069 | selected: false,
|
3070 | action: _noop,
|
3071 | children: undefined,
|
3072 | simpleName: '',
|
3073 | announcerText: ''
|
3074 | };
|
3075 |
|
3076 | var TabList = styled.div(["display:flex;flex-direction:column;font-size:inherit;overflow:hidden;@media (max-width:", "){width:100%;}@media (min-width:", "){flex-direction:row;justify-content:flex-start;}"], function (props) {
|
3077 | return props.theme.screenSize.desktop;
|
3078 | }, function (props) {
|
3079 | return props.theme.screenSize.desktop;
|
3080 | });
|
3081 | var TabContent = styled.div(["margin-top:-1px;background-color:", ";border-top:1px solid ", ";"], function (props) {
|
3082 | return props.theme.colors.white;
|
3083 | }, function (props) {
|
3084 | return props.theme.colors.gray4;
|
3085 | });
|
3086 |
|
3087 | function TabPanel(props) {
|
3088 | var _context;
|
3089 |
|
3090 | var children = props.children,
|
3091 | selectedKey = props.selectedKey,
|
3092 | tabChanged = props.tabChanged,
|
3093 | canTabChange = props.canTabChange;
|
3094 |
|
3095 | var _useState = useState(selectedKey),
|
3096 | _useState2 = _slicedToArray(_useState, 2),
|
3097 | value = _useState2[0],
|
3098 | setValue = _useState2[1];
|
3099 |
|
3100 | var selectedIndex = _findIndex(React.Children.toArray(children), function (child) {
|
3101 | var key = selectedKey || value || value.key;
|
3102 | return child.props.name.key ? child.props.name.key === key : child.props.name === key;
|
3103 | });
|
3104 |
|
3105 | if (selectedIndex < 0) {
|
3106 | selectedIndex = 0;
|
3107 | }
|
3108 |
|
3109 | var elements = _mapInstanceProperty(_context = React.Children).call(_context, children, function (child, index) {
|
3110 | return (
|
3111 |
|
3112 | React.cloneElement(child, {
|
3113 | selected: index === selectedIndex,
|
3114 | action: function () {
|
3115 | var _action = _asyncToGenerator(
|
3116 |
|
3117 | _regeneratorRuntime.mark(function _callee(header) {
|
3118 | var canChange;
|
3119 | return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
3120 | while (1) {
|
3121 | switch (_context2.prev = _context2.next) {
|
3122 | case 0:
|
3123 | _context2.next = 2;
|
3124 | return canTabChange(header);
|
3125 |
|
3126 | case 2:
|
3127 | canChange = _context2.sent;
|
3128 |
|
3129 | if (canChange) {
|
3130 | setValue(header);
|
3131 | tabChanged(header);
|
3132 | }
|
3133 |
|
3134 | case 4:
|
3135 | case "end":
|
3136 | return _context2.stop();
|
3137 | }
|
3138 | }
|
3139 | }, _callee);
|
3140 | }));
|
3141 |
|
3142 | function action(_x) {
|
3143 | return _action.apply(this, arguments);
|
3144 | }
|
3145 |
|
3146 | return action;
|
3147 | }()
|
3148 | })
|
3149 | );
|
3150 | });
|
3151 |
|
3152 | return (
|
3153 |
|
3154 | React.createElement(React.Fragment, null,
|
3155 |
|
3156 | React.createElement(TabList, {
|
3157 | role: "tablist"
|
3158 | }, elements),
|
3159 |
|
3160 | React.createElement(TabContent, {
|
3161 | role: "tabpanel"
|
3162 | }, elements[selectedIndex].props.children))
|
3163 | );
|
3164 | }
|
3165 |
|
3166 | function childrenRule(props, propName, component) {
|
3167 | var children = props[propName];
|
3168 |
|
3169 | if (!_Array$isArray(children)) {
|
3170 | children = [children];
|
3171 | }
|
3172 |
|
3173 | if (!_everyInstanceProperty(children).call(children, function (child) {
|
3174 | return child.type.name === 'Tab' || child.type.target === Tab;
|
3175 | })) {
|
3176 | return new Error('Tab Panel only accepts Tabs as direct descendants.');
|
3177 | }
|
3178 |
|
3179 | return null;
|
3180 | }
|
3181 |
|
3182 | TabPanel.propTypes = process.env.NODE_ENV !== "production" ? {
|
3183 | |
3184 |
|
3185 |
|
3186 | children: childrenRule,
|
3187 | selectedKey: PropTypes.any,
|
3188 |
|
3189 | |
3190 |
|
3191 |
|
3192 | canTabChange: PropTypes.func,
|
3193 |
|
3194 | |
3195 |
|
3196 |
|
3197 | tabChanged: PropTypes.func
|
3198 | } : {};
|
3199 | TabPanel.defaultProps = {
|
3200 | children: undefined,
|
3201 | selectedKey: '',
|
3202 | tabChanged: _noop,
|
3203 | canTabChange: function canTabChange() {
|
3204 | return true;
|
3205 | }
|
3206 | };
|
3207 | TabPanel.Tab = Tab;
|
3208 |
|
3209 | var StripedContainerWrapper = styled.div(["> *{display:block;padding:20px;&:nth-child(even){background-color:", ";}&:nth-child(odd){background-color:", ";}}"], function (props) {
|
3210 | return props.evenColor;
|
3211 | }, function (props) {
|
3212 | return props.oddColor;
|
3213 | });
|
3214 |
|
3215 | function StripedContainer(props) {
|
3216 | var _context;
|
3217 |
|
3218 | var theme = useTheme();
|
3219 | return (
|
3220 |
|
3221 | React.createElement(StripedContainerWrapper, {
|
3222 | oddColor: theme.colors.gray2,
|
3223 | evenColor: theme.colors.gray4
|
3224 | }, _mapInstanceProperty(_context = React.Children).call(_context, props.children, function (child) {
|
3225 | return (
|
3226 |
|
3227 | React.cloneElement(child)
|
3228 | );
|
3229 | }))
|
3230 | );
|
3231 | }
|
3232 |
|
3233 | StripedContainer.propTypes = process.env.NODE_ENV !== "production" ? {
|
3234 | children: PropTypes.node
|
3235 | } : {};
|
3236 | StripedContainer.defaultProps = {
|
3237 | children: undefined
|
3238 | };
|
3239 |
|
3240 | var Label = styled.label(["color:", ";cursor:pointer;font-family:'Source Sans Pro','Segoe UI',Segoe,Calibri,Tahoma,sans-serif;font-size:", ";font-weight:bold;line-height:", ";margin-bottom:5px;display:inline-block;&[disabled]{cursor:not-allowed;}@media (min-width:", "){margin-right:20px;}"], function (props) {
|
3241 | return props.theme.colors.gray9;
|
3242 | }, function (props) {
|
3243 | return props.theme.font.baseFontSize;
|
3244 | }, function (props) {
|
3245 | return props.theme.font.baseLineHeight;
|
3246 | }, function (props) {
|
3247 | return props.theme.screenSize.tablet;
|
3248 | });
|
3249 |
|
3250 | var PromptType = {
|
3251 | readAloud: 'readAloud',
|
3252 | doNotReadAloud: 'doNotReadAloud'
|
3253 | };
|
3254 |
|
3255 | var IconWrapper = styled.div(["background-color:", ";padding:6px 0 0 6px;"], function (promptProps) {
|
3256 | return promptProps.bannerBgColor;
|
3257 | });
|
3258 | var StyledIcon$1 = styled(Icon)(["name:", ";color:", ";padding-right:5px;"], function (promptProps) {
|
3259 | return promptProps.iconName;
|
3260 | }, function (promptProps) {
|
3261 | return promptProps.iconColor;
|
3262 | });
|
3263 | var ContentWrapper$1 = styled.div(["align-items:center;background-color:", ";color:black;border-radius:2px;display:block;margin-bottom:25px;padding:15px;"], function (promptProps) {
|
3264 | return promptProps.bgColor;
|
3265 | });
|
3266 | var Content$1 = styled.div(["font-size:18px;align-self:center;word-break:break-word;"]);
|
3267 | var BannerLabel = styled(Label)(["letter-spacing:0.5px;font-size:20px;font-weight:500;color:", ";"], function (promptProps) {
|
3268 | return promptProps.bannerTextColor;
|
3269 | });
|
3270 |
|
3271 | var Prompt = function Prompt(props) {
|
3272 | var isContentReadAloud = props.isContentReadAloud,
|
3273 | children = props.children;
|
3274 | var theme = useTheme();
|
3275 | var promptStyles = isContentReadAloud ? theme.promptStyles[PromptType.readAloud] : theme.promptStyles[PromptType.doNotReadAloud];
|
3276 | var inlineIconText = isContentReadAloud ?
|
3277 |
|
3278 | React.createElement(BannerLabel, {
|
3279 | bannerTextColor: promptStyles.bannerTextColor
|
3280 | }, "Read Aloud") :
|
3281 |
|
3282 | React.createElement(BannerLabel, {
|
3283 | bannerTextColor: promptStyles.bannerTextColor
|
3284 | }, "Do Not Read Aloud");
|
3285 | return (
|
3286 |
|
3287 | React.createElement(React.Fragment, null,
|
3288 |
|
3289 | React.createElement(IconWrapper, {
|
3290 | bannerBgColor: promptStyles.bannerBgColor,
|
3291 | textColor: promptStyles.textColor
|
3292 | },
|
3293 |
|
3294 | React.createElement(StyledIcon$1, {
|
3295 | name: promptStyles.iconName,
|
3296 | iconColor: promptStyles.iconColor,
|
3297 | size: 30
|
3298 | }), inlineIconText),
|
3299 |
|
3300 | React.createElement(ContentWrapper$1, {
|
3301 | bgColor: promptStyles.bgColor
|
3302 | },
|
3303 |
|
3304 | React.createElement(Content$1, null, children)))
|
3305 | );
|
3306 | };
|
3307 |
|
3308 | Prompt.defaultProps = {
|
3309 | isContentReadAloud: true,
|
3310 | children: null
|
3311 | };
|
3312 | Prompt.propTypes = process.env.NODE_ENV !== "production" ? {
|
3313 | isContentReadAloud: PropTypes.bool,
|
3314 | children: PropTypes.node
|
3315 | } : {};
|
3316 |
|
3317 | var TableBase = styled.table(["border-collapse:collapse;border:0;border-spacing:0;margin:0 0 25px 0;padding:0;width:100%;caption{padding-top:8px;padding-bottom:8px;color:", ";font-size:1.3em;margin:0.5em 0;text-align:left;}thead th{border-bottom:2px solid ", ";}tbody tr:not(:first-child){th,td{border-top:1px solid ", ";}}th{font-family:'Source Sans Pro','Segoe UI',Segoe,Calibri,Tahoma,sans-serif;font-weight:bold;line-height:", ";padding:", ";text-align:left;vertical-align:bottom;}td{line-height:", ";padding:", ";vertical-align:top;}&& tbody{", ";th{vertical-align:top;}}&& tbody{", ";}"], function (props) {
|
3318 | return props.theme.colors.gray8;
|
3319 | }, function (props) {
|
3320 | return props.theme.colors.gray4;
|
3321 | }, function (props) {
|
3322 | return props.theme.colors.gray4;
|
3323 | }, function (props) {
|
3324 | return props.theme.font.baseLineHeight;
|
3325 | }, function (props) {
|
3326 | return props.cellPadding;
|
3327 | }, function (props) {
|
3328 | return props.theme.font.baseLineHeight;
|
3329 | }, function (props) {
|
3330 | return props.cellPadding;
|
3331 | }, function (props) {
|
3332 | return props.hasStripes && css(["tr:nth-of-type(odd){background-color:", ";}"], props.theme.colors.gray0);
|
3333 | }, function (props) {
|
3334 | return props.hasHover && css(["tr:hover{background-color:", ";}"], props.theme.colors.gray1);
|
3335 | });
|
3336 |
|
3337 | function Table(props) {
|
3338 | var isCondensed = props.isCondensed,
|
3339 | isRoomy = props.isRoomy,
|
3340 | rest = _objectWithoutProperties(props, ["isCondensed", "isRoomy"]);
|
3341 |
|
3342 | var cellPadding = '8px';
|
3343 | cellPadding = isCondensed ? '5px' : cellPadding;
|
3344 | cellPadding = isRoomy ? '12px' : cellPadding;
|
3345 | return (
|
3346 |
|
3347 | React.createElement(TableBase, _extends({
|
3348 | cellPadding: cellPadding
|
3349 | }, rest))
|
3350 | );
|
3351 | }
|
3352 |
|
3353 |
|
3354 | var TableRow = styled.tr([""]);
|
3355 | var TableBodyCell = styled.td([""]);
|
3356 | var TableHeaderCell = styled.th([""]);
|
3357 | Table.Row = TableRow;
|
3358 | Table.Cell = TableBodyCell;
|
3359 | Table.HeaderCell = TableHeaderCell;
|
3360 | Table.propTypes = process.env.NODE_ENV !== "production" ? {
|
3361 |
|
3362 | hasStripes: PropTypes.bool,
|
3363 |
|
3364 |
|
3365 | hasHover: PropTypes.bool,
|
3366 |
|
3367 |
|
3368 | isCondensed: PropTypes.bool,
|
3369 |
|
3370 |
|
3371 | isRoomy: PropTypes.bool
|
3372 | } : {};
|
3373 | Table.defaultProps = {
|
3374 | hasStripes: false,
|
3375 | hasHover: false,
|
3376 | isCondensed: false,
|
3377 | isRoomy: false
|
3378 | };
|
3379 |
|
3380 | var TableBase$1 = styled(Table)(["tbody{th{font-family:'Source Sans Pro','Segoe UI',Segoe,Calibri,Tahoma,sans-serif;font-weight:normal;}}&&&{@media (max-width:", "){background-color:", ";thead{border:none;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;}tr{background-color:", ";box-shadow:1px 1px 3px 1px rgba(0,0,0,0.2);display:block;margin:0.625em;padding:0.35em;}td,tbody th{border-top:1px solid ", ";display:flex;justify-content:space-between;padding:0.625em;text-align:right;&:before{content:attr(data-label);font-family:'Source Sans Pro','Segoe UI',Segoe,Calibri,Tahoma,sans-serif;font-weight:bold;margin-right:2em;max-width:25%;text-align:left;}&:first-child{border-top:0;}&:last-child{border-bottom:0;}}}}"], function (props) {
|
3381 | return props.theme.screenSize.phone;
|
3382 | }, function (props) {
|
3383 | return props.theme.colors.gray2;
|
3384 | }, function (props) {
|
3385 | return props.theme.colors.white;
|
3386 | }, function (props) {
|
3387 | return props.theme.colors.gray4;
|
3388 | });
|
3389 |
|
3390 | function ResponsiveTable(props) {
|
3391 | return (
|
3392 |
|
3393 | React.createElement(TableBase$1, props)
|
3394 | );
|
3395 | }
|
3396 |
|
3397 | function _createSuper2(Derived) {
|
3398 | function isNativeReflectConstruct() {
|
3399 | if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
|
3400 | if (_Reflect$construct.sham) return false;
|
3401 | if (typeof Proxy === "function") return true;
|
3402 |
|
3403 | try {
|
3404 | Date.prototype.toString.call(_Reflect$construct(Date, [], function () {}));
|
3405 | return true;
|
3406 | } catch (e) {
|
3407 | return false;
|
3408 | }
|
3409 | }
|
3410 |
|
3411 | return function () {
|
3412 | var Super = _getPrototypeOf(Derived),
|
3413 | result;
|
3414 |
|
3415 | if (isNativeReflectConstruct()) {
|
3416 | var NewTarget = _getPrototypeOf(this).constructor;
|
3417 |
|
3418 | result = _Reflect$construct(Super, arguments, NewTarget);
|
3419 | } else {
|
3420 | result = Super.apply(this, arguments);
|
3421 | }
|
3422 |
|
3423 | return _possibleConstructorReturn(this, result);
|
3424 | };
|
3425 | }
|
3426 |
|
3427 | function getWindowSize() {
|
3428 | var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
3429 | defaultWidth = _ref.defaultWidth,
|
3430 | defaultHeight = _ref.defaultHeight;
|
3431 |
|
3432 | return {
|
3433 | windowWidth: defaultWidth || document.body.clientWidth,
|
3434 | windowHeight: defaultHeight || document.body.clientHeight
|
3435 | };
|
3436 | }
|
3437 |
|
3438 | function withWindowSize(ComponentClass) {
|
3439 | var windowSize =
|
3440 |
|
3441 | function (_React$Component) {
|
3442 | _inherits(windowSize, _React$Component);
|
3443 |
|
3444 | var _super = _createSuper2(windowSize);
|
3445 |
|
3446 | function windowSize() {
|
3447 | var _context;
|
3448 |
|
3449 | var _this;
|
3450 |
|
3451 | _classCallCheck(this, windowSize);
|
3452 |
|
3453 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
3454 | args[_key] = arguments[_key];
|
3455 | }
|
3456 |
|
3457 | _this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
|
3458 |
|
3459 | _defineProperty(_assertThisInitialized(_this), "state", getWindowSize(_this.props));
|
3460 |
|
3461 | _defineProperty(_assertThisInitialized(_this), "handleResize", function () {
|
3462 | var activeTag = document.activeElement.tagName.toLocaleLowerCase();
|
3463 |
|
3464 | if (activeTag === 'input' || activeTag === 'select') {
|
3465 | return;
|
3466 | }
|
3467 |
|
3468 | _this.setState(getWindowSize());
|
3469 | });
|
3470 |
|
3471 | return _this;
|
3472 | }
|
3473 |
|
3474 | _createClass(windowSize, [{
|
3475 | key: "componentDidMount",
|
3476 | value: function componentDidMount() {
|
3477 | window.addEventListener('resize', this.handleResize);
|
3478 | }
|
3479 | }, {
|
3480 | key: "componentWillUnmount",
|
3481 | value: function componentWillUnmount() {
|
3482 | window.removeEventListener('resize', this.handleResize);
|
3483 | }
|
3484 | }, {
|
3485 | key: "render",
|
3486 | value: function render() {
|
3487 | return (
|
3488 |
|
3489 | React.createElement(ComponentClass, _extends({}, this.props, {
|
3490 | windowWidth: this.state.windowWidth,
|
3491 | windowHeight: this.state.windowHeight
|
3492 | }))
|
3493 | );
|
3494 | }
|
3495 | }]);
|
3496 |
|
3497 | return windowSize;
|
3498 | }(React.Component);
|
3499 |
|
3500 | _defineProperty(windowSize, "defaultProps", {
|
3501 | defaultWidth: null,
|
3502 | defaultHeight: null
|
3503 | });
|
3504 |
|
3505 | windowSize.propTypes = process.env.NODE_ENV !== "production" ? {
|
3506 | defaultWidth: PropTypes.number,
|
3507 | defaultHeight: PropTypes.number
|
3508 | } : {};
|
3509 | return windowSize;
|
3510 | }
|
3511 |
|
3512 | var OuterWrapper = styled.div(["overflow:hidden;position:relative;"]);
|
3513 | var InnerWrapper = styled.div(["alignitems:center;display:flex;height:100%;position:relative;white-space:nowrap;z-index:0;"]);
|
3514 | var ScrollIcon = styled.div(["align-items:center;cursor:pointer;display:flex;height:100%;outline:0;position:absolute;top:0;z-index:1;"]);
|
3515 |
|
3516 | var _StyledScrollIcon2 = styled(ScrollIcon)(["right:0;text-align:right;"]);
|
3517 |
|
3518 | var _StyledScrollIcon = styled(ScrollIcon)(["left:0;text-align:left;"]);
|
3519 |
|
3520 | var ArrowContainer = styled.div(["align-items:center;background-color:", ";border-radius:50%;box-shadow:0 1px 1px ", ";color:", ";display:flex;padding:0.5em;"], function (props) {
|
3521 | return props.theme.colors.white;
|
3522 | }, function (props) {
|
3523 | return props.theme.colors.boxShadowDark;
|
3524 | }, function (props) {
|
3525 | return props.theme.colors.gray9;
|
3526 | });
|
3527 |
|
3528 | var generateOnArrowKeyDownHandler = function generateOnArrowKeyDownHandler(onKeyDown) {
|
3529 | return function (event) {
|
3530 | var code = event.code.toLowerCase();
|
3531 |
|
3532 | if (code === 'enter' || code === 'space') {
|
3533 | onKeyDown();
|
3534 | }
|
3535 | };
|
3536 | };
|
3537 |
|
3538 | var ArrowLeft = function ArrowLeft(_ref) {
|
3539 | var onClick = _ref.onClick;
|
3540 | return (
|
3541 |
|
3542 | React.createElement(_StyledScrollIcon, {
|
3543 | role: "button",
|
3544 | tabIndex: 0,
|
3545 | onClick: onClick,
|
3546 | onKeyDown: generateOnArrowKeyDownHandler(onClick)
|
3547 | },
|
3548 |
|
3549 | React.createElement(ArrowContainer, null,
|
3550 |
|
3551 | React.createElement(Icon, {
|
3552 | name: "chevron-left"
|
3553 | })))
|
3554 | );
|
3555 | };
|
3556 |
|
3557 | ArrowLeft.propTypes = process.env.NODE_ENV !== "production" ? {
|
3558 | onClick: PropTypes.func.isRequired
|
3559 | } : {};
|
3560 |
|
3561 | var ArrowRight = function ArrowRight(_ref2) {
|
3562 | var onClick = _ref2.onClick;
|
3563 | return (
|
3564 |
|
3565 | React.createElement(_StyledScrollIcon2, {
|
3566 | role: "button",
|
3567 | tabIndex: 0,
|
3568 | onClick: onClick,
|
3569 | onKeyDown: generateOnArrowKeyDownHandler(onClick)
|
3570 | },
|
3571 |
|
3572 | React.createElement(ArrowContainer, null,
|
3573 |
|
3574 | React.createElement(Icon, {
|
3575 | name: "chevron-right"
|
3576 | })))
|
3577 | );
|
3578 | };
|
3579 |
|
3580 | ArrowRight.propTypes = process.env.NODE_ENV !== "production" ? {
|
3581 | onClick: PropTypes.func.isRequired
|
3582 | } : {};
|
3583 |
|
3584 | function HorizontalScrollWrapper(_ref3) {
|
3585 | var windowWidth = _ref3.windowWidth,
|
3586 | children = _ref3.children,
|
3587 | slideAmount = _ref3.slideAmount,
|
3588 | otherProps = _objectWithoutProperties(_ref3, ["windowWidth", "children", "slideAmount"]);
|
3589 |
|
3590 | var rootRef = useRef(null);
|
3591 | var menuRef = useRef(null);
|
3592 |
|
3593 | var _useState = useState(0),
|
3594 | _useState2 = _slicedToArray(_useState, 2),
|
3595 | rootWidth = _useState2[0],
|
3596 | setRootWidth = _useState2[1];
|
3597 |
|
3598 | var _useState3 = useState(0),
|
3599 | _useState4 = _slicedToArray(_useState3, 2),
|
3600 | menuWidth = _useState4[0],
|
3601 | setMenuWidth = _useState4[1];
|
3602 |
|
3603 | var _useState5 = useState(0),
|
3604 | _useState6 = _slicedToArray(_useState5, 2),
|
3605 | xPosition = _useState6[0],
|
3606 | setXPosition = _useState6[1];
|
3607 |
|
3608 | var _useState7 = useState(0),
|
3609 | _useState8 = _slicedToArray(_useState7, 2),
|
3610 | cursorXPosition = _useState8[0],
|
3611 | setCursorXPosition = _useState8[1];
|
3612 |
|
3613 | var _useState9 = useState(false),
|
3614 | _useState10 = _slicedToArray(_useState9, 2),
|
3615 | hasOverflow = _useState10[0],
|
3616 | setHasOverflow = _useState10[1];
|
3617 |
|
3618 | var _useState11 = useState(false),
|
3619 | _useState12 = _slicedToArray(_useState11, 2),
|
3620 | isDragging = _useState12[0],
|
3621 | setIsDragging = _useState12[1];
|
3622 |
|
3623 | useEffect(function () {
|
3624 | var currentRootWidth = rootRef.current ? rootRef.current.clientWidth : 0;
|
3625 | var currentMenuWidth = menuRef.current ? menuRef.current.scrollWidth : 0;
|
3626 |
|
3627 | if (currentRootWidth <= currentMenuWidth) {
|
3628 | setRootWidth(currentRootWidth);
|
3629 | setMenuWidth(currentMenuWidth);
|
3630 | setHasOverflow(true);
|
3631 | var absoluteXPosition = Math.abs(xPosition);
|
3632 |
|
3633 | if (currentRootWidth + absoluteXPosition > currentMenuWidth) {
|
3634 | var distance = Math.abs(currentMenuWidth - currentRootWidth + xPosition);
|
3635 | setXPosition(xPosition + distance);
|
3636 | }
|
3637 | } else if (hasOverflow) {
|
3638 | setHasOverflow(false);
|
3639 | }
|
3640 | }, [windowWidth, rootRef.current, menuRef.current]);
|
3641 |
|
3642 | var handleDownEvent = function handleDownEvent(downEvent) {
|
3643 | if (!hasOverflow) return;
|
3644 | var cursorX = 0;
|
3645 |
|
3646 | if (downEvent.type === 'mousedown') {
|
3647 | cursorX = downEvent.pageX - xPosition;
|
3648 | } else if (downEvent.type === 'touchstart') {
|
3649 | var touchEvent = downEvent.changedTouches[0];
|
3650 | cursorX = touchEvent.pageX - xPosition;
|
3651 | }
|
3652 |
|
3653 | setCursorXPosition(cursorX);
|
3654 | setIsDragging(true);
|
3655 | };
|
3656 |
|
3657 | var handleMoveEvent = function handleMoveEvent(moveEvent) {
|
3658 | if (!hasOverflow || !isDragging) return;
|
3659 | var distance = 0;
|
3660 |
|
3661 | if (moveEvent.type === 'mousemove') {
|
3662 | moveEvent.preventDefault();
|
3663 | distance = moveEvent.pageX - cursorXPosition;
|
3664 | } else if (moveEvent.type === 'touchmove') {
|
3665 | var touchEvent = moveEvent.changedTouches[0];
|
3666 | distance = touchEvent.pageX - cursorXPosition;
|
3667 | }
|
3668 |
|
3669 | var newXPosition = (xPosition + distance) * 0.5;
|
3670 |
|
3671 | if (newXPosition > 0) {
|
3672 | newXPosition = 0;
|
3673 | }
|
3674 |
|
3675 | if (-newXPosition > menuWidth - rootWidth) {
|
3676 | newXPosition = -(menuWidth - rootWidth);
|
3677 | }
|
3678 |
|
3679 | setXPosition(newXPosition);
|
3680 | };
|
3681 |
|
3682 | var handleUpEvent = function handleUpEvent() {
|
3683 | if (!hasOverflow || !isDragging) return;
|
3684 | setIsDragging(false);
|
3685 | };
|
3686 |
|
3687 | var handleLeftClick = function handleLeftClick(event) {
|
3688 | event.stopPropagation();
|
3689 | event.preventDefault();
|
3690 | var newXPosition = xPosition + slideAmount;
|
3691 |
|
3692 | if (newXPosition > 0) {
|
3693 | newXPosition = 0;
|
3694 | }
|
3695 |
|
3696 | setXPosition(newXPosition);
|
3697 | };
|
3698 |
|
3699 | var handleRightClick = function handleRightClick(event) {
|
3700 | event.stopPropagation();
|
3701 | event.preventDefault();
|
3702 | var newXPosition = xPosition - slideAmount;
|
3703 |
|
3704 | if (-newXPosition > menuWidth - rootWidth) {
|
3705 | newXPosition = -(menuWidth - rootWidth);
|
3706 | }
|
3707 |
|
3708 | setXPosition(newXPosition);
|
3709 | };
|
3710 |
|
3711 | var handleKeyEvent = function handleKeyEvent(event) {
|
3712 | var code = event.key.toLowerCase();
|
3713 | if (code !== 'tab') return;
|
3714 | var element = document.activeElement.parentElement;
|
3715 | var style = window.getComputedStyle ? getComputedStyle(element, null) : element.currentStyle;
|
3716 | var marginLeft = _parseInt(style.marginLeft, 10) || 0;
|
3717 | var marginRight = _parseInt(style.marginRight, 10) || 0;
|
3718 | var tabSlide = element.offsetWidth + marginLeft + marginRight;
|
3719 |
|
3720 | if (event.shiftKey) {
|
3721 | var newXPosition = xPosition + tabSlide;
|
3722 |
|
3723 | if (newXPosition > 0) {
|
3724 | newXPosition = 0;
|
3725 | }
|
3726 |
|
3727 | setXPosition(newXPosition);
|
3728 | } else {
|
3729 | var _newXPosition = xPosition - tabSlide;
|
3730 |
|
3731 | if (-_newXPosition > menuWidth - rootWidth) {
|
3732 | _newXPosition = -(menuWidth - rootWidth);
|
3733 | }
|
3734 |
|
3735 | setXPosition(_newXPosition);
|
3736 | }
|
3737 | };
|
3738 |
|
3739 | return (
|
3740 |
|
3741 | React.createElement(OuterWrapper, _extends({
|
3742 | ref: rootRef
|
3743 | }, otherProps),
|
3744 |
|
3745 | React.createElement(InnerWrapper, {
|
3746 | ref: menuRef,
|
3747 | role: "presentation",
|
3748 | onMouseDown: handleDownEvent,
|
3749 | onMouseMove: handleMoveEvent,
|
3750 | onMouseUp: handleUpEvent,
|
3751 | onMouseLeave: handleUpEvent,
|
3752 | onTouchStart: handleDownEvent,
|
3753 | onTouchMove: handleMoveEvent,
|
3754 | onTouchEnd: handleUpEvent,
|
3755 | onKeyUp: handleKeyEvent,
|
3756 | style: {
|
3757 | transform: "translate3d(".concat(xPosition, "px, 0, 0)"),
|
3758 | transition: "".concat(isDragging ? '' : 'transform 0.3s ease-in-out')
|
3759 | }
|
3760 | }, children), hasOverflow && xPosition < 0 &&
|
3761 |
|
3762 | React.createElement(ArrowLeft, {
|
3763 | onClick: handleLeftClick
|
3764 | }), hasOverflow && -xPosition < menuWidth - rootWidth &&
|
3765 |
|
3766 | React.createElement(ArrowRight, {
|
3767 | onClick: handleRightClick
|
3768 | }))
|
3769 | );
|
3770 | }
|
3771 |
|
3772 | HorizontalScrollWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
|
3773 |
|
3774 | windowWidth: PropTypes.number,
|
3775 | children: PropTypes.node,
|
3776 |
|
3777 |
|
3778 | slideAmount: PropTypes.number
|
3779 | } : {};
|
3780 | HorizontalScrollWrapper.defaultProps = {
|
3781 | windowWidth: undefined,
|
3782 | children: null,
|
3783 | slideAmount: 300
|
3784 | };
|
3785 | var HorizontalScrollWrapper$1 = withWindowSize(HorizontalScrollWrapper);
|
3786 |
|
3787 | var SkeletonContainer = styled.div(["position:relative;background-color:", ";&::after{animation:loading-keyframes 2s linear infinite;background-size:50%;background-repeat:no-repeat;background-image:linear-gradient( -60deg,", " 0,", " 40%,", " 50%,", " 60%,", " 100% );content:'';display:block;height:100%;left:0;position:absolute;top:0;width:100%;}@keyframes loading-keyframes{0%{background-position:-150% 0;}75%{background-position:250% 0;}100%{background-position:250% 0;}}"], function (_ref) {
|
3788 | var skeleton = _ref.theme.skeleton;
|
3789 | return skeleton.shimmerColor;
|
3790 | }, function (_ref2) {
|
3791 | var skeleton = _ref2.theme.skeleton;
|
3792 | return tinycolor(skeleton.shimmerColor).setAlpha(0).toRgbString();
|
3793 | }, function (_ref3) {
|
3794 | var skeleton = _ref3.theme.skeleton;
|
3795 | return tinycolor(skeleton.shimmerColor).setAlpha(0).toRgbString();
|
3796 | }, function (_ref4) {
|
3797 | var skeleton = _ref4.theme.skeleton;
|
3798 | return tinycolor(skeleton.shimmerColor).setAlpha(0.8).toRgbString();
|
3799 | }, function (_ref5) {
|
3800 | var skeleton = _ref5.theme.skeleton;
|
3801 | return tinycolor(skeleton.shimmerColor).setAlpha(0).toRgbString();
|
3802 | }, function (_ref6) {
|
3803 | var skeleton = _ref6.theme.skeleton;
|
3804 | return tinycolor(skeleton.shimmerColor).setAlpha(0).toRgbString();
|
3805 | });
|
3806 | var SkeletonShape = styled.div(["background-color:", ";"], function (_ref7) {
|
3807 | var skeleton = _ref7.theme.skeleton;
|
3808 | return skeleton.shapeColor;
|
3809 | });
|
3810 |
|
3811 | var LoadingSkeleton = function LoadingSkeleton(_ref8) {
|
3812 | var shapeColor = _ref8.shapeColor,
|
3813 | shimmerColor = _ref8.shimmerColor,
|
3814 | props = _objectWithoutProperties(_ref8, ["shapeColor", "shimmerColor"]);
|
3815 |
|
3816 | var theme = useTheme();
|
3817 | var colors = theme.colors;
|
3818 | var shimmer = shimmerColor || colors.white;
|
3819 | var shape = shapeColor || colors.gray3;
|
3820 | var skeleton = {
|
3821 | shimmerColor: shimmer,
|
3822 | shapeColor: shape
|
3823 | };
|
3824 | return (
|
3825 |
|
3826 | React.createElement(ThemeProvider, {
|
3827 | theme: {
|
3828 | skeleton: skeleton
|
3829 | }
|
3830 | },
|
3831 |
|
3832 | React.createElement(SkeletonContainer, props))
|
3833 | );
|
3834 | };
|
3835 |
|
3836 | LoadingSkeleton.propTypes = process.env.NODE_ENV !== "production" ? {
|
3837 | shapeColor: PropTypes.string,
|
3838 | shimmerColor: PropTypes.string
|
3839 | } : {};
|
3840 | LoadingSkeleton.defaultProps = {
|
3841 | shapeColor: null,
|
3842 | shimmerColor: null
|
3843 | };
|
3844 | LoadingSkeleton.Shape = SkeletonShape;
|
3845 |
|
3846 | var ValidationContext =
|
3847 | React.createContext('default');
|
3848 |
|
3849 | var FlexControl = styled.div(["color:", ";display:flex;flex-wrap:wrap;flex-direction:column;margin-bottom:25px;>[role=\"group\"]{margin-bottom:0;}select{border-color:", ";box-shadow:", ";}input:focus,select:focus{border-color:", ";box-shadow:", ";}", "}", ";"], function (props) {
|
3850 | return props.textColor;
|
3851 | }, function (props) {
|
3852 | return props.borderColor;
|
3853 | }, function (props) {
|
3854 | return props.boxShadow;
|
3855 | }, function (props) {
|
3856 | return props.focusBorderColor;
|
3857 | }, function (props) {
|
3858 | return props.focusBoxShadow;
|
3859 | }, function (props) {
|
3860 | return props.hasValidationBorder && props.validationState !== 'default' && css(["border-bottom:2px solid ", ";box-shadow:inset 0 7px 6px -6px ", ";padding:15px ", ";margin-left:-", ";margin-right:-", ";"], props.theme.colors.gray4, props.textColor, props.borderOffset, props.borderOffset, props.borderOffset);
|
3861 | }, function (props) {
|
3862 | return props.layoutOrientation === 'inline' && css(["@media (min-width:", "){align-items:baseline;flex-direction:row;}"], props.theme.screenSize.tablet);
|
3863 | });
|
3864 |
|
3865 | function Control(props) {
|
3866 | var validationState = props.validationState,
|
3867 | hasValidationBorder = props.hasValidationBorder,
|
3868 | orientation = props.orientation,
|
3869 | borderOffset = props.borderOffset,
|
3870 | children = props.children,
|
3871 | other = _objectWithoutProperties(props, ["validationState", "hasValidationBorder", "orientation", "borderOffset", "children"]);
|
3872 |
|
3873 | var theme = useTheme();
|
3874 | var textColor = theme.validationTextColor[validationState];
|
3875 | return (
|
3876 |
|
3877 | React.createElement(OrientationContext.Provider, {
|
3878 | value: orientation
|
3879 | },
|
3880 |
|
3881 | React.createElement(FlexControl, _extends({
|
3882 | textColor: textColor,
|
3883 | borderOffset: borderOffset,
|
3884 | validationState: validationState
|
3885 | }, theme.validationInputColor[validationState], {
|
3886 | layoutOrientation: orientation,
|
3887 | hasValidationBorder: hasValidationBorder
|
3888 | }, other),
|
3889 |
|
3890 | React.createElement(ValidationContext.Provider, {
|
3891 | value: validationState
|
3892 | }, children)))
|
3893 | );
|
3894 | }
|
3895 |
|
3896 | Control.propTypes = process.env.NODE_ENV !== "production" ? {
|
3897 | orientation: PropTypes.oneOf(['stacked', 'inline']),
|
3898 | validationState: PropTypes.oneOf(['default', 'success', 'warning', 'danger']),
|
3899 |
|
3900 |
|
3901 | hasValidationBorder: PropTypes.bool,
|
3902 |
|
3903 |
|
3904 | borderOffset: PropTypes.string,
|
3905 | children: PropTypes.node
|
3906 | } : {};
|
3907 | Control.defaultProps = {
|
3908 | orientation: 'stacked',
|
3909 | validationState: 'default',
|
3910 | hasValidationBorder: false,
|
3911 | borderOffset: '15px',
|
3912 | children: null
|
3913 | };
|
3914 |
|
3915 | var ValidationIcon = styled(Icon)(["align-self:flex-start;font-size:35px;margin-right:5px;"]);
|
3916 | var HelpText = styled.div(["align-items:center;color:inherit;display:inline-flex;margin-top:5px;margin-bottom:10px;width:100%;"]);
|
3917 |
|
3918 | function AdditionalHelp(_ref) {
|
3919 | var children = _ref.children,
|
3920 | hasValidationIcon = _ref.hasValidationIcon,
|
3921 | props = _objectWithoutProperties(_ref, ["children", "hasValidationIcon"]);
|
3922 |
|
3923 | var theme = useTheme();
|
3924 | var validationState = React.useContext(ValidationContext);
|
3925 | return (
|
3926 |
|
3927 | React.createElement(HelpText, props, hasValidationIcon && children && validationState !== 'default' &&
|
3928 |
|
3929 | React.createElement(ValidationIcon, {
|
3930 | "aria-hidden": "true",
|
3931 | name: theme.validationIconName[validationState]
|
3932 | }), children)
|
3933 | );
|
3934 | }
|
3935 |
|
3936 | AdditionalHelp.propTypes = process.env.NODE_ENV !== "production" ? {
|
3937 | children: PropTypes.any,
|
3938 |
|
3939 |
|
3940 | hasValidationIcon: PropTypes.bool
|
3941 | } : {};
|
3942 | AdditionalHelp.defaultProps = {
|
3943 | children: undefined,
|
3944 | hasValidationIcon: true
|
3945 | };
|
3946 |
|
3947 | var InputBase = styled.input(["border:1px solid ", ";border-radius:2px;box-shadow:", ";box-sizing:border-box;color:", ";font-size:", ";font-weight:normal;height:39px;line-height:", ";min-width:0;padding:6px 12px;transition:border-color ease-in-out 0.15s,box-shadow ease-in-out 0.15s;width:100%;&:focus{border-color:", ";box-shadow:", ";outline:0;}&:disabled{background-color:", ";cursor:not-allowed;}&:read-only{background-color:", ";cursor:text;}"], function (props) {
|
3948 | return props.borderColor;
|
3949 | }, function (props) {
|
3950 | return props.boxShadow;
|
3951 | }, function (props) {
|
3952 | return props.theme.colors.black;
|
3953 | }, function (props) {
|
3954 | return props.theme.font.baseFontSize;
|
3955 | }, function (props) {
|
3956 | return props.theme.font.baseLineHeight;
|
3957 | }, function (props) {
|
3958 | return props.focusBorderColor;
|
3959 | }, function (props) {
|
3960 | return props.focusBoxShadow;
|
3961 | }, function (props) {
|
3962 | return props.theme.colors.gray2;
|
3963 | }, function (props) {
|
3964 | return props.theme.colors.gray2;
|
3965 | });
|
3966 |
|
3967 | var defaultBorderRadius = '2px';
|
3968 | var AddOn = styled.div(["background-color:", ";border:1px solid ", ";border-radius:", ";box-sizing:border-box;color:", ";display:flex;flex-direction:column;height:39px;justify-content:center;line-height:1;margin:0;outline:0;padding:6px 11px;"], function (props) {
|
3969 | return props.addOnBgColor;
|
3970 | }, function (props) {
|
3971 | return props.addOnBgColor === props.theme.colors.gray3 ? props.theme.colors.gray5 : props.addOnBgColor;
|
3972 | }, defaultBorderRadius, function (props) {
|
3973 | return props.addOnTextColor;
|
3974 | });
|
3975 | var Prepend = styled(AddOn)(["border-bottom-right-radius:0;border-right:none;border-top-right-radius:0;"]);
|
3976 | var Append = styled(AddOn)(["border-bottom-left-radius:0;border-left:none;border-top-left-radius:0;"]);
|
3977 | var InputWrapper = styled.div(["display:flex;"]);
|
3978 |
|
3979 | var defaultBorderRadius$1 = '2px';
|
3980 | var TextboxBase = styled(InputBase)(["border-bottom-left-radius:", ";border-bottom-right-radius:", ";border-top-left-radius:", ";border-top-right-radius:", ";display:table-cell;-webkit-appearance:none;"], function (props) {
|
3981 | return props.hasPrepend ? '0' : defaultBorderRadius$1;
|
3982 | }, function (props) {
|
3983 | return props.hasAppend ? '0' : defaultBorderRadius$1;
|
3984 | }, function (props) {
|
3985 | return props.hasPrepend ? '0' : defaultBorderRadius$1;
|
3986 | }, function (props) {
|
3987 | return props.hasAppend ? '0' : defaultBorderRadius$1;
|
3988 | });
|
3989 | var Textbox =
|
3990 |
|
3991 | React.forwardRef(function Textbox(props, ref) {
|
3992 | var prependIconName = props.prependIconName,
|
3993 | appendIconName = props.appendIconName,
|
3994 | type = props.type,
|
3995 | additionalTextProps = _objectWithoutProperties(props, ["prependIconName", "appendIconName", "type"]);
|
3996 |
|
3997 | var theme = useTheme();
|
3998 | var validationState = React.useContext(ValidationContext);
|
3999 | var inputRef = React.useRef();
|
4000 | React.useImperativeHandle(ref, function () {
|
4001 | return inputRef.current;
|
4002 | });
|
4003 | var hasPrepend = !!prependIconName;
|
4004 | var hasAppend = !!appendIconName;
|
4005 | var hasValidationState = validationState !== 'default';
|
4006 | var addOnTextColor = hasValidationState ? theme.colors.white : theme.colors.gray8;
|
4007 | var addOnBgColor = hasValidationState ? theme.validationTextColor[validationState] : theme.colors.gray3;
|
4008 |
|
4009 | function focusInput() {
|
4010 | inputRef.current.focus();
|
4011 | }
|
4012 |
|
4013 | return (
|
4014 |
|
4015 | React.createElement(InputWrapper, null, hasPrepend &&
|
4016 |
|
4017 | React.createElement(Prepend, {
|
4018 | addOnTextColor: addOnTextColor,
|
4019 | addOnBgColor: addOnBgColor,
|
4020 | "aria-hidden": "true",
|
4021 | onClick: focusInput
|
4022 | },
|
4023 |
|
4024 | React.createElement(Icon, {
|
4025 | "aria-hidden": "true",
|
4026 | name: prependIconName,
|
4027 | size: 18
|
4028 | })),
|
4029 |
|
4030 | React.createElement(TextboxBase, _extends({
|
4031 | hasAppend: hasAppend,
|
4032 | hasPrepend: hasPrepend,
|
4033 | ref: inputRef,
|
4034 | type: type
|
4035 | }, additionalTextProps, theme.validationInputColor[validationState])), hasAppend &&
|
4036 |
|
4037 | React.createElement(Append, {
|
4038 | addOnTextColor: addOnTextColor,
|
4039 | addOnBgColor: addOnBgColor,
|
4040 | "aria-hidden": "true",
|
4041 | onClick: focusInput
|
4042 | },
|
4043 |
|
4044 | React.createElement(Icon, {
|
4045 | "aria-hidden": "true",
|
4046 | name: appendIconName,
|
4047 | size: 18
|
4048 | })))
|
4049 | );
|
4050 | });
|
4051 | Textbox.propTypes = process.env.NODE_ENV !== "production" ? {
|
4052 |
|
4053 | prependIconName: PropTypes.string,
|
4054 |
|
4055 |
|
4056 | appendIconName: PropTypes.string,
|
4057 |
|
4058 |
|
4059 | type: PropTypes.string
|
4060 | } : {};
|
4061 | Textbox.defaultProps = {
|
4062 | prependIconName: undefined,
|
4063 | appendIconName: undefined,
|
4064 | type: 'text'
|
4065 | };
|
4066 |
|
4067 | var TextareaBase = styled.textarea(["border:1px solid ", ";border-radius:2px;box-shadow:", ";box-sizing:border-box;color:", ";font-size:", ";font-weight:normal;line-height:", ";min-width:0;padding:6px 12px;transition:border-color ease-in-out 0.15s,box-shadow ease-in-out 0.15s;&:focus{border-color:", ";box-shadow:", ";outline:0;}&:disabled{background-color:", ";cursor:not-allowed;}&:read-only{background-color:", ";cursor:text;}"], function (props) {
|
4068 | return props.borderColor;
|
4069 | }, function (props) {
|
4070 | return props.boxShadow;
|
4071 | }, function (props) {
|
4072 | return props.theme.colors.black;
|
4073 | }, function (props) {
|
4074 | return props.theme.font.baseFontSize;
|
4075 | }, function (props) {
|
4076 | return props.theme.font.baseLineHeight;
|
4077 | }, function (props) {
|
4078 | return props.focusBorderColor;
|
4079 | }, function (props) {
|
4080 | return props.focusBoxShadow;
|
4081 | }, function (props) {
|
4082 | return props.theme.colors.gray2;
|
4083 | }, function (props) {
|
4084 | return props.theme.colors.gray2;
|
4085 | });
|
4086 | var Textarea =
|
4087 |
|
4088 | React.forwardRef(function Textarea(props, ref) {
|
4089 | var theme = useTheme();
|
4090 | var validationState = React.useContext(ValidationContext);
|
4091 | return (
|
4092 |
|
4093 | React.createElement(TextareaBase, _extends({
|
4094 | ref: ref
|
4095 | }, props, theme.validationInputColor[validationState]))
|
4096 | );
|
4097 | });
|
4098 |
|
4099 | var inputMask = {
|
4100 | date: {
|
4101 | mask: [/\d/, /\d/, '/', /\d/, /\d/, '/', /\d/, /\d/, /\d/, /\d/],
|
4102 | pipe: createautoCorrectedDatePipe('mm/dd/yyyy'),
|
4103 | showMask: false,
|
4104 | keepCharPositions: true,
|
4105 | placeholderChar: "\u2000",
|
4106 | title: 'Enter month, day, and 4-digit year'
|
4107 | },
|
4108 | dollar: {
|
4109 | mask: createNumberMask({
|
4110 | prefix: '$'
|
4111 | })
|
4112 | },
|
4113 | phone: {
|
4114 | mask: ['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/],
|
4115 | showMask: false,
|
4116 | keepCharPositions: true,
|
4117 | placeholderChar: "\u2000",
|
4118 | title: 'Enter area code and phone number'
|
4119 | },
|
4120 | ssnum: {
|
4121 | mask: [/\d/, /\d/, /\d/, '-', /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/],
|
4122 | showMask: false,
|
4123 | keepCharPositions: true,
|
4124 | placeholderChar: "\u2000",
|
4125 | title: 'Enter 9-digit social security number'
|
4126 | },
|
4127 | zip: {
|
4128 | mask: [/\d/, /\d/, /\d/, /\d/, /\d/],
|
4129 | guide: false,
|
4130 | title: 'Enter 5-digit zip code'
|
4131 | }
|
4132 | };
|
4133 |
|
4134 | var MaskedTextbox =
|
4135 |
|
4136 | React.forwardRef(function MaskedTextbox(props, ref) {
|
4137 | var maskType = props.maskType,
|
4138 | customMask = props.customMask,
|
4139 | additionalTextProps = _objectWithoutProperties(props, ["maskType", "customMask"]);
|
4140 |
|
4141 | var inputRef = React.useRef();
|
4142 | React.useImperativeHandle(ref, function () {
|
4143 | return inputRef.current;
|
4144 | });
|
4145 | var maskArgs = maskType === 'custom' && customMask ? customMask : inputMask[maskType];
|
4146 | return (
|
4147 |
|
4148 | React.createElement(MaskedInput, _extends({
|
4149 | render: function render(maskRef, textboxProps) {
|
4150 | var setRef = function setRef(inputElement) {
|
4151 |
|
4152 | maskRef(inputElement);
|
4153 | inputRef.current = inputElement;
|
4154 | };
|
4155 |
|
4156 | return (
|
4157 |
|
4158 | React.createElement(Textbox, _extends({
|
4159 | ref: setRef
|
4160 | }, textboxProps))
|
4161 | );
|
4162 | }
|
4163 | }, maskArgs, {
|
4164 | type: "text"
|
4165 | }, additionalTextProps))
|
4166 | );
|
4167 | });
|
4168 | MaskedTextbox.propTypes = process.env.NODE_ENV !== "production" ? {
|
4169 |
|
4170 | maskType: PropTypes.oneOf(['date', 'dollar', 'phone', 'ssnum', 'zip', 'custom']).isRequired,
|
4171 |
|
4172 |
|
4173 | customMask: PropTypes.shape({
|
4174 | mask: PropTypes.oneOfType([PropTypes.array, PropTypes.func]).isRequired,
|
4175 | guide: PropTypes.bool,
|
4176 | placeholderChar: PropTypes.string,
|
4177 | keepCharPositions: PropTypes.bool,
|
4178 | pipe: PropTypes.func,
|
4179 | showMask: PropTypes.bool
|
4180 | })
|
4181 | } : {};
|
4182 | MaskedTextbox.defaultProps = {
|
4183 | customMask: undefined
|
4184 | };
|
4185 |
|
4186 | var StyledButton$4 = styled(Button)(["background-color:", ";border-color:", ";color:", ";@media (hover:hover),(-ms-high-contrast:none){&:hover{background-color:", ";border-color:", ";}}"], function (props) {
|
4187 | return props.defaultStyle.bgColor;
|
4188 | }, function (props) {
|
4189 | return props.defaultStyle.bgColor;
|
4190 | }, function (props) {
|
4191 | return props.theme.colors.black;
|
4192 | }, function (props) {
|
4193 | return props.hoverStyle.bgColor;
|
4194 | }, function (props) {
|
4195 | return props.hoverStyle.bgColor;
|
4196 | });
|
4197 | var ActionButton =
|
4198 |
|
4199 | React.forwardRef(function ActionButton(props, ref) {
|
4200 | var children = props.children,
|
4201 | styleType = props.styleType,
|
4202 | other = _objectWithoutProperties(props, ["children", "styleType"]);
|
4203 |
|
4204 | var theme = useTheme();
|
4205 | var defaultStyle = theme.buttonStyles.button.variant.default;
|
4206 | var hoverStyle = theme.buttonStyles.button.variant[styleType];
|
4207 | return (
|
4208 |
|
4209 | React.createElement(StyledButton$4, _extends({
|
4210 | ref: ref,
|
4211 | defaultStyle: defaultStyle,
|
4212 | hoverStyle: hoverStyle,
|
4213 | styleType: styleType,
|
4214 | type: "button"
|
4215 | }, other), children)
|
4216 | );
|
4217 | });
|
4218 | ActionButton.propTypes = process.env.NODE_ENV !== "production" ? {
|
4219 | children: PropTypes.node.isRequired,
|
4220 |
|
4221 |
|
4222 | styleType: PropTypes.string
|
4223 | } : {};
|
4224 | ActionButton.defaultProps = {
|
4225 | styleType: 'primary'
|
4226 | };
|
4227 |
|
4228 | var SplitButton = styled(Button)(["", " ", " min-width:10px;padding-left:8px;padding-right:6px;span{margin-left:0;}"], function (props) {
|
4229 | return props.flatLeftEdge && "\n border-left: solid 1px ".concat(props.theme.colors.gray9, ";\n ");
|
4230 | }, function (props) {
|
4231 | return props.flatRightEdge && "\n border-right: solid 1px ".concat(props.theme.colors.gray9, ";\n ");
|
4232 | });
|
4233 | var Caret = styled.span(["border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px dashed;display:inline-block;height:0;margin-left:5px;vertical-align:middle;width:0;"]);
|
4234 | var ButtonPanel = styled.div(["background-color:", ";border:1px solid ", ";display:", ";margin-top:3px;position:relative;z-index:999;@media (min-width:", "){position:absolute;}"], function (props) {
|
4235 | return props.theme.colors.white;
|
4236 | }, function (props) {
|
4237 | return props.theme.colors.gray3;
|
4238 | }, function (props) {
|
4239 | return props.isOpen ? 'block' : 'none';
|
4240 | }, function (props) {
|
4241 | return props.theme.screenSize.tablet;
|
4242 | });
|
4243 | var ButtonPanelChildrenContainer = styled.div(["display:flex;flex-direction:column;"]);
|
4244 | var StyledButtonLink = styled(LinkButton)(["color:black;margin-bottom:0;padding:10px 20px;text-align:left;text-decoration:none;&:active,&:focus,&:hover{background-color:", ";color:white;}"], function (props) {
|
4245 | return props.theme.colors.primary;
|
4246 | });
|
4247 | var TAB_KEY_CODE = 9;
|
4248 | var UP_ARROW_CODE = 38;
|
4249 | var DOWN_ARROW_CODE = 40;
|
4250 |
|
4251 | function getFocusables(node) {
|
4252 | var focusableElements = node.querySelectorAll('button');
|
4253 | var firstFocusable = focusableElements[0];
|
4254 | var lastFocusable = focusableElements[focusableElements.length - 1];
|
4255 | return {
|
4256 | focusableElements: focusableElements,
|
4257 | firstFocusable: firstFocusable,
|
4258 | lastFocusable: lastFocusable
|
4259 | };
|
4260 | }
|
4261 |
|
4262 | function isCurrentlyActive(node) {
|
4263 | var rootNode = node.getRootNode();
|
4264 | return rootNode.activeElement === node;
|
4265 | }
|
4266 |
|
4267 | function focusTrap(node) {
|
4268 | var _getFocusables = getFocusables(node),
|
4269 | firstFocusable = _getFocusables.firstFocusable,
|
4270 | lastFocusable = _getFocusables.lastFocusable;
|
4271 |
|
4272 | function handleTabFocus(event) {
|
4273 | if (event.key === 'Tab' || event.keyCode === TAB_KEY_CODE) {
|
4274 | if (event.shiftKey) {
|
4275 | if (isCurrentlyActive(firstFocusable)) {
|
4276 | lastFocusable.focus();
|
4277 | event.preventDefault();
|
4278 | }
|
4279 | } else if (isCurrentlyActive(lastFocusable)) {
|
4280 | firstFocusable.focus();
|
4281 | event.preventDefault();
|
4282 | }
|
4283 | }
|
4284 | }
|
4285 |
|
4286 | node.addEventListener('keydown', handleTabFocus);
|
4287 | return function removeKeydownListener() {
|
4288 | node.removeEventListener('keydown', handleTabFocus);
|
4289 | };
|
4290 | }
|
4291 |
|
4292 | function arrowMovement(node) {
|
4293 | var _getFocusables2 = getFocusables(node),
|
4294 | focusableElements = _getFocusables2.focusableElements,
|
4295 | firstFocusable = _getFocusables2.firstFocusable,
|
4296 | lastFocusable = _getFocusables2.lastFocusable;
|
4297 |
|
4298 | var focusables = _toConsumableArray(focusableElements);
|
4299 |
|
4300 | var rootNode = node.getRootNode();
|
4301 |
|
4302 | function handleArrowMovementKeys(event) {
|
4303 | if (event.keyCode === UP_ARROW_CODE) {
|
4304 | if (isCurrentlyActive(firstFocusable)) {
|
4305 | lastFocusable.focus();
|
4306 | event.preventDefault();
|
4307 | } else {
|
4308 | var index = _indexOfInstanceProperty(focusables).call(focusables, rootNode.activeElement);
|
4309 |
|
4310 | focusables[index - 1].focus();
|
4311 | event.preventDefault();
|
4312 | }
|
4313 | }
|
4314 |
|
4315 | if (event.keyCode === DOWN_ARROW_CODE) {
|
4316 | if (isCurrentlyActive(lastFocusable)) {
|
4317 | firstFocusable.focus();
|
4318 | event.preventDefault();
|
4319 | } else {
|
4320 | var _index = _indexOfInstanceProperty(focusables).call(focusables, rootNode.activeElement);
|
4321 |
|
4322 | focusableElements[_index + 1].focus();
|
4323 |
|
4324 | event.preventDefault();
|
4325 | }
|
4326 | }
|
4327 | }
|
4328 |
|
4329 | node.addEventListener('keydown', handleArrowMovementKeys);
|
4330 | return function removeArrowMovementListener() {
|
4331 | node.removeEventListener('keydown', handleArrowMovementKeys);
|
4332 | };
|
4333 | }
|
4334 |
|
4335 | var _StyledRootCloseWrapper = styled(RootCloseWrapper)(["display:", ";flex-direction:column;position:relative;"], function (p) {
|
4336 | return p._css;
|
4337 | });
|
4338 |
|
4339 | var _StyledDiv$1 = styled("div")(["position:relative;"]);
|
4340 |
|
4341 | function DropdownButton(_ref) {
|
4342 | var id = _ref.id,
|
4343 | rootClose = _ref.rootClose,
|
4344 | children = _ref.children,
|
4345 | buttonValue = _ref.buttonValue,
|
4346 | manualButtonValue = _ref.manualButtonValue,
|
4347 | shouldCloseOnButtonClick = _ref.shouldCloseOnButtonClick,
|
4348 | shouldUpdateButtonValue = _ref.shouldUpdateButtonValue,
|
4349 | styleType = _ref.styleType,
|
4350 | inline = _ref.inline,
|
4351 | flatLeftEdge = _ref.flatLeftEdge,
|
4352 | flatRightEdge = _ref.flatRightEdge,
|
4353 | otherProps = _objectWithoutProperties(_ref, ["id", "rootClose", "children", "buttonValue", "manualButtonValue", "shouldCloseOnButtonClick", "shouldUpdateButtonValue", "styleType", "inline", "flatLeftEdge", "flatRightEdge"]);
|
4354 |
|
4355 | var ActivationButton = flatLeftEdge || flatRightEdge ? SplitButton : Button;
|
4356 |
|
4357 | var _useState = useState(buttonValue),
|
4358 | _useState2 = _slicedToArray(_useState, 2),
|
4359 | buttonStateValue = _useState2[0],
|
4360 | setButtonStateValue = _useState2[1];
|
4361 |
|
4362 | var _useState3 = useState(false),
|
4363 | _useState4 = _slicedToArray(_useState3, 2),
|
4364 | isOpen = _useState4[0],
|
4365 | setIsOpen = _useState4[1];
|
4366 |
|
4367 | var initialRender = useRef(true);
|
4368 | var buttonDropdown = useRef();
|
4369 | var triggerButton = useRef();
|
4370 | var panelId = useUniqueId(id);
|
4371 | useEffect(function () {
|
4372 | var removeFocusTrapListener = focusTrap(buttonDropdown.current);
|
4373 | var removeArrowMovementListener = arrowMovement(buttonDropdown.current);
|
4374 | return function removeListeners() {
|
4375 | removeFocusTrapListener();
|
4376 | removeArrowMovementListener();
|
4377 | };
|
4378 | }, [isOpen]);
|
4379 | useEffect(function () {
|
4380 | if (!initialRender.current) {
|
4381 | triggerButton.current.focus();
|
4382 | }
|
4383 |
|
4384 | initialRender.current = false;
|
4385 | }, [isOpen]);
|
4386 |
|
4387 | var toggleDropdown = function toggleDropdown() {
|
4388 | return setIsOpen(!isOpen);
|
4389 | };
|
4390 |
|
4391 | function closeDropdown() {
|
4392 | if (isOpen) {
|
4393 | setIsOpen(false);
|
4394 | }
|
4395 | }
|
4396 |
|
4397 | function handleDropdownItemClick(buttonProps) {
|
4398 | return function (event) {
|
4399 | if (shouldUpdateButtonValue) {
|
4400 | setButtonStateValue(buttonProps.children);
|
4401 | }
|
4402 |
|
4403 | if (shouldCloseOnButtonClick) {
|
4404 | closeDropdown();
|
4405 | }
|
4406 |
|
4407 | buttonProps.onClick(event, buttonProps.name);
|
4408 | };
|
4409 | }
|
4410 |
|
4411 | return (
|
4412 |
|
4413 | React.createElement(_StyledRootCloseWrapper, {
|
4414 | onRootClose: closeDropdown,
|
4415 | disabled: !rootClose,
|
4416 | _css: inline ? 'inline-flex' : 'block'
|
4417 | },
|
4418 |
|
4419 | React.createElement("div", {
|
4420 | ref: buttonDropdown,
|
4421 | role: "combobox",
|
4422 | "aria-controls": panelId,
|
4423 | "aria-expanded": isOpen,
|
4424 | "aria-haspopup": "listbox"
|
4425 | },
|
4426 |
|
4427 | React.createElement(ActivationButton, _extends({}, otherProps, {
|
4428 | flatLeftEdge: flatLeftEdge,
|
4429 | flatRightEdge: flatRightEdge,
|
4430 | onClick: toggleDropdown,
|
4431 | "aria-haspopup": "true",
|
4432 | "aria-pressed": isOpen,
|
4433 | className: isOpen ? "".concat(otherProps && otherProps.className, " pressed") : otherProps.className,
|
4434 | ref: triggerButton,
|
4435 | styleType: styleType
|
4436 | }), manualButtonValue || buttonStateValue,
|
4437 |
|
4438 | React.createElement(Caret, null)),
|
4439 |
|
4440 | React.createElement(_StyledDiv$1, null,
|
4441 |
|
4442 | React.createElement(ButtonPanel, {
|
4443 | isOpen: isOpen,
|
4444 | id: panelId
|
4445 | },
|
4446 |
|
4447 | React.createElement(ButtonPanelChildrenContainer, null, _mapInstanceProperty(Children).call(Children, children, function (child) {
|
4448 | var onClickHandler = handleDropdownItemClick(child.props);
|
4449 | var newProps = {
|
4450 | onClick: onClickHandler,
|
4451 | role: 'option'
|
4452 | };
|
4453 | return (
|
4454 |
|
4455 | React.cloneElement(child, newProps)
|
4456 | );
|
4457 | }))))))
|
4458 | );
|
4459 | }
|
4460 |
|
4461 | DropdownButton.Button = StyledButtonLink;
|
4462 | DropdownButton.propTypes = process.env.NODE_ENV !== "production" ? {
|
4463 |
|
4464 | buttonValue: PropTypes.any,
|
4465 |
|
4466 | |
4467 |
|
4468 |
|
4469 |
|
4470 |
|
4471 | manualButtonValue: PropTypes.node,
|
4472 | children: PropTypes.any.isRequired,
|
4473 |
|
4474 | |
4475 |
|
4476 |
|
4477 |
|
4478 | shouldUpdateButtonValue: PropTypes.bool,
|
4479 |
|
4480 |
|
4481 | shouldCloseOnButtonClick: PropTypes.bool,
|
4482 |
|
4483 | |
4484 |
|
4485 |
|
4486 |
|
4487 | rootClose: PropTypes.bool,
|
4488 |
|
4489 |
|
4490 | styleType: PropTypes.string,
|
4491 |
|
4492 |
|
4493 | inline: PropTypes.bool,
|
4494 | id: PropTypes.string,
|
4495 |
|
4496 |
|
4497 | flatLeftEdge: PropTypes.bool,
|
4498 |
|
4499 |
|
4500 | flatRightEdge: PropTypes.bool
|
4501 | } : {};
|
4502 | DropdownButton.defaultProps = {
|
4503 | buttonValue: undefined,
|
4504 | manualButtonValue: undefined,
|
4505 | shouldUpdateButtonValue: false,
|
4506 | shouldCloseOnButtonClick: false,
|
4507 | styleType: 'default',
|
4508 | rootClose: false,
|
4509 | inline: false,
|
4510 | id: undefined,
|
4511 | flatLeftEdge: false,
|
4512 | flatRightEdge: false
|
4513 | };
|
4514 |
|
4515 | var Container$1 = styled.div(["align-items:center;display:flex;flex-direction:column;max-width:", ";"], function (props) {
|
4516 | return props.maxWidth;
|
4517 | });
|
4518 | var StyledIconButton = styled(OutlineButton)(["background-color:", ";border-radius:50%;border-width:3px;color:", ";display:inline-block;font-weight:normal;min-width:0;padding:13px 14px;width:auto;-webkit-tap-highlight-color:transparent;"], function (props) {
|
4519 | return props.isHighlighted && props.activeColor;
|
4520 | }, function (props) {
|
4521 | return props.isHighlighted && props.theme.colors.white;
|
4522 | });
|
4523 | var IncompleteButton = styled(StyledIconButton)(["background-color:", ";border-left:3px dashed ", ";color:", ";transform:rotate(45deg);&:hover,&:active{background-color:", ";color:", ";}& i{transform:rotate(-45deg) translate(-1px,1px);}"], function (props) {
|
4524 | return props.isHighlighted ? props.theme.colors.gray5 : props.theme.colors.white;
|
4525 | }, function (props) {
|
4526 | return props.theme.colors.gray5;
|
4527 | }, function (props) {
|
4528 | return props.isHighlighted ? props.theme.colors.white : props.theme.colors.gray5;
|
4529 | }, function (props) {
|
4530 | return props.theme.colors.gray6;
|
4531 | }, function (props) {
|
4532 | return props.theme.colors.white;
|
4533 | });
|
4534 | var IconText = styled.span(["font-size:", "px;font-weight:", ";margin-top:6px;max-width:", ";overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"], function (props) {
|
4535 | return props.fontSize;
|
4536 | }, function (props) {
|
4537 | return props.isHighlighted ? 'bold' : 'normal';
|
4538 | }, function (props) {
|
4539 | return props.maxWidth;
|
4540 | });
|
4541 |
|
4542 | function IconButton(_ref) {
|
4543 | var iconName = _ref.iconName,
|
4544 | iconSize = _ref.iconSize,
|
4545 | childrenFontSize = _ref.childrenFontSize,
|
4546 | isHighlighted = _ref.isHighlighted,
|
4547 | isIncomplete = _ref.isIncomplete,
|
4548 | disabled = _ref.disabled,
|
4549 | maxWidth = _ref.maxWidth,
|
4550 | onClick = _ref.onClick,
|
4551 | styleType = _ref.styleType,
|
4552 | children = _ref.children,
|
4553 | otherProps = _objectWithoutProperties(_ref, ["iconName", "iconSize", "childrenFontSize", "isHighlighted", "isIncomplete", "disabled", "maxWidth", "onClick", "styleType", "children"]);
|
4554 |
|
4555 | var CurrentButton = isIncomplete ? IncompleteButton : StyledIconButton;
|
4556 | var theme = useTheme();
|
4557 | var textId = generateAlphaName();
|
4558 | var buttonStyle = theme.buttonStyles.outlineButton.variant[styleType];
|
4559 | return (
|
4560 |
|
4561 | React.createElement(Container$1, _extends({
|
4562 | maxWidth: maxWidth
|
4563 | }, otherProps),
|
4564 |
|
4565 | React.createElement(CurrentButton, {
|
4566 | onClick: onClick,
|
4567 | styleType: styleType,
|
4568 | isHighlighted: isHighlighted,
|
4569 | disabled: disabled,
|
4570 | activeColor: buttonStyle.bgColor,
|
4571 | "aria-describedby": textId
|
4572 | },
|
4573 |
|
4574 | React.createElement(Icon, {
|
4575 | name: iconName,
|
4576 | size: iconSize
|
4577 | })),
|
4578 |
|
4579 | React.createElement(IconText, {
|
4580 | id: textId,
|
4581 | isHighlighted: isHighlighted,
|
4582 | maxWidth: maxWidth,
|
4583 | fontSize: childrenFontSize
|
4584 | }, children))
|
4585 | );
|
4586 | }
|
4587 |
|
4588 | IconButton.propTypes = process.env.NODE_ENV !== "production" ? {
|
4589 |
|
4590 | iconName: PropTypes.string.isRequired,
|
4591 |
|
4592 |
|
4593 | iconSize: PropTypes.number,
|
4594 |
|
4595 |
|
4596 | childrenFontSize: PropTypes.number,
|
4597 |
|
4598 |
|
4599 | isHighlighted: PropTypes.bool,
|
4600 |
|
4601 |
|
4602 | isIncomplete: PropTypes.bool,
|
4603 |
|
4604 |
|
4605 | disabled: PropTypes.bool,
|
4606 |
|
4607 |
|
4608 | maxWidth: PropTypes.string,
|
4609 |
|
4610 |
|
4611 | onClick: PropTypes.func,
|
4612 |
|
4613 |
|
4614 | styleType: PropTypes.string,
|
4615 |
|
4616 |
|
4617 | children: PropTypes.node
|
4618 | } : {};
|
4619 | IconButton.defaultProps = {
|
4620 | isHighlighted: false,
|
4621 | isIncomplete: false,
|
4622 | iconSize: 45,
|
4623 | childrenFontSize: 18,
|
4624 | disabled: false,
|
4625 | maxWidth: undefined,
|
4626 | onClick: function onClick() {},
|
4627 | styleType: 'magenta',
|
4628 | children: undefined
|
4629 | };
|
4630 |
|
4631 | function ownKeys$4(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { keys.push.apply(keys, _Object$getOwnPropertySymbols(object)); } if (enumerableOnly) keys = _filterInstanceProperty(keys).call(keys, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
4632 |
|
4633 | function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys$4(source, true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys$4(source)).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
4634 | var AnswerLabel = styled.label(["flex-grow:1;@media (min-width:", "){flex-grow:0;min-width:", ";}"], function (props) {
|
4635 | return props.theme.screenSize.tablet;
|
4636 | }, function (props) {
|
4637 | return props.itemWidth;
|
4638 | });
|
4639 | var AnswerDisplay = styled.div(["background-color:", ";border-color:transparent;box-shadow:0 4px 0 0 ", ";color:", ";font-weight:", ";font-size:", ";line-height:", ";margin-bottom:4px;margin-top:0;padding-top:", ";padding-right:", ";padding-bottom:", ";padding-left:", ";text-align:center;text-transform:", ";transition:background-color 250ms linear,color 250ms linear;user-select:none;&:active{background-color:", ";box-shadow:0 0 0 0 transparent;color:", ";margin-bottom:0;margin-top:4px;}@media (hover:hover),(-ms-high-contrast:none){&:hover{background-color:", ";color:", ";}}&[disabled]{cursor:not-allowed;opacity:0.65;> *{pointer-events:none;}}"], function (props) {
|
4640 | return props.buttonStyle.bgColor;
|
4641 | }, function (props) {
|
4642 | return darken(props.buttonStyle.bgColor, 10);
|
4643 | }, function (props) {
|
4644 | return getTextColor(props.buttonStyle.bgColor);
|
4645 | }, function (props) {
|
4646 | return props.buttonSize.fontWeight || 'normal';
|
4647 | }, function (props) {
|
4648 | return props.buttonSize.fontSize;
|
4649 | }, function (props) {
|
4650 | return props.buttonSize.lineHeight;
|
4651 | }, function (props) {
|
4652 | return props.buttonSize.paddingTop;
|
4653 | }, function (props) {
|
4654 | return props.buttonSize.paddingSides;
|
4655 | }, function (props) {
|
4656 | return props.buttonSize.paddingBottom;
|
4657 | }, function (props) {
|
4658 | return props.buttonSize.paddingSides;
|
4659 | }, function (props) {
|
4660 | return props.buttonSize.textTransform ? props.buttonSize.textTransform : 'none';
|
4661 | }, function (props) {
|
4662 | return darken(props.buttonStyle.bgColor, 8);
|
4663 | }, function (props) {
|
4664 | return getTextColor(props.buttonStyle.bgColor);
|
4665 | }, function (props) {
|
4666 | return darken(props.buttonStyle.bgColor, 8);
|
4667 | }, function (props) {
|
4668 | return getTextColor(props.buttonStyle.bgColor);
|
4669 | });
|
4670 | var OutlineAnswerDisplay = styled(AnswerDisplay)(["background-color:", ";border:2px solid ", ";box-shadow:none;box-sizing:border-box;color:", ";margin:0;&:active{margin:0;}"], function (props) {
|
4671 | return props.isChecked ? props.buttonStyle.bgColor : props.theme.colors.white;
|
4672 | }, function (props) {
|
4673 | return props.buttonStyle.borderColor || props.buttonStyle.bgColor;
|
4674 | }, function (props) {
|
4675 | return props.isChecked ? props.theme.colors.white : props.buttonStyle.bgColor;
|
4676 | });
|
4677 | var AnswerInput = styled.input(["clip-path:inset(100%);clip:rect(1px,1px,1px,1px);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px;&:focus + div{background-color:", ";color:", ";}"], function (props) {
|
4678 | return darken(props.buttonStyle.bgColor, 8);
|
4679 | }, function (props) {
|
4680 | return getTextColor(props.buttonStyle.bgColor);
|
4681 | });
|
4682 |
|
4683 | function AnswerButton(_ref) {
|
4684 | var name = _ref.name,
|
4685 | children = _ref.children,
|
4686 | itemWidth = _ref.itemWidth,
|
4687 | styleType = _ref.styleType,
|
4688 | selectedType = _ref.selectedType,
|
4689 | size = _ref.size,
|
4690 | isOutline = _ref.isOutline,
|
4691 | checked = _ref.checked,
|
4692 | radioProps = _objectWithoutProperties(_ref, ["name", "children", "itemWidth", "styleType", "selectedType", "size", "isOutline", "checked"]);
|
4693 |
|
4694 | var id = useUniqueId(radioProps.id);
|
4695 | var isChecked = radioProps.checked || radioProps.defaultChecked;
|
4696 | var theme = useTheme();
|
4697 | var validationState = React.useContext(ValidationContext);
|
4698 | var buttonType = isOutline ? 'outlineButton' : 'button';
|
4699 | var buttonSize = theme.buttonStyles[buttonType].size[size];
|
4700 | var variant = validationState !== 'default' && !isOutline ? validationState : styleType;
|
4701 | var validationBorder = theme.buttonStyles[buttonType].variant[validationState].bgColor;
|
4702 | var selectedStyles = theme.buttonStyles[buttonType].variant[selectedType];
|
4703 | var unSelectedStyles = theme.buttonStyles[buttonType].variant[variant];
|
4704 |
|
4705 | if (isOutline && validationState !== 'default') {
|
4706 | selectedStyles = _objectSpread$4(_objectSpread$4({}, selectedStyles), {}, {
|
4707 | borderColor: validationBorder
|
4708 | });
|
4709 | unSelectedStyles = _objectSpread$4(_objectSpread$4({}, unSelectedStyles), {}, {
|
4710 | borderColor: validationBorder
|
4711 | });
|
4712 | }
|
4713 |
|
4714 | var buttonStyle = isChecked ? selectedStyles : unSelectedStyles;
|
4715 | var buttonProps = {
|
4716 | disabled: radioProps.disabled,
|
4717 | isChecked: isChecked,
|
4718 | buttonStyle: buttonStyle,
|
4719 | buttonSize: buttonSize
|
4720 | };
|
4721 | var labelProps = {
|
4722 | disabled: radioProps.disabled,
|
4723 | itemWidth: itemWidth,
|
4724 | htmlFor: id,
|
4725 | validationState: validationState
|
4726 | };
|
4727 | var Display = isOutline ? OutlineAnswerDisplay : AnswerDisplay;
|
4728 | return (
|
4729 |
|
4730 | React.createElement(AnswerLabel, labelProps,
|
4731 |
|
4732 | React.createElement(AnswerInput, _extends({
|
4733 | type: "radio",
|
4734 | name: name,
|
4735 | id: id,
|
4736 | buttonStyle: buttonStyle
|
4737 | }, radioProps)),
|
4738 |
|
4739 | React.createElement(Display, buttonProps, children))
|
4740 | );
|
4741 | }
|
4742 |
|
4743 | function ownKeys$5(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { keys.push.apply(keys, _Object$getOwnPropertySymbols(object)); } if (enumerableOnly) keys = _filterInstanceProperty(keys).call(keys, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
4744 |
|
4745 | function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context3; _forEachInstanceProperty(_context3 = ownKeys$5(source, true)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context4; _forEachInstanceProperty(_context4 = ownKeys$5(source)).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
4746 |
|
4747 | function RadioGroup(_ref) {
|
4748 | var _context;
|
4749 |
|
4750 | var name = _ref.name,
|
4751 | disableAllOptions = _ref.disableAllOptions,
|
4752 | selectedValue = _ref.selectedValue,
|
4753 | children = _ref.children,
|
4754 | onChange = _ref.onChange,
|
4755 | rest = _objectWithoutProperties(_ref, ["name", "disableAllOptions", "selectedValue", "children", "onChange"]);
|
4756 |
|
4757 | return _mapInstanceProperty(_context = React.Children).call(_context, children, function (child, index) {
|
4758 | var _context2;
|
4759 |
|
4760 | var key = _concatInstanceProperty(_context2 = "".concat(name, "-option-")).call(_context2, index + 1);
|
4761 |
|
4762 | var disabled = disableAllOptions || child.props.disabled;
|
4763 | var checked = selectedValue === child.props.value;
|
4764 | return (
|
4765 |
|
4766 | React.cloneElement(child, _objectSpread$5({
|
4767 | key: key,
|
4768 | name: name,
|
4769 | disabled: disabled,
|
4770 | checked: checked,
|
4771 | onChange: onChange
|
4772 | }, rest))
|
4773 | );
|
4774 | });
|
4775 | }
|
4776 |
|
4777 | RadioGroup.propTypes = process.env.NODE_ENV !== "production" ? {
|
4778 |
|
4779 | name: PropTypes.string.isRequired,
|
4780 |
|
4781 |
|
4782 | selectedValue: PropTypes.any,
|
4783 |
|
4784 |
|
4785 | disableAllOptions: PropTypes.bool,
|
4786 |
|
4787 |
|
4788 | onChange: PropTypes.func
|
4789 | } : {};
|
4790 | RadioGroup.defaultProps = {
|
4791 | selectedValue: undefined,
|
4792 | disableAllOptions: false,
|
4793 | onChange: _noop
|
4794 | };
|
4795 |
|
4796 | var outlineStyles = css(["> label:first-child > div{border-radius:4px 0 0 4px;}> label:last-child > div{border-left:none;border-radius:0 4px 4px 0;}> label:not(:first-child):not(:last-child) > div{border-left:1px;}"]);
|
4797 | var AnswerSet = styled.div(["display:flex;flex-wrap:nowrap;", ";"], function (props) {
|
4798 | return props.isOutline && outlineStyles;
|
4799 | });
|
4800 |
|
4801 | function AnswerGroup(props) {
|
4802 | return (
|
4803 |
|
4804 | React.createElement(AnswerSet, {
|
4805 | isOutline: props.isOutline
|
4806 | },
|
4807 |
|
4808 | React.createElement(RadioGroup, props))
|
4809 | );
|
4810 | }
|
4811 |
|
4812 | AnswerGroup.propTypes = process.env.NODE_ENV !== "production" ? {
|
4813 |
|
4814 | name: PropTypes.string.isRequired,
|
4815 | children: PropTypes.node.isRequired,
|
4816 |
|
4817 |
|
4818 | itemWidth: PropTypes.string,
|
4819 |
|
4820 |
|
4821 | styleType: PropTypes.string,
|
4822 |
|
4823 |
|
4824 | selectedType: PropTypes.string,
|
4825 |
|
4826 |
|
4827 | size: PropTypes.string,
|
4828 |
|
4829 |
|
4830 | isOutline: PropTypes.bool,
|
4831 |
|
4832 |
|
4833 | disableAllOptions: PropTypes.bool,
|
4834 |
|
4835 |
|
4836 | selectedValue: PropTypes.any
|
4837 | } : {};
|
4838 | AnswerGroup.defaultProps = {
|
4839 | styleType: 'default',
|
4840 | selectedType: 'success',
|
4841 | size: 'default',
|
4842 | itemWidth: '100px',
|
4843 | isOutline: false,
|
4844 | disableAllOptions: false,
|
4845 | selectedValue: undefined
|
4846 | };
|
4847 |
|
4848 | function getRadioFillVariables(isChecked, isDisabled, validationState, colors) {
|
4849 | var isNotDisabled = !isDisabled;
|
4850 | var isValid = validationState === 'default';
|
4851 |
|
4852 | if (isDisabled) {
|
4853 | return {
|
4854 | fill: colors.gray5
|
4855 | };
|
4856 | }
|
4857 |
|
4858 | if (isNotDisabled && !isValid) {
|
4859 | return {
|
4860 | fill: colors[validationState],
|
4861 | hover: colors.gray3
|
4862 | };
|
4863 | }
|
4864 |
|
4865 | if (isChecked && isNotDisabled) {
|
4866 | return {
|
4867 | fill: colors.primary
|
4868 | };
|
4869 | }
|
4870 |
|
4871 | return {
|
4872 | fill: colors.gray8,
|
4873 | hover: colors.gray3
|
4874 | };
|
4875 | }
|
4876 |
|
4877 | function ownKeys$6(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { keys.push.apply(keys, _Object$getOwnPropertySymbols(object)); } if (enumerableOnly) keys = _filterInstanceProperty(keys).call(keys, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
4878 |
|
4879 | function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys$6(source, true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys$6(source)).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
4880 |
|
4881 | function radioFill(color) {
|
4882 | return "\n background-color: ".concat(color, ";\n border-radius: 50%;\n content: '';\n display: block;\n height: 13px;\n left: 3px;\n position: relative;\n width: 13px;\n top: 3px;\n transition: background 0.25s linear;\n ");
|
4883 | }
|
4884 |
|
4885 | var RadioLabel = styled(Label)(["align-self:flex-start;cursor:pointer;display:flex;font-family:'Source Sans Pro','Segoe UI',Segoe,Calibri,Tahoma,sans-serif;font-size:", ";font-weight:normal;line-height:", ";margin-right:15px;margin-bottom:10px;position:relative;padding:10px 0 10px 10px;text-transform:none;&:hover > .es-radio__fill:before{", ";}@media (min-width:", "){padding:5px 0;}"], function (props) {
|
4886 | return props.theme.font.baseFontSize;
|
4887 | }, function (props) {
|
4888 | return props.theme.font.baseLineHeight;
|
4889 | }, function (props) {
|
4890 | return !props.checked && radioFill(props.hoverFillColor);
|
4891 | }, function (props) {
|
4892 | return props.theme.screenSize.tablet;
|
4893 | });
|
4894 | var RadioInput = styled.input(["clip:rect(0,0,0,0);pointer-events:none;position:absolute;&:focus ~ .es-radio__fill{box-shadow:0 0 3px 3px ", ";}"], function (props) {
|
4895 | return props.theme.colors.inputFocus;
|
4896 | });
|
4897 | var RadioDisplay = styled.span(["border:3px solid ", ";border-radius:50%;box-sizing:border-box;height:25px;margin-right:8px;min-width:25px;&:before{", ";}"], function (props) {
|
4898 | return props.borderColor;
|
4899 | }, function (props) {
|
4900 | return radioFill(_fillInstanceProperty(props));
|
4901 | });
|
4902 | function RadioButton(_ref) {
|
4903 | var children = _ref.children,
|
4904 | className = _ref.className,
|
4905 | radioProps = _objectWithoutProperties(_ref, ["children", "className"]);
|
4906 |
|
4907 | var id = useUniqueId(radioProps.id);
|
4908 | var isChecked = radioProps.checked;
|
4909 | var theme = useTheme();
|
4910 | var validationState = React.useContext(ValidationContext);
|
4911 |
|
4912 | var _getRadioFillVariable = getRadioFillVariables(isChecked, radioProps.disabled, validationState, theme.colors),
|
4913 | hover = _getRadioFillVariable.hover,
|
4914 | fill = _fillInstanceProperty(_getRadioFillVariable);
|
4915 |
|
4916 | var radioDisplayFill = isChecked ? fill : theme.colors.white;
|
4917 | var labelProps = {
|
4918 | disabled: radioProps.disabled,
|
4919 | htmlFor: id,
|
4920 | hoverFillColor: hover,
|
4921 | validationState: validationState,
|
4922 | checked: isChecked
|
4923 | };
|
4924 |
|
4925 | var inputProps = _objectSpread$6(_objectSpread$6({}, radioProps), {}, {
|
4926 | checked: isChecked
|
4927 | });
|
4928 |
|
4929 | return (
|
4930 |
|
4931 | React.createElement(RadioLabel, _extends({
|
4932 | className: className
|
4933 | }, labelProps),
|
4934 |
|
4935 | React.createElement(RadioInput, _extends({
|
4936 | type: "radio",
|
4937 | id: id
|
4938 | }, inputProps)),
|
4939 |
|
4940 | React.createElement(RadioDisplay, {
|
4941 | className: "es-radio__fill",
|
4942 | borderColor: fill,
|
4943 | fill: radioDisplayFill
|
4944 | }), children)
|
4945 | );
|
4946 | }
|
4947 | RadioButton.propTypes = process.env.NODE_ENV !== "production" ? {
|
4948 |
|
4949 | className: PropTypes.string,
|
4950 | children: PropTypes.any
|
4951 | } : {};
|
4952 | RadioButton.defaultProps = {
|
4953 | className: undefined,
|
4954 | children: undefined
|
4955 | };
|
4956 |
|
4957 | var DropdownBase = styled.select(["background-color:", ";border:1px solid ", ";border-radius:2px;box-shadow:", ";box-sizing:border-box;color:", ";flex:auto;font-size:", ";font-weight:normal;height:39px;min-width:100px;padding:6px 12px;transition:border-color ease-in-out 0.15s,box-shadow ease-in-out 0.15s;&:focus{border-color:", ";box-shadow:", ";outline:0;}&:disabled{background-color:", ";cursor:not-allowed;}"], function (props) {
|
4958 | return props.theme.colors.white;
|
4959 | }, function (props) {
|
4960 | return props.theme.colors.gray5;
|
4961 | }, function (props) {
|
4962 | return props.boxShadow;
|
4963 | }, function (props) {
|
4964 | return props.theme.colors.black;
|
4965 | }, function (props) {
|
4966 | return props.theme.font.baseFontSize;
|
4967 | }, function (props) {
|
4968 | return props.focusBorderColor;
|
4969 | }, function (props) {
|
4970 | return props.focusBoxShadow;
|
4971 | }, function (props) {
|
4972 | return props.theme.colors.gray2;
|
4973 | });
|
4974 |
|
4975 | function Dropdown(props) {
|
4976 | return (
|
4977 |
|
4978 | React.createElement(DropdownBase, props)
|
4979 | );
|
4980 | }
|
4981 |
|
4982 | var backgroundColorSelect = function backgroundColorSelect(checked, theme, validationState) {
|
4983 | if (checked) {
|
4984 | return validationState === 'default' ? theme.colors.primary : theme.colors[validationState];
|
4985 | }
|
4986 |
|
4987 | return theme.colors.white;
|
4988 | };
|
4989 |
|
4990 | var CheckboxLabel = styled(Label)(["font-size:", ";font-family:'Source Sans Pro','Segoe UI',Segoe,Calibri,Tahoma,sans-serif;font-size:", ";font-weight:normal;line-height:", ";margin-left:-10px;min-height:25px;padding:10px 0 10px 42px;position:relative;@media (min-width:", "){margin-left:0;padding:5px 0 5px 32px;}.es-checkbox__fill{background-color:", ";border-color:", ";&:after{border-color:", ";}}&:hover .es-checkbox__fill:after{border-color:", ";}&[disabled] .es-checkbox__fill{background-color:", ";border-color:", ";cursor:not-allowed;outline:0;&:after{border-color:", ";}}"], function (props) {
|
4991 | return props.theme.font.baseFontSize;
|
4992 | }, function (props) {
|
4993 | return props.theme.font.baseFontSize;
|
4994 | }, function (props) {
|
4995 | return props.theme.font.baseLineHeight;
|
4996 | }, function (props) {
|
4997 | return props.theme.screenSize.tablet;
|
4998 | }, function (_ref) {
|
4999 | var checked = _ref.checked,
|
5000 | theme = _ref.theme,
|
5001 | validationState = _ref.validationState;
|
5002 | return backgroundColorSelect(checked, theme, validationState);
|
5003 | }, function (_ref2) {
|
5004 | var checked = _ref2.checked,
|
5005 | theme = _ref2.theme,
|
5006 | validationState = _ref2.validationState;
|
5007 | return checked && validationState === 'default' ? theme.colors.primary : theme.colors[validationState];
|
5008 | }, function (props) {
|
5009 | return props.theme.colors.white;
|
5010 | }, function (_ref3) {
|
5011 | var checked = _ref3.checked,
|
5012 | theme = _ref3.theme;
|
5013 | return checked ? theme.colors.white : theme.colors.gray3;
|
5014 | }, function (_ref4) {
|
5015 | var checked = _ref4.checked,
|
5016 | theme = _ref4.theme;
|
5017 | return checked ? theme.colors.gray5 : theme.colors.white;
|
5018 | }, function (props) {
|
5019 | return props.theme.colors.gray5;
|
5020 | }, function (props) {
|
5021 | return props.theme.colors.white;
|
5022 | });
|
5023 | var CheckboxInput = styled.input(["clip:rect(0,0,0,0);pointer-events:none;position:absolute;&:focus ~ .es-checkbox__fill{box-shadow:0 0 3px 3px ", ";&:after{border-color:", ";}}"], function (props) {
|
5024 | return props.theme.colors.inputFocus;
|
5025 | }, function (_ref5) {
|
5026 | var checked = _ref5.checked,
|
5027 | theme = _ref5.theme;
|
5028 | return checked ? theme.colors.white : theme.colors.gray3;
|
5029 | });
|
5030 | var CheckboxDisplay = styled.span(["background:", ";border:3px solid ", ";border-radius:4px;box-sizing:border-box;cursor:pointer;height:25px;left:10px;position:absolute;top:0.55em;transition:all 0.25s linear,box-shadow 0.15s linear;width:25px;@media (min-width:", "){left:0;top:0.35em;}&:after{background:transparent;border:3px solid ", ";border-right:none;border-top:none;box-sizing:border-box;content:'';display:block;height:9px;margin:3px 0 0 2px;transform:rotate(-45deg);transition:border 0.25s linear;width:15px;}"], function (props) {
|
5031 | return props.theme.colors.white;
|
5032 | }, function (props) {
|
5033 | return props.theme.colors.gray8;
|
5034 | }, function (props) {
|
5035 | return props.theme.screenSize.tablet;
|
5036 | }, function (props) {
|
5037 | return props.theme.colors.white;
|
5038 | });
|
5039 |
|
5040 | function Checkbox(_ref6) {
|
5041 | var children = _ref6.children,
|
5042 | checkboxProps = _objectWithoutProperties(_ref6, ["children"]);
|
5043 |
|
5044 | var validationState = React.useContext(ValidationContext);
|
5045 | return (
|
5046 |
|
5047 | React.createElement(CheckboxLabel, {
|
5048 | validationState: validationState,
|
5049 | checked: checkboxProps.checked,
|
5050 | disabled: checkboxProps.disabled
|
5051 | },
|
5052 |
|
5053 | React.createElement(CheckboxInput, _extends({
|
5054 | type: "checkbox"
|
5055 | }, checkboxProps)),
|
5056 |
|
5057 | React.createElement(CheckboxDisplay, {
|
5058 | className: "es-checkbox__fill"
|
5059 | }), children)
|
5060 | );
|
5061 | }
|
5062 |
|
5063 | Checkbox.propTypes = process.env.NODE_ENV !== "production" ? {
|
5064 | children: PropTypes.any
|
5065 | } : {};
|
5066 | Checkbox.defaultProps = {
|
5067 | children: undefined
|
5068 | };
|
5069 |
|
5070 | var Label$1 = styled(CheckboxLabel)(["font-weight:bold;margin-bottom:10px;padding:10px 0 10px 62px;@media (min-width:", "){margin-left:0;padding:5px 0 5px 52px;}", ""], function (props) {
|
5071 | return props.theme.screenSize.tablet;
|
5072 | }, function (_ref) {
|
5073 | var textOnHover = _ref.textOnHover;
|
5074 | return textOnHover && "\n &:hover {\n .es-checkbox__text {\n opacity: 1;\n transition: visibility 0s linear 10ms, opacity 10ms;\n visibility: visible;\n }\n }\n ";
|
5075 | });
|
5076 | var Well = styled.div(["background-color:", ";border:solid 1px ", ";border-radius:2px;display:inline-block;height:45px;left:10px;margin-right:6px;position:absolute;top:-1px;width:45px;@media (min-width:", "){left:0;top:-6px;}"], function (props) {
|
5077 | return props.theme.colors.gray1;
|
5078 | }, function (props) {
|
5079 | return props.theme.colors.gray3;
|
5080 | }, function (props) {
|
5081 | return props.theme.screenSize.tablet;
|
5082 | });
|
5083 | var Display = styled(CheckboxDisplay)(["&&{left:10px;top:10px;}"]);
|
5084 | var Text = styled.span(["", ""], function (_ref2) {
|
5085 | var textOnHover = _ref2.textOnHover,
|
5086 | theme = _ref2.theme;
|
5087 | return textOnHover && "\n @media (min-width: ".concat(theme.screenSize.tablet, ") {\n opacity: 0;\n transition: visibility 0s linear 500ms, opacity 500ms;\n visibility: hidden;\n }\n ");
|
5088 | });
|
5089 |
|
5090 | function CheckAllBox(_ref3) {
|
5091 | var children = _ref3.children,
|
5092 | checkboxProps = _objectWithoutProperties(_ref3, ["children"]);
|
5093 |
|
5094 | var validationState = React.useContext(ValidationContext);
|
5095 | return (
|
5096 |
|
5097 | React.createElement(Label$1, {
|
5098 | validationState: validationState,
|
5099 | checked: checkboxProps.checked,
|
5100 | disabled: checkboxProps.disabled
|
5101 | },
|
5102 |
|
5103 | React.createElement(Well, null,
|
5104 |
|
5105 | React.createElement(CheckboxInput, _extends({
|
5106 | type: "checkbox"
|
5107 | }, checkboxProps)),
|
5108 |
|
5109 | React.createElement(Display, {
|
5110 | className: "es-checkbox__fill"
|
5111 | })),
|
5112 |
|
5113 | React.createElement(Text, {
|
5114 | className: "es-checkbox__text",
|
5115 | textOnHover: checkboxProps.textOnHover
|
5116 | }, children))
|
5117 | );
|
5118 | }
|
5119 |
|
5120 | CheckAllBox.propTypes = process.env.NODE_ENV !== "production" ? {
|
5121 | children: PropTypes.any,
|
5122 | textOnHover: PropTypes.bool
|
5123 | } : {};
|
5124 | CheckAllBox.defaultProps = {
|
5125 | textOnHover: false,
|
5126 | children: undefined
|
5127 | };
|
5128 |
|
5129 | var Spacer = styled.div(["margin-left:", ";"], function (props) {
|
5130 | return props.bumpRight ? '10px' : '0';
|
5131 | });
|
5132 |
|
5133 | function CheckboxGroup(_ref) {
|
5134 | var _context;
|
5135 |
|
5136 | var onChange = _ref.onChange,
|
5137 | disableAllOptions = _ref.disableAllOptions,
|
5138 | options = _ref.options,
|
5139 | checkAllText = _ref.checkAllText,
|
5140 | textOnHoverCheckAll = _ref.textOnHoverCheckAll;
|
5141 |
|
5142 | var _useState = useState(_mapInstanceProperty(_context = _filterInstanceProperty(options).call(options, function (o) {
|
5143 | return o.checked;
|
5144 | })).call(_context, function (o) {
|
5145 | return o.value;
|
5146 | }) || []),
|
5147 | _useState2 = _slicedToArray(_useState, 2),
|
5148 | selectedValues = _useState2[0],
|
5149 | setSelectedValues = _useState2[1];
|
5150 |
|
5151 | var _useState3 = useState(false),
|
5152 | _useState4 = _slicedToArray(_useState3, 2),
|
5153 | checkAll = _useState4[0],
|
5154 | setCheckAll = _useState4[1];
|
5155 |
|
5156 | var handleCheckAll = function handleCheckAll() {
|
5157 | var updatedValues = [];
|
5158 |
|
5159 | if (!checkAll) {
|
5160 | updatedValues = _mapInstanceProperty(options).call(options, function (o) {
|
5161 | return o.value;
|
5162 | });
|
5163 | setCheckAll(true);
|
5164 | } else {
|
5165 | setCheckAll(false);
|
5166 | }
|
5167 |
|
5168 | setSelectedValues(updatedValues);
|
5169 | onChange(updatedValues);
|
5170 | };
|
5171 |
|
5172 | var handleCheckboxChange = function handleCheckboxChange(ev) {
|
5173 | var updatedValues = [];
|
5174 |
|
5175 | if (_includesInstanceProperty(selectedValues).call(selectedValues, ev.target.value)) {
|
5176 | updatedValues = _filterInstanceProperty(selectedValues).call(selectedValues, function (val) {
|
5177 | return val !== ev.target.value;
|
5178 | });
|
5179 | } else {
|
5180 | var _context2;
|
5181 |
|
5182 | updatedValues = _concatInstanceProperty(_context2 = []).call(_context2, _toConsumableArray(selectedValues), [ev.target.value]);
|
5183 | }
|
5184 |
|
5185 | setSelectedValues(updatedValues);
|
5186 | onChange(updatedValues);
|
5187 | };
|
5188 |
|
5189 | return (
|
5190 |
|
5191 | React.createElement(React.Fragment, null, checkAllText &&
|
5192 |
|
5193 | React.createElement(CheckAllBox, {
|
5194 | onChange: handleCheckAll,
|
5195 | checked: checkAll,
|
5196 | disabled: disableAllOptions
|
5197 | }, checkAllText), _mapInstanceProperty(options).call(options, function (option) {
|
5198 | return (
|
5199 |
|
5200 | React.createElement(Spacer, {
|
5201 | bumpRight: Boolean(checkAllText),
|
5202 | key: option.value
|
5203 | },
|
5204 |
|
5205 | React.createElement(Checkbox, {
|
5206 | name: option.name,
|
5207 | value: option.value,
|
5208 | checked: _includesInstanceProperty(selectedValues).call(selectedValues, option.value),
|
5209 | disabled: disableAllOptions || option.disabled,
|
5210 | onChange: handleCheckboxChange
|
5211 | }, option.content || option.value))
|
5212 | );
|
5213 | }))
|
5214 | );
|
5215 | }
|
5216 |
|
5217 | CheckboxGroup.propTypes = process.env.NODE_ENV !== "production" ? {
|
5218 |
|
5219 | onChange: PropTypes.func.isRequired,
|
5220 |
|
5221 |
|
5222 | disableAllOptions: PropTypes.bool,
|
5223 |
|
5224 |
|
5225 | options: PropTypes.arrayOf(PropTypes.shape({
|
5226 | name: PropTypes.string,
|
5227 | value: PropTypes.string.isRequired,
|
5228 | content: PropTypes.any,
|
5229 | checked: PropTypes.bool,
|
5230 | disabled: PropTypes.bool
|
5231 | })),
|
5232 |
|
5233 |
|
5234 | checkAllText: PropTypes.string,
|
5235 |
|
5236 |
|
5237 | textOnHoverCheckAll: PropTypes.bool
|
5238 | } : {};
|
5239 | CheckboxGroup.defaultProps = {
|
5240 | checkAllText: undefined,
|
5241 | textOnHoverCheckAll: false,
|
5242 | disableAllOptions: false,
|
5243 | options: []
|
5244 | };
|
5245 |
|
5246 | var Directions = {
|
5247 | 'top': 'column-reverse',
|
5248 | 'bottom': 'column',
|
5249 | 'right': 'row',
|
5250 | 'left': 'row-reverse'
|
5251 | };
|
5252 | var Padding = {
|
5253 | 'top': '0 0 0.5rem',
|
5254 | 'bottom': '2.25rem 0 0',
|
5255 | 'right': '0 0 0.5rem',
|
5256 | 'left': '0 1rem 0 0'
|
5257 | };
|
5258 | var primary = "#0073b6";
|
5259 | var primaryLight = "#ededed";
|
5260 | var success = "#298544";
|
5261 | var successLight = "#69aa7c";
|
5262 | var warning = "#c25400";
|
5263 | var warningLight = "#d4874d";
|
5264 | var danger = "#cc0000";
|
5265 | var dangerLight = "#db4d4d";
|
5266 |
|
5267 | function Type(type, light) {
|
5268 | switch (type) {
|
5269 | case "primary":
|
5270 | return light ? primaryLight : primary;
|
5271 |
|
5272 | case "success":
|
5273 | return light ? successLight : success;
|
5274 |
|
5275 | case "warning":
|
5276 | return light ? warningLight : warning;
|
5277 |
|
5278 | case "danger":
|
5279 | return light ? dangerLight : danger;
|
5280 |
|
5281 | default:
|
5282 | return light ? primaryLight : primary;
|
5283 | }
|
5284 | }
|
5285 |
|
5286 | var SwitchBase = styled.div(["margin:0 auto 10px;display:flex;"]);
|
5287 | var SwitchLabel = styled.label(["flex-direction:", ";text-align:", ";justify-content:", ";cursor:", ";display:flex;position:relative:padding:5px 0;transition:all .25s linear;&:hover{span{&::before{box-shadow:", ";}}input[type=\"checkbox\"]:checked ~ span::before{box-shadow:", ";}}"], function (props) {
|
5288 | return Directions[props.direction];
|
5289 | }, function (props) {
|
5290 | return props.direction === 'top' || props.direction === 'bottom' ? 'center' : 'left';
|
5291 | }, function (props) {
|
5292 | return props.direction === 'left' ? 'flex-end' : 'normal';
|
5293 | }, function (props) {
|
5294 | return props.isDisabled ? 'not-allowed' : 'pointer';
|
5295 | }, function (props) {
|
5296 | return props.isDisabled ? '0' : 'inset 0 3px 3px rgba(0,0,0,0.4)';
|
5297 | }, function (props) {
|
5298 | return props.isDisabled ? '0' : 'inset 0 3px 3px rgba(0,0,0,0.7)';
|
5299 | });
|
5300 | var SwitchInput = styled.input(["overflow:visible;margin:0;font-family:inherit;font-size:inherit;line-height:inherit;position:absolute;clip:rect(0,0,0,0);pointer-events:none;box-sizing:border-box;padding:0;&:focus ~ span::after{box-shadow:0 0 3px 3px #83bffc;}&:checked ~ span{&::before{background:", ";}&::after{background:#f4f4f4;left:28px;}}"], function (props) {
|
5301 | return Type(props.styleType, false);
|
5302 | });
|
5303 | var SwitchLabelText = styled.span(["padding:", ";flex-grow:1;color:", ";"], function (props) {
|
5304 | return Padding[props.direction];
|
5305 | }, function (props) {
|
5306 | return props.type === 'primary' ? '#000' : Type(props.type, false);
|
5307 | });
|
5308 | var SwitchCheck = styled.span(["order:-2;position:relative;width:64px;&::before{background:", ";border-radius:11px;content:\"\";display:block;height:25px;left:3px;outline:none;position:absolute;top:.2rem;width:54px;z-index:5;transition:background-color .25s linear,border .25s linear,box-shadow .25s linear;}&::after{background:#f4f4f4;box-shadow:0 2px 6px #444;display:block;position:absolute;content:\"\";border-radius:100%;height:30px;width:30px;top:0;left:0;transform:all .18s linear;z-index:7;}"], function (props) {
|
5309 | return Type(props.type, true);
|
5310 | });
|
5311 | var SwitchOffText = styled.span(["order:", ";padding:", ";;vertical-align:middle;"], function (props) {
|
5312 | return props.direction === 'left' || props.direction === 'top' ? '-1' : '-3';
|
5313 | }, function (props) {
|
5314 | return props.offText === '' ? '0' : '0 1rem 0 1rem';
|
5315 | });
|
5316 | var SwitchOnText = styled.span(["order:", ";padding:", ";vertical-align:middle;"], function (props) {
|
5317 | return props.direction === 'left' || props.direction === 'top' ? '-3' : '-1';
|
5318 | }, function (props) {
|
5319 | return props.onText === '' ? '0' : '0 1rem 0 0.75rem';
|
5320 | });
|
5321 |
|
5322 | function Switch(_ref) {
|
5323 | var type = _ref.type,
|
5324 | label = _ref.label,
|
5325 | direction = _ref.direction,
|
5326 | ariaLabel = _ref.ariaLabel,
|
5327 | onText = _ref.onText,
|
5328 | offText = _ref.offText,
|
5329 | checked = _ref.checked,
|
5330 | onChange = _ref.onChange,
|
5331 | disabled = _ref.disabled,
|
5332 | switchProps = _objectWithoutProperties(_ref, ["type", "label", "direction", "ariaLabel", "onText", "offText", "checked", "onChange", "disabled"]);
|
5333 |
|
5334 | var _useState = useState(checked),
|
5335 | _useState2 = _slicedToArray(_useState, 2),
|
5336 | isToggled = _useState2[0],
|
5337 | setIsToggled = _useState2[1];
|
5338 |
|
5339 | function handleToggle(event) {
|
5340 | setIsToggled(!isToggled);
|
5341 | onChange(event);
|
5342 | }
|
5343 |
|
5344 | return (
|
5345 |
|
5346 | React.createElement(SwitchBase, _extends({
|
5347 | type: type
|
5348 | }, switchProps),
|
5349 |
|
5350 | React.createElement(SwitchLabel, {
|
5351 | isDisabled: disabled,
|
5352 | direction: direction,
|
5353 | onChange: handleToggle
|
5354 | },
|
5355 |
|
5356 | React.createElement(SwitchInput, {
|
5357 | disabled: disabled,
|
5358 | styleType: type,
|
5359 | type: "checkbox",
|
5360 | checked: isToggled,
|
5361 | "aria-label": ariaLabel
|
5362 | }),
|
5363 |
|
5364 | React.createElement(SwitchLabelText, {
|
5365 | direction: direction,
|
5366 | type: type
|
5367 | }, label),
|
5368 |
|
5369 | React.createElement(SwitchOffText, {
|
5370 | direction: direction,
|
5371 | offText: offText
|
5372 | }, offText),
|
5373 |
|
5374 | React.createElement(SwitchCheck, {
|
5375 | type: type
|
5376 | }),
|
5377 |
|
5378 | React.createElement(SwitchOnText, {
|
5379 | direction: direction,
|
5380 | onText: onText
|
5381 | }, onText)))
|
5382 | );
|
5383 | }
|
5384 |
|
5385 | Switch.propTypes = process.env.NODE_ENV !== "production" ? {
|
5386 |
|
5387 | type: PropTypes.oneOf(['primary', 'success', 'warning', 'danger']),
|
5388 |
|
5389 |
|
5390 | label: PropTypes.string,
|
5391 |
|
5392 |
|
5393 | direction: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
5394 |
|
5395 |
|
5396 | ariaLabel: PropTypes.string,
|
5397 |
|
5398 |
|
5399 | onText: PropTypes.string,
|
5400 |
|
5401 |
|
5402 | offText: PropTypes.string,
|
5403 |
|
5404 |
|
5405 | checked: PropTypes.bool,
|
5406 |
|
5407 |
|
5408 | onChange: PropTypes.func,
|
5409 |
|
5410 |
|
5411 | disabled: PropTypes.bool
|
5412 | } : {};
|
5413 | Switch.defaultProps = {
|
5414 | type: 'primary',
|
5415 | label: '',
|
5416 | direction: 'right',
|
5417 | ariaLabel: '',
|
5418 | onText: '',
|
5419 | offText: '',
|
5420 | checked: false,
|
5421 | onChange: _noop,
|
5422 | disabled: false
|
5423 | };
|
5424 |
|
5425 | var StyledAnchor = styled.a(["background-color:transparent;box-sizing:border-box;color:", ";text-decoration:underline;&:hover{color:", ";text-decoration:none;}"], function (props) {
|
5426 | return props.theme.colors.primary;
|
5427 | }, function (props) {
|
5428 | return props.theme.colors.primaryHover;
|
5429 | });
|
5430 |
|
5431 | function Anchor(_ref) {
|
5432 | var props = _Object$assign({}, _ref);
|
5433 |
|
5434 | return (
|
5435 |
|
5436 | React.createElement(StyledAnchor, props)
|
5437 | );
|
5438 | }
|
5439 |
|
5440 | var VerticalNavigation = styled.nav(["background-color:", ";box-shadow:2px 2px 5px ", ";ul{list-style:none;margin:0;padding:0;}"], function (props) {
|
5441 | return props.theme.colors.white;
|
5442 | }, function (props) {
|
5443 | return props.theme.colors.gray6;
|
5444 | });
|
5445 | var HorizontalNavigation = styled.nav(["background-color:", ";ul{display:flex;list-style:none;margin:0;padding:0;}"], function (props) {
|
5446 | return props.theme.colors.white;
|
5447 | });
|
5448 | function useNavigation(orientation) {
|
5449 | var OrientedNavigation = orientation === 'horizontal' ? HorizontalNavigation : VerticalNavigation;
|
5450 |
|
5451 | function Navigation(props) {
|
5452 | var _context;
|
5453 |
|
5454 | var useAltStyle = props.useAltStyle,
|
5455 | children = props.children;
|
5456 |
|
5457 | var _React$useState = React.useState(props.selected),
|
5458 | _React$useState2 = _slicedToArray(_React$useState, 2),
|
5459 | selected = _React$useState2[0],
|
5460 | setSelected = _React$useState2[1];
|
5461 |
|
5462 | React.useEffect(function () {
|
5463 | setSelected(props.selected);
|
5464 | }, [props.selected]);
|
5465 | return (
|
5466 |
|
5467 | React.createElement(OrientedNavigation, {
|
5468 | className: "es-sidenav"
|
5469 | },
|
5470 |
|
5471 | React.createElement("ul", null, _mapInstanceProperty(_context = React.Children).call(_context, children, function (child) {
|
5472 | return (
|
5473 |
|
5474 | React.cloneElement(child, {
|
5475 | useAltStyle: useAltStyle,
|
5476 | highlightedId: selected
|
5477 | })
|
5478 | );
|
5479 | })))
|
5480 | );
|
5481 | }
|
5482 |
|
5483 | Navigation.propTypes = process.env.NODE_ENV !== "production" ? {
|
5484 |
|
5485 | useAltStyle: PropTypes.bool,
|
5486 | children: PropTypes.node.isRequired,
|
5487 |
|
5488 |
|
5489 | selected: PropTypes.string
|
5490 | } : {};
|
5491 | Navigation.defaultProps = {
|
5492 | useAltStyle: false,
|
5493 | selected: undefined
|
5494 | };
|
5495 | return Navigation;
|
5496 | }
|
5497 |
|
5498 | var NavItemWrapper = styled.li(["background-color:", ";color:", ";cursor:pointer;line-height:", ";min-width:75px;padding:0;&:hover{background-color:", ";color:", ";> i{color:", ";}}", " ", ";"], function (props) {
|
5499 | return props.theme.colors.white;
|
5500 | }, function (props) {
|
5501 | return props.theme.colors.black;
|
5502 | }, function (props) {
|
5503 | return props.theme.font.baseLineHeight;
|
5504 | }, function (props) {
|
5505 | return props.theme.colors.gray2;
|
5506 | }, function (props) {
|
5507 | return props.theme.colors.primary;
|
5508 | }, function (props) {
|
5509 | return props.theme.colors.primary;
|
5510 | }, function (props) {
|
5511 | return props.isActive && css(["background-color:", ";color:", ";&:hover{background-color:", ";color:", ";> i{color:", ";}}"], props.theme.colors.primary, props.theme.colors.white, props.theme.colors.primary, props.theme.colors.white, props.theme.colors.white);
|
5512 | }, function (props) {
|
5513 | return props.isDisabled && css(["background-color:", ";color:", ";cursor:not-allowed;> span{pointer-events:none;}> i{color:", ";}&:hover{background-color:", ";color:", ";> i{color:", ";}}"], props.theme.colors.gray1, props.theme.colors.gray6, props.theme.colors.gray1, props.theme.colors.gray1, props.theme.colors.gray6, props.theme.colors.gray1);
|
5514 | });
|
5515 | var AltNavItemWrapper = styled(NavItemWrapper)(["border-bottom:", " ", ";padding-left:", ";&:hover{border-", ":4px solid ", ";padding-left:0;}", " ", ";"], function (props) {
|
5516 | return props.isVertical ? 'none' : '2px solid';
|
5517 | }, function (props) {
|
5518 | return props.theme.colors.gray5;
|
5519 | }, function (props) {
|
5520 | return props.isVertical ? '4px' : '0';
|
5521 | }, function (props) {
|
5522 | return props.isVertical ? 'left' : 'bottom';
|
5523 | }, function (props) {
|
5524 | return props.theme.colors.primary;
|
5525 | }, function (props) {
|
5526 | return props.isActive && css(["background-color:", ";border-", ":4px solid ", ";color:", ";padding-left:0;> i{color:", ";}&:hover{background-color:", ";border-", ":4px solid ", ";color:", ";> i{color:", ";}}"], props.theme.colors.gray1, props.isVertical ? 'left' : 'bottom', props.theme.brandColors.primary3, props.theme.colors.black, props.theme.brandColors.primary3, props.theme.colors.gray1, props.isVertical ? 'left' : 'bottom', props.theme.brandColors.primary3, props.theme.colors.black, props.theme.brandColors.primary3);
|
5527 | }, function (props) {
|
5528 | return props.isDisabled && css(["padding-left:0;&:hover{border-left:none;}"]);
|
5529 | });
|
5530 | var NavIcon = styled(Icon)(["align-self:flex-end;"]);
|
5531 | var NavigationAnchor = styled.a(["align-content:center;background-color:transparent;box-sizing:border-box;border:0;color:inherit;cursor:inherit;display:flex;font-size:inherit;height:100%;padding:10px;text-decoration:none;width:100%;"]);
|
5532 | function useNavigationItem(orientation) {
|
5533 | function NavItem(props) {
|
5534 | var highlightedId = props.highlightedId,
|
5535 | id = props.id,
|
5536 | isDisabled = props.isDisabled,
|
5537 | useAltStyle = props.useAltStyle,
|
5538 | children = props.children;
|
5539 | var isActive = id === highlightedId;
|
5540 | var Wrapper = useAltStyle ? AltNavItemWrapper : NavItemWrapper;
|
5541 | var isVertical = orientation === 'vertical';
|
5542 | var child = React.Children.only(children);
|
5543 |
|
5544 | var _child$props = child.props,
|
5545 | grandChildren = _child$props.children,
|
5546 | rest = _objectWithoutProperties(_child$props, ["children"]);
|
5547 |
|
5548 | var styledChild =
|
5549 |
|
5550 | React.createElement(NavigationAnchor, _extends({
|
5551 | as: child.type,
|
5552 | style: {
|
5553 | justifyContent: isVertical ? 'space-between' : 'center'
|
5554 | }
|
5555 | }, rest),
|
5556 |
|
5557 | React.createElement("span", null, grandChildren), isVertical ?
|
5558 |
|
5559 | React.createElement(NavIcon, {
|
5560 | name: "chevron-right"
|
5561 | }) : null);
|
5562 | return (
|
5563 |
|
5564 | React.createElement(Wrapper, {
|
5565 | className: "es-sidenav__navitem",
|
5566 | isActive: isActive,
|
5567 | isDisabled: isDisabled,
|
5568 | isVertical: isVertical
|
5569 | }, styledChild)
|
5570 | );
|
5571 | }
|
5572 |
|
5573 | NavItem.propTypes = process.env.NODE_ENV !== "production" ? {
|
5574 |
|
5575 | useAltStyle: PropTypes.bool,
|
5576 |
|
5577 |
|
5578 | children: PropTypes.any,
|
5579 |
|
5580 |
|
5581 | highlightedId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
5582 |
|
5583 |
|
5584 | id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
5585 |
|
5586 |
|
5587 | isDisabled: PropTypes.bool
|
5588 | } : {};
|
5589 | NavItem.defaultProps = {
|
5590 | useAltStyle: false,
|
5591 | isDisabled: false,
|
5592 | children: undefined,
|
5593 | highlightedId: undefined
|
5594 | };
|
5595 | return NavItem;
|
5596 | }
|
5597 |
|
5598 | var Navigation = useNavigation('vertical');
|
5599 |
|
5600 | function SideNav(props) {
|
5601 | return (
|
5602 |
|
5603 | React.createElement(Navigation, props)
|
5604 | );
|
5605 | }
|
5606 |
|
5607 | SideNav.Item = useNavigationItem('vertical');
|
5608 |
|
5609 | var Navigation$1 = useNavigation('horizontal');
|
5610 |
|
5611 | function HorizontalNav(props) {
|
5612 | return (
|
5613 |
|
5614 | React.createElement(Navigation$1, props)
|
5615 | );
|
5616 | }
|
5617 |
|
5618 | HorizontalNav.Item = useNavigationItem('horizontal');
|
5619 |
|
5620 | function useWindowWidth() {
|
5621 | var getMediaWidth = function getMediaWidth() {
|
5622 | return (
|
5623 | window.innerWidth > 0 ? window.innerWidth : window.screen.width
|
5624 | );
|
5625 | };
|
5626 |
|
5627 | var _React$useState = React.useState(getMediaWidth()),
|
5628 | _React$useState2 = _slicedToArray(_React$useState, 2),
|
5629 | width = _React$useState2[0],
|
5630 | setWidth = _React$useState2[1];
|
5631 |
|
5632 | React.useEffect(function () {
|
5633 | var handleResize = function handleResize() {
|
5634 | return setWidth(getMediaWidth());
|
5635 | };
|
5636 |
|
5637 | window.addEventListener('resize', handleResize);
|
5638 | return function () {
|
5639 | return window.removeEventListener('resize', handleResize);
|
5640 | };
|
5641 | }, []);
|
5642 | return width;
|
5643 | }
|
5644 |
|
5645 | function _templateObject$2() {
|
5646 | var data = _taggedTemplateLiteral(["\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle,\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle,\n .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__month-read-view--down-arrow {\n margin-left: -8px;\n position: absolute;\n }\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle,\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle,\n .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__month-read-view--down-arrow,\n .react-datepicker__month-year-read-view--down-arrow,\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle::before,\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle::before,\n .react-datepicker__year-read-view--down-arrow::before,\n .react-datepicker__month-read-view--down-arrow::before,\n .react-datepicker__month-year-read-view--down-arrow::before {\n box-sizing: content-box;\n position: absolute;\n border: 8px solid transparent;\n height: 0;\n width: 1px;\n }\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle::before,\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle::before,\n .react-datepicker__year-read-view--down-arrow::before,\n .react-datepicker__month-read-view--down-arrow::before,\n .react-datepicker__month-year-read-view--down-arrow::before {\n content: \"\";\n z-index: -1;\n border-width: 8px;\n left: -8px;\n border-bottom-color: ", ";\n }\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle {\n top: 0;\n margin-top: -8px;\n }\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle,\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle::before {\n border-top: none;\n border-bottom-color: ", ";\n }\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle::before {\n top: -1px;\n border-bottom-color: ", ";\n }\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle,\n .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__month-read-view--down-arrow,\n .react-datepicker__month-year-read-view--down-arrow {\n bottom: 1px;\n margin-bottom: -8px;\n }\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle,\n .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__month-read-view--down-arrow,\n .react-datepicker__month-year-read-view--down-arrow,\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle::before,\n .react-datepicker__year-read-view--down-arrow::before,\n .react-datepicker__month-read-view--down-arrow::before,\n .react-datepicker__month-year-read-view--down-arrow::before {\n border-bottom: none;\n border-top-color: ", ";\n }\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle::before,\n .react-datepicker__year-read-view--down-arrow::before,\n .react-datepicker__month-read-view--down-arrow::before,\n .react-datepicker__month-year-read-view--down-arrow::before {\n bottom: -1px;\n border-top-color: ", ";\n }\n .react-datepicker-wrapper {\n display: inline-block;\n }\n .react-datepicker {\n font-size: 18px;\n background-color: ", ";\n border: solid 1px ", ";\n border-radius: 4px;\n color: ", ";\n box-shadow: 0 5px 10px ", ";\n display: inline-block;\n position: relative;\n }\n .react-datepicker--time-only .react-datepicker__triangle {\n left: 35px;\n }\n .react-datepicker--time-only .react-datepicker__time-container {\n border-left: 0;\n }\n .react-datepicker--time-only .react-datepicker__time {\n border-radius: 0.3rem;\n }\n .react-datepicker--time-only .react-datepicker__time-box {\n border-radius: 0.3rem;\n }\n .react-datepicker__triangle {\n position: absolute;\n left: 50px;\n }\n .react-datepicker-popper {\n z-index: 1060;\n }\n .react-datepicker-popper[data-placement^=\"bottom\"] {\n margin-top: 12px;\n }\n .react-datepicker-popper[data-placement^=\"top\"] {\n margin-bottom: 6px;\n }\n .react-datepicker-popper[data-placement^=\"right\"] {\n margin-left: 8px;\n }\n .react-datepicker-popper[data-placement^=\"right\"] .react-datepicker__triangle {\n left: auto;\n right: 42px;\n }\n .react-datepicker-popper[data-placement^=\"left\"] {\n margin-right: 8px;\n }\n .react-datepicker-popper[data-placement^=\"left\"] .react-datepicker__triangle {\n left: 42px;\n right: auto;\n }\n .react-datepicker__header {\n text-align: center;\n background-color: ", ";\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n padding-top: 10px;\n position: relative;\n }\n .react-datepicker__header--time {\n padding-bottom: 8px;\n padding-left: 5px;\n padding-right: 5px;\n }\n .react-datepicker__year-dropdown-container--select,\n .react-datepicker__month-dropdown-container--select,\n .react-datepicker__month-year-dropdown-container--select,\n .react-datepicker__year-dropdown-container--scroll,\n .react-datepicker__month-dropdown-container--scroll,\n .react-datepicker__month-year-dropdown-container--scroll {\n display: inline-block;\n margin: 0 2px;\n }\n .react-datepicker__current-month,\n .react-datepicker-time__header {\n margin-top: 0;\n color: ", ";\n font-weight: bold;\n font-size: 18px;\n }\n .react-datepicker-time__header {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n }\n .react-datepicker__navigation {\n background-color: transparent;\n line-height: 1.7rem;\n text-align: center;\n cursor: pointer;\n position: absolute;\n top: 10px;\n padding: 0;\n height: 10px;\n width: 0;\n border: 0.45rem solid transparent;\n z-index: 1;\n text-indent: -999em;\n overflow: hidden;\n }\n .react-datepicker__navigation--previous {\n left: 10px;\n border-right-color: ", ";\n }\n .react-datepicker__navigation--previous:hover {\n border-right-color: ", ";\n }\n .react-datepicker__navigation--previous--disabled,\n .react-datepicker__navigation--previous--disabled:hover {\n border-right-color: ", ";\n cursor: default;\n }\n .react-datepicker__navigation--next {\n right: 10px;\n border-left-color: ", ";\n }\n .react-datepicker__navigation--next--with-time:not(.react-datepicker__navigation--next--with-today-button) {\n right: 110px;\n }\n .react-datepicker__navigation--next:hover {\n border-left-color: ", ";\n }\n .react-datepicker__navigation--next--disabled,\n .react-datepicker__navigation--next--disabled:hover {\n border-left-color: ", ";\n cursor: default;\n }\n .react-datepicker__navigation--years {\n position: relative;\n top: 0;\n display: block;\n margin-left: auto;\n margin-right: auto;\n }\n .react-datepicker__navigation--years-previous {\n top: 4px;\n border-top-color: ", ";\n }\n .react-datepicker__navigation--years-previous:hover {\n border-top-color: ", ";\n }\n .react-datepicker__navigation--years-upcoming {\n top: -4px;\n border-bottom-color: ", ";\n }\n .react-datepicker__navigation--years-upcoming:hover {\n border-bottom-color: ", ";\n }\n .react-datepicker__month-container {\n float: left;\n }\n .react-datepicker__month {\n margin: 0.4rem;\n text-align: center;\n }\n .react-datepicker__time-container {\n float: right;\n border-left: 1px solid ", ";\n }\n .react-datepicker__time-container--with-today-button {\n display: inline;\n border: 1px solid ", ";\n border-radius: 0.3rem;\n position: absolute;\n right: -72px;\n top: 0;\n }\n .react-datepicker__time-container .react-datepicker__time {\n font-size: 14px;\n position: relative;\n background: white;\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box {\n width: 102px;\n overflow-x: hidden;\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list {\n list-style: none;\n margin: 0;\n height: 204px;\n overflow-y: scroll;\n padding: 0;\n width: 100%;\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item {\n padding: 5px 10px;\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item:hover {\n cursor: pointer;\n background-color: ", ";\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--selected {\n background-color: ", ";\n color: white;\n font-weight: bold;\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--selected:hover {\n background-color: ", ";\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--disabled {\n color: ", ";\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--disabled:hover {\n cursor: default;\n background-color: transparent;\n }\n .react-datepicker__week-number {\n color: ", ";\n display: inline-block;\n width: 1.7rem;\n line-height: 1.7rem;\n text-align: center;\n margin: 0.166rem;\n }\n .react-datepicker__week-number.react-datepicker__week-number--clickable {\n cursor: pointer;\n }\n .react-datepicker__week-number.react-datepicker__week-number--clickable:hover {\n border-radius: 0.3rem;\n background-color: ", ";\n }\n .react-datepicker__day-names,\n .react-datepicker__week {\n white-space: nowrap;\n }\n .react-datepicker__day-names {\n font-weight: bold;\n }\n .react-datepicker__day-names .react-datepicker__day-name {\n color: ", ";\n }\n .react-datepicker__day-name,\n .react-datepicker__day,\n .react-datepicker__time-name {\n color: ", ";\n display: inline-block;\n width: 1.9rem;\n line-height: 1.9rem;\n text-align: center;\n margin: 0.2rem;\n }\n .react-datepicker__day {\n cursor: pointer;\n }\n .react-datepicker__day:hover {\n border-radius: 0.3rem;\n background-color: ", ";\n }\n .react-datepicker__day--today {\n font-weight: bold;\n }\n .react-datepicker__day--highlighted {\n border-radius: 0.3rem;\n background-color: ", ";\n color: ", ";\n }\n .react-datepicker__day--highlighted:hover {\n background-color: ", ";\n color: ", "\n }\n .react-datepicker__day--selected,\n .react-datepicker__day--in-selecting-range,\n .react-datepicker__day--in-range {\n border-radius: 0.3rem;\n background-color: ", ";\n color: ", ";\n }\n .react-datepicker__day--selected:hover,\n .react-datepicker__day--in-selecting-range:hover,\n .react-datepicker__day--in-range:hover {\n background-color: ", ";\n }\n .react-datepicker__day--keyboard-selected {\n border-radius: 0.3rem;\n background-color: ", ";\n color: ", ";\n }\n .react-datepicker__day--keyboard-selected:hover {\n background-color: ", ";\n }\n .react-datepicker__day--in-selecting-range:not(.react-datepicker__day--in-range) {\n background-color: ", ";\n color: ", ";\n }\n .react-datepicker__month--selecting-range .react-datepicker__day--in-range:not(.react-datepicker__day--in-selecting-range) {\n background-color: ", ";\n color: ", ";\n }\n .react-datepicker__day--disabled {\n cursor: default;\n color: ", ";\n }\n .react-datepicker__day--disabled:hover {\n background-color: transparent;\n }\n .react-datepicker__input-container {\n position: relative;\n display: inline-block;\n }\n .react-datepicker__year-read-view,\n .react-datepicker__month-read-view,\n .react-datepicker__month-year-read-view {\n border: 1px solid transparent;\n color: ", ";\n }\n .react-datepicker__year-read-view:hover,\n .react-datepicker__month-read-view:hover,\n .react-datepicker__month-year-read-view:hover {\n cursor: pointer;\n }\n .react-datepicker__year-read-view:hover .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__year-read-view:hover .react-datepicker__month-read-view--down-arrow,\n .react-datepicker__month-read-view:hover .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__month-read-view:hover .react-datepicker__month-read-view--down-arrow,\n .react-datepicker__month-year-read-view:hover .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__month-year-read-view:hover .react-datepicker__month-read-view--down-arrow {\n border-top-color: ", ";\n }\n .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__month-read-view--down-arrow,\n .react-datepicker__month-year-read-view--down-arrow {\n border-top-color: ", ";\n float: right;\n margin-left: 20px;\n top: 5px;\n position: relative;\n border-width: 0.45rem;\n }\n .react-datepicker__year-dropdown,\n .react-datepicker__month-dropdown,\n .react-datepicker__month-year-dropdown {\n background-color: ", ";\n position: absolute;\n width: 50%;\n left: 25%;\n top: 30px;\n z-index: 1;\n text-align: center;\n border-radius: 0.3rem;\n border: 1px solid ", ";\n }\n .react-datepicker__year-dropdown:hover,\n .react-datepicker__month-dropdown:hover,\n .react-datepicker__month-year-dropdown:hover {\n cursor: pointer;\n }\n .react-datepicker__year-dropdown--scrollable,\n .react-datepicker__month-dropdown--scrollable,\n .react-datepicker__month-year-dropdown--scrollable {\n height: 150px;\n overflow-y: scroll;\n }\n .react-datepicker__year-option,\n .react-datepicker__month-option,\n .react-datepicker__month-year-option {\n line-height: 20px;\n width: 100%;\n display: block;\n margin-left: auto;\n margin-right: auto;\n }\n .react-datepicker__year-option:first-of-type,\n .react-datepicker__month-option:first-of-type,\n .react-datepicker__month-year-option:first-of-type {\n border-top-left-radius: 0.3rem;\n border-top-right-radius: 0.3rem;\n }\n .react-datepicker__year-option:last-of-type,\n .react-datepicker__month-option:last-of-type,\n .react-datepicker__month-year-option:last-of-type {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n border-bottom-left-radius: 0.3rem;\n border-bottom-right-radius: 0.3rem;\n }\n .react-datepicker__year-option:hover,\n .react-datepicker__month-option:hover,\n .react-datepicker__month-year-option:hover {\n background-color: ", ";\n }\n .react-datepicker__year-option--selected,\n .react-datepicker__month-option--selected,\n .react-datepicker__month-year-option--selected {\n position: absolute;\n left: 15px;\n }\n .react-datepicker__close-icon {\n background-color: transparent;\n border: 0;\n cursor: pointer;\n display: inline-block;\n height: 0;\n outline: 0;\n padding: 0;\n vertical-align: middle;\n }\n .react-datepicker__close-icon::after {\n background-color: ", ";\n border-radius: 50%;\n bottom: 0;\n box-sizing: border-box;\n color: ", void 0, ";\n border-top: 1px solid ", ";\n cursor: pointer;\n text-align: center;\n font-weight: bold;\n padding: 5px 0;\n clear: left;\n }\n .react-datepicker__portal {\n position: fixed;\n width: 100vw;\n height: 100vh;\n background-color: ", ";\n left: 0;\n top: 0;\n justify-content: center;\n align-items: center;\n display: flex;\n z-index: 2147483647;\n }\n .react-datepicker__portal .react-datepicker__day-name,\n .react-datepicker__portal .react-datepicker__day,\n .react-datepicker__portal .react-datepicker__time-name {\n width: 3rem;\n line-height: 3rem;\n }\n @media (max-width: 400px),\n (max-height: 550px) {\n .react-datepicker__portal .react-datepicker__day-name,\n .react-datepicker__portal .react-datepicker__day,\n .react-datepicker__portal .react-datepicker__time-name {\n width: 2rem;\n line-height: 2rem;\n }\n }\n .react-datepicker__portal .react-datepicker__current-month,\n .react-datepicker__portal .react-datepicker-time__header {\n font-size: 1.44rem;\n }\n .react-datepicker__portal .react-datepicker__navigation {\n border: 0.81rem solid transparent;\n }\n .react-datepicker__portal .react-datepicker__navigation--previous {\n border-right-color: ", ";\n }\n .react-datepicker__portal .react-datepicker__navigation--previous:hover {\n border-right-color: ", ";\n }\n .react-datepicker__portal .react-datepicker__navigation--previous--disabled,\n .react-datepicker__portal .react-datepicker__navigation--previous--disabled:hover {\n border-right-color: ", ";\n cursor: default;\n }\n .react-datepicker__portal .react-datepicker__navigation--next {\n border-left-color: ", ";\n }\n .react-datepicker__portal .react-datepicker__navigation--next:hover {\n border-left-color: ", ";\n }\n .react-datepicker__portal .react-datepicker__navigation--next--disabled,\n .react-datepicker__portal .react-datepicker__navigation--next--disabled:hover {\n border-left-color: ", ";\n cursor: default;\n }\n"], ["\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle,\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle,\n .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__month-read-view--down-arrow {\n margin-left: -8px;\n position: absolute;\n }\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle,\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle,\n .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__month-read-view--down-arrow,\n .react-datepicker__month-year-read-view--down-arrow,\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle::before,\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle::before,\n .react-datepicker__year-read-view--down-arrow::before,\n .react-datepicker__month-read-view--down-arrow::before,\n .react-datepicker__month-year-read-view--down-arrow::before {\n box-sizing: content-box;\n position: absolute;\n border: 8px solid transparent;\n height: 0;\n width: 1px;\n }\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle::before,\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle::before,\n .react-datepicker__year-read-view--down-arrow::before,\n .react-datepicker__month-read-view--down-arrow::before,\n .react-datepicker__month-year-read-view--down-arrow::before {\n content: \"\";\n z-index: -1;\n border-width: 8px;\n left: -8px;\n border-bottom-color: ", ";\n }\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle {\n top: 0;\n margin-top: -8px;\n }\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle,\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle::before {\n border-top: none;\n border-bottom-color: ", ";\n }\n .react-datepicker-popper[data-placement^=\"bottom\"] .react-datepicker__triangle::before {\n top: -1px;\n border-bottom-color: ", ";\n }\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle,\n .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__month-read-view--down-arrow,\n .react-datepicker__month-year-read-view--down-arrow {\n bottom: 1px;\n margin-bottom: -8px;\n }\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle,\n .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__month-read-view--down-arrow,\n .react-datepicker__month-year-read-view--down-arrow,\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle::before,\n .react-datepicker__year-read-view--down-arrow::before,\n .react-datepicker__month-read-view--down-arrow::before,\n .react-datepicker__month-year-read-view--down-arrow::before {\n border-bottom: none;\n border-top-color: ", ";\n }\n .react-datepicker-popper[data-placement^=\"top\"] .react-datepicker__triangle::before,\n .react-datepicker__year-read-view--down-arrow::before,\n .react-datepicker__month-read-view--down-arrow::before,\n .react-datepicker__month-year-read-view--down-arrow::before {\n bottom: -1px;\n border-top-color: ", ";\n }\n .react-datepicker-wrapper {\n display: inline-block;\n }\n .react-datepicker {\n font-size: 18px;\n background-color: ", ";\n border: solid 1px ", ";\n border-radius: 4px;\n color: ", ";\n box-shadow: 0 5px 10px ", ";\n display: inline-block;\n position: relative;\n }\n .react-datepicker--time-only .react-datepicker__triangle {\n left: 35px;\n }\n .react-datepicker--time-only .react-datepicker__time-container {\n border-left: 0;\n }\n .react-datepicker--time-only .react-datepicker__time {\n border-radius: 0.3rem;\n }\n .react-datepicker--time-only .react-datepicker__time-box {\n border-radius: 0.3rem;\n }\n .react-datepicker__triangle {\n position: absolute;\n left: 50px;\n }\n .react-datepicker-popper {\n z-index: 1060;\n }\n .react-datepicker-popper[data-placement^=\"bottom\"] {\n margin-top: 12px;\n }\n .react-datepicker-popper[data-placement^=\"top\"] {\n margin-bottom: 6px;\n }\n .react-datepicker-popper[data-placement^=\"right\"] {\n margin-left: 8px;\n }\n .react-datepicker-popper[data-placement^=\"right\"] .react-datepicker__triangle {\n left: auto;\n right: 42px;\n }\n .react-datepicker-popper[data-placement^=\"left\"] {\n margin-right: 8px;\n }\n .react-datepicker-popper[data-placement^=\"left\"] .react-datepicker__triangle {\n left: 42px;\n right: auto;\n }\n .react-datepicker__header {\n text-align: center;\n background-color: ", ";\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n padding-top: 10px;\n position: relative;\n }\n .react-datepicker__header--time {\n padding-bottom: 8px;\n padding-left: 5px;\n padding-right: 5px;\n }\n .react-datepicker__year-dropdown-container--select,\n .react-datepicker__month-dropdown-container--select,\n .react-datepicker__month-year-dropdown-container--select,\n .react-datepicker__year-dropdown-container--scroll,\n .react-datepicker__month-dropdown-container--scroll,\n .react-datepicker__month-year-dropdown-container--scroll {\n display: inline-block;\n margin: 0 2px;\n }\n .react-datepicker__current-month,\n .react-datepicker-time__header {\n margin-top: 0;\n color: ", ";\n font-weight: bold;\n font-size: 18px;\n }\n .react-datepicker-time__header {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n }\n .react-datepicker__navigation {\n background-color: transparent;\n line-height: 1.7rem;\n text-align: center;\n cursor: pointer;\n position: absolute;\n top: 10px;\n padding: 0;\n height: 10px;\n width: 0;\n border: 0.45rem solid transparent;\n z-index: 1;\n text-indent: -999em;\n overflow: hidden;\n }\n .react-datepicker__navigation--previous {\n left: 10px;\n border-right-color: ", ";\n }\n .react-datepicker__navigation--previous:hover {\n border-right-color: ", ";\n }\n .react-datepicker__navigation--previous--disabled,\n .react-datepicker__navigation--previous--disabled:hover {\n border-right-color: ", ";\n cursor: default;\n }\n .react-datepicker__navigation--next {\n right: 10px;\n border-left-color: ", ";\n }\n .react-datepicker__navigation--next--with-time:not(.react-datepicker__navigation--next--with-today-button) {\n right: 110px;\n }\n .react-datepicker__navigation--next:hover {\n border-left-color: ", ";\n }\n .react-datepicker__navigation--next--disabled,\n .react-datepicker__navigation--next--disabled:hover {\n border-left-color: ", ";\n cursor: default;\n }\n .react-datepicker__navigation--years {\n position: relative;\n top: 0;\n display: block;\n margin-left: auto;\n margin-right: auto;\n }\n .react-datepicker__navigation--years-previous {\n top: 4px;\n border-top-color: ", ";\n }\n .react-datepicker__navigation--years-previous:hover {\n border-top-color: ", ";\n }\n .react-datepicker__navigation--years-upcoming {\n top: -4px;\n border-bottom-color: ", ";\n }\n .react-datepicker__navigation--years-upcoming:hover {\n border-bottom-color: ", ";\n }\n .react-datepicker__month-container {\n float: left;\n }\n .react-datepicker__month {\n margin: 0.4rem;\n text-align: center;\n }\n .react-datepicker__time-container {\n float: right;\n border-left: 1px solid ", ";\n }\n .react-datepicker__time-container--with-today-button {\n display: inline;\n border: 1px solid ", ";\n border-radius: 0.3rem;\n position: absolute;\n right: -72px;\n top: 0;\n }\n .react-datepicker__time-container .react-datepicker__time {\n font-size: 14px;\n position: relative;\n background: white;\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box {\n width: 102px;\n overflow-x: hidden;\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list {\n list-style: none;\n margin: 0;\n height: 204px;\n overflow-y: scroll;\n padding: 0;\n width: 100%;\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item {\n padding: 5px 10px;\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item:hover {\n cursor: pointer;\n background-color: ", ";\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--selected {\n background-color: ", ";\n color: white;\n font-weight: bold;\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--selected:hover {\n background-color: ", ";\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--disabled {\n color: ", ";\n }\n .react-datepicker__time-container .react-datepicker__time .react-datepicker__time-box ul.react-datepicker__time-list li.react-datepicker__time-list-item--disabled:hover {\n cursor: default;\n background-color: transparent;\n }\n .react-datepicker__week-number {\n color: ", ";\n display: inline-block;\n width: 1.7rem;\n line-height: 1.7rem;\n text-align: center;\n margin: 0.166rem;\n }\n .react-datepicker__week-number.react-datepicker__week-number--clickable {\n cursor: pointer;\n }\n .react-datepicker__week-number.react-datepicker__week-number--clickable:hover {\n border-radius: 0.3rem;\n background-color: ", ";\n }\n .react-datepicker__day-names,\n .react-datepicker__week {\n white-space: nowrap;\n }\n .react-datepicker__day-names {\n font-weight: bold;\n }\n .react-datepicker__day-names .react-datepicker__day-name {\n color: ", ";\n }\n .react-datepicker__day-name,\n .react-datepicker__day,\n .react-datepicker__time-name {\n color: ", ";\n display: inline-block;\n width: 1.9rem;\n line-height: 1.9rem;\n text-align: center;\n margin: 0.2rem;\n }\n .react-datepicker__day {\n cursor: pointer;\n }\n .react-datepicker__day:hover {\n border-radius: 0.3rem;\n background-color: ", ";\n }\n .react-datepicker__day--today {\n font-weight: bold;\n }\n .react-datepicker__day--highlighted {\n border-radius: 0.3rem;\n background-color: ", ";\n color: ", ";\n }\n .react-datepicker__day--highlighted:hover {\n background-color: ", ";\n color: ", "\n }\n .react-datepicker__day--selected,\n .react-datepicker__day--in-selecting-range,\n .react-datepicker__day--in-range {\n border-radius: 0.3rem;\n background-color: ", ";\n color: ", ";\n }\n .react-datepicker__day--selected:hover,\n .react-datepicker__day--in-selecting-range:hover,\n .react-datepicker__day--in-range:hover {\n background-color: ", ";\n }\n .react-datepicker__day--keyboard-selected {\n border-radius: 0.3rem;\n background-color: ", ";\n color: ", ";\n }\n .react-datepicker__day--keyboard-selected:hover {\n background-color: ", ";\n }\n .react-datepicker__day--in-selecting-range:not(.react-datepicker__day--in-range) {\n background-color: ", ";\n color: ", ";\n }\n .react-datepicker__month--selecting-range .react-datepicker__day--in-range:not(.react-datepicker__day--in-selecting-range) {\n background-color: ", ";\n color: ", ";\n }\n .react-datepicker__day--disabled {\n cursor: default;\n color: ", ";\n }\n .react-datepicker__day--disabled:hover {\n background-color: transparent;\n }\n .react-datepicker__input-container {\n position: relative;\n display: inline-block;\n }\n .react-datepicker__year-read-view,\n .react-datepicker__month-read-view,\n .react-datepicker__month-year-read-view {\n border: 1px solid transparent;\n color: ", ";\n }\n .react-datepicker__year-read-view:hover,\n .react-datepicker__month-read-view:hover,\n .react-datepicker__month-year-read-view:hover {\n cursor: pointer;\n }\n .react-datepicker__year-read-view:hover .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__year-read-view:hover .react-datepicker__month-read-view--down-arrow,\n .react-datepicker__month-read-view:hover .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__month-read-view:hover .react-datepicker__month-read-view--down-arrow,\n .react-datepicker__month-year-read-view:hover .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__month-year-read-view:hover .react-datepicker__month-read-view--down-arrow {\n border-top-color: ", ";\n }\n .react-datepicker__year-read-view--down-arrow,\n .react-datepicker__month-read-view--down-arrow,\n .react-datepicker__month-year-read-view--down-arrow {\n border-top-color: ", ";\n float: right;\n margin-left: 20px;\n top: 5px;\n position: relative;\n border-width: 0.45rem;\n }\n .react-datepicker__year-dropdown,\n .react-datepicker__month-dropdown,\n .react-datepicker__month-year-dropdown {\n background-color: ", ";\n position: absolute;\n width: 50%;\n left: 25%;\n top: 30px;\n z-index: 1;\n text-align: center;\n border-radius: 0.3rem;\n border: 1px solid ", ";\n }\n .react-datepicker__year-dropdown:hover,\n .react-datepicker__month-dropdown:hover,\n .react-datepicker__month-year-dropdown:hover {\n cursor: pointer;\n }\n .react-datepicker__year-dropdown--scrollable,\n .react-datepicker__month-dropdown--scrollable,\n .react-datepicker__month-year-dropdown--scrollable {\n height: 150px;\n overflow-y: scroll;\n }\n .react-datepicker__year-option,\n .react-datepicker__month-option,\n .react-datepicker__month-year-option {\n line-height: 20px;\n width: 100%;\n display: block;\n margin-left: auto;\n margin-right: auto;\n }\n .react-datepicker__year-option:first-of-type,\n .react-datepicker__month-option:first-of-type,\n .react-datepicker__month-year-option:first-of-type {\n border-top-left-radius: 0.3rem;\n border-top-right-radius: 0.3rem;\n }\n .react-datepicker__year-option:last-of-type,\n .react-datepicker__month-option:last-of-type,\n .react-datepicker__month-year-option:last-of-type {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n border-bottom-left-radius: 0.3rem;\n border-bottom-right-radius: 0.3rem;\n }\n .react-datepicker__year-option:hover,\n .react-datepicker__month-option:hover,\n .react-datepicker__month-year-option:hover {\n background-color: ", ";\n }\n .react-datepicker__year-option--selected,\n .react-datepicker__month-option--selected,\n .react-datepicker__month-year-option--selected {\n position: absolute;\n left: 15px;\n }\n .react-datepicker__close-icon {\n background-color: transparent;\n border: 0;\n cursor: pointer;\n display: inline-block;\n height: 0;\n outline: 0;\n padding: 0;\n vertical-align: middle;\n }\n .react-datepicker__close-icon::after {\n background-color: ", ";\n border-radius: 50%;\n bottom: 0;\n box-sizing: border-box;\n color: ", ";\n content: \"\\00d7\";\n cursor: pointer;\n font-size: 12px;\n height: 16px;\n width: 16px;\n line-height: 1;\n margin: -8px auto 0;\n padding: 2px;\n position: absolute;\n right: 7px;\n text-align: center;\n top: 50%;\n }\n .react-datepicker__today-button {\n background: ", ";\n border-top: 1px solid ", ";\n cursor: pointer;\n text-align: center;\n font-weight: bold;\n padding: 5px 0;\n clear: left;\n }\n .react-datepicker__portal {\n position: fixed;\n width: 100vw;\n height: 100vh;\n background-color: ", ";\n left: 0;\n top: 0;\n justify-content: center;\n align-items: center;\n display: flex;\n z-index: 2147483647;\n }\n .react-datepicker__portal .react-datepicker__day-name,\n .react-datepicker__portal .react-datepicker__day,\n .react-datepicker__portal .react-datepicker__time-name {\n width: 3rem;\n line-height: 3rem;\n }\n @media (max-width: 400px),\n (max-height: 550px) {\n .react-datepicker__portal .react-datepicker__day-name,\n .react-datepicker__portal .react-datepicker__day,\n .react-datepicker__portal .react-datepicker__time-name {\n width: 2rem;\n line-height: 2rem;\n }\n }\n .react-datepicker__portal .react-datepicker__current-month,\n .react-datepicker__portal .react-datepicker-time__header {\n font-size: 1.44rem;\n }\n .react-datepicker__portal .react-datepicker__navigation {\n border: 0.81rem solid transparent;\n }\n .react-datepicker__portal .react-datepicker__navigation--previous {\n border-right-color: ", ";\n }\n .react-datepicker__portal .react-datepicker__navigation--previous:hover {\n border-right-color: ", ";\n }\n .react-datepicker__portal .react-datepicker__navigation--previous--disabled,\n .react-datepicker__portal .react-datepicker__navigation--previous--disabled:hover {\n border-right-color: ", ";\n cursor: default;\n }\n .react-datepicker__portal .react-datepicker__navigation--next {\n border-left-color: ", ";\n }\n .react-datepicker__portal .react-datepicker__navigation--next:hover {\n border-left-color: ", ";\n }\n .react-datepicker__portal .react-datepicker__navigation--next--disabled,\n .react-datepicker__portal .react-datepicker__navigation--next--disabled:hover {\n border-left-color: ", ";\n cursor: default;\n }\n"]);
|
5647 |
|
5648 | _templateObject$2 = function _templateObject() {
|
5649 | return data;
|
5650 | };
|
5651 |
|
5652 | return data;
|
5653 | }
|
5654 | var DatepickerStyles = createGlobalStyle(_templateObject$2(), function (_ref) {
|
5655 | var theme = _ref.theme;
|
5656 | return theme.colors.gray5;
|
5657 | }, function (_ref2) {
|
5658 | var theme = _ref2.theme;
|
5659 | return theme.datepickerColors.dpBackground;
|
5660 | }, function (_ref3) {
|
5661 | var theme = _ref3.theme;
|
5662 | return theme.colors.gray5;
|
5663 | }, function (_ref4) {
|
5664 | var theme = _ref4.theme;
|
5665 | return theme.colors.white;
|
5666 | }, function (_ref5) {
|
5667 | var theme = _ref5.theme;
|
5668 | return theme.colors.gray5;
|
5669 | }, function (_ref6) {
|
5670 | var theme = _ref6.theme;
|
5671 | return theme.colors.white;
|
5672 | }, function (_ref7) {
|
5673 | var theme = _ref7.theme;
|
5674 | return theme.colors.gray5;
|
5675 | }, function (_ref8) {
|
5676 | var theme = _ref8.theme;
|
5677 | return theme.colors.gray9;
|
5678 | }, function (_ref9) {
|
5679 | var theme = _ref9.theme;
|
5680 | return theme.colors.boxShadowLight;
|
5681 | }, function (_ref10) {
|
5682 | var theme = _ref10.theme;
|
5683 | return theme.datepickerColors.dpBackground;
|
5684 | }, function (_ref11) {
|
5685 | var theme = _ref11.theme;
|
5686 | return theme.colors.white;
|
5687 | }, function (_ref12) {
|
5688 | var theme = _ref12.theme;
|
5689 | return theme.datepickerColors.navArrow;
|
5690 | }, function (_ref13) {
|
5691 | var theme = _ref13.theme;
|
5692 | return theme.datepickerColors.navArrowHover;
|
5693 | }, function (_ref14) {
|
5694 | var theme = _ref14.theme;
|
5695 | return theme.colors.gray3;
|
5696 | }, function (_ref15) {
|
5697 | var theme = _ref15.theme;
|
5698 | return theme.datepickerColors.navArrow;
|
5699 | }, function (_ref16) {
|
5700 | var theme = _ref16.theme;
|
5701 | return theme.datepickerColors.navArrowHover;
|
5702 | }, function (_ref17) {
|
5703 | var theme = _ref17.theme;
|
5704 | return theme.colors.gray3;
|
5705 | }, function (_ref18) {
|
5706 | var theme = _ref18.theme;
|
5707 | return theme.datepickerColors.dpBackground;
|
5708 | }, function (_ref19) {
|
5709 | var theme = _ref19.theme;
|
5710 | return theme.datepickerColors.dpBackground;
|
5711 | }, function (_ref20) {
|
5712 | var theme = _ref20.theme;
|
5713 | return theme.datepickerColors.dpBackground;
|
5714 | }, function (_ref21) {
|
5715 | var theme = _ref21.theme;
|
5716 | return theme.datepickerColors.dpBackground;
|
5717 | }, function (_ref22) {
|
5718 | var theme = _ref22.theme;
|
5719 | return theme.colors.gray5;
|
5720 | }, function (_ref23) {
|
5721 | var theme = _ref23.theme;
|
5722 | return theme.colors.gray5;
|
5723 | }, function (_ref24) {
|
5724 | var theme = _ref24.theme;
|
5725 | return theme.colors.gray1;
|
5726 | }, function (_ref25) {
|
5727 | var theme = _ref25.theme;
|
5728 | return theme.datepickerColors.selected;
|
5729 | }, function (_ref26) {
|
5730 | var theme = _ref26.theme;
|
5731 | return theme.datepickerColors.selected;
|
5732 | }, function (_ref27) {
|
5733 | var theme = _ref27.theme;
|
5734 | return theme.colors.gray2;
|
5735 | }, function (_ref28) {
|
5736 | var theme = _ref28.theme;
|
5737 | return theme.colors.gray2;
|
5738 | }, function (_ref29) {
|
5739 | var theme = _ref29.theme;
|
5740 | return theme.colors.gray1;
|
5741 | }, function (_ref30) {
|
5742 | var theme = _ref30.theme;
|
5743 | return theme.colors.white;
|
5744 | }, function (_ref31) {
|
5745 | var theme = _ref31.theme;
|
5746 | return theme.colors.gray9;
|
5747 | }, function (_ref32) {
|
5748 | var theme = _ref32.theme;
|
5749 | return theme.colors.gray3;
|
5750 | }, function (_ref33) {
|
5751 | var theme = _ref33.theme;
|
5752 | return theme.datepickerColors.highlight;
|
5753 | }, function (_ref34) {
|
5754 | var theme = _ref34.theme;
|
5755 | return theme.colors.white;
|
5756 | }, function (_ref35) {
|
5757 | var theme = _ref35.theme;
|
5758 | return theme.datepickerColors.highlightHover;
|
5759 | }, function (_ref36) {
|
5760 | var theme = _ref36.theme;
|
5761 | return theme.colors.gray9;
|
5762 | }, function (_ref37) {
|
5763 | var theme = _ref37.theme;
|
5764 | return theme.datepickerColors.selected;
|
5765 | }, function (_ref38) {
|
5766 | var theme = _ref38.theme;
|
5767 | return theme.colors.white;
|
5768 | }, function (_ref39) {
|
5769 | var theme = _ref39.theme;
|
5770 | return theme.datepickerColors.hover;
|
5771 | }, function (_ref40) {
|
5772 | var theme = _ref40.theme;
|
5773 | return theme.datepickerColors.keyboard;
|
5774 | }, function (_ref41) {
|
5775 | var theme = _ref41.theme;
|
5776 | return theme.colors.white;
|
5777 | }, function (_ref42) {
|
5778 | var theme = _ref42.theme;
|
5779 | return theme.datepickerColors.hover;
|
5780 | }, function (_ref43) {
|
5781 | var theme = _ref43.theme;
|
5782 | return theme.datepickerColors.inRange;
|
5783 | }, function (_ref44) {
|
5784 | var theme = _ref44.theme;
|
5785 | return theme.colors.gray9;
|
5786 | }, function (_ref45) {
|
5787 | var theme = _ref45.theme;
|
5788 | return theme.colors.gray3;
|
5789 | }, function (_ref46) {
|
5790 | var theme = _ref46.theme;
|
5791 | return theme.colors.gray9;
|
5792 | }, function (_ref47) {
|
5793 | var theme = _ref47.theme;
|
5794 | return theme.colors.gray5;
|
5795 | }, function (_ref48) {
|
5796 | var theme = _ref48.theme;
|
5797 | return theme.colors.white;
|
5798 | }, function (_ref49) {
|
5799 | var theme = _ref49.theme;
|
5800 | return theme.colors.gray5;
|
5801 | }, function (_ref50) {
|
5802 | var theme = _ref50.theme;
|
5803 | return theme.colors.gray3;
|
5804 | }, function (_ref51) {
|
5805 | var theme = _ref51.theme;
|
5806 | return theme.colors.gray1;
|
5807 | }, function (_ref52) {
|
5808 | var theme = _ref52.theme;
|
5809 | return theme.colors.gray5;
|
5810 | }, function (_ref53) {
|
5811 | var theme = _ref53.theme;
|
5812 | return theme.colors.gray3;
|
5813 | }, function (_ref54) {
|
5814 | var theme = _ref54.theme;
|
5815 | return theme.datepickerColors.selected;
|
5816 | }, function (_ref55) {
|
5817 | var theme = _ref55.theme;
|
5818 | return theme.colors.white;
|
5819 | }, function (_ref56) {
|
5820 | var theme = _ref56.theme;
|
5821 | return theme.colors.gray1;
|
5822 | }, function (_ref57) {
|
5823 | var theme = _ref57.theme;
|
5824 | return theme.colors.gray5;
|
5825 | }, function (_ref58) {
|
5826 | var theme = _ref58.theme;
|
5827 | return theme.colors.boxShadowDark;
|
5828 | }, function (_ref59) {
|
5829 | var theme = _ref59.theme;
|
5830 | return theme.datepickerColors.navArrow;
|
5831 | }, function (_ref60) {
|
5832 | var theme = _ref60.theme;
|
5833 | return theme.datepickerColors.navArrowHover;
|
5834 | }, function (_ref61) {
|
5835 | var theme = _ref61.theme;
|
5836 | return theme.colors.gray3;
|
5837 | }, function (_ref62) {
|
5838 | var theme = _ref62.theme;
|
5839 | return theme.datepickerColors.navArrow;
|
5840 | }, function (_ref63) {
|
5841 | var theme = _ref63.theme;
|
5842 | return theme.datepickerColors.navArrowHover;
|
5843 | }, function (_ref64) {
|
5844 | var theme = _ref64.theme;
|
5845 | return theme.colors.gray3;
|
5846 | });
|
5847 |
|
5848 |
|
5849 |
|
5850 |
|
5851 | var popperPlacementPositions = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
|
5852 | var reactDatePickerPropTypes = {
|
5853 | adjustDateOnChange: PropTypes.bool,
|
5854 | allowSameDay: PropTypes.bool,
|
5855 | autoComplete: PropTypes.string,
|
5856 | autoFocus: PropTypes.bool,
|
5857 | calendarClassName: PropTypes.string,
|
5858 | calendarContainer: PropTypes.func,
|
5859 | children: PropTypes.node,
|
5860 | className: PropTypes.string,
|
5861 | customInput: PropTypes.element,
|
5862 | customInputRef: PropTypes.string,
|
5863 |
|
5864 | dateFormat: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
5865 | dateFormatCalendar: PropTypes.string,
|
5866 | dayClassName: PropTypes.func,
|
5867 | disabled: PropTypes.bool,
|
5868 | disabledKeyboardNavigation: PropTypes.bool,
|
5869 | dropdownMode: PropTypes.oneOf(["scroll", "select"]).isRequired,
|
5870 | endDate: PropTypes.instanceOf(Date),
|
5871 | excludeDates: PropTypes.array,
|
5872 | filterDate: PropTypes.func,
|
5873 | fixedHeight: PropTypes.bool,
|
5874 | formatWeekNumber: PropTypes.func,
|
5875 | highlightDates: PropTypes.array,
|
5876 | id: PropTypes.string,
|
5877 | includeDates: PropTypes.array,
|
5878 | includeTimes: PropTypes.array,
|
5879 | injectTimes: PropTypes.array,
|
5880 | inline: PropTypes.bool,
|
5881 | isClearable: PropTypes.bool,
|
5882 | locale: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
|
5883 | locale: PropTypes.object
|
5884 | })]),
|
5885 | maxDate: PropTypes.instanceOf(Date),
|
5886 | minDate: PropTypes.instanceOf(Date),
|
5887 | monthsShown: PropTypes.number,
|
5888 | name: PropTypes.string,
|
5889 | onBlur: PropTypes.func,
|
5890 | onChange: PropTypes.func.isRequired,
|
5891 | onSelect: PropTypes.func,
|
5892 | onWeekSelect: PropTypes.func,
|
5893 | onClickOutside: PropTypes.func,
|
5894 | onChangeRaw: PropTypes.func,
|
5895 | onFocus: PropTypes.func,
|
5896 | onInputClick: PropTypes.func,
|
5897 | onKeyDown: PropTypes.func,
|
5898 | onMonthChange: PropTypes.func,
|
5899 | onYearChange: PropTypes.func,
|
5900 | onInputError: PropTypes.func,
|
5901 | open: PropTypes.bool,
|
5902 | openToDate: PropTypes.instanceOf(Date),
|
5903 | peekNextMonth: PropTypes.bool,
|
5904 | placeholderText: PropTypes.string,
|
5905 | popperContainer: PropTypes.func,
|
5906 | popperClassName: PropTypes.string,
|
5907 |
|
5908 | popperModifiers: PropTypes.object,
|
5909 |
|
5910 | popperPlacement: PropTypes.oneOf(popperPlacementPositions),
|
5911 |
|
5912 | popperProps: PropTypes.object,
|
5913 | preventOpenOnFocus: PropTypes.bool,
|
5914 | readOnly: PropTypes.bool,
|
5915 | required: PropTypes.bool,
|
5916 | scrollableYearDropdown: PropTypes.bool,
|
5917 | scrollableMonthYearDropdown: PropTypes.bool,
|
5918 | selected: PropTypes.instanceOf(Date),
|
5919 | selectsEnd: PropTypes.bool,
|
5920 | selectsStart: PropTypes.bool,
|
5921 | showMonthDropdown: PropTypes.bool,
|
5922 | showMonthYearDropdown: PropTypes.bool,
|
5923 | showWeekNumbers: PropTypes.bool,
|
5924 | showYearDropdown: PropTypes.bool,
|
5925 | strictParsing: PropTypes.bool,
|
5926 | forceShowMonthNavigation: PropTypes.bool,
|
5927 | showDisabledMonthNavigation: PropTypes.bool,
|
5928 | startDate: PropTypes.instanceOf(Date),
|
5929 | startOpen: PropTypes.bool,
|
5930 | tabIndex: PropTypes.number,
|
5931 | timeCaption: PropTypes.string,
|
5932 | title: PropTypes.string,
|
5933 | todayButton: PropTypes.node,
|
5934 | useWeekdaysShort: PropTypes.bool,
|
5935 | formatWeekDay: PropTypes.func,
|
5936 | value: PropTypes.string,
|
5937 | weekLabel: PropTypes.string,
|
5938 | withPortal: PropTypes.bool,
|
5939 | yearDropdownItemNumber: PropTypes.number,
|
5940 | shouldCloseOnSelect: PropTypes.bool,
|
5941 | showTimeInput: PropTypes.bool,
|
5942 | showMonthYearPicker: PropTypes.bool,
|
5943 | showTimeSelect: PropTypes.bool,
|
5944 | showTimeSelectOnly: PropTypes.bool,
|
5945 | timeFormat: PropTypes.string,
|
5946 | timeIntervals: PropTypes.number,
|
5947 | minTime: PropTypes.instanceOf(Date),
|
5948 | maxTime: PropTypes.instanceOf(Date),
|
5949 | excludeTimes: PropTypes.array,
|
5950 | useShortMonthInDropdown: PropTypes.bool,
|
5951 | clearButtonTitle: PropTypes.string,
|
5952 | previousMonthButtonLabel: PropTypes.string,
|
5953 | nextMonthButtonLabel: PropTypes.string,
|
5954 | timeInputLabel: PropTypes.string,
|
5955 | renderCustomHeader: PropTypes.func,
|
5956 | renderDayContents: PropTypes.func,
|
5957 | inlineFocusSelectedMonth: PropTypes.bool,
|
5958 | onDayMouseEnter: PropTypes.func,
|
5959 | onMonthMouseLeave: PropTypes.func
|
5960 | };
|
5961 |
|
5962 | function ownKeys$7(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { keys.push.apply(keys, _Object$getOwnPropertySymbols(object)); } if (enumerableOnly) keys = _filterInstanceProperty(keys).call(keys, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
5963 |
|
5964 | function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys$7(source, true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys$7(source)).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
5965 | var STRING_FORMAT = 'yyyy-MM-dd';
|
5966 |
|
5967 | function normalizeDateString(date) {
|
5968 | var stringFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : STRING_FORMAT;
|
5969 |
|
5970 | if (typeof date === 'string') {
|
5971 | var parsedDate = parse(date, stringFormat, new Date());
|
5972 | return isValid(parsedDate) ? format(parsedDate, stringFormat) : '';
|
5973 | }
|
5974 |
|
5975 | return isValid(date) ? format(date, stringFormat) : '';
|
5976 | }
|
5977 |
|
5978 | function normalizeDate(date) {
|
5979 | if (typeof date === 'string') {
|
5980 | var parsedDate = parse(date, STRING_FORMAT, new Date());
|
5981 | return isValid(parsedDate) ? parsedDate : null;
|
5982 | }
|
5983 |
|
5984 | return isValid(date) ? date : null;
|
5985 | }
|
5986 |
|
5987 |
|
5988 |
|
5989 | function NativeDatePicker(props) {
|
5990 | return (
|
5991 |
|
5992 | React.createElement(Textbox, _extends({
|
5993 | prependIconName: "calendar",
|
5994 | type: "date",
|
5995 | value: normalizeDateString(props.selectedDate)
|
5996 | }, props))
|
5997 | );
|
5998 | }
|
5999 |
|
6000 | var _StyledMaskedTextbox = styled(MaskedTextbox)(["max-width:265px;"]);
|
6001 |
|
6002 | var DateTextbox =
|
6003 |
|
6004 | React.forwardRef(function DateTextbox(props, ref) {
|
6005 | var inputRef = React.useRef();
|
6006 | React.useImperativeHandle(ref, function () {
|
6007 | return {
|
6008 | focus: function focus() {
|
6009 | inputRef.current.focus();
|
6010 | }
|
6011 | };
|
6012 | });
|
6013 |
|
6014 |
|
6015 | var datepickerProps = _pick(props, _Object$keys(reactDatePickerPropTypes));
|
6016 |
|
6017 | var textboxProps = _omit(props, _Object$keys(reactDatePickerPropTypes));
|
6018 |
|
6019 |
|
6020 |
|
6021 | var textbox =
|
6022 |
|
6023 | React.createElement(_StyledMaskedTextbox, _extends({
|
6024 | maskType: "date",
|
6025 | placeholder: props.placeholder,
|
6026 | prependIconName: "calendar",
|
6027 | ref: inputRef
|
6028 | }, textboxProps));
|
6029 | return (
|
6030 |
|
6031 | React.createElement(React.Fragment, null,
|
6032 |
|
6033 | React.createElement(DatepickerStyles, null), props.suppressDatepicker ? textbox :
|
6034 |
|
6035 | React.createElement(ReactDatePicker, _extends({
|
6036 | customInput: textbox,
|
6037 | placeholderText: props.placeholder,
|
6038 | selected: normalizeDate(props.selectedDate)
|
6039 | }, datepickerProps)))
|
6040 | );
|
6041 | });
|
6042 |
|
6043 |
|
6044 | var DatePicker = function DatePicker(props) {
|
6045 | var normalizedDateFromProps = props.selectedDate ? normalizeDate(props.selectedDate) : null;
|
6046 |
|
6047 | var _useState = useState(normalizedDateFromProps),
|
6048 | _useState2 = _slicedToArray(_useState, 2),
|
6049 | selectedDate = _useState2[0],
|
6050 | setSelectedDate = _useState2[1];
|
6051 |
|
6052 | function dateSelected(dateOrEvent) {
|
6053 | if (dateOrEvent) {
|
6054 | if (isValid(dateOrEvent)) {
|
6055 | setSelectedDate(dateOrEvent);
|
6056 | } else {
|
6057 | var normalizedDate = normalizeDate(dateOrEvent.target.value);
|
6058 | setSelectedDate(normalizedDate);
|
6059 | }
|
6060 | } else {
|
6061 | setSelectedDate(null);
|
6062 | }
|
6063 | }
|
6064 |
|
6065 | useEffect(function () {
|
6066 | if (normalizeDateString(selectedDate) !== normalizeDateString(props.selectedDate)) {
|
6067 | props.onChange(selectedDate);
|
6068 | }
|
6069 | }, [selectedDate]);
|
6070 | var windowWidth = useWindowWidth();
|
6071 | var theme = useTheme();
|
6072 | var phoneWidth = _parseInt(theme.screenSize.phone, 10) || 0;
|
6073 | var userAgent = navigator.userAgent.toLowerCase();
|
6074 | var isAndroid = _indexOfInstanceProperty(userAgent).call(userAgent, 'android') > -1;
|
6075 | var DatePickerInput = props.allowNativeDatepickerOnMobile && windowWidth <= phoneWidth && !isAndroid ? NativeDatePicker : DateTextbox;
|
6076 |
|
6077 | var actualProps = _objectSpread$7(_objectSpread$7({}, props), {}, {
|
6078 | selectedDate: selectedDate,
|
6079 | onChange: props.onChange ? dateSelected : _noop
|
6080 | });
|
6081 |
|
6082 | return (
|
6083 |
|
6084 | React.createElement(DatePickerInput, actualProps)
|
6085 | );
|
6086 | };
|
6087 |
|
6088 | DatePicker.propTypes = process.env.NODE_ENV !== "production" ? {
|
6089 | suppressDatepicker: PropTypes.bool,
|
6090 | allowNativeDatepickerOnMobile: PropTypes.bool,
|
6091 | selectedDate: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
6092 | onChange: PropTypes.func
|
6093 | } : {};
|
6094 | DatePicker.defaultProps = {
|
6095 | suppressDatepicker: false,
|
6096 | allowNativeDatepickerOnMobile: true,
|
6097 | selectedDate: '',
|
6098 | onChange: undefined
|
6099 | };
|
6100 |
|
6101 | function onNonNumericHandler(event) {
|
6102 |
|
6103 | if (event.keyCode === 69 || event.keyCode === 187 || event.keyCode === 189 || event.keyCode === 190) {
|
6104 | event.preventDefault();
|
6105 | }
|
6106 | }
|
6107 |
|
6108 | var DayInput = styled(InputBase)(["appearance:textfield;flex:1 0 35px;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{appearance:none;margin:0;}"]);
|
6109 |
|
6110 | function Day(_ref) {
|
6111 | var onChange = _ref.onChange,
|
6112 | date = _ref.date,
|
6113 | props = _objectWithoutProperties(_ref, ["onChange", "date"]);
|
6114 |
|
6115 | var theme = useTheme();
|
6116 | var validationState = React.useContext(ValidationContext);
|
6117 |
|
6118 | var _React$useState = React.useState(date ? date.getDate() : ''),
|
6119 | _React$useState2 = _slicedToArray(_React$useState, 2),
|
6120 | value = _React$useState2[0],
|
6121 | setValue = _React$useState2[1];
|
6122 |
|
6123 | function onDayChange(event) {
|
6124 | var day = event.target.value;
|
6125 | day = day.length > 2 ? _sliceInstanceProperty(day).call(day, 0, 2) : day;
|
6126 | setValue(day);
|
6127 | onChange('day', day);
|
6128 | }
|
6129 |
|
6130 | return (
|
6131 |
|
6132 | React.createElement(DayInput, _extends({
|
6133 | type: "number",
|
6134 | inputmode: "numeric",
|
6135 | pattern: "[0-9]*",
|
6136 | min: "1",
|
6137 | max: "31",
|
6138 | onKeyDown: onNonNumericHandler,
|
6139 | onChange: onDayChange,
|
6140 | placeholder: "Day",
|
6141 | value: value
|
6142 | }, theme.validationInputColor[validationState], props))
|
6143 | );
|
6144 | }
|
6145 |
|
6146 | var MonthDropdown = styled(Dropdown)(["flex:3 1 100px;"]);
|
6147 |
|
6148 | function Month(_ref) {
|
6149 | var onChange = _ref.onChange,
|
6150 | monthNames = _ref.monthNames,
|
6151 | selectOptionText = _ref.selectOptionText,
|
6152 | date = _ref.date,
|
6153 | props = _objectWithoutProperties(_ref, ["onChange", "monthNames", "selectOptionText", "date"]);
|
6154 |
|
6155 | var theme = useTheme();
|
6156 | var validationState = React.useContext(ValidationContext);
|
6157 |
|
6158 | var _React$useState = React.useState(date ? date.getMonth() + 1 : ''),
|
6159 | _React$useState2 = _slicedToArray(_React$useState, 2),
|
6160 | month = _React$useState2[0],
|
6161 | setMonth = _React$useState2[1];
|
6162 |
|
6163 | function onMonthChange(event) {
|
6164 | setMonth(event.target.value);
|
6165 | onChange('month', event.target.value);
|
6166 | }
|
6167 |
|
6168 | return (
|
6169 |
|
6170 | React.createElement(MonthDropdown, _extends({
|
6171 | onChange: onMonthChange
|
6172 | }, theme.validationInputColor[validationState], {
|
6173 | value: month
|
6174 | }, props), selectOptionText &&
|
6175 |
|
6176 | React.createElement("option", {
|
6177 | value: "none"
|
6178 | }, selectOptionText), _mapInstanceProperty(monthNames).call(monthNames, function (value, index) {
|
6179 | return (
|
6180 |
|
6181 | React.createElement("option", {
|
6182 | value: index + 1,
|
6183 | key: value
|
6184 | }, value)
|
6185 | );
|
6186 | }))
|
6187 | );
|
6188 | }
|
6189 |
|
6190 | Month.propTypes = process.env.NODE_ENV !== "production" ? {
|
6191 |
|
6192 | monthNames: PropTypes.array,
|
6193 |
|
6194 |
|
6195 | selectOptionText: PropTypes.string
|
6196 | } : {};
|
6197 | Month.defaultProps = {
|
6198 | monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
6199 | selectOptionText: undefined
|
6200 | };
|
6201 |
|
6202 | var YearInput = styled(InputBase)(["appearance:textfield;flex:2 0 40px;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{appearance:none;margin:0;}"]);
|
6203 |
|
6204 | function Year(_ref) {
|
6205 | var onChange = _ref.onChange,
|
6206 | date = _ref.date,
|
6207 | props = _objectWithoutProperties(_ref, ["onChange", "date"]);
|
6208 |
|
6209 | var theme = useTheme();
|
6210 | var validationState = React.useContext(ValidationContext);
|
6211 |
|
6212 | var _React$useState = React.useState(date ? date.getFullYear() : ''),
|
6213 | _React$useState2 = _slicedToArray(_React$useState, 2),
|
6214 | value = _React$useState2[0],
|
6215 | setValue = _React$useState2[1];
|
6216 |
|
6217 | function onYearChange(event) {
|
6218 | var year = event.target.value;
|
6219 | year = year.length > 4 ? _sliceInstanceProperty(year).call(year, 0, 4) : year;
|
6220 | setValue(year);
|
6221 | onChange('year', year);
|
6222 | }
|
6223 |
|
6224 | return (
|
6225 |
|
6226 | React.createElement(YearInput, _extends({
|
6227 | type: "number",
|
6228 | inputmode: "numeric",
|
6229 | pattern: "[0-9]*",
|
6230 | onChange: onYearChange,
|
6231 | onKeyDown: onNonNumericHandler,
|
6232 | placeholder: "Year",
|
6233 | value: value
|
6234 | }, theme.validationInputColor[validationState], props))
|
6235 | );
|
6236 | }
|
6237 |
|
6238 | function ownKeys$8(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { keys.push.apply(keys, _Object$getOwnPropertySymbols(object)); } if (enumerableOnly) keys = _filterInstanceProperty(keys).call(keys, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
6239 |
|
6240 | function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context5; _forEachInstanceProperty(_context5 = ownKeys$8(source, true)).call(_context5, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context6; _forEachInstanceProperty(_context6 = ownKeys$8(source)).call(_context6, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
6241 | var Wrapper = styled.div(["display:flex;&& > *{margin-right:2px;}@media (min-width:", "){max-width:350px;}"], function (props) {
|
6242 | return props.theme.screenSize.tablet;
|
6243 | });
|
6244 |
|
6245 | function cleanZeroes(day) {
|
6246 | var cleanDay = day;
|
6247 |
|
6248 | while (cleanDay.charAt(0) === '0') {
|
6249 | cleanDay = cleanDay.substr(1);
|
6250 | }
|
6251 |
|
6252 | return cleanDay;
|
6253 | }
|
6254 |
|
6255 | function reducer(state, action) {
|
6256 | switch (action.type) {
|
6257 | case 'day_updated':
|
6258 | return _objectSpread$8(_objectSpread$8({}, state), {}, {
|
6259 | day: action.value
|
6260 | });
|
6261 |
|
6262 | case 'month_updated':
|
6263 | return _objectSpread$8(_objectSpread$8({}, state), {}, {
|
6264 | month: action.value
|
6265 | });
|
6266 |
|
6267 | case 'year_updated':
|
6268 | return _objectSpread$8(_objectSpread$8({}, state), {}, {
|
6269 | year: action.value
|
6270 | });
|
6271 |
|
6272 | default:
|
6273 | throw new Error();
|
6274 | }
|
6275 | }
|
6276 |
|
6277 | function DateInput(_ref) {
|
6278 | var _context4;
|
6279 |
|
6280 | var children = _ref.children,
|
6281 | defaultValue = _ref.defaultValue,
|
6282 | defaultDay = _ref.defaultDay,
|
6283 | id = _ref.id,
|
6284 | maxDate = _ref.maxDate,
|
6285 | minDate = _ref.minDate,
|
6286 | onBlur = _ref.onBlur,
|
6287 | onChange = _ref.onChange,
|
6288 | props = _objectWithoutProperties(_ref, ["children", "defaultValue", "defaultDay", "id", "maxDate", "minDate", "onBlur", "onChange"]);
|
6289 |
|
6290 | var _useReducer = useReducer(reducer, {
|
6291 | day: defaultValue ? defaultValue.getDate() : defaultDay,
|
6292 | month: defaultValue ? defaultValue.getMonth() + 1 : '',
|
6293 | year: defaultValue ? defaultValue.getFullYear().toString() : ''
|
6294 | }),
|
6295 | _useReducer2 = _slicedToArray(_useReducer, 2),
|
6296 | state = _useReducer2[0],
|
6297 | dispatch = _useReducer2[1];
|
6298 |
|
6299 | var hasDayElement = useRef(false);
|
6300 | useEffect(function () {
|
6301 | var _context;
|
6302 |
|
6303 | _forEachInstanceProperty(_context = React.Children).call(_context, children, function (child) {
|
6304 | if (child.type === Month && !state.month) {
|
6305 | if (child.props.selectOptionText) {
|
6306 | dispatch({
|
6307 | type: 'month_updated',
|
6308 | value: 'none'
|
6309 | });
|
6310 | }
|
6311 | }
|
6312 |
|
6313 | if (child.type === Day) {
|
6314 | hasDayElement.current = true;
|
6315 | }
|
6316 | });
|
6317 | }, []);
|
6318 |
|
6319 | function createDate(year, month, day) {
|
6320 | var _context2, _context3;
|
6321 |
|
6322 | var cleanDay = day ? cleanZeroes(day.toString()) : day;
|
6323 | var date = new Date(_concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = "".concat(year, "/")).call(_context3, month, "/")).call(_context2, cleanDay));
|
6324 | var dateIsValid = month !== 'none' && year.length === 4 && (hasDayElement.current ? date.getDate().toString() === cleanDay : true) && (month ? (date.getMonth() + 1).toString() === month.toString() : true) && date.getFullYear().toString() === year.toString();
|
6325 | var isInRange = dateIsValid && (minDate ? isAfter(date, minDate) : true) && (maxDate ? isBefore(date, maxDate) : true);
|
6326 | return {
|
6327 | value: dateIsValid ? date : undefined,
|
6328 | isInRange: isInRange
|
6329 | };
|
6330 | }
|
6331 |
|
6332 | function onChangeDatePart(datePart, value) {
|
6333 | switch (datePart) {
|
6334 | case 'day':
|
6335 | onChange(createDate(state.year, state.month, value));
|
6336 | dispatch({
|
6337 | type: 'day_updated',
|
6338 | value: value
|
6339 | });
|
6340 | return;
|
6341 |
|
6342 | case 'month':
|
6343 | onChange(createDate(state.year, value, state.day));
|
6344 | dispatch({
|
6345 | type: 'month_updated',
|
6346 | value: value
|
6347 | });
|
6348 | return;
|
6349 |
|
6350 | case 'year':
|
6351 | onChange(createDate(value, state.month, state.day));
|
6352 | dispatch({
|
6353 | type: 'year_updated',
|
6354 | value: value
|
6355 | });
|
6356 | return;
|
6357 |
|
6358 | default:
|
6359 | throw new Error();
|
6360 | }
|
6361 | }
|
6362 |
|
6363 | function onBlurComponent(event) {
|
6364 | var target = event.currentTarget;
|
6365 |
|
6366 | _setTimeout(function () {
|
6367 | if (!target.contains(target.getRootNode().activeElement)) {
|
6368 | onBlur(event);
|
6369 | }
|
6370 | }, 0);
|
6371 | }
|
6372 |
|
6373 | return (
|
6374 |
|
6375 | React.createElement(Wrapper, _extends({
|
6376 | tabIndex: "-1"
|
6377 | }, props, {
|
6378 | onBlur: onBlurComponent
|
6379 | }), _mapInstanceProperty(_context4 = React.Children).call(_context4, children, function (child, index) {
|
6380 | return index === 0 ?
|
6381 |
|
6382 | React.cloneElement(child, {
|
6383 | id: id,
|
6384 | onChange: onChangeDatePart,
|
6385 | date: createDate(state.year, state.month, state.day).value
|
6386 | }) :
|
6387 |
|
6388 | React.cloneElement(child, {
|
6389 | onChange: onChangeDatePart,
|
6390 | date: createDate(state.year, state.month, state.day).value
|
6391 | });
|
6392 | }))
|
6393 | );
|
6394 | }
|
6395 |
|
6396 | DateInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
6397 | id: PropTypes.string,
|
6398 | children: PropTypes.node.isRequired,
|
6399 |
|
6400 |
|
6401 | maxDate: PropTypes.instanceOf(Date),
|
6402 |
|
6403 |
|
6404 | minDate: PropTypes.instanceOf(Date),
|
6405 |
|
6406 |
|
6407 | onChange: PropTypes.func.isRequired,
|
6408 | onBlur: PropTypes.func,
|
6409 |
|
6410 |
|
6411 | defaultValue: PropTypes.instanceOf(Date),
|
6412 |
|
6413 |
|
6414 | defaultDay: PropTypes.string
|
6415 | } : {};
|
6416 | DateInput.defaultProps = {
|
6417 | id: undefined,
|
6418 | maxDate: undefined,
|
6419 | minDate: undefined,
|
6420 | defaultValue: undefined,
|
6421 | defaultDay: '',
|
6422 | onBlur: _noop
|
6423 | };
|
6424 | DateInput.Day = Day;
|
6425 | DateInput.Month = Month;
|
6426 | DateInput.Year = Year;
|
6427 |
|
6428 | var IncrementerWrapper = styled.div(["align-items:flex-start;display:flex;"]);
|
6429 | var IncrementerTextbox = styled(InputBase)(["margin:0 10px;min-width:60px;padding-right:12px;text-align:center;@media (min-width:", "){width:60px;}-moz-appearance:textfield;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{-webkit-appearance:none;margin:0;}&::-ms-clear{display:none;}"], function (props) {
|
6430 | return props.theme.screenSize.tablet;
|
6431 | });
|
6432 | var IncrementerButton = styled(Button)(["min-width:0;.es-button__display{min-width:0;}"]);
|
6433 |
|
6434 | function determineIsDisabled(threshold, newValue) {
|
6435 | return _isFinite(threshold) && newValue === threshold;
|
6436 | }
|
6437 |
|
6438 | function sanitizeValue(val, lower, upper) {
|
6439 | var enteredValue = _parseInt$1(val);
|
6440 |
|
6441 | if (_isFinite(enteredValue)) {
|
6442 | if (upper !== null && enteredValue > upper) {
|
6443 | return upper;
|
6444 | }
|
6445 |
|
6446 | if (lower !== null && enteredValue < lower) {
|
6447 | return lower;
|
6448 | }
|
6449 |
|
6450 | return enteredValue;
|
6451 | }
|
6452 |
|
6453 | return lower > 0 ? lower : 0;
|
6454 | }
|
6455 |
|
6456 | function updateCountReducer(state, action) {
|
6457 | switch (action.type) {
|
6458 | case 'increment':
|
6459 | return {
|
6460 | count: sanitizeValue(_parseInt$1(state.count) + _parseInt$1(action.amount), action.lower, action.upper)
|
6461 | };
|
6462 |
|
6463 | case 'decrement':
|
6464 | return {
|
6465 | count: sanitizeValue(_parseInt$1(state.count) - _parseInt$1(action.amount), action.lower, action.upper)
|
6466 | };
|
6467 |
|
6468 | case 'set':
|
6469 | return {
|
6470 | count: action.amount
|
6471 | };
|
6472 | }
|
6473 |
|
6474 | return null;
|
6475 | }
|
6476 |
|
6477 | var ScreenReaderButtonText = screenReaderOnly('span');
|
6478 |
|
6479 | function Incrementer(_ref) {
|
6480 | var startingValue = _ref.startingValue,
|
6481 | incrementAmount = _ref.incrementAmount,
|
6482 | decrementAmount = _ref.decrementAmount,
|
6483 | upperThreshold = _ref.upperThreshold,
|
6484 | lowerThreshold = _ref.lowerThreshold,
|
6485 | useOutlineButton = _ref.useOutlineButton,
|
6486 | onValueUpdated = _ref.onValueUpdated,
|
6487 | other = _objectWithoutProperties(_ref, ["startingValue", "incrementAmount", "decrementAmount", "upperThreshold", "lowerThreshold", "useOutlineButton", "onValueUpdated"]);
|
6488 |
|
6489 | var theme = useTheme();
|
6490 | var initialRender = useRef(true);
|
6491 |
|
6492 | var _React$useReducer = React.useReducer(updateCountReducer, {
|
6493 | count: startingValue === null ? '' : startingValue
|
6494 | }),
|
6495 | _React$useReducer2 = _slicedToArray(_React$useReducer, 2),
|
6496 | state = _React$useReducer2[0],
|
6497 | dispatch = _React$useReducer2[1];
|
6498 |
|
6499 | var isIncrementDisabled = determineIsDisabled(upperThreshold, state.count);
|
6500 | var isDecrementDisabled = determineIsDisabled(lowerThreshold, state.count);
|
6501 | React.useEffect(function () {
|
6502 | if (!initialRender.current) {
|
6503 | onValueUpdated(state.count);
|
6504 | }
|
6505 |
|
6506 | initialRender.current = false;
|
6507 | }, [state.count]);
|
6508 |
|
6509 | function setValue(event) {
|
6510 | dispatch({
|
6511 | type: 'set',
|
6512 | amount: event.target.value
|
6513 | });
|
6514 | }
|
6515 |
|
6516 | function decrementValue() {
|
6517 | dispatch({
|
6518 | type: 'decrement',
|
6519 | amount: decrementAmount,
|
6520 | lower: lowerThreshold,
|
6521 | upper: upperThreshold
|
6522 | });
|
6523 | }
|
6524 |
|
6525 | function incrementValue() {
|
6526 | dispatch({
|
6527 | type: 'increment',
|
6528 | amount: incrementAmount,
|
6529 | lower: lowerThreshold,
|
6530 | upper: upperThreshold
|
6531 | });
|
6532 | }
|
6533 |
|
6534 | function handleOnBlur(event) {
|
6535 | var sanitizedValue = sanitizeValue(event.target.value, lowerThreshold, upperThreshold);
|
6536 |
|
6537 | if (event.target.value !== sanitizedValue) {
|
6538 | dispatch({
|
6539 | type: 'set',
|
6540 | amount: sanitizedValue
|
6541 | });
|
6542 | }
|
6543 | }
|
6544 |
|
6545 | function shortcutKeys(event) {
|
6546 | if (upperThreshold && event.keyCode === 35) {
|
6547 | dispatch({
|
6548 | type: 'set',
|
6549 | amount: upperThreshold
|
6550 | });
|
6551 | }
|
6552 |
|
6553 | if (lowerThreshold && event.keyCode === 36) {
|
6554 | dispatch({
|
6555 | type: 'set',
|
6556 | amount: lowerThreshold
|
6557 | });
|
6558 | }
|
6559 | }
|
6560 |
|
6561 | var RenderedButton = useOutlineButton ? OutlineButton : Button;
|
6562 | return (
|
6563 |
|
6564 | React.createElement(IncrementerWrapper, null,
|
6565 |
|
6566 | React.createElement(IncrementerButton, {
|
6567 | as: RenderedButton,
|
6568 | styleType: "primary",
|
6569 | onClick: decrementValue,
|
6570 | disabled: isDecrementDisabled
|
6571 | },
|
6572 |
|
6573 | React.createElement(ScreenReaderButtonText, null, "Decrement value by", decrementAmount),
|
6574 |
|
6575 | React.createElement(Icon, {
|
6576 | name: "minus",
|
6577 | size: 22
|
6578 | })),
|
6579 |
|
6580 | React.createElement(IncrementerTextbox, _extends({}, theme.validationInputColor.default, other, {
|
6581 | type: "number",
|
6582 | role: "spinbutton",
|
6583 | max: upperThreshold,
|
6584 | min: lowerThreshold,
|
6585 | step: incrementAmount,
|
6586 | value: state.count,
|
6587 | "aria-valuemin": lowerThreshold,
|
6588 | "aria-valuemax": upperThreshold,
|
6589 | "aria-valuenow": state.count,
|
6590 | onKeyDown: shortcutKeys,
|
6591 | onChange: setValue,
|
6592 | onBlur: handleOnBlur
|
6593 | })),
|
6594 |
|
6595 | React.createElement(IncrementerButton, {
|
6596 | as: RenderedButton,
|
6597 | styleType: "primary",
|
6598 | onClick: incrementValue,
|
6599 | disabled: isIncrementDisabled
|
6600 | },
|
6601 |
|
6602 | React.createElement(ScreenReaderButtonText, null, "Increment value by", incrementAmount),
|
6603 |
|
6604 | React.createElement(Icon, {
|
6605 | name: "add",
|
6606 | size: 22
|
6607 | })))
|
6608 | );
|
6609 | }
|
6610 |
|
6611 | Incrementer.propTypes = process.env.NODE_ENV !== "production" ? {
|
6612 |
|
6613 | startingValue: PropTypes.number,
|
6614 |
|
6615 |
|
6616 | incrementAmount: PropTypes.number,
|
6617 |
|
6618 |
|
6619 | decrementAmount: PropTypes.number,
|
6620 |
|
6621 |
|
6622 | upperThreshold: PropTypes.number,
|
6623 |
|
6624 |
|
6625 | lowerThreshold: PropTypes.number,
|
6626 |
|
6627 |
|
6628 | useOutlineButton: PropTypes.bool,
|
6629 |
|
6630 |
|
6631 | onValueUpdated: PropTypes.func
|
6632 | } : {};
|
6633 | Incrementer.defaultProps = {
|
6634 | startingValue: 0,
|
6635 | incrementAmount: 1,
|
6636 | decrementAmount: 1,
|
6637 | onValueUpdated: _noop,
|
6638 | upperThreshold: null,
|
6639 | lowerThreshold: null,
|
6640 | useOutlineButton: false
|
6641 | };
|
6642 |
|
6643 | function getCallToActionChildren(children) {
|
6644 | var _context;
|
6645 |
|
6646 | var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
|
6647 | var allChildren = React.Children.toArray(children);
|
6648 |
|
6649 | var actions = _mapInstanceProperty(_context = _filterInstanceProperty(allChildren).call(allChildren, function (child) {
|
6650 | return child.type.name === 'Action';
|
6651 | })).call(_context, function (action) {
|
6652 | if (type === 'light') {
|
6653 | var _styleType = action.props.isPrimary ? 'primary' : 'darkDefault';
|
6654 |
|
6655 | return (
|
6656 |
|
6657 | React.cloneElement(action, {
|
6658 | styleType: _styleType
|
6659 | })
|
6660 | );
|
6661 | }
|
6662 |
|
6663 | var styleType = action.props.isPrimary ? 'primary' : 'default';
|
6664 | return (
|
6665 |
|
6666 | React.cloneElement(action, {
|
6667 | styleType: styleType
|
6668 | })
|
6669 | );
|
6670 | });
|
6671 |
|
6672 | var nonActions = _filterInstanceProperty(allChildren).call(allChildren, function (child) {
|
6673 | return child.type.name !== 'Action';
|
6674 | });
|
6675 |
|
6676 | return {
|
6677 | actions: actions,
|
6678 | nonActions: nonActions
|
6679 | };
|
6680 | }
|
6681 |
|
6682 | function ownKeys$9(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { keys.push.apply(keys, _Object$getOwnPropertySymbols(object)); } if (enumerableOnly) keys = _filterInstanceProperty(keys).call(keys, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
6683 |
|
6684 | function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys$9(source, true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys$9(source)).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
6685 | var Container$2 = styled.div(["flex-basis:100%;"]);
|
6686 | var CallToActionContainer = styled.div(["display:flex;justify-content:flex-end;"]);
|
6687 |
|
6688 | function CallToAction(_ref) {
|
6689 | var children = _ref.children,
|
6690 | rest = _objectWithoutProperties(_ref, ["children"]);
|
6691 |
|
6692 | var _getCallToActionChild = getCallToActionChildren(children),
|
6693 | actions = _getCallToActionChild.actions,
|
6694 | nonActions = _getCallToActionChild.nonActions;
|
6695 |
|
6696 | var props = _objectSpread$9(_objectSpread$9({}, rest), {}, {
|
6697 | isDismissable: false
|
6698 | });
|
6699 |
|
6700 | return (
|
6701 |
|
6702 | React.createElement(React.Fragment, null,
|
6703 |
|
6704 | React.createElement(Notification$1, props,
|
6705 |
|
6706 | React.createElement(Container$2, null, nonActions)),
|
6707 |
|
6708 | React.createElement(CallToActionContainer, null, actions))
|
6709 | );
|
6710 | }
|
6711 |
|
6712 | CallToAction.propTypes = process.env.NODE_ENV !== "production" ? {
|
6713 | children: PropTypes.any
|
6714 | } : {};
|
6715 | CallToAction.defaultProps = {
|
6716 | children: undefined
|
6717 | };
|
6718 |
|
6719 | function ownKeys$a(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { keys.push.apply(keys, _Object$getOwnPropertySymbols(object)); } if (enumerableOnly) keys = _filterInstanceProperty(keys).call(keys, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
|
6720 |
|
6721 | function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys$a(source, true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys$a(source)).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
6722 | var Container$3 = styled.div(["flex-basis:100%;"]);
|
6723 | var CallToActionContainer$1 = styled.div(["display:flex;justify-content:flex-end;"]);
|
6724 |
|
6725 | function LightCallToAction(_ref) {
|
6726 | var children = _ref.children,
|
6727 | rest = _objectWithoutProperties(_ref, ["children"]);
|
6728 |
|
6729 | var _getCallToActionChild = getCallToActionChildren(children, 'light'),
|
6730 | actions = _getCallToActionChild.actions,
|
6731 | nonActions = _getCallToActionChild.nonActions;
|
6732 |
|
6733 | var props = _objectSpread$a(_objectSpread$a({}, rest), {}, {
|
6734 | isDismissable: false
|
6735 | });
|
6736 |
|
6737 | return (
|
6738 |
|
6739 | React.createElement(LightNotification, props,
|
6740 |
|
6741 | React.createElement(Container$3, null, nonActions,
|
6742 |
|
6743 | React.createElement(CallToActionContainer$1, null, actions)))
|
6744 | );
|
6745 | }
|
6746 |
|
6747 | LightCallToAction.propTypes = process.env.NODE_ENV !== "production" ? {
|
6748 | children: PropTypes.any
|
6749 | } : {};
|
6750 | LightCallToAction.defaultProps = {
|
6751 | children: undefined
|
6752 | };
|
6753 |
|
6754 | var ActionButton$1 = styled(Button)([":not(:first-of-type){margin-left:15px;}"]);
|
6755 | function Action(_ref) {
|
6756 | var isPrimary = _ref.isPrimary,
|
6757 | children = _ref.children,
|
6758 | rest = _objectWithoutProperties(_ref, ["isPrimary", "children"]);
|
6759 |
|
6760 | return (
|
6761 |
|
6762 | React.createElement(ActionButton$1, rest, children)
|
6763 | );
|
6764 | }
|
6765 | Action.propTypes = process.env.NODE_ENV !== "production" ? {
|
6766 | isPrimary: PropTypes.bool,
|
6767 | children: PropTypes.node
|
6768 | } : {};
|
6769 | Action.defaultProps = {
|
6770 | isPrimary: false,
|
6771 | children: null
|
6772 | };
|
6773 |
|
6774 | var sizes = {
|
6775 | ACTIVE: 45,
|
6776 | INACTIVE: 20,
|
6777 | DESKTOP: 41,
|
6778 | TRACKING_LINE_HEIGHT: 3
|
6779 | };
|
6780 |
|
6781 | var ACTIVE = sizes.ACTIVE,
|
6782 | INACTIVE = sizes.INACTIVE,
|
6783 | DESKTOP = sizes.DESKTOP,
|
6784 | TRACKING_LINE_HEIGHT = sizes.TRACKING_LINE_HEIGHT;
|
6785 |
|
6786 | var getProgressLineBreakPercentage = function getProgressLineBreakPercentage(activeStepIndex, numberOfSteps) {
|
6787 | return activeStepIndex / (numberOfSteps - 1) * 100;
|
6788 | };
|
6789 |
|
6790 | var getProgressItemWidthPercentage = function getProgressItemWidthPercentage(baseAmount) {
|
6791 | return 1 / baseAmount * 100;
|
6792 | };
|
6793 |
|
6794 | var getCenterTopPosition = function getCenterTopPosition(containerHeight, itemHeight) {
|
6795 | return containerHeight / 2 - itemHeight / 2;
|
6796 | };
|
6797 |
|
6798 | var stepStates = {
|
6799 | active: 'active',
|
6800 | pastStep: 'isPastStep',
|
6801 | clickableFutureStep: 'clickableFutureStep'
|
6802 | };
|
6803 | var ProgressContainer = styled.ol(["align-items:flex-start;background-image:linear-gradient( to right,", " 0%,", " ", "%,", " ", "%,", " 100% );background-size:100% ", "px;background-position:0 ", "px;background-repeat:no-repeat;counter-reset:progress-tracker-counter;display:flex;flex-flow:row nowrap;justify-content:space-between;margin-left:0;padding-left:0;width:100%;@media (min-width:", "){background-position:center ", "px;background-size:", "% ", "px;}"], function (props) {
|
6804 | return props.theme.colors.gray9;
|
6805 | }, function (props) {
|
6806 | return props.theme.colors.gray9;
|
6807 | }, function (props) {
|
6808 | return getProgressLineBreakPercentage(props.activeStepIndex, props.numberOfSteps);
|
6809 | }, function (props) {
|
6810 | return props.theme.colors.gray5;
|
6811 | }, function (props) {
|
6812 | return getProgressLineBreakPercentage(props.activeStepIndex, props.numberOfSteps);
|
6813 | }, function (props) {
|
6814 | return props.theme.colors.gray5;
|
6815 | }, function () {
|
6816 | return TRACKING_LINE_HEIGHT;
|
6817 | }, function () {
|
6818 | return getCenterTopPosition(ACTIVE, TRACKING_LINE_HEIGHT);
|
6819 | }, function (props) {
|
6820 | return props.theme.screenSize.tablet;
|
6821 | }, function () {
|
6822 | return getCenterTopPosition(DESKTOP, TRACKING_LINE_HEIGHT);
|
6823 | }, function (props) {
|
6824 | return 100 - getProgressItemWidthPercentage(props.numberOfSteps);
|
6825 | }, function () {
|
6826 | return TRACKING_LINE_HEIGHT;
|
6827 | });
|
6828 | ProgressContainer.propTypes = {
|
6829 | activePercentage: PropTypes.number
|
6830 | };
|
6831 | var BasicProgressButton = styled.button(["align-items:center;background:none;border:none;counter-increment:progress-tracker-counter;display:flex;flex-flow:column nowrap;font-family:'Source Sans Pro',sans-serif;margin-top:", "px;padding:0;text-align:center;&:active,&:hover,&:focus{outline:none;}@media (min-width:", "){font-size:18px;margin-top:0;margin:0 auto;}span{color:", ";display:none;font-size:18px;line-height:1.1em;@media (min-width:", "){display:inline;font-weight:normal;}}&::before{background-color:white;border:", ";border-radius:", "px;box-shadow:0 0 0 3px white;box-sizing:border-box;color:", ";content:counter(progress-tracker-counter);display:block;font-size:", "px;height:", "px;line-height:1em;margin-bottom:5px;text-align:center;width:", "px;position:relative;@media (min-width:", "){border-radius:", "px;border-width:3px;font-size:", "px;font-weight:normal;height:", "px;line-height:1.7em;width:", "px;}}"], function () {
|
6832 | return getCenterTopPosition(ACTIVE, INACTIVE);
|
6833 | }, function (props) {
|
6834 | return props.theme.screenSize.tablet;
|
6835 | }, function (props) {
|
6836 | return props.theme.colors.gray9;
|
6837 | }, function (props) {
|
6838 | return props.theme.screenSize.tablet;
|
6839 | }, function (props) {
|
6840 | return "1px solid ".concat(props.theme.colors.gray5);
|
6841 | }, function () {
|
6842 | return INACTIVE;
|
6843 | }, function (props) {
|
6844 | return props.theme.colors.gray9;
|
6845 | }, function () {
|
6846 | return INACTIVE * 0.8;
|
6847 | }, function () {
|
6848 | return INACTIVE;
|
6849 | }, function () {
|
6850 | return INACTIVE;
|
6851 | }, function (props) {
|
6852 | return props.theme.screenSize.tablet;
|
6853 | }, function () {
|
6854 | return DESKTOP;
|
6855 | }, function () {
|
6856 | return DESKTOP * 0.488;
|
6857 | }, function () {
|
6858 | return DESKTOP;
|
6859 | }, function () {
|
6860 | return DESKTOP;
|
6861 | });
|
6862 | var FutureProgressButton = styled(BasicProgressButton)(["cursor:pointer;&:hover{&::before{box-shadow:rgba(0,0,0,0.35) 0 0 3px 1px;}}&:active,&:hover,&:focus{span{text-decoration:underline;}}"]);
|
6863 | var PastProgressButton = styled(BasicProgressButton)(["cursor:pointer;&:hover{&::before{box-shadow:rgba(0,0,0,0.35) 0 0 3px 1px;}}&:active,&:hover,&:focus{span{text-decoration:underline;}}&:focus{&::before{box-shadow:", " 0 0 4px 2px;}span{outline:1px dotted ", ";}}&::before{border-color:", ";@media (min-width:", "){border-width:5px;font-weight:bold;line-height:1.5em;}}span{@media (min-width:", "){font-weight:bold;}}"], function (props) {
|
6864 | return props.theme.colors.inputFocus;
|
6865 | }, function (props) {
|
6866 | return props.theme.colors.inputFocus;
|
6867 | }, function (props) {
|
6868 | return props.theme.colors.gray9;
|
6869 | }, function (props) {
|
6870 | return props.theme.screenSize.tablet;
|
6871 | }, function (props) {
|
6872 | return props.theme.screenSize.tablet;
|
6873 | });
|
6874 | var NonNavigablePastProgressButton = styled(BasicProgressButton)(["&::before{border-color:", ";@media (min-width:", "){border-width:5px;font-weight:bold;line-height:1.5em;}}span{@media (min-width:", "){font-weight:bold;}}"], function (props) {
|
6875 | return props.theme.colors.gray9;
|
6876 | }, function (props) {
|
6877 | return props.theme.screenSize.tablet;
|
6878 | }, function (props) {
|
6879 | return props.theme.screenSize.tablet;
|
6880 | });
|
6881 | var ActiveProgressButton = styled(BasicProgressButton)(["margin-top:0;&::before{border:5px solid ", ";border-radius:", "px;color:", ";font-size:", "px;font-weight:bold;height:", "px;line-height:1.5em;width:", "px;@media (min-width:", "){border-width:5px;font-size:", "px;height:", "px;line-height:1.5em;width:", "px;}}span{color:", ";display:inline;font-weight:bold;@media (min-width:", "){font-weight:bold;}}"], function (props) {
|
6882 | return props.theme.brandColors.primary3;
|
6883 | }, ACTIVE, function (props) {
|
6884 | return props.theme.brandColors.primary3;
|
6885 | }, ACTIVE * 0.488, ACTIVE, ACTIVE, function (props) {
|
6886 | return props.theme.screenSize.tablet;
|
6887 | }, function () {
|
6888 | return DESKTOP * 0.488;
|
6889 | }, function () {
|
6890 | return DESKTOP;
|
6891 | }, function () {
|
6892 | return DESKTOP;
|
6893 | }, function (props) {
|
6894 | return props.theme.brandColors.primary3;
|
6895 | }, function (props) {
|
6896 | return props.theme.screenSize.tablet;
|
6897 | });
|
6898 | var ProgressLi = styled.li(["display:flex;list-style-type:none;max-width:", "%;align-items:center;&:first-child{&,& button{align-items:flex-start;text-align:left;}}&:last-child{&,& button{align-items:flex-end;text-align:right;}}@media (min-width:", "){width:", "%;&:first-child,&:last-child{&,& button{align-items:center;text-align:center;}}}"], function (props) {
|
6899 | return getProgressItemWidthPercentage(props.numberOfSteps - 1);
|
6900 | }, function (props) {
|
6901 | return props.theme.screenSize.tablet;
|
6902 | }, function (props) {
|
6903 | return getProgressItemWidthPercentage(props.numberOfSteps);
|
6904 | });
|
6905 |
|
6906 | function getProgressItemType(itemType, showNav) {
|
6907 | switch (itemType) {
|
6908 | case stepStates.active:
|
6909 | return ActiveProgressButton;
|
6910 |
|
6911 | case stepStates.pastStep:
|
6912 | return showNav ? PastProgressButton : NonNavigablePastProgressButton;
|
6913 |
|
6914 | case stepStates.clickableFutureStep:
|
6915 | return showNav ? FutureProgressButton : BasicProgressButton;
|
6916 |
|
6917 | default:
|
6918 | return BasicProgressButton;
|
6919 | }
|
6920 | }
|
6921 |
|
6922 | function getStepState(isActiveStep, isPastStep, canClickFutureStep) {
|
6923 | if (isActiveStep) {
|
6924 | return stepStates.active;
|
6925 | }
|
6926 |
|
6927 | if (isPastStep) {
|
6928 | return stepStates.pastStep;
|
6929 | }
|
6930 |
|
6931 | if (canClickFutureStep) {
|
6932 | return stepStates.clickableFutureStep;
|
6933 | }
|
6934 |
|
6935 | return stepStates.active;
|
6936 | }
|
6937 |
|
6938 | function ProgressItem(_ref) {
|
6939 | var active = _ref.active,
|
6940 | isPastStep = _ref.isPastStep,
|
6941 | numberOfSteps = _ref.numberOfSteps,
|
6942 | onPastStepClicked = _ref.onPastStepClicked,
|
6943 | canClickFutureStep = _ref.canClickFutureStep,
|
6944 | label = _ref.label,
|
6945 | showNav = _ref.showNav;
|
6946 | var itemType;
|
6947 |
|
6948 | if (isPastStep || active || canClickFutureStep) {
|
6949 | itemType = getStepState(active, isPastStep, canClickFutureStep);
|
6950 | }
|
6951 |
|
6952 | var ProgressItemType = getProgressItemType(itemType, showNav);
|
6953 | var listItemProps = {
|
6954 | numberOfSteps: numberOfSteps,
|
6955 | disabled: !isPastStep && !canClickFutureStep,
|
6956 | onClick: onPastStepClicked
|
6957 | };
|
6958 | return (
|
6959 |
|
6960 | React.createElement(ProgressLi, {
|
6961 | numberOfSteps: numberOfSteps
|
6962 | },
|
6963 |
|
6964 | React.createElement(ProgressItemType, listItemProps,
|
6965 |
|
6966 | React.createElement("span", null, label)))
|
6967 | );
|
6968 | }
|
6969 | ProgressItem.propTypes = process.env.NODE_ENV !== "production" ? {
|
6970 | active: PropTypes.bool.isRequired,
|
6971 | isPastStep: PropTypes.bool.isRequired,
|
6972 | numberOfSteps: PropTypes.number.isRequired,
|
6973 | onPastStepClicked: PropTypes.func,
|
6974 | label: PropTypes.string,
|
6975 | canClickFutureStep: PropTypes.bool,
|
6976 | showNav: PropTypes.bool
|
6977 | } : {};
|
6978 | ProgressItem.defaultProps = {
|
6979 | onPastStepClicked: function onPastStepClicked() {},
|
6980 | label: '',
|
6981 | canClickFutureStep: false,
|
6982 | showNav: true
|
6983 | };
|
6984 |
|
6985 | var getMappedSteps = function getMappedSteps(steps, _onPastStepClicked, _onFutureStepClicked, showNav) {
|
6986 | var isPastStep = true;
|
6987 | return _mapInstanceProperty(steps).call(steps, function (step, index) {
|
6988 | var _context;
|
6989 |
|
6990 | isPastStep = !(step.active || !isPastStep);
|
6991 | return (
|
6992 |
|
6993 | React.createElement(ProgressItem
|
6994 |
|
6995 | , {
|
6996 | key: _concatInstanceProperty(_context = "".concat(index, "-")).call(_context, step.label)
|
6997 |
|
6998 | ,
|
6999 | active: step.active,
|
7000 | isPastStep: isPastStep,
|
7001 | numberOfSteps: steps.length,
|
7002 | onPastStepClicked: function onPastStepClicked() {
|
7003 | return _onPastStepClicked(index);
|
7004 | },
|
7005 | canClickFutureStep: _onFutureStepClicked !== null && _onFutureStepClicked !== undefined,
|
7006 | onFutureStepClicked: function onFutureStepClicked() {
|
7007 | return _onFutureStepClicked(index);
|
7008 | },
|
7009 | label: step.label,
|
7010 | showNav: showNav
|
7011 | })
|
7012 | );
|
7013 | });
|
7014 | };
|
7015 |
|
7016 | var getIndexOfActiveStep = function getIndexOfActiveStep(steps) {
|
7017 | return _findIndexInstanceProperty(steps).call(steps, function (step) {
|
7018 | return step.active;
|
7019 | });
|
7020 | };
|
7021 |
|
7022 | function ProgressTracker(_ref) {
|
7023 | var steps = _ref.steps,
|
7024 | onPastStepClicked = _ref.onPastStepClicked,
|
7025 | onFutureStepClicked = _ref.onFutureStepClicked,
|
7026 | showNav = _ref.showNav;
|
7027 | return (
|
7028 |
|
7029 | React.createElement(ProgressContainer, {
|
7030 | "data-testid": "progress-tracker",
|
7031 | activeStepIndex: getIndexOfActiveStep(steps),
|
7032 | numberOfSteps: steps.length
|
7033 | }, getMappedSteps(steps, onPastStepClicked, onFutureStepClicked, showNav))
|
7034 | );
|
7035 | }
|
7036 |
|
7037 | ProgressTracker.propTypes = process.env.NODE_ENV !== "production" ? {
|
7038 | steps: PropTypes.arrayOf(PropTypes.shape({
|
7039 | active: PropTypes.bool,
|
7040 | label: PropTypes.string
|
7041 | })),
|
7042 | onPastStepClicked: PropTypes.func,
|
7043 | onFutureStepClicked: PropTypes.func,
|
7044 | showNav: PropTypes.bool
|
7045 | } : {};
|
7046 | ProgressTracker.defaultProps = {
|
7047 | steps: [],
|
7048 | onPastStepClicked: function onPastStepClicked() {},
|
7049 | onFutureStepClicked: null,
|
7050 | showNav: true
|
7051 | };
|
7052 | var ProgressTracker$1 = withTheme(ProgressTracker);
|
7053 |
|
7054 |
|
7055 | formatMessage.setup({
|
7056 | missingTranslation: 'ignore'
|
7057 | });
|
7058 | var HelpContent = styled(Modal.Body)(["max-height:750px;overflow-y:scroll;ul{display:block;list-style-type:disc;margin-bottom:10px;margin-left:0;margin-right:0;padding-left:40px;ul{list-style-type:circle;}}"]);
|
7059 | var CautionRating = styled.div(["background-image:url(https://bdaim-webexcdn-p.azureedge.net/es-assets/images/poor-performer-mask.svg);background-size:100% 100%;height:30px;width:150px;"]);
|
7060 | var StarRating = styled.div(["background-image:url(https://bdaim-webexcdn-p.azureedge.net/es-assets/images/star-rating-mask.svg);background-color:#ffc436;height:28px;"]);
|
7061 | var RatingTable = styled(Table)(["border:1px solid black;text-align:left;margin:15px 0px;thead{font-weight:bold;}th,td{border:1px solid black;padding:8px;vertical-align:middle;}td{height:63px;}"]);
|
7062 | function StarRatingExplanation(props) {
|
7063 | return (
|
7064 |
|
7065 | React.createElement(Modal, {
|
7066 | show: props.show,
|
7067 | size: "large",
|
7068 | onHide: props.closeModal,
|
7069 | parentSelector: function parentSelector() {
|
7070 | return props.parentNode;
|
7071 | }
|
7072 | },
|
7073 |
|
7074 | React.createElement(Modal.Header, null, formatMessage('Plan Ratings')),
|
7075 |
|
7076 | React.createElement(HelpContent, null,
|
7077 |
|
7078 | React.createElement("p", null, formatMessage('The Overall Plan Rating combines scores, as rated by Medicare, for the types of services each plan offers.')),
|
7079 |
|
7080 | React.createElement(RatingTable, null,
|
7081 |
|
7082 | React.createElement("thead", null,
|
7083 |
|
7084 | React.createElement("tr", null,
|
7085 |
|
7086 | React.createElement("th", null, formatMessage('Legend')),
|
7087 |
|
7088 | React.createElement("th", null, formatMessage('Description')))),
|
7089 |
|
7090 | React.createElement("tbody", null,
|
7091 |
|
7092 | React.createElement("tr", null,
|
7093 |
|
7094 | React.createElement("td", null,
|
7095 |
|
7096 | React.createElement(CautionRating, null)),
|
7097 |
|
7098 | React.createElement("td", null, formatMessage('Caution - The plan has received low summary ratings from Medicare three years in a row.'))),
|
7099 |
|
7100 | React.createElement("tr", null,
|
7101 |
|
7102 | React.createElement("td", null,
|
7103 |
|
7104 | React.createElement(StarRating, null)),
|
7105 |
|
7106 | React.createElement("td", null, formatMessage("The plan has been given a 5 out 5 stars rating. People with Medicare can switch into these plans at any time during the year, even if it's not during an enrollment period."))))),
|
7107 |
|
7108 | React.createElement("strong", null, formatMessage('What is being measured?')),
|
7109 |
|
7110 | React.createElement("ul", null,
|
7111 |
|
7112 | React.createElement("li", null, formatMessage.rich('<s>For plans covering health services</s>, the overall score for quality of those services covers <s>36 different topics in 5 categories:</s>', {
|
7113 | s: function s(_ref) {
|
7114 | var children = _ref.children;
|
7115 | return (
|
7116 |
|
7117 | React.createElement("strong", {
|
7118 | key: "bold"
|
7119 | }, children)
|
7120 | );
|
7121 | }
|
7122 | }),
|
7123 |
|
7124 | React.createElement("ul", null,
|
7125 |
|
7126 | React.createElement("li", null, formatMessage.rich('<s>Staying healthy: screenings, tests, and vaccines:</s> Includes how often members got various screening tests, vaccines, and other check-ups that help them stay healthy.', {
|
7127 | s: function s(_ref2) {
|
7128 | var children = _ref2.children;
|
7129 | return (
|
7130 |
|
7131 | React.createElement("strong", {
|
7132 | key: "bold"
|
7133 | }, children)
|
7134 | );
|
7135 | }
|
7136 | })),
|
7137 |
|
7138 | React.createElement("li", null, formatMessage.rich('<s>Managing chronic (long-term) conditions:</s> Includes how often members with different conditions got certain tests and treatments that help them manage their condition.', {
|
7139 | s: function s(_ref3) {
|
7140 | var children = _ref3.children;
|
7141 | return (
|
7142 |
|
7143 | React.createElement("strong", {
|
7144 | key: "bold"
|
7145 | }, children)
|
7146 | );
|
7147 | }
|
7148 | })),
|
7149 |
|
7150 | React.createElement("li", null, formatMessage.rich('<s>Ratings of health plan responsiveness and care:</s> Includes ratings of member satisfaction with the plan.', {
|
7151 | s: function s(_ref4) {
|
7152 | var children = _ref4.children;
|
7153 | return (
|
7154 |
|
7155 | React.createElement("strong", {
|
7156 | key: "bold"
|
7157 | }, children)
|
7158 | );
|
7159 | }
|
7160 | })),
|
7161 |
|
7162 | React.createElement("li", null, formatMessage.rich('<s>Member complaints, problems getting services, and choosing to leave the plan:</s> Includes how often members filed complaints against the plan and how often members choose to leave the plan. Includes how often Medicare found problems with the plan.', {
|
7163 | s: function s(_ref5) {
|
7164 | var children = _ref5.children;
|
7165 | return (
|
7166 |
|
7167 | React.createElement("strong", {
|
7168 | key: "bold"
|
7169 | }, children)
|
7170 | );
|
7171 | }
|
7172 | })),
|
7173 |
|
7174 | React.createElement("li", null, formatMessage.rich('<s>Health plan customer service:</s> Includes how well the plan handles calls and makes decisions about member appeals for health coverage.', {
|
7175 | s: function s(_ref6) {
|
7176 | var children = _ref6.children;
|
7177 | return (
|
7178 |
|
7179 | React.createElement("strong", {
|
7180 | key: "bold"
|
7181 | }, children)
|
7182 | );
|
7183 | }
|
7184 | })))),
|
7185 |
|
7186 | React.createElement("li", null, formatMessage.rich('<s>For plans covering drug services,</s> the overall score for quality of those services covers <s>17 different topics in 4 categories:</s>', {
|
7187 | s: function s(_ref7) {
|
7188 | var children = _ref7.children;
|
7189 | return (
|
7190 |
|
7191 | React.createElement("strong", {
|
7192 | key: "bold"
|
7193 | }, children)
|
7194 | );
|
7195 | }
|
7196 | }),
|
7197 |
|
7198 | React.createElement("ul", null,
|
7199 |
|
7200 | React.createElement("li", null, formatMessage.rich('<s>Drug plan customer service:</s> Includes how well the plan handles calls and makes decisions about member appeals for drug coverage.', {
|
7201 | s: function s(_ref8) {
|
7202 | var children = _ref8.children;
|
7203 | return (
|
7204 |
|
7205 | React.createElement("strong", {
|
7206 | key: "bold"
|
7207 | }, children)
|
7208 | );
|
7209 | }
|
7210 | })),
|
7211 |
|
7212 | React.createElement("li", null, formatMessage.rich('<s>Member complaints, problems getting services, and choosing to leave the plan:</s> Includes how often members filed complaints about the plan and how often members choose to leave the plan. Includes how often Medicare found problems with the plan.', {
|
7213 | s: function s(_ref9) {
|
7214 | var children = _ref9.children;
|
7215 | return (
|
7216 |
|
7217 | React.createElement("strong", {
|
7218 | key: "bold"
|
7219 | }, children)
|
7220 | );
|
7221 | }
|
7222 | })),
|
7223 |
|
7224 | React.createElement("li", null, formatMessage.rich("<s>Member experience with plan's drug services:</s> Includes ratings of member satisfaction with the plan.", {
|
7225 | s: function s(_ref10) {
|
7226 | var children = _ref10.children;
|
7227 | return (
|
7228 |
|
7229 | React.createElement("strong", {
|
7230 | key: "bold"
|
7231 | }, children)
|
7232 | );
|
7233 | }
|
7234 | })),
|
7235 |
|
7236 | React.createElement("li", null, formatMessage.rich('<s>Drug pricing and patient safety:</s> Includes how well the plan prices prescriptions and provides updated and accurate pricing information for the Medicare website. Includes information on how often members with certain medical conditions get prescription drugs that are considered safer and clinically recommended for their condition. Includes information on whether members are taking certain medications as directed.', {
|
7237 | s: function s(_ref11) {
|
7238 | var children = _ref11.children;
|
7239 | return (
|
7240 |
|
7241 | React.createElement("strong", {
|
7242 | key: "bold"
|
7243 | }, children)
|
7244 | );
|
7245 | }
|
7246 | })))),
|
7247 |
|
7248 | React.createElement("li", null, formatMessage.rich('<s>For plans covering both health and drug services,</s> the overall score for quality of those services covers <s>all of the 53 topics listed above.</s>', {
|
7249 | s: function s(_ref12) {
|
7250 | var children = _ref12.children;
|
7251 | return (
|
7252 |
|
7253 | React.createElement("strong", {
|
7254 | key: "bold"
|
7255 | }, children)
|
7256 | );
|
7257 | }
|
7258 | }))),
|
7259 |
|
7260 | React.createElement("p", null,
|
7261 |
|
7262 | React.createElement("strong", null, formatMessage('Where does the information for the Overall Plan Rating come from?'))),
|
7263 |
|
7264 | React.createElement("ul", null,
|
7265 |
|
7266 | React.createElement("li", null, formatMessage.rich('For quality of <s>health services</s>, the information comes from sources that include:', {
|
7267 | s: function s(_ref13) {
|
7268 | var children = _ref13.children;
|
7269 | return (
|
7270 |
|
7271 | React.createElement("strong", {
|
7272 | key: "bold"
|
7273 | }, children)
|
7274 | );
|
7275 | }
|
7276 | }),
|
7277 |
|
7278 | React.createElement("ul", null,
|
7279 |
|
7280 | React.createElement("li", null, formatMessage('Member surveys done by Medicare')),
|
7281 |
|
7282 | React.createElement("li", null, formatMessage('Information from clinicians')),
|
7283 |
|
7284 | React.createElement("li", null, formatMessage('Information submitted by the plans')),
|
7285 |
|
7286 | React.createElement("li", null, formatMessage("Results from Medicare's regular monitoring activities")))),
|
7287 |
|
7288 | React.createElement("li", null, formatMessage.rich('For quality of <s>drug services</s>, the information comes from sources that include:', {
|
7289 | s: function s(_ref14) {
|
7290 | var children = _ref14.children;
|
7291 | return (
|
7292 |
|
7293 | React.createElement("strong", {
|
7294 | key: "bold"
|
7295 | }, children)
|
7296 | );
|
7297 | }
|
7298 | }),
|
7299 |
|
7300 | React.createElement("ul", null,
|
7301 |
|
7302 | React.createElement("li", null, formatMessage('Member surveys done by Medicare')),
|
7303 |
|
7304 | React.createElement("li", null, formatMessage('Reviews of billing and other information that plans submit to Medicare')),
|
7305 |
|
7306 | React.createElement("li", null, formatMessage("Results from Medicare's regular monitoring activities"))))),
|
7307 |
|
7308 | React.createElement("p", null,
|
7309 |
|
7310 | React.createElement("strong", null, formatMessage('Why is the Overall Plan Rating important?'))),
|
7311 |
|
7312 | React.createElement("p", null, formatMessage('The Overall Plan Rating gives you a single summary score that makes it easy for you to compare plans based on quality and performance. Learn more about differences among plans by looking at the detailed ratings.')),
|
7313 |
|
7314 | React.createElement("p", null, formatMessage('Medicare evaluates plans based on a 5-Star rating system. Star Ratings are calculated each year and may change from one year to the next.'))),
|
7315 |
|
7316 | React.createElement(Modal.Footer, null,
|
7317 |
|
7318 | React.createElement(ModalButtonContainer, null,
|
7319 |
|
7320 | React.createElement(Button, {
|
7321 | onClick: props.closeModal
|
7322 | }, formatMessage('Close')))))
|
7323 | );
|
7324 | }
|
7325 |
|
7326 | formatMessage.setup({
|
7327 | missingTranslation: 'ignore'
|
7328 | });
|
7329 | var StarContainer = styled.div(["background-color:", ";display:flex;flex-direction:column;height:21px;margin-top:3px;width:133px;"], function (props) {
|
7330 | return !props.isPoorPerformer ? props.theme.colors.gray5 : 'transparent';
|
7331 | });
|
7332 | var StarRatingLink = styled(LinkButton)(["color:", ";border-bottom:1px dashed;text-decoration:none;&:hover,&:focus{color:", ";border-bottom:1px solid;}"], function (props) {
|
7333 | return props.theme.colors.gray8;
|
7334 | }, function (props) {
|
7335 | return props.theme.colors.gray8;
|
7336 | });
|
7337 | var StarFill = styled.span(["background-color:#ffc436;display:block;height:21px;margin-left:2px;width:", ";"], function (props) {
|
7338 | return props.fillWidth;
|
7339 | });
|
7340 | var StarOverlay = styled.div(["background-image:url(https://bdaim-webexcdn-p.azureedge.net/es-assets/images/star-rating-mask.svg);height:25px;margin-top:-23px;"]);
|
7341 | var PoorPerformerOverlay = styled.div(["background-image:url(https://bdaim-webexcdn-p.azureedge.net/es-assets/images/poor-performer-mask.svg);background-size:100% 100%;height:30px;margin-top:-5px;"]);
|
7342 |
|
7343 | function getStarRatingBackgroundWidth(rating) {
|
7344 | var starWidth = 20.2;
|
7345 | var spaceWidth = 7;
|
7346 | var ratingFloor = Math.floor(rating);
|
7347 | var spaceNumber = ratingFloor === rating && rating !== 0 ? ratingFloor - 1 : ratingFloor;
|
7348 | var spacingAmount = spaceWidth * spaceNumber;
|
7349 | var width = starWidth * rating;
|
7350 | return "".concat(width + spacingAmount, "px");
|
7351 | }
|
7352 |
|
7353 | function getAriaText(isPoorPerformer, rating) {
|
7354 | if (isPoorPerformer) {
|
7355 | return formatMessage('CMS has indicated that this plan is a poor performer');
|
7356 | }
|
7357 |
|
7358 | if (rating !== null) {
|
7359 | return formatMessage("CMS has rated this plan {rating} out of five stars", {
|
7360 | rating: rating
|
7361 | });
|
7362 | }
|
7363 |
|
7364 | return '';
|
7365 | }
|
7366 |
|
7367 | function StarRating$1(_ref) {
|
7368 | var rating = _ref.rating,
|
7369 | isPoorPerformer = _ref.isPoorPerformer,
|
7370 | onExplanationOpen = _ref.onExplanationOpen;
|
7371 |
|
7372 | var _useState = useState(false),
|
7373 | _useState2 = _slicedToArray(_useState, 2),
|
7374 | showHelp = _useState2[0],
|
7375 | updateShowHelp = _useState2[1];
|
7376 |
|
7377 | var _useRootNode = useRootNode(document.body),
|
7378 | _useRootNode2 = _slicedToArray(_useRootNode, 2),
|
7379 | rootNode = _useRootNode2[0],
|
7380 | rootNodeRef = _useRootNode2[1];
|
7381 |
|
7382 | var ariaText = getAriaText(isPoorPerformer, rating);
|
7383 | return (
|
7384 |
|
7385 | React.createElement(React.Fragment, null,
|
7386 |
|
7387 | React.createElement(StarRatingLink, {
|
7388 | ref: rootNodeRef,
|
7389 | onClick: function onClick() {
|
7390 | if (onExplanationOpen) {
|
7391 | onExplanationOpen();
|
7392 | }
|
7393 |
|
7394 | updateShowHelp(true);
|
7395 | }
|
7396 | }, rating === null &&
|
7397 |
|
7398 | React.createElement("span", null, formatMessage('Star Rating not available')), rating !== null &&
|
7399 |
|
7400 | React.createElement(StarContainer, {
|
7401 | "aria-label": ariaText,
|
7402 | isPoorPerformer: isPoorPerformer
|
7403 | }, !isPoorPerformer ?
|
7404 |
|
7405 | React.createElement("div", null,
|
7406 |
|
7407 | React.createElement(StarFill, {
|
7408 | fillWidth: getStarRatingBackgroundWidth(rating)
|
7409 | }),
|
7410 |
|
7411 | React.createElement(StarOverlay, null)) :
|
7412 |
|
7413 | React.createElement("div", null,
|
7414 |
|
7415 | React.createElement(PoorPerformerOverlay, null)))),
|
7416 |
|
7417 | React.createElement(StarRatingExplanation, {
|
7418 | show: showHelp,
|
7419 | closeModal: function closeModal() {
|
7420 | return updateShowHelp(false);
|
7421 | },
|
7422 | parentNode: rootNode
|
7423 | }))
|
7424 | );
|
7425 | }
|
7426 |
|
7427 | StarRating$1.propTypes = process.env.NODE_ENV !== "production" ? {
|
7428 | rating: PropTypes.number.isRequired,
|
7429 | isPoorPerformer: PropTypes.bool,
|
7430 | onExplanationOpen: PropTypes.func
|
7431 | } : {};
|
7432 | StarRating$1.defaultProps = {
|
7433 | isPoorPerformer: false,
|
7434 | onExplanationOpen: function onExplanationOpen() {}
|
7435 | };
|
7436 |
|
7437 | var rotatorAnimation = keyframes(["0%{transform:rotate(0deg);}100%{transform:rotate(270deg);}"]);
|
7438 | var ieAnimation = keyframes(["0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}"]);
|
7439 | var dashAnimation = keyframes(["0%{stroke-dashoffset:187;}50%{stroke-dashoffset:37.4;transform:rotate(135deg);}100%{stroke-dashoffset:187;transform:rotate(450deg);}"]);
|
7440 |
|
7441 | var colorsAnimation = function colorsAnimation(props) {
|
7442 | return keyframes(["0%{stroke:", ";}40%{stroke:", ";}80%{stroke:", ";}100%{stroke:", ";}"], props.theme.brandColors.primary1, props.theme.brandColors.primary2, props.theme.brandColors.primary3, props.theme.brandColors.primary1);
|
7443 | };
|
7444 |
|
7445 | var SpinnerSvg = styled.svg(["animation:", " 1.4s linear infinite;@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){animation:", " 1.4s linear infinite;}"], rotatorAnimation, ieAnimation);
|
7446 | var SpinnerCircle = styled.circle(["stroke:", ";stroke-dasharray:187;stroke-dashoffset:37.4;transform-origin:center;animation:", " 1.4s ease-in-out infinite,", " 3.5s ease-in-out infinite;"], function (props) {
|
7447 | return props.theme.brandColors.secondary1;
|
7448 | }, dashAnimation, colorsAnimation);
|
7449 |
|
7450 | var Spinner = function Spinner(_ref) {
|
7451 | var _context, _context2;
|
7452 |
|
7453 | var title = _ref.title,
|
7454 | description = _ref.description,
|
7455 | other = _objectWithoutProperties(_ref, ["title", "description"]);
|
7456 |
|
7457 | var titleId = title && "".concat(useUniqueId(other.id), "-title");
|
7458 | var descId = description && "".concat(useUniqueId(other.id), "-desc");
|
7459 | return (
|
7460 |
|
7461 | React.createElement(SpinnerSvg, _extends({
|
7462 | viewBox: "0 0 66 66",
|
7463 | xmlns: "http://www.w3.org/2000/svg",
|
7464 | role: "img",
|
7465 | "aria-labelledby": _trimInstanceProperty(_context = _concatInstanceProperty(_context2 = "".concat(titleId, " ")).call(_context2, descId)).call(_context)
|
7466 | }, other), title &&
|
7467 |
|
7468 | React.createElement("title", {
|
7469 | id: titleId
|
7470 | }, title), description &&
|
7471 |
|
7472 | React.createElement("desc", {
|
7473 | id: descId
|
7474 | }, description),
|
7475 |
|
7476 | React.createElement(SpinnerCircle, {
|
7477 | fill: "none",
|
7478 | strokeWidth: "6",
|
7479 | strokeLinecap: "round",
|
7480 | cx: "33",
|
7481 | cy: "33",
|
7482 | r: "30"
|
7483 | }))
|
7484 | );
|
7485 | };
|
7486 |
|
7487 |
|
7488 | var descriptionTitleProp = process.env.NODE_ENV !== "production" ? function (props, propName, componentName) {
|
7489 | if (!props.title && !props.description) {
|
7490 | return new Error("You must provide a title, description, or both to ".concat(componentName, "."));
|
7491 | }
|
7492 | } : {};
|
7493 | Spinner.propTypes = process.env.NODE_ENV !== "production" ? {
|
7494 | |
7495 |
|
7496 | title: descriptionTitleProp,
|
7497 |
|
7498 | |
7499 |
|
7500 | description: descriptionTitleProp
|
7501 | } : {};
|
7502 | Spinner.defaultProps = {
|
7503 | title: '',
|
7504 | description: ''
|
7505 | };
|
7506 |
|
7507 | function _templateObject$3() {
|
7508 | var data = _taggedTemplateLiteral(["\n html, body, div, span, applet, object, iframe,\n a, big, cite, code, del, dfn, em, img, ins, kbd,\n q, s, samp, strike, tt, var,\n b, u, i, center, fieldset, form, label, legend\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed,\n figure, figcaption, footer, header, hgroup,\n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n border: 0;\n font-family: 'Source Sans Pro', 'Segoe UI', Segoe, Calibri, Tahoma, sans-serif;\n font-size: 100%;\n margin: 0;\n padding: 0;\n vertical-align: baseline;\n }\n\n ul, ol {\n margin: 0 1em 25px;\n padding-left: 1em;\n list-style-position: outside;\n }\n\n input, button {\n font: inherit;\n }\n\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n small {\n font-size: 85%;\n }\n\n strong, b {\n font-family: 'Source Sans Pro', 'Segoe UI', Segoe, Calibri, Tahoma, sans-serif;\n font-weight: bold;\n }\n\n h1, h2, h3, h4, h5, h6 {\n color: inherit;\n font: inherit;\n font-family: 'Source Sans Pro', 'Segoe UI', Segoe, Calibri, Tahoma, sans-serif;\n font-weight: 300;\n line-height: 1.1;\n margin-bottom: 0.45em;\n margin-top: 0;\n }\n\n h1 {\n font-size: 44.78976px;\n }\n h2 {\n font-size: 37.3248px;\n }\n h3 {\n font-size: 31.104px;\n }\n h4 {\n font-size: 25.92px;\n }\n h5 {\n font-size: 21.6px;\n }\n h6 {\n font-size: 18px;\n }\n"]);
|
7509 |
|
7510 | _templateObject$3 = function _templateObject() {
|
7511 | return data;
|
7512 | };
|
7513 |
|
7514 | return data;
|
7515 | }
|
7516 | var StyleReset = createGlobalStyle(_templateObject$3());
|
7517 |
|
7518 | function isValidEmail(emailAddress) {
|
7519 | var re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
7520 | return re.test(emailAddress);
|
7521 | }
|
7522 |
|
7523 | export { Action, ActionButton, AdditionalHelp, Anchor, AnswerButton, AnswerGroup, Button, CallToAction, Checkbox, CheckboxGroup, Control, DateInput, DatePicker, Drawer, Dropdown, DropdownButton, Fade, Fieldset, FullColorIcon, Heading, HorizontalNav, HorizontalScrollWrapper$1 as HorizontalScrollWrapper, Icon, IconButton, Incrementer, InlineMessage, Label, LightCallToAction, LightNotification, LinkButton, LoadingSkeleton, MaskedTextbox, Menu, Message, MessageNotification, Modal, ModalButtonContainer, Notification$1 as Notification, OutlineButton, PageHeading, Popover, PopoverLink, ProgressTracker$1 as ProgressTracker, Prompt, RadioButton, RadioGroup, ResponsiveTable, SideNav, SlidingPane, Spinner, StarRating$1 as StarRating, StarRatingExplanation, StripedContainer, StyleReset, Switch, TabPanel, Table, Textarea, Textbox, ToggleButton, Tooltip, generateAlphaName, isValidEmail, screenReaderOnly, useTheme, useWindowWidth, withWindowSize };
|