react-ui-basics 0.0.175 → 0.0.176

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.
Files changed (137) hide show
  1. package/Animated.js.map +1 -1
  2. package/AutocompleteSelect.js.map +1 -1
  3. package/Button.js.map +1 -1
  4. package/Checkbox.js.map +1 -1
  5. package/CircleProgress.js.map +1 -1
  6. package/CommonFields.js.map +1 -1
  7. package/DNDContainer.js.map +1 -1
  8. package/DNDDraggable.js.map +1 -1
  9. package/DNDDroppable.js.map +1 -1
  10. package/Dialog.js.map +1 -1
  11. package/DropFileInput.js.map +1 -1
  12. package/DroppableHorizontalList.js.map +1 -1
  13. package/DroppableList.js.map +1 -1
  14. package/Dropzone.js.map +1 -1
  15. package/FilteredList.js.map +1 -1
  16. package/FloatingActionButton.js.map +1 -1
  17. package/FormUploadProgress.js.map +1 -1
  18. package/ImageGallery.js.map +1 -1
  19. package/MaterialIcon.js.map +1 -1
  20. package/Modal.js.map +1 -1
  21. package/ModalMenu.js.map +1 -1
  22. package/ReactConstants.js.map +1 -1
  23. package/ReactCreateElement.js.map +1 -1
  24. package/ReadyListener.js.map +1 -1
  25. package/Scrollable.js.map +1 -1
  26. package/ScrollableTable.js.map +1 -1
  27. package/Size.js.map +1 -1
  28. package/Snackbar.js.map +1 -1
  29. package/SpinningProgress.js.map +1 -1
  30. package/Switch.js.map +1 -1
  31. package/Table.js.map +1 -1
  32. package/TextField.js.map +1 -1
  33. package/Tools.d.ts +2 -2
  34. package/Tools.js.map +1 -1
  35. package/bundle.css +596 -596
  36. package/package.json +1 -1
  37. package/router/HistoryTools.js.map +1 -1
  38. package/router/Link.js.map +1 -1
  39. package/router/NavLink.js.map +1 -1
  40. package/router/Route.js.map +1 -1
  41. package/router/index.js.map +1 -1
  42. package/src/Animated.css +7 -0
  43. package/src/Animated.js +219 -0
  44. package/src/Animated.scss +8 -0
  45. package/src/AutocompleteSelect.css +256 -0
  46. package/src/AutocompleteSelect.js +473 -0
  47. package/src/AutocompleteSelect.scss +322 -0
  48. package/src/Button.css +138 -0
  49. package/src/Button.js +104 -0
  50. package/src/Button.scss +177 -0
  51. package/src/Checkbox.css +56 -0
  52. package/src/Checkbox.js +52 -0
  53. package/src/Checkbox.scss +87 -0
  54. package/src/CircleProgress.css +11 -0
  55. package/src/CircleProgress.js +38 -0
  56. package/src/CircleProgress.scss +13 -0
  57. package/src/CommonFields.js +21 -0
  58. package/src/DNDContainer.css +26 -0
  59. package/src/DNDContainer.js +263 -0
  60. package/src/DNDContainer.scss +33 -0
  61. package/src/DNDDraggable.js +55 -0
  62. package/src/DNDDroppable.js +58 -0
  63. package/src/Dialog.css +36 -0
  64. package/src/Dialog.js +160 -0
  65. package/src/Dialog.scss +42 -0
  66. package/src/DropFileInput.css +24 -0
  67. package/src/DropFileInput.js +45 -0
  68. package/src/DropFileInput.scss +28 -0
  69. package/src/DroppableHorizontalList.js +190 -0
  70. package/src/DroppableList.css +14 -0
  71. package/src/DroppableList.js +201 -0
  72. package/src/DroppableList.scss +27 -0
  73. package/src/Dropzone.css +54 -0
  74. package/src/Dropzone.js +140 -0
  75. package/src/Dropzone.scss +66 -0
  76. package/src/FilteredList.css +68 -0
  77. package/src/FilteredList.js +196 -0
  78. package/src/FilteredList.scss +86 -0
  79. package/src/FloatingActionButton.css +20 -0
  80. package/src/FloatingActionButton.js +35 -0
  81. package/src/FloatingActionButton.scss +25 -0
  82. package/src/FormUploadProgress.css +61 -0
  83. package/src/FormUploadProgress.js +87 -0
  84. package/src/FormUploadProgress.scss +78 -0
  85. package/src/ImageGallery.css +196 -0
  86. package/src/ImageGallery.js +935 -0
  87. package/src/ImageGallery.scss +256 -0
  88. package/src/MaterialIcon.js +1837 -0
  89. package/src/Modal.css +61 -0
  90. package/src/Modal.js +160 -0
  91. package/src/Modal.scss +73 -0
  92. package/src/ModalMenu.css +30 -0
  93. package/src/ModalMenu.js +59 -0
  94. package/src/ModalMenu.scss +36 -0
  95. package/src/ReactConstants.ts +42 -0
  96. package/src/ReactCreateElement.js +5 -0
  97. package/src/ReadyListener.js +53 -0
  98. package/src/ResizeObserver.ts +50 -0
  99. package/src/Scrollable.css +80 -0
  100. package/src/Scrollable.js +388 -0
  101. package/src/Scrollable.scss +100 -0
  102. package/src/ScrollableTable.css +6 -0
  103. package/src/ScrollableTable.scss +12 -0
  104. package/src/ScrollableTable.tsx +39 -0
  105. package/src/Size.js +56 -0
  106. package/src/Snackbar.css +40 -0
  107. package/src/Snackbar.js +71 -0
  108. package/src/Snackbar.scss +47 -0
  109. package/src/SpinningProgress.css +49 -0
  110. package/src/SpinningProgress.js +19 -0
  111. package/src/SpinningProgress.scss +57 -0
  112. package/src/Switch.css +69 -0
  113. package/src/Switch.js +54 -0
  114. package/src/Switch.scss +73 -0
  115. package/src/Table.css +94 -0
  116. package/src/Table.scss +121 -0
  117. package/src/Table.tsx +360 -0
  118. package/src/TextField.css +122 -0
  119. package/src/TextField.js +162 -0
  120. package/src/TextField.scss +160 -0
  121. package/src/Tools.test.js +105 -0
  122. package/src/Tools.ts +231 -0
  123. package/src/global.css +1 -0
  124. package/src/global.scss +6 -0
  125. package/src/index.js +78 -0
  126. package/src/router/HistoryTools.js +32 -0
  127. package/src/router/Link.js +27 -0
  128. package/src/router/NavLink.js +25 -0
  129. package/src/router/README.md +55 -0
  130. package/src/router/Route.js +209 -0
  131. package/src/router/Route.test.js +139 -0
  132. package/src/router/index.js +14 -0
  133. package/src/store/ProxyTools.js +91 -0
  134. package/src/store/ProxyTools.test.js +97 -0
  135. package/src/store/Store.ts +91 -0
  136. package/store/ProxyTools.js.map +1 -1
  137. package/store/Store.js.map +1 -1
@@ -0,0 +1,263 @@
1
+ import ReactConstants from "./../ReactConstants";
2
+ import {clientHeight as __clientHeight, clientWidth as __clientWidth, createAccessor as __createAccessor, data as __data, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, props as __props, scrollLeft as __scrollLeft, scrollTop as __scrollTop, state as __state, style as __style, target as __target, top as __top, value as __value, width as __width} from "./../CommonFields";
3
+ import React, {Component} from 'react';
4
+ import {toConsumableArray as __toConsumableArray} from "./../_virtual/_rollupPluginBabelHelpers";
5
+ import {extends as __extends} from "./../_virtual/_rollupPluginBabelHelpers";
6
+ import {inherits as __inherits} from "./../_virtual/_rollupPluginBabelHelpers";
7
+ import './DNDContainer.css';
8
+ import ReactCreateElement from './ReactCreateElement';
9
+ import './DNDContainer.css'
10
+ import {classNames, NOOP, orNoop, preventDefault, ref, DOCUMENT, WINDOW, addEventListener, removeEventListener, setTimeout, clearTimeout, requestAnimationFrame} from "./Tools";
11
+
12
+ const clearSelection = () => {
13
+ const getSelection = WINDOW.getSelection;
14
+ if (getSelection) {
15
+ if (getSelection().empty) { // Chrome
16
+ getSelection().empty();
17
+ } else if (getSelection().removeAllRanges) { // Firefox
18
+ getSelection().removeAllRanges();
19
+ }
20
+ } else if (DOCUMENT.selection) { // IE?
21
+ DOCUMENT.selection.empty();
22
+ }
23
+ };
24
+
25
+ const droppables = 'ds';
26
+ const positionListener = 'pl';
27
+
28
+ class DNDContainer extends Component {
29
+
30
+ constructor(props) {
31
+ super(props);
32
+
33
+ this.state = {
34
+ draggable: null,
35
+ };
36
+
37
+ this[droppables] = [];
38
+ this[positionListener] = NOOP;
39
+ }
40
+
41
+ render() {
42
+ const {children, className} = __props(this);
43
+ const {draggable} = __state(this);
44
+ return <div className={classNames('DNDContainer', className)} ref={ref('container', this)}>
45
+ {children}
46
+ <div className="overlay">{draggable}</div>
47
+ </div>;
48
+ };
49
+
50
+ componentDidMount() {
51
+ const {
52
+ provideDraggableInitializer,
53
+ provideDroppableInitializer,
54
+ } = __props(this);
55
+
56
+ orNoop(provideDraggableInitializer)(this.draggableInitializer);
57
+ orNoop(provideDroppableInitializer)(this.droppableInitializer);
58
+ addEventListener(this.container, 'dragover', this.onDrag, {capture: true, passive: true})
59
+ };
60
+
61
+ draggableInitializer = (item) => {
62
+ const handle = __props(item).handle;
63
+ const draggableElement = (handle && item.element.childNodes[0]) || item.element;
64
+ draggableElement.draggable = true;
65
+
66
+ const dragStartListener = (e) => {
67
+ clearSelection();
68
+ const container = this.container;
69
+ this.data = __props(item).data;
70
+ this.draggable = item;
71
+ this.scrollOffsetX = __pageX(e) - e.clientX;
72
+ this.scrollOffsetY = __pageY(e) - e.clientY;
73
+ const dataTransfer = e.dataTransfer;
74
+ const itemOffset = item.element.getBoundingClientRect();
75
+
76
+ item.width = __width(itemOffset);
77
+ item.height = __height(itemOffset);
78
+
79
+ let clone = orNoop(__props(item).copy)((it) => {
80
+ let style = it.element.style;
81
+
82
+ const offsetLeft = totalOffsetLeft(container) + (e.clientX - __left(itemOffset));
83
+ const offsetTop = totalOffsetTop(container) + (e.clientY - __top(itemOffset));
84
+ this[positionListener] = orNoop(it.createPositionListener)(e, style, itemOffset, container) || ((e) => {
85
+ if (__pageX(e) === 0)
86
+ return;
87
+
88
+ style.transform = 'translate(' + (__pageX(e) - offsetLeft) + 'px, ' + (__pageY(e) - offsetTop) + 'px)';
89
+ });
90
+
91
+
92
+ requestAnimationFrame(() => {
93
+ if (dataTransfer && !dataTransfer.setDragImage) {
94
+ style.opacity = '0'; // hide dragged element in ie and edge
95
+ }
96
+ if (it.initDraggedStyles)
97
+ it.initDraggedStyles(style, itemOffset);
98
+ else {
99
+ style.position = 'absolute';
100
+ style.pointerEvents = 'none';
101
+ style.opacity = '1';
102
+ style.top = '0px';
103
+ style.left = '0px';
104
+ style.width = __width(itemOffset) + 'px';
105
+ style.height = __height(itemOffset) + 'px';
106
+ }
107
+
108
+ this.onDrag(e);
109
+ it.setState({dragged: true});
110
+ });
111
+ return it;
112
+ }, 'copy', item);
113
+
114
+ dataTransfer && dataTransfer.setData && dataTransfer.setData('text', ''); // required by firefox
115
+ dataTransfer && (dataTransfer.dropEffect = "move");
116
+ if (clone) {
117
+ if (dataTransfer && dataTransfer.setDragImage) {
118
+ clone !== item && this.setState({draggable: clone});
119
+ const img = document.createElement('img');
120
+ img.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
121
+ dataTransfer.setDragImage(img, 0, 0);
122
+ }
123
+ }
124
+ this.onDragStart(e);
125
+ setTimeout(() => item.setState({placeholder: true}), 1)
126
+ };
127
+ addListener(draggableElement, item, 'dragend', (e) => {
128
+ item.setState({placeholder: false});
129
+ this.onDragEnd()
130
+ });
131
+ addListener(draggableElement, item, 'dragstart', dragStartListener);
132
+
133
+ let longTouch;
134
+ let dragStarted = false;
135
+ let dragged = false;
136
+ addListener(draggableElement, item, 'touchstart', e => {
137
+ if (e.touches.length > 1)
138
+ return;
139
+
140
+ dragged = dragStarted = false;
141
+ const touch = e.targetTouches[0];
142
+ longTouch = setTimeout(() => longTouch && (dragStarted = true) && (longTouch = dragStartListener(touch)), !handle ? 500 : 0)
143
+ });
144
+
145
+ addListener(draggableElement, item, 'touchmove', e => {
146
+ if (longTouch) {
147
+ longTouch = clearTimeout(longTouch);
148
+ return;
149
+ }
150
+ if (!dragStarted)
151
+ return;
152
+
153
+ if (e.touches.length > 1)
154
+ return;
155
+
156
+ preventDefault(e);
157
+ dragged = true;
158
+ const touch = e.targetTouches[0];
159
+ this[positionListener](touch);
160
+ this[droppables].forEach(it => it.isHover(touch, item))
161
+ });
162
+
163
+ addListener(draggableElement, item, 'touchend', e => {
164
+ longTouch = clearTimeout(longTouch);
165
+ if (!dragged)
166
+ return;
167
+
168
+ item.setState({placeholder: false});
169
+ if (e.touches.length > 0)
170
+ return;
171
+
172
+ this[droppables].forEach(it => it.dropIfHover());
173
+ this.onDragEnd();
174
+ });
175
+ };
176
+
177
+
178
+ droppableInitializer = (item) => {
179
+ this[droppables].push(item);
180
+
181
+ addEventListener(item.element, 'drop', (e) => {
182
+ preventDefault(e);
183
+ __data(this) && orNoop(__props(item).onDrop)(__data(this));
184
+ }, false);
185
+
186
+ item.onDragStart = (e, draggable) => {
187
+ item.bounds = item.element.getBoundingClientRect();
188
+ item.setState({allow: true});
189
+ orNoop(__props(item).onDragStart)(e, draggable);
190
+ };
191
+ item.isHover = (e, draggable) => {
192
+ const bounds = item.bounds;
193
+ if (!bounds)
194
+ return;
195
+
196
+ let y = __pageY(e) - this.scrollOffsetY;
197
+ let x = __pageX(e) - this.scrollOffsetX;
198
+ let hover = __left(bounds) <= x && bounds.right >= x && __top(bounds) <= y && bounds.bottom >= y;
199
+
200
+ hover && orNoop(__props(item).onHover)(e, draggable);
201
+
202
+ if (hover)
203
+ !__state(item).hover && item.setState({hover});
204
+ else
205
+ __state(item).hover && item.setState({hover});
206
+ };
207
+ item.dropIfHover = () => {
208
+ __data(this) && __state(item).hover && orNoop(__props(item).onDrop)(__data(this));
209
+ };
210
+ item.onDragEnd = () => {
211
+ orNoop(orNoop(this.draggable).onDragEnd)();
212
+ item.setState({allow: false, hover: false});
213
+ };
214
+ item.onUnmount = () => this[droppables].splice(this[droppables].indexOf(item), 1);
215
+ };
216
+
217
+ onDrag = (e) => {
218
+ if (!this.draggable)
219
+ return;
220
+
221
+ this[positionListener](e);
222
+ this[droppables].forEach(it => it.isHover(e, this.draggable))
223
+ };
224
+ onDragStart = (e) => {
225
+ this[droppables].forEach(it => it.onDragStart(e, this.draggable))
226
+ };
227
+ onDragEnd = () => {
228
+ const draggable = this.draggable;
229
+ if (draggable.element) {
230
+ let style = draggable.element.style;
231
+ style.position = '';
232
+ style.pointerEvents = '';
233
+ style.width = ``;
234
+ style.height = ``;
235
+ style.opacity = '';
236
+ }
237
+ draggable.setState({dragged: false});
238
+
239
+ this.setState({draggable: null});
240
+
241
+ this[droppables].forEach(it => {
242
+ it.onDragEnd();
243
+ orNoop(__props(it).onDragEnd)(this.draggable)
244
+ });
245
+ this.data = null;
246
+ this.draggable = null;
247
+ };
248
+ }
249
+
250
+ export const removeListener = (el, item, type) => item[type] && removeEventListener(el, type, item[type]);
251
+ export const addListener = (el, item, type, listener) => {
252
+ removeListener(el, item, type);
253
+ addEventListener(el, type, item[type] = listener);
254
+ };
255
+
256
+ const totalOffsetTop = (el) => {
257
+ return el.getBoundingClientRect().top + (WINDOW.pageYOffset || DOCUMENT.documentElement.scrollTop);
258
+ };
259
+ const totalOffsetLeft = (el) => {
260
+ return el.getBoundingClientRect().left + (WINDOW.pageXOffset || DOCUMENT.documentElement.scrollLeft);
261
+ };
262
+
263
+ export default DNDContainer;
@@ -0,0 +1,33 @@
1
+ .DNDContainer {
2
+ position: relative;
3
+
4
+ .Draggable {
5
+ &[draggable=true], [draggable=true] {
6
+ cursor: pointer;
7
+ }
8
+
9
+ &.placeholder {
10
+ opacity: 0.2;
11
+ }
12
+
13
+ &.copy {
14
+ position: absolute;
15
+ box-sizing: border-box;
16
+ will-change: transform;
17
+ opacity: 0;
18
+ }
19
+
20
+ &.dragged {
21
+ z-index: 10;
22
+ }
23
+ }
24
+
25
+ .overlay {
26
+ position: absolute;
27
+ top: 0;
28
+ left: 0;
29
+ right: 0;
30
+ bottom: 0;
31
+ pointer-events: none;
32
+ }
33
+ }
@@ -0,0 +1,55 @@
1
+ import ReactConstants from "./../ReactConstants";
2
+ import {clientHeight as __clientHeight, clientWidth as __clientWidth, createAccessor as __createAccessor, data as __data, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, props as __props, scrollLeft as __scrollLeft, scrollTop as __scrollTop, state as __state, style as __style, target as __target, top as __top, value as __value, width as __width} from "./../CommonFields";
3
+ import React from 'react';
4
+ import {toConsumableArray as __toConsumableArray} from "./../_virtual/_rollupPluginBabelHelpers";
5
+ import {extends as __extends} from "./../_virtual/_rollupPluginBabelHelpers";
6
+ import {inherits as __inherits} from "./../_virtual/_rollupPluginBabelHelpers";
7
+ import ReactCreateElement from './ReactCreateElement';
8
+ import {classNames, orNoop, ref} from "./Tools";
9
+ import {componentDidUpdate, props, state, render, children, className, componentDidMount, componentWillUnmount, PureComponent} from "./ReactConstants";
10
+
11
+ const hover = 'hover',
12
+ dragged = 'dragged',
13
+ placeholder = 'placeholder',
14
+ initializer = 'initializer',
15
+ handle = 'handle'
16
+ ;
17
+
18
+ const init = that => orNoop(props(that)[initializer])(that);
19
+
20
+ class Draggable extends PureComponent {
21
+
22
+ constructor(properties) {
23
+ super(properties);
24
+ const that = this;
25
+ that.state = {};
26
+ that[ReactConstants[2]] = (prevProps) => {
27
+ if (prevProps[handle] !== props(that)[handle] || prevProps[initializer] !== props(that)[initializer])
28
+ init(that)
29
+ };
30
+ that[ReactConstants[0]] = () => {
31
+ init(that)
32
+ };
33
+ that[ReactConstants[1]] = () => {
34
+ orNoop(that.onUnmount)();
35
+ };
36
+ that[ReactConstants[3]] = () => {
37
+ const _state = state(that),
38
+ _props = props(that);
39
+ return <div className={classNames('Draggable', _props[ReactConstants[5]],
40
+ _state[dragged] && dragged,
41
+ _state[placeholder] && placeholder,
42
+ _state[hover] && hover,
43
+ )}
44
+ onClick={_props[ReactConstants[6]]}
45
+ ref={ref('element', that)}
46
+ >
47
+ {_props[handle]}
48
+ {_props[ReactConstants[4]]}
49
+ </div>;
50
+ }
51
+ }
52
+ }
53
+
54
+
55
+ export default Draggable;
@@ -0,0 +1,58 @@
1
+ import ReactConstants from "./../ReactConstants";
2
+ import {clientHeight as __clientHeight, clientWidth as __clientWidth, createAccessor as __createAccessor, data as __data, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, props as __props, scrollLeft as __scrollLeft, scrollTop as __scrollTop, state as __state, style as __style, target as __target, top as __top, value as __value, width as __width} from "./../CommonFields";
3
+ import React from 'react';
4
+ import {toConsumableArray as __toConsumableArray} from "./../_virtual/_rollupPluginBabelHelpers";
5
+ import {extends as __extends} from "./../_virtual/_rollupPluginBabelHelpers";
6
+ import {inherits as __inherits} from "./../_virtual/_rollupPluginBabelHelpers";
7
+ import ReactCreateElement from './ReactCreateElement';
8
+ import {classNames, orNoop, ref, preventDefault, stopPropagation} from "./Tools";
9
+ import {componentDidMount, componentDidUpdate, render, props, state, componentWillUnmount, children, className, PureComponent} from "./ReactConstants";
10
+
11
+ const hover = 'hover',
12
+ allow = 'allow',
13
+ initializer = 'initializer'
14
+ ;
15
+
16
+ const init = that => orNoop(props(that)[initializer])(that);
17
+
18
+ class Droppable extends PureComponent {
19
+
20
+ constructor(properties) {
21
+ super(properties);
22
+ const that = this;
23
+
24
+ that[ReactConstants[2]] = (prevProps) => {
25
+ if (prevProps[initializer] !== props(that)[initializer])
26
+ init(that)
27
+ };
28
+
29
+ that[ReactConstants[0]] = () => {
30
+ init(that)
31
+ };
32
+
33
+ that[ReactConstants[1]] = () => {
34
+ orNoop(that.onUnmount)();
35
+ };
36
+
37
+ that[ReactConstants[3]] = () => {
38
+ const _props = props(that),
39
+ _state = state(that);
40
+ return <div className={
41
+ classNames(
42
+ 'Droppable',
43
+ _props[ReactConstants[5]],
44
+ _state[hover] && hover,
45
+ _state[allow] && allow,
46
+ )}
47
+ onDragOver={e => {
48
+ preventDefault(e);
49
+ stopPropagation(e);
50
+ }}
51
+ ref={ref('element', that)}>
52
+ {_props[ReactConstants[4]]}
53
+ </div>;
54
+ };
55
+ }
56
+ }
57
+
58
+ export default Droppable;
package/src/Dialog.css ADDED
@@ -0,0 +1,36 @@
1
+ .DialogModal {
2
+ overflow: hidden;
3
+ }
4
+ .DialogModal .content {
5
+ top: 20vh;
6
+ }
7
+
8
+ .Dialog {
9
+ background-color: white;
10
+ min-width: 460px;
11
+ max-width: 40vw;
12
+ padding: 15px;
13
+ }
14
+ .Dialog .title {
15
+ margin-bottom: 15px;
16
+ padding: 20px 50px 0px 30px;
17
+ font-size: 1.25rem;
18
+ line-height: 2rem;
19
+ font-weight: 400;
20
+ letter-spacing: 0.0125em;
21
+ }
22
+ .Dialog .description {
23
+ color: rgba(0, 0, 0, 0.54);
24
+ font-size: 1rem;
25
+ line-height: 1.5rem;
26
+ font-weight: 400;
27
+ letter-spacing: 0.03125em;
28
+ margin-top: 20px;
29
+ padding: 0 24px 24px;
30
+ }
31
+ .Dialog > div.row {
32
+ margin-bottom: 15px;
33
+ }
34
+ .Dialog > div.row:last-child {
35
+ margin-bottom: 0;
36
+ }
package/src/Dialog.js ADDED
@@ -0,0 +1,160 @@
1
+ import ReactConstants from "./../ReactConstants";
2
+ import {clientHeight as __clientHeight, clientWidth as __clientWidth, createAccessor as __createAccessor, data as __data, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, props as __props, scrollLeft as __scrollLeft, scrollTop as __scrollTop, state as __state, style as __style, target as __target, top as __top, value as __value, width as __width} from "./../CommonFields";
3
+ import React, {Component} from 'react';
4
+ import {toConsumableArray as __toConsumableArray} from "./../_virtual/_rollupPluginBabelHelpers";
5
+ import {extends as __extends} from "./../_virtual/_rollupPluginBabelHelpers";
6
+ import {inherits as __inherits} from "./../_virtual/_rollupPluginBabelHelpers";
7
+ import './Dialog.css';
8
+ import ReactCreateElement from './ReactCreateElement';
9
+ import './Dialog.css'
10
+ import Button from "./Button";
11
+ import Modal from "./Modal";
12
+ import {isUndefined, orNoop, preventDefault, ref, UNDEFINED, classNames, createRef} from "./Tools";
13
+ import {PureComponent, render, componentDidMount, propsGetter, stateGSs} from "./ReactConstants";
14
+ import PropTypes from "prop-types";
15
+
16
+ class Dialog extends PureComponent {
17
+ constructor(properties) {
18
+ super(properties);
19
+
20
+ this[ReactConstants[3]] = () => {
21
+ const {title, description, accept, cancel, onAccept, onCancel, children} = __props(this);
22
+ return <div className="Dialog">
23
+ {title && <div className="title">{title}</div>}
24
+ {description && <div className="description">{description}</div>}
25
+ {children}
26
+ <div className="row right">
27
+ {cancel && <Button flat={true} onClick={onCancel}>{cancel}</Button>}
28
+ {accept && <Button flat={true} onClick={onAccept}>{accept}</Button>}
29
+ </div>
30
+ </div>
31
+ }
32
+ }
33
+ }
34
+
35
+ Dialog.defaultProps = {
36
+ accept: 'Accept',
37
+ cancel: 'Decline',
38
+ };
39
+
40
+ const throwIfPropExists = (key, props) => {
41
+ if (props[key]) throw Error(key + " was already set by props")
42
+ };
43
+
44
+ class DialogWrapper extends Component {
45
+
46
+ constructor(properties) {
47
+ super(properties);
48
+ const that = this;
49
+ that.state = {};
50
+
51
+ const props = propsGetter(that);
52
+ const openRef = createRef();
53
+ const closeRef = createRef();
54
+
55
+ const [titleState,
56
+ descriptionState,
57
+ onAcceptState,
58
+ onCancelState,
59
+ acceptState,
60
+ cancelState
61
+ ] = stateGSs(that, 6);
62
+
63
+ const onCancel = (e) => {
64
+ preventDefault(e);
65
+ orNoop(props().onCancel || onCancelState())();
66
+ closeRef()();
67
+ };
68
+
69
+ const onAccept = (e) => {
70
+ preventDefault(e);
71
+ orNoop(props().onAccept || onAcceptState())();
72
+ closeRef()();
73
+ };
74
+
75
+ that[ReactConstants[3]] = () => {
76
+ const {top, className, ...other} = props();
77
+ return (
78
+ <Modal
79
+ top={top}
80
+ className={classNames('DialogModal', className)}
81
+ open={openRef}
82
+ close={closeRef}
83
+ onClose={onCancel}
84
+ >
85
+ <Dialog title={titleState()} description={descriptionState()} accept={acceptState()} cancel={cancelState()} {...other} onAccept={onAccept} onCancel={onCancel}/>
86
+ </Modal>
87
+ );
88
+ };
89
+
90
+ that.open = (onAccept, onCancel, title, description, accept, cancel) => {
91
+ titleState(UNDEFINED);
92
+ descriptionState(UNDEFINED);
93
+ onAcceptState(UNDEFINED);
94
+ onCancelState(UNDEFINED);
95
+ acceptState(UNDEFINED);
96
+ cancelState(UNDEFINED);
97
+
98
+ const _props = props();
99
+ if (!isUndefined(onAccept)) {
100
+ throwIfPropExists("onAccept", _props);
101
+ onAcceptState(onAccept);
102
+ }
103
+ if (!isUndefined(onCancel)) {
104
+ throwIfPropExists("onCancel", _props);
105
+ onCancelState(onCancel);
106
+ }
107
+ if (!isUndefined(title)) {
108
+ throwIfPropExists("title", _props);
109
+ titleState(title);
110
+ }
111
+ if (!isUndefined(description)) {
112
+ throwIfPropExists("description", _props);
113
+ descriptionState(description);
114
+ }
115
+ if (!isUndefined(accept)) {
116
+ throwIfPropExists("accept", _props);
117
+ acceptState(accept);
118
+ }
119
+ if (!isUndefined(cancel)) {
120
+ throwIfPropExists("cancel", _props);
121
+ cancelState(cancel);
122
+ }
123
+ openRef()();
124
+ };
125
+
126
+ that[ReactConstants[0]] = () => {
127
+ const _props = props();
128
+ orNoop(_props.open)(that.open);
129
+ orNoop(_props.close)(closeRef());
130
+ _props.show && that.open();
131
+ }
132
+ }
133
+ }
134
+
135
+ export default DialogWrapper;
136
+
137
+ if (process.env.NODE_ENV !== 'production') {
138
+ DialogWrapper.propTypes = {
139
+ title: PropTypes.oneOfType([
140
+ PropTypes.string,
141
+ PropTypes.element
142
+ ]),
143
+ description: PropTypes.oneOfType([
144
+ PropTypes.string,
145
+ PropTypes.element
146
+ ]),
147
+ accept: PropTypes.oneOfType([
148
+ PropTypes.string,
149
+ PropTypes.element
150
+ ]),
151
+ cancel: PropTypes.oneOfType([
152
+ PropTypes.string,
153
+ PropTypes.element
154
+ ]),
155
+ onAccept: PropTypes.func,
156
+ onCancel: PropTypes.func,
157
+ [ReactConstants[5]]: PropTypes.string,
158
+ top: PropTypes.number,
159
+ };
160
+ }
@@ -0,0 +1,42 @@
1
+ .DialogModal {
2
+ overflow: hidden;
3
+
4
+ .content {
5
+ top: 20vh;
6
+ }
7
+ }
8
+
9
+ .Dialog {
10
+ background-color: white;
11
+ min-width: 460px;
12
+ max-width: 40vw;
13
+ padding: 15px;
14
+
15
+ .title {
16
+ margin-bottom: 15px;
17
+ padding: 20px 50px 0px 30px;
18
+ font-size: 1.25rem;
19
+ line-height: 2rem;
20
+ font-weight: 400;
21
+ letter-spacing: .0125em;
22
+ }
23
+
24
+ .description {
25
+ color: rgba(0, 0, 0, .54);
26
+ font-size: 1rem;
27
+ line-height: 1.5rem;
28
+ font-weight: 400;
29
+ letter-spacing: .03125em;
30
+ margin-top: 20px;
31
+ padding: 0 24px 24px;
32
+ }
33
+
34
+
35
+ > div.row {
36
+ margin-bottom: 15px;
37
+
38
+ &:last-child {
39
+ margin-bottom: 0;
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,24 @@
1
+ .DropFileInput {
2
+ flex-grow: 1;
3
+ }
4
+ .DropFileInput .Dropzone {
5
+ border: 1px dashed #808080;
6
+ padding: 12px;
7
+ display: flex;
8
+ flex-flow: row nowrap;
9
+ justify-content: center;
10
+ align-items: center;
11
+ color: gray;
12
+ cursor: pointer;
13
+ border-radius: 3px;
14
+ font-weight: normal;
15
+ line-height: 22px;
16
+ font-size: 14px;
17
+ color: #7E7E7E;
18
+ max-width: 100%;
19
+ word-break: break-all;
20
+ word-break: break-word;
21
+ }
22
+ .DropFileInput .Dropzone .icon.withText {
23
+ margin-right: 10px;
24
+ }