@burnsred/ui 0.6.2 → 0.6.4-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1888 +0,0 @@
1
- import styled, { css, keyframes, ThemeConsumer, withTheme } from 'styled-components';
2
- import React from 'react';
3
- import { withEnhanceProps, colorFromPalette, mixins, color, useEnhanceProps, useCleanProps, media, variant, image, component } from '@burnsred/theme';
4
- import { action } from '@storybook/addon-actions';
5
- import { text, boolean, select } from '@storybook/addon-knobs';
6
- import PropTypes from 'prop-types';
7
- import PropTypesImmutable from 'react-immutable-proptypes';
8
- import PropTypesPlus from '@burnsred/prop-types-plus';
9
- import 'core-js/modules/es6.object.assign';
10
- import classnames from 'classnames';
11
- import { useDefault } from '@burnsred/default';
12
- import 'core-js/modules/es6.function.name';
13
- import 'core-js/modules/es6.regexp.to-string';
14
- import 'core-js/modules/web.dom.iterable';
15
- import 'core-js/modules/es6.array.iterator';
16
- import 'core-js/modules/es6.object.keys';
17
- import _flowRight from 'lodash/flowRight';
18
- import { withProps } from '@burnsred/higher-order-component';
19
- import { Map, List } from 'immutable';
20
- import exact from 'prop-types-exact';
21
- import withOnClickOutside from 'react-onclickoutside';
22
- import ReactDOM from 'react-dom';
23
- import _isFunction from 'lodash/isFunction';
24
- import 'core-js/modules/es6.regexp.split';
25
-
26
- function _classCallCheck(instance, Constructor) {
27
- if (!(instance instanceof Constructor)) {
28
- throw new TypeError("Cannot call a class as a function");
29
- }
30
- }
31
-
32
- function _defineProperties(target, props) {
33
- for (var i = 0; i < props.length; i++) {
34
- var descriptor = props[i];
35
- descriptor.enumerable = descriptor.enumerable || false;
36
- descriptor.configurable = true;
37
- if ("value" in descriptor) descriptor.writable = true;
38
- Object.defineProperty(target, descriptor.key, descriptor);
39
- }
40
- }
41
-
42
- function _createClass(Constructor, protoProps, staticProps) {
43
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
44
- if (staticProps) _defineProperties(Constructor, staticProps);
45
- return Constructor;
46
- }
47
-
48
- function _defineProperty(obj, key, value) {
49
- if (key in obj) {
50
- Object.defineProperty(obj, key, {
51
- value: value,
52
- enumerable: true,
53
- configurable: true,
54
- writable: true
55
- });
56
- } else {
57
- obj[key] = value;
58
- }
59
-
60
- return obj;
61
- }
62
-
63
- function _extends() {
64
- _extends = Object.assign || function (target) {
65
- for (var i = 1; i < arguments.length; i++) {
66
- var source = arguments[i];
67
-
68
- for (var key in source) {
69
- if (Object.prototype.hasOwnProperty.call(source, key)) {
70
- target[key] = source[key];
71
- }
72
- }
73
- }
74
-
75
- return target;
76
- };
77
-
78
- return _extends.apply(this, arguments);
79
- }
80
-
81
- function _objectSpread(target) {
82
- for (var i = 1; i < arguments.length; i++) {
83
- var source = arguments[i] != null ? arguments[i] : {};
84
- var ownKeys = Object.keys(source);
85
-
86
- if (typeof Object.getOwnPropertySymbols === 'function') {
87
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
88
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
89
- }));
90
- }
91
-
92
- ownKeys.forEach(function (key) {
93
- _defineProperty(target, key, source[key]);
94
- });
95
- }
96
-
97
- return target;
98
- }
99
-
100
- function _inherits(subClass, superClass) {
101
- if (typeof superClass !== "function" && superClass !== null) {
102
- throw new TypeError("Super expression must either be null or a function");
103
- }
104
-
105
- subClass.prototype = Object.create(superClass && superClass.prototype, {
106
- constructor: {
107
- value: subClass,
108
- writable: true,
109
- configurable: true
110
- }
111
- });
112
- if (superClass) _setPrototypeOf(subClass, superClass);
113
- }
114
-
115
- function _getPrototypeOf(o) {
116
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
117
- return o.__proto__ || Object.getPrototypeOf(o);
118
- };
119
- return _getPrototypeOf(o);
120
- }
121
-
122
- function _setPrototypeOf(o, p) {
123
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
124
- o.__proto__ = p;
125
- return o;
126
- };
127
-
128
- return _setPrototypeOf(o, p);
129
- }
130
-
131
- function _assertThisInitialized(self) {
132
- if (self === void 0) {
133
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
134
- }
135
-
136
- return self;
137
- }
138
-
139
- function _possibleConstructorReturn(self, call) {
140
- if (call && (typeof call === "object" || typeof call === "function")) {
141
- return call;
142
- }
143
-
144
- return _assertThisInitialized(self);
145
- }
146
-
147
- function _taggedTemplateLiteral(strings, raw) {
148
- if (!raw) {
149
- raw = strings.slice(0);
150
- }
151
-
152
- return Object.freeze(Object.defineProperties(strings, {
153
- raw: {
154
- value: Object.freeze(raw)
155
- }
156
- }));
157
- }
158
-
159
- function _slicedToArray(arr, i) {
160
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
161
- }
162
-
163
- function _toConsumableArray(arr) {
164
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
165
- }
166
-
167
- function _arrayWithoutHoles(arr) {
168
- if (Array.isArray(arr)) {
169
- for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
170
-
171
- return arr2;
172
- }
173
- }
174
-
175
- function _arrayWithHoles(arr) {
176
- if (Array.isArray(arr)) return arr;
177
- }
178
-
179
- function _iterableToArray(iter) {
180
- if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
181
- }
182
-
183
- function _iterableToArrayLimit(arr, i) {
184
- var _arr = [];
185
- var _n = true;
186
- var _d = false;
187
- var _e = undefined;
188
-
189
- try {
190
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
191
- _arr.push(_s.value);
192
-
193
- if (i && _arr.length === i) break;
194
- }
195
- } catch (err) {
196
- _d = true;
197
- _e = err;
198
- } finally {
199
- try {
200
- if (!_n && _i["return"] != null) _i["return"]();
201
- } finally {
202
- if (_d) throw _e;
203
- }
204
- }
205
-
206
- return _arr;
207
- }
208
-
209
- function _nonIterableSpread() {
210
- throw new TypeError("Invalid attempt to spread non-iterable instance");
211
- }
212
-
213
- function _nonIterableRest() {
214
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
215
- }
216
-
217
- var UIIcon = withEnhanceProps(styled.i.attrs(function (props) {
218
- var _classnames;
219
-
220
- return {
221
- className: classnames((_classnames = {
222
- 'material-icons': props.material
223
- }, _defineProperty(_classnames, "fa fa-".concat(props.name), props.fontawesome), _defineProperty(_classnames, "icon icon-".concat(props.name), !props.fontawesome && !props.material), _defineProperty(_classnames, props.className, props.className), _classnames)),
224
- children: props.material ? props.name : props.children
225
- };
226
- }).withConfig({
227
- displayName: "Icon__UIIcon",
228
- componentId: "sc-10obg3m-0"
229
- })(["&&{font-size:", ";}", " ", " ", ""], function (props) {
230
- return props.fontSize || '1rem';
231
- }, function (props) {
232
- return props.$palette && css(["color:", ";"], colorFromPalette());
233
- }, mixins.space, function (props) {
234
- return props.css;
235
- }));
236
- UIIcon.propTypes = {
237
- fontawesome: PropTypes.bool,
238
- fontSize: PropTypes.string,
239
- hidden: PropTypes.bool,
240
- material: PropTypes.bool,
241
- margin: PropTypes.string,
242
- name: PropTypes.string.isRequired,
243
- namespace: PropTypes.string,
244
- padding: PropTypes.string,
245
- palette: PropTypes.string,
246
- paletteAsBackground: PropTypes.bool,
247
- paletteWeight: PropTypes.string,
248
- variant: PropTypes.string
249
- };
250
- UIIcon.defaultProps = {
251
- fontawesome: false,
252
- fontSize: undefined,
253
- hidden: undefined,
254
- material: false,
255
- margin: undefined,
256
- namespace: 'component_uiIcon',
257
- padding: undefined,
258
- palette: undefined,
259
- paletteAsBackground: false,
260
- paletteWeight: undefined,
261
- variant: 'standard'
262
- };
263
-
264
- var spinnerRotateLinear =
265
- /*#__PURE__*/
266
- keyframes(["0%{transform:rotate(0);}100%{transform:rotate(360deg);}"]);
267
-
268
- var spinnerStrokeRotate = function spinnerStrokeRotate(props) {
269
- return keyframes(["0%{stroke-dashoffset:", ";transform:rotate(0);}12.5%{stroke-dashoffset:", ";transform:rotate(0);}12.5001%{stroke-dashoffset:", ";transform:rotateX(180deg) rotate(72.5deg);}25%{stroke-dashoffset:", ";transform:rotateX(180deg) rotate(72.5deg);}25.0001%{stroke-dashoffset:", ";transform:rotate(270deg);}37.5%{stroke-dashoffset:", ";transform:rotate(270deg);}37.5001%{stroke-dashoffset:", ";transform:rotateX(180deg) rotate(161.5deg);}50%{stroke-dashoffset:", ";transform:rotateX(180deg) rotate(161.5deg);}50.0001%{stroke-dashoffset:", ";transform:rotate(180deg);}62.5%{stroke-dashoffset:", ";transform:rotate(180deg);}62.5001%{stroke-dashoffset:", ";transform:rotateX(180deg) rotate(251.5deg);}75%{stroke-dashoffset:", ";transform:rotateX(180deg) rotate(251.5deg);}75.0001%{stroke-dashoffset:", ";transform:rotate(90deg);}87.5%{stroke-dashoffset:", ";transform:rotate(90deg);}87.5001%{stroke-dashoffset:", ";transform:rotateX(180deg) rotate(341.5deg);}100%{stroke-dashoffset:", ";transform:rotateX(180deg) rotate(341.5deg);}"], "".concat((100 - props.thickness) * Math.PI * 0.95, "px"), "".concat((100 - props.thickness) * Math.PI * 0.2, "px"), "".concat((100 - props.thickness) * Math.PI * 0.2, "px"), "".concat((100 - props.thickness) * Math.PI * 0.95, "px"), "".concat((100 - props.thickness) * Math.PI * 0.95, "px"), "".concat((100 - props.thickness) * Math.PI * 0.2, "px"), "".concat((100 - props.thickness) * Math.PI * 0.2, "px"), "".concat((100 - props.thickness) * Math.PI * 0.95, "px"), "".concat((100 - props.thickness) * Math.PI * 0.95, "px"), "".concat((100 - props.thickness) * Math.PI * 0.2, "px"), "".concat((100 - props.thickness) * Math.PI * 0.2, "px"), "".concat((100 - props.thickness) * Math.PI * 0.95, "px"), "".concat((100 - props.thickness) * Math.PI * 0.95, "px"), "".concat((100 - props.thickness) * Math.PI * 0.2, "px"), "".concat((100 - props.thickness) * Math.PI * 0.2, "px"), "".concat((100 - props.thickness) * Math.PI * 0.95, "px"));
270
- };
271
-
272
- var Circle =
273
- /*#__PURE__*/
274
- styled.circle.withConfig({
275
- displayName: "ProgressCirclestyles__Circle",
276
- componentId: "hm517x-0"
277
- })(["animation-name:", ";fill:transparent;stroke:", ";stroke-dasharray:", ";stroke-width:", ";transition:stroke-dashoffset ", " linear;transform-box:view-box;transform-origin:center;", " ", ""], function (props) {
278
- return spinnerStrokeRotate(props);
279
- }, function (props) {
280
- return color({
281
- palette: props.palette || 'primary',
282
- paletteWeight: props.paletteWeight
283
- })(props);
284
- }, function (props) {
285
- return "".concat((100 - props.thickness) * Math.PI, "px");
286
- }, function (props) {
287
- return "".concat(props.thickness, "%");
288
- }, function (props) {
289
- return props.transitionDuration || '225ms';
290
- }, function (props) {
291
- return props.value === null && css(["animation-duration:4s;animation-iteration-count:infinite;animation-timing-function:cubic-bezier(0.35,0,0.25,1);transition-property:stroke;"]);
292
- }, function (props) {
293
- return props.value !== null && css(["stroke-dashoffset:", "px;"], (100 - props.thickness) * Math.PI * (100 - props.value) / 100);
294
- });
295
- var Container =
296
- /*#__PURE__*/
297
- styled.div.withConfig({
298
- displayName: "ProgressCirclestyles__Container",
299
- componentId: "hm517x-1"
300
- })(["display:inline-block;height:", ";position:relative;width:", ";", " ", ""], function (props) {
301
- return props.size;
302
- }, function (props) {
303
- return props.size;
304
- }, mixins.margin, mixins.padding);
305
- var SVG =
306
- /*#__PURE__*/
307
- styled.svg.withConfig({
308
- displayName: "ProgressCirclestyles__SVG",
309
- componentId: "hm517x-2"
310
- })(["height:100%;left:0;top:0;overflow:visible;position:absolute;transform:rotate(-90deg);transform-origin:center;width:100%;", ""], function (props) {
311
- return props.value === null && css(["animation:", " 2s linear infinite;"], spinnerRotateLinear);
312
- });
313
-
314
- function _templateObject() {
315
- var data = _taggedTemplateLiteral(["", ""]);
316
-
317
- _templateObject = function _templateObject() {
318
- return data;
319
- };
320
-
321
- return data;
322
- }
323
-
324
- function ProgressCircle(_props) {
325
- var props = useEnhanceProps(_props);
326
-
327
- var _React$useState = React.useState(props.valueInitial === undefined ? props.value : props.valueInitial),
328
- _React$useState2 = _slicedToArray(_React$useState, 2),
329
- value = _React$useState2[0],
330
- setValue = _React$useState2[1];
331
-
332
- React.useEffect(function () {
333
- setTimeout(function () {
334
- return setValue(props.value);
335
- }, 0);
336
- }, [props.value]);
337
- return React.createElement(_StyledContainer, _extends({}, useCleanProps(props), {
338
- _css: props.css
339
- }), React.createElement(SVG, {
340
- focusable: "false",
341
- preserveAspectRatio: "xMidYMid meet",
342
- value: value,
343
- viewBox: "0 0 100 100"
344
- }, props.bufferPalette && React.createElement(Circle, {
345
- cx: "50%",
346
- cy: "50%",
347
- palette: props.bufferPalette,
348
- paletteWeight: props.bufferPaletteWeight,
349
- r: (50 - props.thickness / 2).toString(),
350
- thickness: props.thickness,
351
- transitionDuration: props.transitionDuration,
352
- value: 100
353
- }), React.createElement(Circle, {
354
- cx: "50%",
355
- cy: "50%",
356
- palette: props.$palette // eslint-disable-line react/prop-types
357
- ,
358
- paletteWeight: props.$paletteWeight // eslint-disable-line react/prop-types
359
- ,
360
- r: (50 - props.thickness / 2).toString(),
361
- thickness: props.thickness,
362
- transitionDuration: props.transitionDuration,
363
- value: value
364
- })));
365
- }
366
-
367
- ProgressCircle.propTypes = {
368
- bufferPalette: PropTypesPlus.string,
369
- bufferPaletteWeight: PropTypes.string,
370
- css: PropTypesPlus.css,
371
- namespace: PropTypes.string,
372
- palette: PropTypesPlus.string,
373
- paletteWeight: PropTypes.string,
374
- size: PropTypes.string,
375
- transitionDuration: PropTypes.string,
376
- value: PropTypes.number,
377
- valueInitial: PropTypes.number,
378
- thickness: PropTypes.number
379
- };
380
- ProgressCircle.defaultProps = {
381
- bufferPalette: undefined,
382
- bufferPaletteWeight: undefined,
383
- css: undefined,
384
- namespace: 'component_uiProgressCircle',
385
- palette: undefined,
386
- paletteWeight: undefined,
387
- size: '32px',
388
- transitionDuration: undefined,
389
- value: null,
390
- valueInitial: undefined,
391
- thickness: 20
392
- };
393
-
394
- var _StyledContainer = styled(Container)(_templateObject(), function (p) {
395
- return p._css;
396
- });
397
-
398
- function _templateObject$1() {
399
- var data = _taggedTemplateLiteral(["\n color: ", ";\n "]);
400
-
401
- _templateObject$1 = function _templateObject() {
402
- return data;
403
- };
404
-
405
- return data;
406
- }
407
- var local = ['onChangeInput', 'value'];
408
-
409
- var StringComponent = function StringComponent(props) {
410
- return props.children;
411
- };
412
-
413
- var Component =
414
- /*#__PURE__*/
415
- styled.span.withConfig({
416
- displayName: "Typehooks__Component",
417
- componentId: "rbnsuu-0"
418
- })(["", " ", " ", " ", ""], function (props) {
419
- return props.$palette && css(["color:", ";"], colorFromPalette());
420
- }, mixins.space, media.print(_templateObject$1(), color({
421
- palette: 'black'
422
- })), function (props) {
423
- return props.css;
424
- });
425
- var hooks = {
426
- useComponent: function useComponent(props) {
427
- return props.as === null ? StringComponent : Component;
428
- },
429
- useProps: function useProps(props) {
430
- return useCleanProps(props, {
431
- local: local
432
- });
433
- }
434
- };
435
-
436
- function render(props, intl) {
437
- var _ref;
438
-
439
- var value = props.children || props.value;
440
-
441
- if (props.hidden) {
442
- return null;
443
- }
444
-
445
- if (value instanceof Error) {
446
- return value.message;
447
- }
448
-
449
- if (props.field) {
450
- return props.field.toString(value);
451
- }
452
-
453
- if (intl && ((_ref = value) != null ? _ref.id : _ref)) {
454
- return intl.formatMessage(value, props.values);
455
- }
456
-
457
- return value;
458
- }
459
-
460
- var DummyContext = React.createContext({});
461
- var mapDefault = {
462
- intlContext: ['uiType_context_intl', 'context_intl']
463
- };
464
-
465
- function UIType(_props) {
466
- var props = useEnhanceProps(_props);
467
- var Component = hooks.useComponent(props);
468
-
469
- var _useDefault = useDefault(mapDefault, props),
470
- _useDefault$intlConte = _useDefault.intlContext,
471
- intlContext = _useDefault$intlConte === void 0 ? DummyContext : _useDefault$intlConte;
472
-
473
- var intl = React.useContext(intlContext);
474
- return React.createElement(Component, hooks.useProps(props), (props.render || render)(props, intl));
475
- }
476
-
477
- UIType.propTypes = {
478
- as: PropTypesPlus.component,
479
- children: PropTypes.oneOfType([PropTypes.node, PropTypesPlus.typography]),
480
- className: PropTypesPlus.string,
481
- field: PropTypes.shape({
482
- toString: PropTypes.func.isRequired
483
- }),
484
- hidden: PropTypes.bool,
485
- intlContext: PropTypes.shape({}),
486
- mediaPrintDisabled: PropTypes.bool,
487
- namespace: PropTypesPlus.string,
488
- palette: PropTypes.string,
489
- paletteAsBackground: PropTypes.bool,
490
- paletteWeight: PropTypes.string,
491
- render: PropTypes.func,
492
- value: PropTypes.oneOfType([PropTypesPlus.typography, PropTypesPlus.value]),
493
- variant: PropTypes.string
494
- };
495
- UIType.defaultProps = {
496
- as: undefined,
497
- children: undefined,
498
- className: '',
499
- field: undefined,
500
- hidden: undefined,
501
- intlContext: undefined,
502
- mediaPrintDisabled: undefined,
503
- namespace: 'component_uiType',
504
- palette: undefined,
505
- paletteAsBackground: undefined,
506
- paletteWeight: undefined,
507
- render: undefined,
508
- value: undefined,
509
- variant: undefined
510
- };
511
- var UIType$1 = React.memo(UIType);
512
-
513
- var local$1 = ['contentPaletteAsBackground', 'iconCss', 'iconFont', 'iconHidden', 'iconName', 'iconPaletteAsBackground', 'processingPaletteAsBackground'];
514
- var mapDefault$1 = {
515
- contentComponent: ['uiButton_component_type', 'component_type'],
516
- iconComponent: ['uiButton_component_icon', 'component_icon'],
517
- linkComponent: ['uiButton_component_link', 'component_link'],
518
- processingComponent: ['uiButton_component_processing', 'component_processing']
519
- };
520
- var hooks$1 = {
521
- useComponents: function useComponents(props) {
522
- var defaults = useDefault(mapDefault$1, props);
523
- return {
524
- Content: defaults.contentComponent || UIType$1,
525
- Icon: defaults.iconComponent || UIIcon,
526
- Processing: defaults.processingComponent || ProgressCircle
527
- };
528
- },
529
- useProps: function useProps(props) {
530
- var _useDefault = useDefault(mapDefault$1, props),
531
- linkComponent = _useDefault.linkComponent;
532
-
533
- return useCleanProps(Object.assign({
534
- href: props.to
535
- }, props, props.to && {
536
- as: props.as || !/^https?:\/\//.exec(props.to) && linkComponent || 'a'
537
- }, {
538
- disabled: props.processing || props.disabled
539
- }), {
540
- local: local$1
541
- });
542
- },
543
- usePropsIcon: function usePropsIcon(props) {
544
- var _ref2;
545
-
546
- return Object.assign({
547
- css: props.iconCss,
548
- fontSize: props.iconFontSize,
549
- hidden: props.processing || props.iconHidden === undefined || props.iconHidden,
550
- name: props.iconName || 'name',
551
- palette: props.$palette,
552
- paletteAsBackground: props.iconPaletteAsBackground,
553
- paletteWeight: props.$paletteWeight,
554
- variant: 'button'
555
- }, props.iconFont && _defineProperty({}, props.iconFont, true), props.iconComponentProps, {
556
- className: classnames('uiButton-Icon', (_ref2 = props) != null ? (_ref2 = _ref2.iconComponentProps) != null ? _ref2.className : _ref2 : _ref2)
557
- });
558
- },
559
- usePropsContent: function usePropsContent(props) {
560
- var _ref;
561
-
562
- return _objectSpread({
563
- children: props.children,
564
- hidden: props.contentHidden || props.processing,
565
- palette: props.$palette,
566
- paletteAsBackground: props.contentPaletteAsBackground,
567
- paletteWeight: props.$paletteWeight,
568
- value: props.content,
569
- variant: 'button'
570
- }, props.contentComponentProps, {
571
- className: classnames('uiButton-Content', (_ref = props) != null ? (_ref = _ref.contentComponentProps) != null ? _ref.className : _ref : _ref)
572
- });
573
- },
574
- usePropsProcessing: function usePropsProcessing(props) {
575
- return _objectSpread({
576
- hidden: !props.processing,
577
- palette: props.$palette,
578
- paletteAsBackground: props.processingPaletteAsBackground,
579
- paletteWeight: props.$paletteWeight,
580
- variant: 'button'
581
- }, props.processingComponentProps);
582
- }
583
- };
584
-
585
- function _templateObject$2() {
586
- var data = _taggedTemplateLiteral(["\n display: none;\n "]);
587
-
588
- _templateObject$2 = function _templateObject() {
589
- return data;
590
- };
591
-
592
- return data;
593
- }
594
- var Button = styled.button.withConfig({
595
- displayName: "Buttonstyles",
596
- componentId: "ym92z0-0"
597
- })(["align-items:center;background-color:", ";border:0;border-radius:0.25em;cursor:pointer;display:inline-flex;justify-content:center;outline:none;padding:0.5em 1.5em;position:relative;text-decoration:none;", " &:hover{background-color:", ";}&:focus{background-color:", ";}&:disabled{background-color:", ";cursor:auto;*{color:", ";}}", " ", " ", ""], function (props) {
598
- return props.$paletteAsBackground ? colorFromPalette()(props) : 'transparent';
599
- }, mixins.space, color({
600
- palette: 'gray',
601
- paletteWeight: '50'
602
- }), color({
603
- palette: 'gray',
604
- paletteWeight: '100'
605
- }), color({
606
- palette: 'gray',
607
- paletteWeight: '200'
608
- }), color({
609
- palette: 'gray',
610
- paletteWeight: '800'
611
- }), function (props) {
612
- return props.$media && css(["@media only screen and (", "){padding:0.5em 1em;.uiButton-Content{display:none;}.uiButton-Icon{display:inline-block;}}"], props.$media);
613
- }, media.print(_templateObject$2()), function (props) {
614
- return props.css;
615
- });
616
-
617
- function UIButton(_props) {
618
- var props = useEnhanceProps(_props);
619
-
620
- var _hooks$useComponents = hooks$1.useComponents(props),
621
- Content = _hooks$useComponents.Content,
622
- Icon = _hooks$useComponents.Icon,
623
- Processing = _hooks$useComponents.Processing;
624
-
625
- var processingProps = hooks$1.usePropsProcessing(props);
626
- return React.createElement(Button, hooks$1.useProps(props), React.createElement(Icon, hooks$1.usePropsIcon(props)), !processingProps.hidden && React.createElement(Processing, processingProps), React.createElement(Content, hooks$1.usePropsContent(props)));
627
- }
628
-
629
- UIButton.propTypes = {
630
- as: PropTypesPlus.component,
631
- children: PropTypes.node,
632
- content: PropTypes.oneOfType([PropTypes.string, PropTypesPlus.locale, PropTypesImmutable.map]),
633
- contentComponent: PropTypesPlus.component,
634
- contentComponentProps: PropTypes.shape({}),
635
- contentHidden: PropTypes.bool,
636
- contentPaletteAsBackground: PropTypes.bool,
637
- css: PropTypesPlus.css,
638
- disabled: PropTypes.bool,
639
- hidden: PropTypes.bool,
640
- iconComponent: PropTypesPlus.component,
641
- iconComponentProps: PropTypes.shape({}),
642
- iconCss: PropTypesPlus.css,
643
- iconFont: PropTypesPlus.string,
644
- iconHidden: PropTypes.bool,
645
- iconName: PropTypesPlus.string,
646
- iconPaletteAsBackground: PropTypes.bool,
647
- media: PropTypesPlus.string,
648
- mediaPrintDisabled: PropTypes.bool,
649
- namespace: PropTypesPlus.string,
650
- onClick: PropTypes.func,
651
- palette: PropTypesPlus.string,
652
- paletteAsBackground: PropTypes.bool,
653
- paletteWeight: PropTypes.string,
654
- processing: PropTypes.bool,
655
- processingComponent: PropTypesPlus.component,
656
- processingComponentProps: PropTypes.shape({}),
657
- processingDidFail: PropTypes.bool,
658
- processingPaletteAsBackground: PropTypes.bool,
659
- to: PropTypesPlus.string,
660
- variant: PropTypesPlus.string
661
- };
662
- UIButton.defaultProps = {
663
- as: undefined,
664
- children: undefined,
665
- content: undefined,
666
- contentComponent: undefined,
667
- contentComponentProps: undefined,
668
- contentHidden: undefined,
669
- contentPaletteAsBackground: undefined,
670
- css: undefined,
671
- disabled: undefined,
672
- hidden: undefined,
673
- iconComponent: undefined,
674
- iconComponentProps: undefined,
675
- iconCss: undefined,
676
- iconFont: undefined,
677
- iconHidden: undefined,
678
- iconName: undefined,
679
- iconPaletteAsBackground: undefined,
680
- media: undefined,
681
- mediaPrintDisabled: undefined,
682
- namespace: 'component_uiButton',
683
- onClick: undefined,
684
- palette: undefined,
685
- paletteAsBackground: undefined,
686
- paletteWeight: undefined,
687
- processing: undefined,
688
- processingComponent: undefined,
689
- processingComponentProps: undefined,
690
- processingDidFail: undefined,
691
- processingPaletteAsBackground: undefined,
692
- to: undefined,
693
- variant: 'standard'
694
- };
695
- var UIButton$1 = React.memo(UIButton);
696
-
697
- var Wrapper =
698
- /*#__PURE__*/
699
- styled.div.withConfig({
700
- displayName: "Buttonstories__Wrapper",
701
- componentId: "sc-17igda1-0"
702
- })(["text-align:center;margin:1rem;"]);
703
- var createStoryForUIButton = (function (stories) {
704
- return stories.add('dynamic story', function () {
705
- return React.createElement(ThemeConsumer, null, function (theme) {
706
- return React.createElement(UIButton$1, {
707
- content: text('children', 'Hello Button'),
708
- disabled: boolean('disabled', false),
709
- iconFont: "material",
710
- iconName: "delete",
711
- onClick: action('clicked'),
712
- palette: "primary",
713
- processing: boolean('processing', false),
714
- variant: select('variant', variant({
715
- name: 'component_uiButton_'
716
- })({
717
- theme: theme
718
- }), 'text')
719
- });
720
- });
721
- }).add('variants', function () {
722
- return React.createElement(ThemeConsumer, null, function (theme) {
723
- return variant({
724
- name: 'component_uiButton_'
725
- })({
726
- theme: theme
727
- }).map(function (name) {
728
- return React.createElement(Wrapper, {
729
- key: name
730
- }, React.createElement(UIButton$1, {
731
- content: name,
732
- iconFont: "material",
733
- iconName: "delete",
734
- palette: "primary",
735
- variant: name
736
- }));
737
- });
738
- });
739
- });
740
- });
741
-
742
- function _templateObject$3() {
743
- var data = _taggedTemplateLiteral(["", ""]);
744
-
745
- _templateObject$3 = function _templateObject() {
746
- return data;
747
- };
748
-
749
- return data;
750
- }
751
- var iconCss =
752
- /*#__PURE__*/
753
- css(["margin-right:0.5rem;max-width:2rem;vertical-align:middle;"]);
754
- var Wrapper$1 =
755
- /*#__PURE__*/
756
- styled.div.withConfig({
757
- displayName: "Iconstories__Wrapper",
758
- componentId: "sc-1p3nfhe-0"
759
- })(["display:inline-block;margin:1rem;position:relative;&:after{content:'", "';font-size:0.75rem;left:50%;position:absolute;top:calc(100% + 1rem);transform:translateX(-50%);white-space:pre;}"], function (props) {
760
- return props.label;
761
- });
762
- var createStoryForUIIcon = (function (stories) {
763
- return stories.add('dynamic story', function () {
764
- return React.createElement(ThemeConsumer, null, function (theme) {
765
- return React.createElement(_StyledUIIcon, {
766
- fontawesome: boolean('fontawesome', false),
767
- material: boolean('material', false),
768
- name: select('name', ['apple', 'delete', 'plus'], 'apple'),
769
- variant: select('variant', variant({
770
- name: 'component_uiIcon_'
771
- })({
772
- theme: theme
773
- }), 'main')
774
- });
775
- });
776
- }).add('variants', function () {
777
- return React.createElement(ThemeConsumer, null, function (theme) {
778
- return variant({
779
- name: 'component_uiIcon_'
780
- })({
781
- theme: theme
782
- }).map(function (name) {
783
- return React.createElement(Wrapper$1, {
784
- key: name
785
- }, React.createElement(UIIcon, {
786
- name: "apple",
787
- variant: name
788
- }), name);
789
- });
790
- });
791
- });
792
- });
793
-
794
- var _StyledUIIcon = styled(UIIcon)(_templateObject$3(), iconCss);
795
-
796
- var UIImage =
797
- /*#__PURE__*/
798
- styled.img.withConfig({
799
- displayName: "Image__UIImage",
800
- componentId: "sc-1fmo7bh-0"
801
- })(["", " ", ""], component(), function (props) {
802
- return props.css;
803
- });
804
- UIImage.propTypes = {
805
- alt: PropTypes.string.isRequired,
806
- namespace: PropTypesPlus.string,
807
- src: PropTypes.string.isRequired,
808
- variant: PropTypes.string
809
- };
810
- UIImage.defaultProps = {
811
- namespace: 'component_uiImage',
812
- variant: 'standard'
813
- };
814
- var UIImage$1 = _flowRight([withTheme, withProps(function (props) {
815
- return {
816
- alt: props.name,
817
- src: image(props)
818
- };
819
- })])(UIImage);
820
-
821
- function _templateObject2() {
822
- var data = _taggedTemplateLiteral(["", ""]);
823
-
824
- _templateObject2 = function _templateObject2() {
825
- return data;
826
- };
827
-
828
- return data;
829
- }
830
-
831
- function _templateObject$4() {
832
- var data = _taggedTemplateLiteral(["", ""]);
833
-
834
- _templateObject$4 = function _templateObject() {
835
- return data;
836
- };
837
-
838
- return data;
839
- }
840
- var imageCss =
841
- /*#__PURE__*/
842
- css(["margin-right:0.5rem;max-width:2rem;vertical-align:middle;"]);
843
- var Wrapper$2 =
844
- /*#__PURE__*/
845
- styled.div.withConfig({
846
- displayName: "Imagestories__Wrapper",
847
- componentId: "a2mbve-0"
848
- })(["display:inline-block;margin:1rem;position:relative;&:after{content:'", "';font-size:0.75rem;left:50%;position:absolute;top:calc(100% + 1rem);transform:translateX(-50%);white-space:pre;}"], function (props) {
849
- return props.label;
850
- });
851
- var createStoryForUIImage = (function (stories) {
852
- return stories.add('dynamic story', function () {
853
- return React.createElement(ThemeConsumer, null, function (theme) {
854
- return React.createElement(_StyledUIImage, {
855
- name: select('name', Object.keys(theme.images || {}), Object.keys(theme.images || {})[0]),
856
- variant: select('variant', variant({
857
- name: 'component_uiImage_'
858
- })({
859
- theme: theme
860
- }), 'main')
861
- });
862
- });
863
- }).add('names', function () {
864
- return React.createElement(ThemeConsumer, null, function (theme) {
865
- return variant({
866
- name: 'images_'
867
- })({
868
- theme: theme
869
- }).map(function (name) {
870
- return React.createElement(Wrapper$2, {
871
- key: name,
872
- label: name
873
- }, React.createElement(_StyledUIImage2, {
874
- name: name
875
- }));
876
- });
877
- });
878
- }).add('variants', function () {
879
- return React.createElement(ThemeConsumer, null, function (theme) {
880
- return variant({
881
- name: 'component_uiImage_'
882
- })({
883
- theme: theme
884
- }).map(function (name) {
885
- return React.createElement(Wrapper$2, {
886
- key: name
887
- }, React.createElement(UIImage$1, {
888
- name: variant({
889
- name: 'images_'
890
- })({
891
- theme: theme
892
- })[0],
893
- variant: name
894
- }), name);
895
- });
896
- });
897
- });
898
- });
899
-
900
- var _StyledUIImage = styled(UIImage$1)(_templateObject$4(), imageCss);
901
-
902
- var _StyledUIImage2 = styled(UIImage$1)(_templateObject2(), imageCss);
903
-
904
- var createStoryForUIProcessingCircle = (function (stories) {
905
- return stories.add('dynamic story', function () {
906
- return React.createElement(ProgressCircle, {
907
- palette: select('palette', ['primary', 'secondary', 'black']),
908
- size: select('size', ['16px', '32px', '48px'], '32px'),
909
- thickness: select('thickness', [10, 20, 40], 20),
910
- value: select('value', [null, 0, 33, 50, 100], null)
911
- });
912
- });
913
- });
914
-
915
- var primaryScale =
916
- /*#__PURE__*/
917
- keyframes(["0%{transform:scaleX(0.08);}36.65%{animation-timing-function:cubic-bezier(0.334731,0.12482,0.785844,1);transform:scaleX(0.08);}65.15%{animation-timing-function:cubmic-bezier(0.06,0.11,0.6,1);transform:scaleX(0.661479);}100%{transform:scaleX(0.08);}"]);
918
- var primaryTranslate =
919
- /*#__PURE__*/
920
- keyframes(["0%{transform:translateX(0);}20%{animation-timing-function:cubic-bezier(0.5,0,0.701732,0.495819);transform:translateX(0);}59.15%{animation-timing-function:cubic-bezier(0.302435,0.381352,0.55,0.956352);transform:translateX(83.67142%);}100%{transform:translateX(200.611057%);}"]);
921
- var secondaryScale =
922
- /*#__PURE__*/
923
- keyframes(["0%{animation-timing-function:cubic-bezier(0.205028,0.057051,0.57661,0.45397);transform:scaleX(0.08);}19.15%{animation-timing-function:cubic-bezier(0.152313,0.196432,0.648374,1.004315);transform:scaleX(0.457104);}44.15%{animation-timing-function:cubic-bezier(0.257759,-0.003163,0.211762,1.38179);transform:scaleX(0.72796);}100%{transform:scaleX(0.08);}"]);
924
- var secondaryTranslate =
925
- /*#__PURE__*/
926
- keyframes(["0%{animation-timing-function:cubic-bezier(0.15,0,0.515058,0.409685);transform:translateX(0);}25%{animation-timing-function:cubic-bezier(0.31033,0.284058,0.8,0.733712);transform:translateX(37.651913%);}48.35%{animation-timing-function:cubic-bezier(0.4,0.627035,0.6,0.902026);transform:translateX(84.386165%);}100%{transform:translateX(160.277782%);}"]);
927
- var Block =
928
- /*#__PURE__*/
929
- styled.div.withConfig({
930
- displayName: "ProgressLinestyles__Block",
931
- componentId: "gwo5u1-0"
932
- })(["display:flex;align-items:center;height:", ";min-width:2rem;overflow:hidden;position:relative;transition:opacity 0.25s cubic-bezier(0.4,0,0.6,1) 0ms;transform:translateZ(0);", ""], function (props) {
933
- return props.height;
934
- }, mixins.margin);
935
- var BarWrapper =
936
- /*#__PURE__*/
937
- styled.div.withConfig({
938
- displayName: "ProgressLinestyles__BarWrapper",
939
- componentId: "gwo5u1-1"
940
- })(["height:", ";position:relative;flex:1;"], function (props) {
941
- return props.thickness;
942
- });
943
- var Buffer =
944
- /*#__PURE__*/
945
- styled.div.withConfig({
946
- displayName: "ProgressLinestyles__Buffer",
947
- componentId: "gwo5u1-2"
948
- })(["background-color:", ";height:100%;position:absolute;transition:transform ", ";transform-origin:left top;width:100%;", ""], function (props) {
949
- return color({
950
- palette: props.palette || 'gray',
951
- paletteWeight: props.paletteWeight
952
- })(props);
953
- }, function (props) {
954
- return props.transitionDuration || '225ms';
955
- }, function (props) {
956
- return props.value !== null && css(["transform:translateX(", "%);"], props.value - 100);
957
- });
958
- var BarPrimary =
959
- /*#__PURE__*/
960
- styled.div.withConfig({
961
- displayName: "ProgressLinestyles__BarPrimary",
962
- componentId: "gwo5u1-3"
963
- })(["height:100%;position:absolute;transform-origin:left top;width:100%;", ""], function (props) {
964
- return props.value === null && css(["transform:scaleX(0);animation:", " 2s infinite linear;left:-145.166611%;transition:none;"], primaryTranslate);
965
- });
966
- var BarPrimaryInner =
967
- /*#__PURE__*/
968
- styled.span.withConfig({
969
- displayName: "ProgressLinestyles__BarPrimaryInner",
970
- componentId: "gwo5u1-4"
971
- })(["background-color:", ";display:inline-block;height:100%;position:absolute;width:100%;", " ", ""], function (props) {
972
- return color({
973
- palette: props.palette || 'primary',
974
- paletteWeight: props.paletteWeight
975
- })(props);
976
- }, function (props) {
977
- return props.value === null && css(["animation:", " 2s infinite linear;"], primaryScale);
978
- }, function (props) {
979
- return props.value !== null && css(["transform:translateX(", "%);transition:transform ", " cubic-bezier(0.4,0,0.6,1) 0ms;"], props.value - 100, props.transitionDuration || '225ms');
980
- });
981
- var BarSecondary =
982
- /*#__PURE__*/
983
- styled.div.withConfig({
984
- displayName: "ProgressLinestyles__BarSecondary",
985
- componentId: "gwo5u1-5"
986
- })(["animation:", " 2s infinite linear;height:100%;left:-54.888891%;position:absolute;transition:none;transform-origin:left top;visibility:visible;width:100%;"], secondaryTranslate);
987
- var BarSecondaryInner =
988
- /*#__PURE__*/
989
- styled.span.withConfig({
990
- displayName: "ProgressLinestyles__BarSecondaryInner",
991
- componentId: "gwo5u1-6"
992
- })(["animation:", " 2s infinite linear;background-color:", ";display:inline-block;height:100%;position:absolute;visibility:visible;width:100%;"], secondaryScale, function (props) {
993
- return color({
994
- palette: props.palette || 'primary',
995
- paletteWeight: props.paletteWeight
996
- })(props);
997
- });
998
-
999
- function UIProgressLine(props) {
1000
- var _React$useState = React.useState(props.valueInitial === undefined ? props.value : props.valueInitial),
1001
- _React$useState2 = _slicedToArray(_React$useState, 2),
1002
- value = _React$useState2[0],
1003
- setValue = _React$useState2[1];
1004
-
1005
- var _React$useState3 = React.useState(props.bufferValueInitial === undefined ? props.bufferValue : props.bufferValueInitial),
1006
- _React$useState4 = _slicedToArray(_React$useState3, 2),
1007
- bufferValue = _React$useState4[0],
1008
- setBufferValue = _React$useState4[1];
1009
-
1010
- React.useEffect(function () {
1011
- setTimeout(function () {
1012
- setValue(props.value);
1013
- setBufferValue(props.bufferValue);
1014
- }, 0);
1015
- }, [props.value, props.bufferValue]);
1016
- return React.createElement(Block, {
1017
- className: props.className,
1018
- height: props.height,
1019
- $margin: props.margin,
1020
- $marginBottom: props.marginBottom,
1021
- $marginLeft: props.marginLeft,
1022
- $marginRight: props.marginRight,
1023
- $marginTop: props.marginTop
1024
- }, React.createElement(Buffer, {
1025
- palette: props.bufferPalette,
1026
- paletteWeight: props.bufferPaletteWeight,
1027
- transitionDuration: props.transitionDuration,
1028
- value: bufferValue
1029
- }), React.createElement(BarWrapper, {
1030
- thickness: props.thickness || props.height
1031
- }, React.createElement(BarPrimary, {
1032
- value: props.value,
1033
- transitionDuration: props.transitionDuration
1034
- }, React.createElement(BarPrimaryInner, {
1035
- palette: props.palette,
1036
- paletteWeight: props.paletteWeight,
1037
- transitionDuration: props.transitionDuration,
1038
- value: value
1039
- })), value === null && React.createElement(BarSecondary, null, React.createElement(BarSecondaryInner, {
1040
- palette: props.palette,
1041
- paletteWeight: props.paletteWeight
1042
- }))));
1043
- }
1044
-
1045
- UIProgressLine.propTypes = {
1046
- bufferPalette: PropTypes.string,
1047
- bufferPaletteWeight: PropTypes.string,
1048
- bufferValue: PropTypes.number,
1049
- bufferValueInitial: PropTypes.number,
1050
- height: PropTypes.string,
1051
- margin: PropTypes.string,
1052
- marginBottom: PropTypes.string,
1053
- marginLeft: PropTypes.string,
1054
- marginRight: PropTypes.string,
1055
- marginTop: PropTypes.string,
1056
- palette: PropTypes.string,
1057
- paletteWeight: PropTypes.string,
1058
- thickness: PropTypes.string,
1059
- transitionDuration: PropTypes.string,
1060
- value: PropTypes.number,
1061
- valueInitial: PropTypes.number
1062
- };
1063
- UIProgressLine.defaultProps = {
1064
- bufferPalette: undefined,
1065
- bufferPaletteWeight: undefined,
1066
- bufferValue: 100,
1067
- bufferValueInitial: undefined,
1068
- height: '4px',
1069
- margin: undefined,
1070
- marginBottom: undefined,
1071
- marginLeft: undefined,
1072
- marginRight: undefined,
1073
- marginTop: undefined,
1074
- palette: undefined,
1075
- paletteWeight: undefined,
1076
- thickness: undefined,
1077
- transitionDuration: undefined,
1078
- value: null,
1079
- valueInitial: undefined
1080
- };
1081
-
1082
- var Block$1 =
1083
- /*#__PURE__*/
1084
- styled.div.withConfig({
1085
- displayName: "ProgressLinestories__Block",
1086
- componentId: "rcgabs-0"
1087
- })(["width:300px;"]);
1088
- var createStoryForUIProcessingLine = (function (stories) {
1089
- return stories.add('dynamic story', function () {
1090
- return React.createElement(Block$1, null, React.createElement(UIProgressLine, {
1091
- bufferPalette: select('bufferPalette', ['primary', 'secondary', 'gray']),
1092
- height: select('height', ['1px', '2px', '4px', '8px', '16px'], '4px'),
1093
- palette: select('palette', ['primary', 'secondary', 'gray']),
1094
- value: select('value', [null, 0, 33, 50, 100], null)
1095
- }));
1096
- });
1097
- });
1098
-
1099
- var Wrapper$3 =
1100
- /*#__PURE__*/
1101
- styled.div.withConfig({
1102
- displayName: "Typestories__Wrapper",
1103
- componentId: "nme558-0"
1104
- })(["text-align:center;margin:1rem;"]);
1105
- var createStoryForUIType = (function (stories) {
1106
- return stories.add('dynamic story', function () {
1107
- return React.createElement(ThemeConsumer, null, function (theme) {
1108
- return React.createElement(UIType$1, {
1109
- variant: select('variant', variant({
1110
- name: 'component_uiType_'
1111
- })({
1112
- theme: theme
1113
- }), 'body1')
1114
- }, text('children', 'Hello TypeSet'));
1115
- });
1116
- }).add('variants', function () {
1117
- return React.createElement(ThemeConsumer, null, function (theme) {
1118
- return variant({
1119
- name: 'component_uiType_'
1120
- })({
1121
- theme: theme
1122
- }).map(function (name) {
1123
- return React.createElement(Wrapper$3, {
1124
- key: name
1125
- }, React.createElement(UIType$1, {
1126
- variant: name
1127
- }, name));
1128
- });
1129
- });
1130
- });
1131
- });
1132
-
1133
- var UICard = withEnhanceProps(styled.div.withConfig({
1134
- displayName: "Card__UICard",
1135
- componentId: "zuegsg-0"
1136
- })(["background-color:", ";", " ", ""], function (props) {
1137
- return props.$palette && colorFromPalette({
1138
- paletteAsBackground: props.$paletteAsBackground !== undefined && !props.$paletteAsBackground
1139
- })(props);
1140
- }, mixins.space, function (props) {
1141
- return props.css;
1142
- }));
1143
- UICard.propTypes = {
1144
- css: PropTypesPlus.css,
1145
- margin: PropTypesPlus.string,
1146
- namespace: PropTypesPlus.string,
1147
- padding: PropTypesPlus.string,
1148
- palette: PropTypes.string,
1149
- paletteAsBackground: PropTypes.bool,
1150
- paletteWeight: PropTypes.string,
1151
- variant: PropTypes.string
1152
- };
1153
- UICard.defaultProps = {
1154
- css: undefined,
1155
- margin: undefined,
1156
- padding: undefined,
1157
- palette: undefined,
1158
- paletteAsBackground: undefined,
1159
- paletteWeight: undefined,
1160
- namespace: 'component_uiCard',
1161
- variant: 'standard'
1162
- };
1163
-
1164
- var Wrapper$4 =
1165
- /*#__PURE__*/
1166
- styled.div.withConfig({
1167
- displayName: "Cardstories__Wrapper",
1168
- componentId: "sc-1ogn9bx-0"
1169
- })(["text-align:center;margin:1rem;"]);
1170
- var createStoryForUICard = (function (stories) {
1171
- return stories.add('dynamic story', function () {
1172
- return React.createElement(ThemeConsumer, null, function (theme) {
1173
- var _ref2;
1174
-
1175
- return React.createElement(UICard, {
1176
- variant: select('variant', Object.keys(((_ref2 = theme) != null ? (_ref2 = _ref2.components) != null ? _ref2.uiCard : _ref2 : _ref2) || {}), 'main')
1177
- }, text('children', 'Hello Well'));
1178
- });
1179
- }).add('variants', function () {
1180
- return React.createElement(ThemeConsumer, null, function (theme) {
1181
- var _ref;
1182
-
1183
- return Object.keys(((_ref = theme) != null ? (_ref = _ref.components) != null ? _ref.uiCard : _ref : _ref) || {}).map(function (variant) {
1184
- return React.createElement(Wrapper$4, {
1185
- key: variant
1186
- }, React.createElement(UICard, {
1187
- variant: variant
1188
- }, variant));
1189
- });
1190
- });
1191
- });
1192
- });
1193
-
1194
- function createStoriesForUI(storyFactory) {
1195
- createStoryForUIButton(storyFactory('Button'));
1196
- createStoryForUICard(storyFactory('Card'));
1197
- createStoryForUIIcon(storyFactory('Icon'));
1198
- createStoryForUIImage(storyFactory('Image'));
1199
- createStoryForUIProcessingCircle(storyFactory('ProcessingCircle'));
1200
- createStoryForUIProcessingLine(storyFactory('ProcessingLine'));
1201
- createStoryForUIType(storyFactory('Type'));
1202
- }
1203
-
1204
- var UIError = function UIError(props) {
1205
- return React.createElement(UIType$1, _extends({
1206
- variant: "body2",
1207
- palette: "danger"
1208
- }, props), Map.isMap(props.children) ? props.children.get('message') : props.children);
1209
- };
1210
-
1211
- UIError.propTypes = {
1212
- children: PropTypes.oneOfType([PropTypes.node, PropTypesImmutable.map])
1213
- };
1214
- UIError.defaultProps = {
1215
- children: undefined
1216
- };
1217
- var UIError$1 = React.memo(UIError);
1218
-
1219
- var UIErrorWell = function UIErrorWell(props) {
1220
- return props.errors.size > 0 && React.createElement(UICard, {
1221
- className: props.className,
1222
- variant: "danger"
1223
- }, props.errors.map(function (error, index) {
1224
- return React.createElement(UIError$1, {
1225
- key: index
1226
- }, error) // eslint-disable-line react/no-array-index-key
1227
- ;
1228
- }));
1229
- };
1230
-
1231
- UIErrorWell.propTypes = {
1232
- errors: PropTypesImmutable.list.isRequired
1233
- };
1234
- var ErrorWell = React.memo(UIErrorWell);
1235
-
1236
- var ErrorBoundary =
1237
- /*#__PURE__*/
1238
- function (_React$Component) {
1239
- _inherits(ErrorBoundary, _React$Component);
1240
-
1241
- function ErrorBoundary() {
1242
- var _getPrototypeOf2;
1243
-
1244
- var _this;
1245
-
1246
- _classCallCheck(this, ErrorBoundary);
1247
-
1248
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1249
- args[_key] = arguments[_key];
1250
- }
1251
-
1252
- _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ErrorBoundary)).call.apply(_getPrototypeOf2, [this].concat(args)));
1253
-
1254
- _defineProperty(_assertThisInitialized(_this), "state", {
1255
- hasError: false
1256
- });
1257
-
1258
- return _this;
1259
- }
1260
-
1261
- _createClass(ErrorBoundary, [{
1262
- key: "componentDidCatch",
1263
- value: function componentDidCatch(error, info) {
1264
- this.props.onError(error, info);
1265
- }
1266
- }, {
1267
- key: "render",
1268
- value: function render() {
1269
- if (!this.state.hasError) return this.props.children;
1270
- var Fallback = this.props.fallbackComponent;
1271
- return React.createElement(Fallback, _extends({
1272
- errors: List([this.state.error.message])
1273
- }, this.props.fallbackComponentProps));
1274
- }
1275
- }], [{
1276
- key: "getDerivedStateFromError",
1277
- value: function getDerivedStateFromError(error) {
1278
- return {
1279
- error: error,
1280
- hasError: true
1281
- };
1282
- }
1283
- }]);
1284
-
1285
- return ErrorBoundary;
1286
- }(React.Component);
1287
-
1288
- ErrorBoundary.propTypes = {
1289
- children: PropTypes.node.isRequired,
1290
- fallbackComponent: PropTypesPlus.component,
1291
- fallbackComponentProps: PropTypes.shape({}),
1292
- onError: PropTypes.func
1293
- };
1294
- ErrorBoundary.defaultProps = {
1295
- fallbackComponent: ErrorWell,
1296
- fallbackComponentProps: {},
1297
- onError: function onError() {
1298
- return undefined;
1299
- }
1300
- };
1301
-
1302
- var UIFlexBox = withEnhanceProps(styled.div.withConfig({
1303
- displayName: "FlexBox__UIFlexBox",
1304
- componentId: "sc-13ev10s-0"
1305
- })(["align-items:", ";display:flex;", " ", " ", " ", " ", ""], function (props) {
1306
- return props.alignItems;
1307
- }, function (props) {
1308
- return props.$palette && css(["background-color:", ";"], colorFromPalette({
1309
- paletteAsBackground: props.$paletteAsBackground !== undefined && !props.$paletteAsBackground
1310
- })(props));
1311
- }, function (props) {
1312
- return props.flexDirection && css(["flex-direction:", ";"], props.flexDirection);
1313
- }, function (props) {
1314
- return props.justifyContent && css(["justify-content:", ";"], props.justifyContent);
1315
- }, mixins.space, function (props) {
1316
- return props.css;
1317
- }));
1318
- UIFlexBox.propTypes = {
1319
- alignItems: PropTypes.string,
1320
- justifyContent: PropTypes.string,
1321
- namespace: PropTypes.string,
1322
- palette: PropTypes.string,
1323
- paletteAsBackground: PropTypes.bool,
1324
- paletteWeight: PropTypes.string,
1325
- variant: PropTypes.string
1326
- };
1327
- UIFlexBox.defaultProps = {
1328
- alignItems: 'center',
1329
- namespace: 'component_uiFlexBox',
1330
- palette: undefined,
1331
- paletteAsBackground: undefined,
1332
- paletteWeight: undefined,
1333
- variant: 'standard'
1334
- };
1335
-
1336
- var hooks$2 = {
1337
- usePropsTrigger: function usePropsTrigger(props, styles, hidden, setHidden) {
1338
- return React.useMemo(function () {
1339
- var _Object$assign;
1340
-
1341
- return Object.assign((_Object$assign = {}, _defineProperty(_Object$assign, props.event, function () {
1342
- return setHidden(!hidden);
1343
- }), _defineProperty(_Object$assign, "css", styles.icon), _Object$assign), props.componentProps);
1344
- }, [hidden, setHidden, props.componentProps, props.event, styles.icon]);
1345
- }
1346
- };
1347
-
1348
- var Wrapper$5 =
1349
- /*#__PURE__*/
1350
- styled.div.withConfig({
1351
- displayName: "Tooltipstyles__Wrapper",
1352
- componentId: "bv396u-0"
1353
- })(["display:inline-block;position:relative;", ""], function (props) {
1354
- return props.css;
1355
- });
1356
- var Popup =
1357
- /*#__PURE__*/
1358
- styled.div.withConfig({
1359
- displayName: "Tooltipstyles__Popup",
1360
- componentId: "bv396u-1"
1361
- })(["background-color:white;border:1px solid black;border-radius:3px;top:0;left:0;padding:8px;position:absolute;transform:translateY(-100%);"]);
1362
- var styles = {
1363
- icon: css(["color:", ";"], color({
1364
- palette: 'danger'
1365
- }))
1366
- };
1367
-
1368
- function _templateObject$5() {
1369
- var data = _taggedTemplateLiteral(["", ""]);
1370
-
1371
- _templateObject$5 = function _templateObject() {
1372
- return data;
1373
- };
1374
-
1375
- return data;
1376
- }
1377
-
1378
- function UITooltip(_props) {
1379
- var _React$useState = React.useState(true),
1380
- _React$useState2 = _slicedToArray(_React$useState, 2),
1381
- hidden = _React$useState2[0],
1382
- setHidden = _React$useState2[1];
1383
-
1384
- var props = useEnhanceProps(_props);
1385
- var Component = props.component;
1386
- return React.createElement(_StyledWrapper, {
1387
- className: props.className,
1388
- _css: props.css
1389
- }, React.createElement(Component, hooks$2.usePropsTrigger(props, styles, hidden, setHidden)), React.createElement(Popup, {
1390
- hidden: hidden
1391
- }, props.children));
1392
- }
1393
-
1394
- UITooltip.propTypes = {
1395
- children: PropTypes.node.isRequired,
1396
- component: PropTypesPlus.component,
1397
- componentProps: PropTypes.shape({}),
1398
- css: PropTypesPlus.css,
1399
- event: PropTypes.string,
1400
- namespace: PropTypesPlus.string
1401
- };
1402
- UITooltip.defaultProps = {
1403
- component: UIIcon,
1404
- componentProps: {},
1405
- css: undefined,
1406
- event: 'onClick',
1407
- namespace: 'component_uiTooltip'
1408
- };
1409
- var UITooltip$1 = React.memo(UITooltip);
1410
-
1411
- var _StyledWrapper = styled(Wrapper$5)(_templateObject$5(), function (p) {
1412
- return p._css;
1413
- });
1414
-
1415
- var hooks$3 = {
1416
- usePropsTooltip: function usePropsTooltip(props, styles) {
1417
- return React.useMemo(function () {
1418
- return {
1419
- componentProps: {
1420
- css: styles.icon,
1421
- name: 'error',
1422
- material: true
1423
- },
1424
- css: styles.tooltip
1425
- };
1426
- }, [styles.icon, styles.tooltip]);
1427
- }
1428
- };
1429
-
1430
- var UILabelRoot =
1431
- /*#__PURE__*/
1432
- styled.div.withConfig({
1433
- displayName: "Labelstyles__UILabelRoot",
1434
- componentId: "sc-1i2zjma-0"
1435
- })(["", " ", ""], mixins.margin, function (props) {
1436
- return props.css;
1437
- });
1438
- var Label =
1439
- /*#__PURE__*/
1440
- styled.label.withConfig({
1441
- displayName: "Labelstyles__Label",
1442
- componentId: "sc-1i2zjma-1"
1443
- })(["", ""], function (props) {
1444
- return props.css;
1445
- });
1446
- var styles$1 = {
1447
- icon: css(["color:", ";&&{font-size:0.8rem;}"], color({
1448
- palette: 'danger'
1449
- })),
1450
- tooltip: css(["margin-left:0.5rem;"])
1451
- };
1452
-
1453
- function _templateObject$6() {
1454
- var data = _taggedTemplateLiteral(["", ""]);
1455
-
1456
- _templateObject$6 = function _templateObject() {
1457
- return data;
1458
- };
1459
-
1460
- return data;
1461
- }
1462
-
1463
- function UILabel(_props) {
1464
- var props = useEnhanceProps(_props);
1465
- var propsTooltip = hooks$3.usePropsTooltip(props, styles$1);
1466
- return React.createElement(_StyledUILabelRoot, {
1467
- className: props.className,
1468
- $margin: props.$margin // eslint-disable-line react/prop-types
1469
- ,
1470
- $marginBottom: props.$marginBottom // eslint-disable-line react/prop-types
1471
- ,
1472
- $marginLeft: props.$marginLeft // eslint-disable-line react/prop-types
1473
- ,
1474
- $marginRight: props.$marginRight // eslint-disable-line react/prop-types
1475
- ,
1476
- $marginTop: props.$marginTop // eslint-disable-line react/prop-types
1477
- ,
1478
- _css: props.css
1479
- }, props.label && React.createElement(UIType$1, _extends({
1480
- as: Label,
1481
- palette: props.labelComponentPalette,
1482
- variant: props.labelComponentVariant || 'label',
1483
- value: props.label
1484
- }, props.labelComponentProps)), props.label && !props.errorComponentHidden && props.inputProps.errors && props.inputProps.errors.size > 0 && React.createElement(UITooltip$1, propsTooltip, props.inputProps.errors.map(function (error, index) {
1485
- return React.createElement(UIError$1, {
1486
- key: index
1487
- }, error) // eslint-disable-line react/no-array-index-key
1488
- ;
1489
- })), props.children);
1490
- }
1491
-
1492
- UILabel.propTypes = {
1493
- children: PropTypes.node,
1494
- css: PropTypesPlus.css,
1495
- errorComponentHidden: PropTypes.bool,
1496
- inputProps: PropTypes.shape({
1497
- errors: PropTypesImmutable.list
1498
- }).isRequired,
1499
- label: PropTypesPlus.typography,
1500
- labelComponentPalette: PropTypes.string,
1501
- labelComponentProps: PropTypes.shape({}),
1502
- labelComponentVariant: PropTypes.string,
1503
- margin: PropTypes.string,
1504
- marginBottom: PropTypes.string,
1505
- marginLeft: PropTypes.string,
1506
- marginRight: PropTypes.string,
1507
- marginTop: PropTypes.string,
1508
- namespace: PropTypesPlus.string,
1509
- variant: PropTypes.string
1510
- };
1511
- UILabel.defaultProps = {
1512
- children: undefined,
1513
- css: undefined,
1514
- errorComponentHidden: undefined,
1515
- label: undefined,
1516
- labelComponentPalette: undefined,
1517
- labelComponentProps: {},
1518
- labelComponentVariant: undefined,
1519
- margin: undefined,
1520
- marginBottom: undefined,
1521
- marginLeft: undefined,
1522
- marginRight: undefined,
1523
- marginTop: undefined,
1524
- namespace: 'component_uiLabel',
1525
- variant: 'standard'
1526
- };
1527
- var Label$1 = React.memo(UILabel);
1528
-
1529
- var _StyledUILabelRoot = styled(UILabelRoot)(_templateObject$6(), function (p) {
1530
- return p._css;
1531
- });
1532
-
1533
- var UILine = withEnhanceProps(styled.hr.withConfig({
1534
- displayName: "Line__UILine",
1535
- componentId: "sc-2dkwme-0"
1536
- })(["border:0;border-bottom:1px ", " ", ";", " ", ""], function (props) {
1537
- return props.borderStyle || 'solid';
1538
- }, colorFromPalette(), mixins.margin, function (props) {
1539
- return props.css;
1540
- }));
1541
- UILine.propTypes = {
1542
- namespace: PropTypes.string,
1543
- variant: PropTypes.string
1544
- };
1545
- UILine.defaultProps = {
1546
- namespace: 'component_uiLine',
1547
- variant: undefined
1548
- };
1549
-
1550
- var Overlay =
1551
- /*#__PURE__*/
1552
- styled.div.withConfig({
1553
- displayName: "Overlay",
1554
- componentId: "sc-15ca6dc-0"
1555
- })(["background-color:", ";display:", ";position:absolute;", ""], color({
1556
- palette: 'white'
1557
- }), function (props) {
1558
- return props.visible ? 'block' : 'none';
1559
- }, component());
1560
- Overlay.propTypes = {
1561
- namespace: PropTypes.string,
1562
- variant: PropTypes.string
1563
- };
1564
- Overlay.defaultProps = {
1565
- namespace: 'component_uiPopup_Overlay',
1566
- variant: 'standard'
1567
- };
1568
-
1569
- var Container$1 =
1570
- /*#__PURE__*/
1571
- styled.div.withConfig({
1572
- displayName: "Portalstyles__Container",
1573
- componentId: "sc-11pm1fj-0"
1574
- })(["align-items:center;background-color:rgba(0,0,0,0.65);display:flex;height:100%;justify-content:center;overflow:auto;"]);
1575
- var Content =
1576
- /*#__PURE__*/
1577
- styled.div.withConfig({
1578
- displayName: "Portalstyles__Content",
1579
- componentId: "sc-11pm1fj-1"
1580
- })(["background-color:", ";border:2px solid ", ";border-radius:5px;max-width:1024px;min-height:100px;width:80%;@media (max-width:539px){width:95%;}"], color({
1581
- palette: 'white'
1582
- }), color({
1583
- palette: 'black'
1584
- }));
1585
-
1586
- var Portal =
1587
- /*#__PURE__*/
1588
- function (_React$Component) {
1589
- _inherits(Portal, _React$Component);
1590
-
1591
- function Portal() {
1592
- var _getPrototypeOf2;
1593
-
1594
- var _this;
1595
-
1596
- _classCallCheck(this, Portal);
1597
-
1598
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1599
- args[_key] = arguments[_key];
1600
- }
1601
-
1602
- _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Portal)).call.apply(_getPrototypeOf2, [this].concat(args)));
1603
-
1604
- _defineProperty(_assertThisInitialized(_this), "state", {
1605
- prop_visible: _this.props.visible,
1606
- ref: null
1607
- });
1608
-
1609
- return _this;
1610
- }
1611
-
1612
- _createClass(Portal, [{
1613
- key: "componentDidUpdate",
1614
- value: function componentDidUpdate(prevProps, prevState) {
1615
- if (this.props.visible === true && prevProps.visible === false) {
1616
- this.state.ref.style.position = 'fixed';
1617
- this.state.ref.style.top = '0';
1618
- this.state.ref.style.right = '0';
1619
- this.state.ref.style.bottom = '0';
1620
- this.state.ref.style.left = '0';
1621
- document.body.appendChild(this.state.ref);
1622
- }
1623
-
1624
- if (this.props.visible === false && prevProps.visible === true && prevState.ref) {
1625
- document.body.removeChild(prevState.ref);
1626
- }
1627
- }
1628
- }, {
1629
- key: "componentWillUnmount",
1630
- value: function componentWillUnmount() {
1631
- if (this.state.ref) {
1632
- document.body.removeChild(this.state.ref);
1633
- }
1634
- }
1635
- }, {
1636
- key: "getPropsContainer",
1637
- value: function getPropsContainer() {
1638
- return this.props.containerComponentProps;
1639
- }
1640
- }, {
1641
- key: "getPropsContent",
1642
- value: function getPropsContent() {
1643
- return Object.assign({}, this.props.contentComponentProps, {
1644
- className: this.props.contentComponentProps.className ? "".concat(this.props.contentComponentProps.className, " ignore-react-onclickoutside") : 'ignore-react-onclickoutside'
1645
- });
1646
- }
1647
- }, {
1648
- key: "renderContent",
1649
- value: function renderContent() {
1650
- var ContainerComponent = this.props.containerComponent;
1651
- var ContentComponent = this.props.contentComponent;
1652
- return React.createElement(ContainerComponent, this.getPropsContainer(), React.createElement(ContentComponent, this.getPropsContent(), this.props.children));
1653
- }
1654
- }, {
1655
- key: "render",
1656
- value: function render() {
1657
- return this.state.ref && ReactDOM.createPortal(this.renderContent(), this.state.ref);
1658
- }
1659
- }], [{
1660
- key: "getDerivedStateFromProps",
1661
- value: function getDerivedStateFromProps(nextProps, prevState) {
1662
- if (prevState.prop_visible === nextProps.visible) {
1663
- return {
1664
- prop_visible: nextProps.visible,
1665
- ref: prevState.ref
1666
- };
1667
- }
1668
-
1669
- return {
1670
- prop_visible: nextProps.visible,
1671
- ref: prevState.prop_visible === true ? null : document.createElement('div')
1672
- };
1673
- }
1674
- }]);
1675
-
1676
- return Portal;
1677
- }(React.Component);
1678
-
1679
- Portal.propTypes = exact({
1680
- children: PropTypes.node.isRequired,
1681
- containerComponent: PropTypesPlus.component,
1682
- containerComponentProps: PropTypes.shape({}),
1683
- contentComponent: PropTypesPlus.component,
1684
- contentComponentProps: PropTypes.shape({
1685
- className: PropTypesPlus.string
1686
- }),
1687
- visible: PropTypes.bool.isRequired
1688
- });
1689
- Portal.defaultProps = {
1690
- containerComponent: Container$1,
1691
- containerComponentProps: {},
1692
- contentComponent: Content,
1693
- contentComponentProps: {}
1694
- };
1695
-
1696
- var hooks$4 = {
1697
- useComponents: function useComponents(props) {
1698
- var mapDefault = React.useMemo(function () {
1699
- return {
1700
- wrapperComponent: "uiPopup_component_".concat(props.type),
1701
- controlComponent: ['uiPopup_control', 'component_button']
1702
- };
1703
- }, [props.type]);
1704
- var defaults = useDefault(mapDefault, props);
1705
- return {
1706
- Component: props.component,
1707
- Container: props.containerComponent,
1708
- Control: defaults.controlComponent,
1709
- Wrapper: defaults.wrapperComponent || Portal
1710
- };
1711
- },
1712
-
1713
- /**
1714
- * HACK(thierry): react-onclickoutside use the first instance of the
1715
- * onClose provided. So it is unabled to capture the changing values around it.
1716
- * Hence mutating the staticObject giving it a new onClose
1717
- */
1718
- useGetClickOutside: function useGetClickOutside(componentProps) {
1719
- var _React$useState = React.useState({}),
1720
- _React$useState2 = _slicedToArray(_React$useState, 1),
1721
- staticObject = _React$useState2[0];
1722
-
1723
- staticObject.onClose = componentProps.onClose;
1724
- return function () {
1725
- return staticObject.onClose();
1726
- };
1727
- },
1728
- usePropsComponent: function usePropsComponent(props, opened, setOpened) {
1729
- var handleClose = React.useCallback(function (x) {
1730
- if (!opened) return x;
1731
- setOpened(false);
1732
- props.onClose();
1733
- return x;
1734
- }, [opened, props.onClose]);
1735
- return Object.assign({
1736
- onClose: handleClose
1737
- }, _isFunction(props.componentProps) ? props.componentProps() : props.componentProps);
1738
- },
1739
- usePropsContainer: function usePropsContainer(props) {
1740
- return props.containerComponentProps;
1741
- },
1742
- usePropsControl: function usePropsControl(props, opened, setOpened) {
1743
- var handleEvent = React.useCallback(function () {
1744
- return setOpened(!opened);
1745
- }, [opened]);
1746
- return Object.assign(_defineProperty({}, props.event, handleEvent), props.controlComponentProps);
1747
- },
1748
- usePropsWrapper: function usePropsWrapper(props, opened) {
1749
- return Object.assign({
1750
- visible: opened
1751
- }, _isFunction(props.wrapperComponentProps) ? props.wrapperComponentProps() : props.wrapperComponentProps);
1752
- }
1753
- };
1754
-
1755
- var ContainerComponent =
1756
- /*#__PURE__*/
1757
- styled.div.withConfig({
1758
- displayName: "Popup__ContainerComponent",
1759
- componentId: "sc-1an9fmj-0"
1760
- })(["display:inline-block;position:", ";"], function (props) {
1761
- return props.static ? 'static' : 'relative';
1762
- });
1763
- /**
1764
- * To ignore element outside container, attach className 'ignore-react-onclickoutside' to it
1765
- * https://github.com/Pomax/react-onclickoutside#marking-elements-as-skip-over-this-one-during-the-event-loop
1766
- */
1767
-
1768
- function Popup$1(_props) {
1769
- var _React$useState = React.useState(false),
1770
- _React$useState2 = _slicedToArray(_React$useState, 2),
1771
- opened = _React$useState2[0],
1772
- setOpened = _React$useState2[1];
1773
-
1774
- var props = useEnhanceProps(_props);
1775
-
1776
- var _hooks$useComponents = hooks$4.useComponents(props),
1777
- Container = _hooks$useComponents.Container,
1778
- Control = _hooks$useComponents.Control,
1779
- Component = _hooks$useComponents.Component,
1780
- Wrapper = _hooks$useComponents.Wrapper;
1781
-
1782
- var componentProps = hooks$4.usePropsComponent(props, opened, setOpened);
1783
- Popup$1.handleClickOutside = hooks$4.useGetClickOutside(componentProps);
1784
- return React.createElement(Container, hooks$4.usePropsContainer(props), React.createElement(Control, hooks$4.usePropsControl(props, opened, setOpened)), React.createElement(Wrapper, hooks$4.usePropsWrapper(props, opened), React.createElement(Component, componentProps)));
1785
- }
1786
-
1787
- Popup$1.propTypes = exact({
1788
- component: PropTypesPlus.component.isRequired,
1789
- componentProps: PropTypes.shape({}),
1790
- containerComponent: PropTypesPlus.component,
1791
- containerComponentProps: PropTypes.shape({}),
1792
- controlComponent: PropTypesPlus.component,
1793
- controlComponentProps: PropTypes.shape({}),
1794
- event: PropTypesPlus.string,
1795
- namespace: PropTypesPlus.string,
1796
- onClose: PropTypes.func,
1797
- type: PropTypesPlus.string,
1798
- wrapperComponent: PropTypesPlus.component,
1799
- wrapperComponentProps: PropTypes.shape({}),
1800
- // form props
1801
- name: PropTypesPlus.string,
1802
- // onclickoutside props
1803
- disableOnClickOutside: PropTypes.func.isRequired,
1804
- enableOnClickOutside: PropTypes.func.isRequired,
1805
- eventTypes: PropTypes.arrayOf(PropTypes.string).isRequired,
1806
- outsideClickIgnoreClass: PropTypes.string.isRequired,
1807
- preventDefault: PropTypes.bool.isRequired,
1808
- stopPropagation: PropTypes.bool.isRequired,
1809
- wrappedRef: PropTypes.func.isRequired
1810
- });
1811
- Popup$1.defaultProps = {
1812
- componentProps: {},
1813
- containerComponent: ContainerComponent,
1814
- containerComponentProps: {},
1815
- controlComponent: undefined,
1816
- controlComponentProps: {},
1817
- event: 'onClick',
1818
- namespace: 'component_uiPopup',
1819
- onClose: function onClose() {
1820
- return undefined;
1821
- },
1822
- type: undefined,
1823
- wrapperComponent: undefined,
1824
- wrapperComponentProps: {},
1825
- // form props
1826
- name: undefined
1827
- };
1828
- var clickOutsideConfig = {
1829
- handleClickOutside: function handleClickOutside() {
1830
- return Popup$1.handleClickOutside;
1831
- }
1832
- };
1833
- var EnhancedPopup = withOnClickOutside(Popup$1, clickOutsideConfig);
1834
- EnhancedPopup.Overlay = Overlay;
1835
- EnhancedPopup.Portal = Portal;
1836
-
1837
- function Portal$1(props) {
1838
- var _React$useState = React.useState(null),
1839
- _React$useState2 = _slicedToArray(_React$useState, 2),
1840
- elementRef = _React$useState2[0],
1841
- setElementRef = _React$useState2[1];
1842
-
1843
- var previousClassNameRef = React.useRef(props.className);
1844
- var previousClassName = previousClassNameRef.current;
1845
- React.useEffect(function () {
1846
- previousClassNameRef.current = props.className;
1847
- });
1848
- React.useEffect(function () {
1849
- var element = document.createElement('div');
1850
- setElementRef(element);
1851
- document.body.appendChild(element);
1852
- return function () {
1853
- return document.body.removeChild(element);
1854
- };
1855
- }, []);
1856
- React.useEffect(function () {
1857
- if (elementRef && previousClassName) {
1858
- var _elementRef$classList;
1859
-
1860
- (_elementRef$classList = elementRef.classList).remove.apply(_elementRef$classList, _toConsumableArray(previousClassName.split(' ')));
1861
- }
1862
-
1863
- if (elementRef && props.className) {
1864
- var _elementRef$classList2;
1865
-
1866
- (_elementRef$classList2 = elementRef.classList).add.apply(_elementRef$classList2, _toConsumableArray(props.className.split(' ')));
1867
- }
1868
- }, [elementRef, props.className, previousClassName]);
1869
- return elementRef && ReactDOM.createPortal(props.children, elementRef);
1870
- }
1871
-
1872
- var UISpacer = withEnhanceProps(styled.div.withConfig({
1873
- displayName: "Spacer__UISpacer",
1874
- componentId: "sc-62ugl2-0"
1875
- })(["flex:", ";", ""], function (props) {
1876
- return props.flex === undefined ? 1 : props.flex;
1877
- }, mixins.space));
1878
- UISpacer.propTypes = {
1879
- namespace: PropTypes.string,
1880
- variant: PropTypes.string
1881
- };
1882
- UISpacer.defaultProps = {
1883
- namespace: 'component_uiSpacer',
1884
- variant: 'standard'
1885
- };
1886
-
1887
- export { UIButton$1 as UIButton, UICard, UIError$1 as UIError, ErrorBoundary as UIErrorBoundary, ErrorWell as UIErrorWell, UIFlexBox, UIIcon, UIImage$1 as UIImage, Label$1 as UILabel, UILine, EnhancedPopup as UIPopup, Portal$1 as UIPortal, ProgressCircle as UIProgressCircle, UIProgressLine, UISpacer, UIType$1 as UIType, createStoriesForUI, createStoryForUIButton, createStoryForUIIcon, createStoryForUIImage, createStoryForUIProcessingCircle, createStoryForUIProcessingLine, createStoryForUIType, createStoryForUICard };
1888
- //# sourceMappingURL=development.js.map