@reactivers/generic-ui 0.1.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.
Files changed (37) hide show
  1. package/.babelrc +3 -0
  2. package/README.md +36 -0
  3. package/dist/bundle.css +1 -0
  4. package/dist/index.cjs.js +1566 -0
  5. package/dist/index.esm.js +1510 -0
  6. package/package.json +68 -0
  7. package/rollup.config.js +36 -0
  8. package/src/components/Badge/index.js +19 -0
  9. package/src/components/Button/index.js +63 -0
  10. package/src/components/Card/index.js +51 -0
  11. package/src/components/ColorPicker/index.js +44 -0
  12. package/src/components/EmptyResult/index.js +30 -0
  13. package/src/components/FadeAnimation/index.js +35 -0
  14. package/src/components/Form/index.js +25 -0
  15. package/src/components/Grid/index.js +1 -0
  16. package/src/components/Header/index.js +20 -0
  17. package/src/components/Image/index.js +63 -0
  18. package/src/components/IncDecField/index.js +35 -0
  19. package/src/components/InfiniteScroll/index.js +150 -0
  20. package/src/components/ListItem/index.js +81 -0
  21. package/src/components/Mapper/index.js +12 -0
  22. package/src/components/Modal/index.js +87 -0
  23. package/src/components/Notification/index.js +69 -0
  24. package/src/components/OverflowImages/index.js +38 -0
  25. package/src/components/Popover/index.js +109 -0
  26. package/src/components/Rate/index.js +33 -0
  27. package/src/components/Section/index.js +26 -0
  28. package/src/components/Selectfield/index.js +63 -0
  29. package/src/components/Show/index.js +15 -0
  30. package/src/components/Tag/index.js +67 -0
  31. package/src/components/TextListField/index.js +85 -0
  32. package/src/components/Textfield/index.js +51 -0
  33. package/src/components/ThreeDot/index.js +22 -0
  34. package/src/components/Upload/index.js +14 -0
  35. package/src/css/index.css +110 -0
  36. package/src/index.js +32 -0
  37. package/src/utils/styles.js +116 -0
@@ -0,0 +1,51 @@
1
+ import React, {useCallback, useRef} from "react";
2
+ import appStyles from "../../utils/styles";
3
+ import Show from "../Show";
4
+
5
+ const Textfield = props => {
6
+ const {
7
+ containerClassName,
8
+ className,
9
+ label,
10
+ prefix,
11
+ suffix,
12
+ value,
13
+ onChange,
14
+ onBlur,
15
+ onPressEnter,
16
+ ...rest
17
+ } = props;
18
+ const input = useRef(null);
19
+
20
+ const focusInput = useCallback(() => {
21
+ if (input.current) input.current.focus()
22
+ }, [input])
23
+
24
+ const onKeyPress = useCallback((e) => {
25
+ if (["enter", "Enter"].indexOf(e.key) > -1)
26
+ if (onPressEnter) onPressEnter(e)
27
+ }, [onPressEnter])
28
+
29
+ return (
30
+ <div className={containerClassName}
31
+ style={{width: '100%'}}>
32
+ <Show condition={label}>
33
+ <p className="no-select" style={{fontWeight: 500}} onClick={focusInput}>{label}</p>
34
+ </Show>
35
+ <div style={{...appStyles.row, alignItems: 'center'}}>
36
+ {prefix}
37
+ <input className={`${className || ""} input`}
38
+ style={{width: '100%'}}
39
+ value={value || ""}
40
+ ref={input}
41
+ onChange={onChange}
42
+ onBlur={onBlur}
43
+ onKeyPress={onKeyPress}
44
+ {...rest}/>
45
+ {suffix}
46
+ </div>
47
+ </div>
48
+ )
49
+ }
50
+
51
+ export default Textfield;
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import Popover from "../Popover";
3
+ import appStyles from "../../utils/styles";
4
+
5
+ const ThreeDot = props => {
6
+ const {title, children} = props;
7
+ return (
8
+ <Popover trigger="mouse"
9
+ alignment="top"
10
+ overlay={
11
+ <div style={appStyles.toolTip}>
12
+ {title || children}
13
+ </div>
14
+ }>
15
+ <div style={appStyles.threeDot}>
16
+ {children}
17
+ </div>
18
+ </Popover>
19
+ )
20
+ }
21
+
22
+ export default ThreeDot;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import UUpload from 'rc-upload'
3
+
4
+ const Upload = props => {
5
+ const {style, ...rest} = props;
6
+ return (
7
+ <UUpload style={{
8
+ outline: 'none',
9
+ ...(style || {})
10
+ }} {...rest} />
11
+ )
12
+ }
13
+
14
+ export default Upload;
@@ -0,0 +1,110 @@
1
+ .select-field {
2
+ width: 100%;
3
+ outline: none;
4
+ border: none;
5
+ padding: 8px;
6
+ background-color: transparent;
7
+ }
8
+
9
+ .grid-item {
10
+ margin: 8px 8px 0 0;
11
+ }
12
+
13
+ .stretch-cell {
14
+ width: 100% !important;
15
+ height: 100% !important;
16
+ }
17
+
18
+ .full-width {
19
+ width: 100% !important;
20
+ }
21
+
22
+ .no-select {
23
+ -webkit-touch-callout: none;
24
+ -webkit-user-select: none;
25
+ -moz-user-select: none;
26
+ -ms-user-select: none;
27
+ user-select: none;
28
+ }
29
+
30
+ .clickable:hover {
31
+ background-color: #eeeeee !important;
32
+ opacity: 0.8;
33
+ cursor: pointer;
34
+ transition: 0.4s;
35
+ }
36
+
37
+ .clickable {
38
+ background-color: transparent;
39
+ transition: 0.4s;
40
+ }
41
+
42
+ .clickable:active {
43
+ opacity: 0.5;
44
+ transition: 0.4s;
45
+ }
46
+
47
+ .center {
48
+ display: flex !important;
49
+ justify-content: center;
50
+ align-items: center;
51
+ flex-shrink: 0;
52
+ }
53
+
54
+ .center-column {
55
+ display: flex !important;
56
+ justify-content: center;
57
+ align-items: center;
58
+ flex-direction: column;
59
+ }
60
+
61
+ .rounded-image-container {
62
+ background-color: #eee;
63
+ overflow: hidden;
64
+ }
65
+
66
+ .rounded-image {
67
+ width: 100%;
68
+ height: 100%;
69
+ object-fit: cover;
70
+ border-radius: 50%;
71
+ }
72
+
73
+ .spread-horizontally {
74
+ display: flex;
75
+ justify-content: space-between;
76
+ align-items: center;
77
+ }
78
+
79
+ .three-dot {
80
+ white-space: nowrap;
81
+ display: block;
82
+ overflow: hidden;
83
+ text-overflow: ellipsis;
84
+ }
85
+
86
+ .fade-in {
87
+ animation: fade-in 2s backwards;
88
+ }
89
+
90
+ @keyframes fade-in {
91
+ from {
92
+ opacity: 0;
93
+ }
94
+ to {
95
+ opacity: 1;
96
+ }
97
+ }
98
+
99
+
100
+ @media (min-width: 768px) {
101
+ .show-mobil {
102
+ display: none !important;
103
+ }
104
+ }
105
+
106
+ @media (max-width: 767px) {
107
+ .show-desktop {
108
+ display: none !important;
109
+ }
110
+ }
package/src/index.js ADDED
@@ -0,0 +1,32 @@
1
+ import "./css/index.css";
2
+
3
+ export { default as Badge } from './components/Badge';
4
+ export { default as Button } from './components/Button';
5
+ export { default as Card } from './components/Card';
6
+ export { default as ColorPicker } from './components/ColorPicker';
7
+ export { default as EmptyResult } from './components/EmptyResult';
8
+ export { default as FadeAnimation } from './components/FadeAnimation';
9
+ export { Field, Form, useForm } from './components/Form';
10
+ export { Col, Grid, Row } from './components/Grid';
11
+ export { default as Header } from './components/Header';
12
+ export { default as Image } from './components/Image';
13
+ export { default as IncDecField } from './components/IncDecField';
14
+ export { default as InfiniteScroll } from './components/InfiniteScroll';
15
+ export { default as ListItem } from './components/ListItem';
16
+ export { default as Mapper } from './components/Mapper';
17
+ export { default as Modal } from './components/Modal';
18
+ export { default as notification, notificationPusher } from './components/Notification';
19
+ export { default as OverflowImages } from './components/OverflowImages';
20
+ export { default as Popover } from './components/Popover';
21
+ export { default as Rate } from './components/Rate';
22
+ export { default as Section } from './components/Section';
23
+ export { default as Selectfield } from './components/Selectfield';
24
+ export { default as Show } from './components/Show';
25
+ export { default as Tag } from './components/Tag';
26
+ export { default as Textfield } from './components/Textfield';
27
+ export { default as TextListField } from './components/TextListField';
28
+ export { default as ThreeDot } from './components/ThreeDot';
29
+ export { default as Upload } from './components/Upload';
30
+ export { default as appStyles } from './utils/styles';
31
+
32
+
@@ -0,0 +1,116 @@
1
+ const appStyles = {
2
+ stretchRow: {
3
+ display: 'flex',
4
+ alignItems: 'stretch',
5
+ flexFlow: 'row wrap'
6
+ },
7
+ defaultShadow: {
8
+ boxShadow: "0 0 5px -2.75px black",
9
+ },
10
+ cardBorderRadius: {
11
+ borderBottomLeftRadius: 20,
12
+ borderTopRightRadius: 20,
13
+ borderBottomRightRadius: 20,
14
+ },
15
+ borderBottom: {
16
+ borderBottomWidth: 1,
17
+ borderBottomColor: '#eee'
18
+ },
19
+ center: {
20
+ display: "flex",
21
+ justifyContent: "center",
22
+ alignItems: 'center',
23
+ flexShrink: 0
24
+ },
25
+ centerInColumn: {
26
+ display: "flex",
27
+ justifyContent: "center",
28
+ alignItems: 'center',
29
+ flexDirection: 'column'
30
+ },
31
+ secondaryText: {
32
+ color: '#aaa'
33
+ },
34
+ imageStyle: {
35
+ height: "100%",
36
+ width: '100%',
37
+ borderRadius: 20,
38
+ resizeMode: 'contain',
39
+ },
40
+ listHeader: {
41
+ fontSize: 18,
42
+ fontWeight: 'bold'
43
+ },
44
+ spreadHorizontally: {
45
+ display: 'flex',
46
+ flexDirection: 'row',
47
+ justifyContent: 'space-between',
48
+ alignItems: 'center'
49
+ },
50
+ paddingHorizontal: (value) => ({
51
+ paddingLeft: value,
52
+ paddingRight: value
53
+ }),
54
+ paddingVertical: (value) => ({
55
+ paddingTop: value,
56
+ paddingBottom: value
57
+ }),
58
+ marginHorizontal: (value) => ({
59
+ marginLeft: value,
60
+ marginRight: value
61
+ }),
62
+ marginVertical: (value) => ({
63
+ marginTop: value,
64
+ marginBottom: value
65
+ }),
66
+ row: {
67
+ display: 'flex',
68
+ flexDirection: 'row'
69
+ },
70
+ card: {
71
+ backgroundColor: 'white',
72
+ },
73
+ grid: {
74
+ display: 'flex',
75
+ flexDirection: 'row',
76
+ flexWrap: 'wrap',
77
+ flexShrink: 'initial'
78
+ },
79
+ cardTitle: {
80
+ fontSize: 24,
81
+ fontWeight: 'bold',
82
+ color: 'black',
83
+ },
84
+ cardSubtitle: {
85
+ marginTop: 8,
86
+ marginBottom: 8,
87
+ fontSize: 14,
88
+ fontWeight: '300'
89
+ },
90
+ rounded: size => ({
91
+ width: size,
92
+ height: size,
93
+ borderRadius: size * 2
94
+ }),
95
+ roundedImage: {
96
+ width: '100%',
97
+ objectFit: "cover",
98
+ borderRadius: "50%"
99
+ },
100
+ threeDot: {
101
+ whiteSpace: 'nowrap',
102
+ width: '100%',
103
+ display: 'inline-block',
104
+ textOverflow: 'ellipsis',
105
+ overflow: 'hidden',
106
+ },
107
+ toolTip: {
108
+ backgroundColor: 'rgba(0,0,0,0.7)',
109
+ color: 'white',
110
+ padding: "2px 6px",
111
+ borderRadius: 10
112
+ }
113
+ }
114
+
115
+
116
+ export default appStyles