@xaypay/tui 0.0.105 → 0.0.107

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 (93) hide show
  1. package/.eslintrc.js +30 -0
  2. package/.husky/pre-commit +4 -0
  3. package/.prettierrc +10 -0
  4. package/.storybook/main.js +42 -45
  5. package/.storybook/preview.js +7 -7
  6. package/cli-command.js +1 -1
  7. package/dist/index.es.js +105 -94
  8. package/dist/index.js +105 -94
  9. package/package.json +16 -4
  10. package/rollup.config.js +11 -11
  11. package/src/assets_old/icons/demo-files/demo.js +16 -18
  12. package/src/components/autocomplate/autocomplate.stories.js +30 -28
  13. package/src/components/autocomplate/index.js +145 -127
  14. package/src/components/button/button.stories.js +6 -6
  15. package/src/components/button/index.js +176 -126
  16. package/src/components/captcha/captcha.stories.js +12 -8
  17. package/src/components/captcha/index.js +47 -50
  18. package/src/components/checkbox/checkbox.stories.js +7 -7
  19. package/src/components/checkbox/index.js +77 -93
  20. package/src/components/file/file.stories.js +15 -15
  21. package/src/components/file/index.js +114 -116
  22. package/src/components/icon/Arrow.js +18 -18
  23. package/src/components/icon/CaptchaArrowDown.js +18 -18
  24. package/src/components/icon/CaptchaArrowUp.js +18 -18
  25. package/src/components/icon/CheckboxChecked.js +20 -20
  26. package/src/components/icon/CheckboxUnchecked.js +20 -20
  27. package/src/components/icon/Close.js +18 -18
  28. package/src/components/icon/CloseIcon.js +18 -18
  29. package/src/components/icon/CloseSlide.js +18 -18
  30. package/src/components/icon/DeleteComponent.js +19 -19
  31. package/src/components/icon/Dots.js +18 -18
  32. package/src/components/icon/HeartFilled.js +22 -23
  33. package/src/components/icon/HeartOutline.js +22 -22
  34. package/src/components/icon/Icon.js +3 -5
  35. package/src/components/icon/ListItemDelete.js +18 -18
  36. package/src/components/icon/ListItemJpeg.js +20 -20
  37. package/src/components/icon/ListItemJpg.js +20 -20
  38. package/src/components/icon/ListItemPdf.js +20 -20
  39. package/src/components/icon/ListItemPng.js +20 -20
  40. package/src/components/icon/Next.js +19 -19
  41. package/src/components/icon/Nextarrow.js +18 -18
  42. package/src/components/icon/PDF.js +18 -18
  43. package/src/components/icon/Prev.js +19 -19
  44. package/src/components/icon/RangeArrowDefault.js +41 -52
  45. package/src/components/icon/RangeArrowError.js +41 -52
  46. package/src/components/icon/RangeArrowSuccess.js +41 -52
  47. package/src/components/icon/RemoveFile.js +19 -19
  48. package/src/components/icon/ToasterClose.js +18 -18
  49. package/src/components/icon/ToasterError.js +18 -18
  50. package/src/components/icon/ToasterInfo.js +18 -18
  51. package/src/components/icon/ToasterSuccess.js +18 -18
  52. package/src/components/icon/ToasterWarning.js +18 -18
  53. package/src/components/icon/Tooltip.js +18 -18
  54. package/src/components/icon/Upload.js +24 -24
  55. package/src/components/input/index.js +267 -224
  56. package/src/components/input/input.stories.js +20 -21
  57. package/src/components/modal/index.js +172 -159
  58. package/src/components/modal/modal.stories.js +79 -78
  59. package/src/components/newAutocomplete/NewAutocomplete.stories.js +93 -51
  60. package/src/components/newAutocomplete/index.js +342 -216
  61. package/src/components/newFile/fileItem.js +214 -191
  62. package/src/components/newFile/index.js +235 -173
  63. package/src/components/newFile/newFile.stories.js +32 -35
  64. package/src/components/pagination/index.js +97 -122
  65. package/src/components/pagination/pagination.stories.js +362 -362
  66. package/src/components/pagination/paginationRange.js +42 -53
  67. package/src/components/radio/index.js +49 -62
  68. package/src/components/radio/radio.stories.js +7 -7
  69. package/src/components/select/index.js +318 -223
  70. package/src/components/select/select.stories.js +25 -14
  71. package/src/components/singleCheckbox/Checkbox.js +31 -34
  72. package/src/components/singleCheckbox/index.js +36 -45
  73. package/src/components/singleCheckbox/singleCheckbox.stories.js +16 -16
  74. package/src/components/stepper/index.js +35 -30
  75. package/src/components/stepper/stepper.stories.js +11 -11
  76. package/src/components/table/index.js +280 -148
  77. package/src/components/table/table.stories.js +105 -217
  78. package/src/components/table/td.js +80 -72
  79. package/src/components/table/th.js +19 -16
  80. package/src/components/textarea/index.js +86 -62
  81. package/src/components/textarea/textarea.stories.js +10 -13
  82. package/src/components/toaster/Toast.js +180 -158
  83. package/src/components/toaster/index.js +108 -111
  84. package/src/components/toaster/toaster.module.css +13 -0
  85. package/src/components/toaster/toaster.stories.js +582 -367
  86. package/src/components/tooltip/index.js +79 -46
  87. package/src/components/tooltip/tooltip.stories.js +9 -10
  88. package/src/components/typography/index.js +108 -101
  89. package/src/components/typography/typography.stories.js +16 -19
  90. package/src/index.js +20 -20
  91. package/src/stories/configuration.stories.mdx +1 -0
  92. package/src/utils/index.js +11 -11
  93. package/tui.config.js +343 -340
@@ -1,213 +1,236 @@
1
- import React, { useEffect, useState } from 'react';
2
-
3
- import SvgListItemPdf from './../icon/ListItemPdf';
4
- import SvgListItemJpg from './../icon/ListItemJpg';
5
- import SvgListItemPng from './../icon/ListItemPng';
6
- import SvgListItemJpeg from './../icon/ListItemJpeg';
7
- import SvgListItemDelete from './../icon/ListItemDelete';
8
-
9
- const FileItem = React.memo(({
10
- size,
11
- name,
12
- uuid,
13
- check,
14
- radius,
15
- status,
16
- removeFile,
17
- fileFormat,
18
- progressColor,
19
- listItemHeight,
20
- listItemPadding,
21
- progressFontSize,
22
- listItemErrorSize,
23
- listItemErrorColor,
24
- progressTrackColor,
25
- progressFailedColor,
26
- progressSuccessColor,
27
- progressLoadingColor,
28
- listItemBackgroundColor,
29
- listItemBackgroundErrorColor
30
- }) => {
31
- const [i, setI] = useState(_ => _);
32
- const [t, setT] = useState(_ => _);
33
- const [progress, setProgress] = useState(7);
34
-
35
- const handleRemoveItem = (id) => {
36
- removeFile(id);
37
- };
38
-
39
- useEffect(() => {
40
- let time = Math.floor(Math.random() * (1100 - 900 + 1)) + 900;
41
- let fileSizeInMB = Math.round(size / (1024 * 1024));
42
- if (fileSizeInMB > 5) {
43
- const times = [
44
- Math.floor(Math.random() * (1700 - 1300 + 1)) + 1300,
45
- Math.floor(Math.random() * (3200 - 2800 + 1)) + 2800,
46
- Math.floor(Math.random() * (4700 - 4300 + 1)) + 4300,
47
- Math.floor(Math.random() * (6200 - 5800 + 1)) + 5800,
48
- Math.floor(Math.random() * (7700 - 7300 + 1)) + 7300
49
- ];
50
- const index = Math.min(Math.floor((size - 1) / 15), times.length - 1);
51
- time = times[index];
52
- }
53
- setI(setInterval(() => {
54
- setProgress(prev => {
55
- return prev += 7;
56
- });
57
- }, time));
58
- return () => {
59
- setI(_ => _);
60
- clearTimeout(t);
61
- clearInterval(i);
62
- };
63
- }, []);
64
-
65
- useEffect(() => {
66
- if (progress > 84) {
67
- clearInterval(i);
68
- }
69
- }, [progress]);
70
-
71
- useEffect(() => {
72
- if (status === 'success') {
73
- setProgress(100);
74
- clearInterval(i);
1
+ import React, { useEffect, useState } from 'react'
2
+
3
+ import SvgListItemPdf from './../icon/ListItemPdf'
4
+ import SvgListItemJpg from './../icon/ListItemJpg'
5
+ import SvgListItemPng from './../icon/ListItemPng'
6
+ import SvgListItemJpeg from './../icon/ListItemJpeg'
7
+ import SvgListItemDelete from './../icon/ListItemDelete'
8
+
9
+ // eslint-disable-next-line react/display-name
10
+ const FileItem = React.memo(
11
+ ({
12
+ size,
13
+ name,
14
+ uuid,
15
+ check,
16
+ radius,
17
+ status,
18
+ removeFile,
19
+ fileFormat,
20
+ progressColor,
21
+ listItemHeight,
22
+ listItemPadding,
23
+ progressFontSize,
24
+ listItemErrorSize,
25
+ timeForRemoveError,
26
+ listItemErrorColor,
27
+ progressTrackColor,
28
+ progressFailedColor,
29
+ progressSuccessColor,
30
+ progressLoadingColor,
31
+ listItemBackgroundColor,
32
+ listItemBackgroundErrorColor,
33
+ }) => {
34
+ const [i, setI] = useState((_) => _)
35
+ const [t, setT] = useState((_) => _)
36
+ const [progress, setProgress] = useState(7)
37
+
38
+ const handleRemoveItem = (id) => {
39
+ removeFile(id)
75
40
  }
76
41
 
77
- if (status === 'failed') {
78
- setProgress(0);
79
- clearInterval(i);
80
- }
81
- }, [status]);
42
+ useEffect(() => {
43
+ let time = Math.floor(Math.random() * (1100 - 900 + 1)) + 900
44
+ let fileSizeInMB = Math.round(size / (1024 * 1024))
45
+ if (fileSizeInMB > 5) {
46
+ const times = [
47
+ Math.floor(Math.random() * (1700 - 1300 + 1)) + 1300,
48
+ Math.floor(Math.random() * (3200 - 2800 + 1)) + 2800,
49
+ Math.floor(Math.random() * (4700 - 4300 + 1)) + 4300,
50
+ Math.floor(Math.random() * (6200 - 5800 + 1)) + 5800,
51
+ Math.floor(Math.random() * (7700 - 7300 + 1)) + 7300,
52
+ ]
53
+ const index = Math.min(Math.floor((size - 1) / 15), times.length - 1)
54
+ time = times[index]
55
+ }
56
+ setI(
57
+ setInterval(() => {
58
+ setProgress((prev) => {
59
+ return (prev += 7)
60
+ })
61
+ }, time)
62
+ )
63
+ return () => {
64
+ setI((_) => _)
65
+ clearTimeout(t)
66
+ clearInterval(i)
67
+ }
68
+ }, [])
82
69
 
83
- useEffect(() => {
84
- if (check !== '') {
85
- setT(setTimeout(() => {
86
- removeFile(uuid);
87
- }, 3500));
88
- }
89
- }, [check]);
90
-
91
- return (
92
- <div
93
- style={{
94
- width: '100%',
95
- display: 'flex',
96
- marginTop: '6px',
97
- alignItems: 'center',
98
- borderRadius: radius,
99
- height: listItemHeight,
100
- boxSizing: 'border-box',
101
- padding: listItemPadding,
102
- flexDirection: check !== '' ? 'column' : 'row',
103
- justifyContent: check !== '' ? 'space-around' : 'space-between',
104
- backgroundColor: check !== '' ? listItemBackgroundErrorColor : listItemBackgroundColor
105
- }}
106
- >
107
- {
108
- check !== ''
109
- ? <>
110
- <p style={{
111
- margin: '0px',
112
- color: listItemErrorColor,
113
- fontSize: listItemErrorSize
114
- }}>{ name }</p>
115
- <p style={{
116
- margin: '0px',
117
- color: listItemErrorColor,
118
- fontSize: listItemErrorSize
119
- }}>{ check }</p>
120
- </>
121
- : <>
122
- <div
123
- style={{
124
- width: '32px'
125
- }}
126
- >
127
- {
128
- fileFormat === 'pdf' ? <SvgListItemPdf /> :
129
- fileFormat === 'jpg' ? <SvgListItemJpg /> :
130
- fileFormat === 'png' ? <SvgListItemPng /> :
131
- fileFormat === 'jpeg' ? <SvgListItemJpeg /> : ''
132
- }
133
- </div>
70
+ useEffect(() => {
71
+ if (progress > 84) {
72
+ clearInterval(i)
73
+ }
74
+ }, [progress])
134
75
 
76
+ useEffect(() => {
77
+ if (status === 'success') {
78
+ setProgress(100)
79
+ clearInterval(i)
80
+ }
135
81
 
136
- <div
137
- style={{
138
- position: 'relative',
139
- display: 'flex',
140
- height: '40px',
141
- margin: '0px 14px',
142
- alignItems: 'flex-end',
143
- width: 'calc(100% - 82px)'
144
- }}
145
- >
82
+ if (status === 'failed') {
83
+ setProgress(0)
84
+ clearInterval(i)
85
+ }
86
+ }, [status])
87
+
88
+ useEffect(() => {
89
+ if (check !== '') {
90
+ setT(
91
+ setTimeout(() => {
92
+ removeFile(uuid)
93
+ }, timeForRemoveError)
94
+ )
95
+ }
96
+ }, [check])
97
+
98
+ return (
99
+ <div
100
+ style={{
101
+ width: '100%',
102
+ display: 'flex',
103
+ marginTop: '6px',
104
+ alignItems: 'center',
105
+ borderRadius: radius,
106
+ height: listItemHeight,
107
+ boxSizing: 'border-box',
108
+ padding: listItemPadding,
109
+ flexDirection: check !== '' ? 'column' : 'row',
110
+ justifyContent: check !== '' ? 'space-around' : 'space-between',
111
+ backgroundColor: check !== '' ? listItemBackgroundErrorColor : listItemBackgroundColor,
112
+ }}
113
+ >
114
+ {check !== '' ? (
115
+ <>
116
+ <p
117
+ style={{
118
+ margin: '0px',
119
+ color: listItemErrorColor,
120
+ fontSize: listItemErrorSize,
121
+ }}
122
+ >
123
+ {name}
124
+ </p>
125
+ <p
126
+ style={{
127
+ margin: '0px',
128
+ color: listItemErrorColor,
129
+ fontSize: listItemErrorSize,
130
+ }}
131
+ >
132
+ {check}
133
+ </p>
134
+ </>
135
+ ) : (
136
+ <>
146
137
  <div
147
138
  style={{
148
- width: '100%',
149
- height: '100%',
150
- display: 'flex',
151
- paddingTop: '5px',
152
- color: progressColor,
153
- boxSizing: 'border-box',
154
- alignItems: 'flex-start',
155
- fontSize: progressFontSize,
156
- justifyContent: 'space-between'
139
+ width: '32px',
157
140
  }}
158
141
  >
159
- <p
160
- style={{
161
- margin: '0px',
162
- overflow: 'hidden',
163
- whiteSpace: 'nowrap',
164
- textOverflow: 'ellipsis',
165
- maxWidth: 'calc(100% - 56px)'
166
- }}
167
- >{name}</p>
168
-
169
- <span>
170
- {progress} %
171
- </span>
142
+ {fileFormat === 'pdf' ? (
143
+ <SvgListItemPdf />
144
+ ) : fileFormat === 'jpg' ? (
145
+ <SvgListItemJpg />
146
+ ) : fileFormat === 'png' ? (
147
+ <SvgListItemPng />
148
+ ) : fileFormat === 'jpeg' ? (
149
+ <SvgListItemJpeg />
150
+ ) : (
151
+ ''
152
+ )}
172
153
  </div>
173
154
 
174
155
  <div
175
156
  style={{
176
- position: 'absolute',
177
- left: '0px',
178
- bottom: '5px',
179
- width: '100%',
180
- height: '4px',
181
- borderRadius: '10px',
182
- backgroundColor: progressTrackColor
157
+ position: 'relative',
158
+ display: 'flex',
159
+ height: '40px',
160
+ margin: '0px 14px',
161
+ alignItems: 'flex-end',
162
+ width: 'calc(100% - 82px)',
183
163
  }}
184
164
  >
185
165
  <div
186
166
  style={{
167
+ width: '100%',
187
168
  height: '100%',
169
+ display: 'flex',
170
+ paddingTop: '5px',
171
+ color: progressColor,
172
+ boxSizing: 'border-box',
173
+ alignItems: 'flex-start',
174
+ fontSize: progressFontSize,
175
+ justifyContent: 'space-between',
176
+ }}
177
+ >
178
+ <p
179
+ style={{
180
+ margin: '0px',
181
+ overflow: 'hidden',
182
+ whiteSpace: 'nowrap',
183
+ textOverflow: 'ellipsis',
184
+ maxWidth: 'calc(100% - 56px)',
185
+ }}
186
+ >
187
+ {name}
188
+ </p>
189
+
190
+ <span>{progress} %</span>
191
+ </div>
192
+
193
+ <div
194
+ style={{
195
+ position: 'absolute',
196
+ left: '0px',
197
+ bottom: '5px',
198
+ width: '100%',
199
+ height: '4px',
188
200
  borderRadius: '10px',
189
- width: status === 'failed' ? '100%' : progress + '%',
190
- backgroundColor: status === 'success' ? progressSuccessColor : status === 'failed' ? progressFailedColor : progressLoadingColor
201
+ backgroundColor: progressTrackColor,
191
202
  }}
192
- ></div>
203
+ >
204
+ <div
205
+ style={{
206
+ height: '100%',
207
+ borderRadius: '10px',
208
+ width: status === 'failed' ? '100%' : progress + '%',
209
+ backgroundColor:
210
+ status === 'success'
211
+ ? progressSuccessColor
212
+ : status === 'failed'
213
+ ? progressFailedColor
214
+ : progressLoadingColor,
215
+ }}
216
+ ></div>
217
+ </div>
193
218
  </div>
194
219
 
195
- </div>
196
-
197
-
198
- <div
199
- style={{
200
- width: '22px',
201
- cursor: 'pointer'
202
- }}
203
- onClick={() => handleRemoveItem(uuid)}
204
- >
205
- <SvgListItemDelete />
206
- </div>
207
- </>
208
- }
209
- </div>
210
- )
211
- });
212
-
213
- export default FileItem;
220
+ <div
221
+ style={{
222
+ width: '22px',
223
+ cursor: 'pointer',
224
+ }}
225
+ onClick={() => handleRemoveItem(uuid)}
226
+ >
227
+ <SvgListItemDelete />
228
+ </div>
229
+ </>
230
+ )}
231
+ </div>
232
+ )
233
+ }
234
+ )
235
+
236
+ export default FileItem