@xaypay/tui 0.0.80 → 0.0.82

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 (57) hide show
  1. package/dist/index.es.js +220 -146
  2. package/dist/index.js +220 -146
  3. package/package.json +1 -1
  4. package/src/assets/attach.svg +4 -0
  5. package/src/assets/delete.svg +4 -0
  6. package/src/assets/down-arrow.svg +4 -0
  7. package/src/assets/minus.svg +4 -0
  8. package/src/assets/plus.svg +4 -0
  9. package/src/assets/up-arrow.svg +4 -0
  10. package/src/components/icon/Arrow.js +2 -2
  11. package/src/components/icon/CaptchaArrowDown.js +2 -2
  12. package/src/components/icon/CaptchaArrowUp.js +2 -2
  13. package/src/components/icon/CheckboxChecked.js +2 -2
  14. package/src/components/icon/CheckboxUnchecked.js +2 -2
  15. package/src/components/icon/Close.js +2 -2
  16. package/src/components/icon/CloseIcon.js +2 -2
  17. package/src/components/icon/CloseSlide.js +2 -2
  18. package/src/components/icon/DeleteComponent.js +2 -2
  19. package/src/components/icon/Dots.js +2 -2
  20. package/src/components/icon/HeartFilled.js +2 -2
  21. package/src/components/icon/HeartOutline.js +2 -2
  22. package/src/components/icon/ListItemDelete.js +2 -2
  23. package/src/components/icon/ListItemJpeg.js +2 -2
  24. package/src/components/icon/ListItemJpg.js +2 -2
  25. package/src/components/icon/ListItemPdf.js +2 -2
  26. package/src/components/icon/ListItemPng.js +2 -2
  27. package/src/components/icon/Next.js +2 -2
  28. package/src/components/icon/Nextarrow.js +2 -2
  29. package/src/components/icon/PDF.js +2 -2
  30. package/src/components/icon/Prev.js +2 -2
  31. package/src/components/icon/RangeArrowDefault.js +2 -2
  32. package/src/components/icon/RangeArrowError.js +2 -2
  33. package/src/components/icon/RangeArrowSuccess.js +2 -2
  34. package/src/components/icon/RemoveFile.js +2 -2
  35. package/src/components/icon/ToasterClose.js +2 -2
  36. package/src/components/icon/ToasterError.js +2 -2
  37. package/src/components/icon/ToasterInfo.js +2 -2
  38. package/src/components/icon/ToasterSuccess.js +2 -2
  39. package/src/components/icon/ToasterWarning.js +2 -2
  40. package/src/components/icon/Tooltip.js +2 -2
  41. package/src/components/icon/Upload.js +2 -2
  42. package/src/components/input/index.js +11 -21
  43. package/src/components/modal/index.js +28 -20
  44. package/src/components/modal/modal.stories.js +1 -1
  45. package/src/components/newAutocomplete/index.js +9 -5
  46. package/src/components/newFile/index.js +4 -3
  47. package/src/components/select/index.js +9 -2
  48. package/src/components/singleCheckbox/index.js +27 -5
  49. package/src/components/table/index.js +70 -97
  50. package/src/components/table/table.module.css +28 -0
  51. package/src/components/table/table.stories.js +391 -172
  52. package/src/components/table/td.js +133 -0
  53. package/src/components/table/th.js +55 -0
  54. package/src/components/textarea/index.js +21 -15
  55. package/src/components/textarea/textarea.stories.js +4 -0
  56. package/src/stories/configuration.stories.mdx +17 -5
  57. package/tui.config.js +18 -7
@@ -1,11 +1,14 @@
1
- import React from 'react';
1
+ import React, { useState, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
+ import TH from './th';
5
+ import TD from './td';
6
+
4
7
  import { compereConfigs } from './../../utils';
5
8
 
6
9
  const Table = ({
7
- tableHeadItems,
8
- tableBodyItems,
10
+ dataBody,
11
+ dataHeader,
9
12
 
10
13
  tHeadColor,
11
14
  tHeadFamily,
@@ -22,22 +25,36 @@ const Table = ({
22
25
  tBodyFontFamily,
23
26
 
24
27
  tBodyRowBorder,
25
- tBodyMarginTop,
28
+
29
+ handleCheckedBody,
30
+ handleCheckedHeader,
31
+ handleHeaderItemClick,
32
+ handleBodyActionClick
26
33
  }) => {
34
+ const [body, setBody] = useState([]);
35
+ const [header, setHeader] = useState([]);
27
36
 
28
37
  const configStyles = compereConfigs();
29
38
 
39
+ useEffect(() => {
40
+ setBody(dataBody);
41
+ }, [dataBody]);
42
+
43
+ useEffect(() => {
44
+ setHeader(dataHeader);
45
+ }, [dataHeader]);
46
+
30
47
  return (
31
48
  <>
32
49
  <table
33
50
  style={{
34
- width: '1475px',
51
+ width: '2000px',
35
52
  borderCollapse: 'collapse'
36
53
  }}
37
54
  >
38
55
 
39
56
  {
40
- tableHeadItems && tableHeadItems.length > 0 && <thead>
57
+ header && header.length > 0 && <thead>
41
58
  <tr
42
59
  style={{
43
60
  color: tHeadColor ? tHeadColor : configStyles.TABLE.tHeadColor,
@@ -45,21 +62,19 @@ const Table = ({
45
62
  }}
46
63
  >
47
64
  {
48
- tableHeadItems.map((item, index) => {
65
+ header.map((item, index) => {
49
66
  return (
50
- <th
67
+ <TH
68
+ item={item}
51
69
  key={`${item}_${index}`}
52
- style={{
53
- cursor: 'pointer',
54
- padding: tHeadPadding ? tHeadPadding : configStyles.TABLE.tHeadPadding,
55
- fontFamily: tHeadFamily ? tHeadFamily : configStyles.TABLE.tHeadFamily,
56
- fontWeight: tHeadFontWeight ? tHeadFontWeight : configStyles.TABLE.tHeadFontWeight,
57
- borderTopLeftRadius: index === 0 ? tHeadBorderRadius ? tHeadBorderRadius : configStyles.TABLE.tHeadBorderRadius : '0px',
58
- borderTopRightRadius: index === tableHeadItems.length - 1 ? tHeadBorderRadius ? tHeadBorderRadius : configStyles.TABLE.tHeadBorderRadius : '0px'
59
- }}
60
- >
61
- {item.type === 'show' ? item.content : ''}
62
- </th>
70
+ tHeadFamily={tHeadFamily ? tHeadFamily : configStyles.TABLE.tHeadFamily}
71
+ handleCheckedHeader={handleCheckedHeader ? handleCheckedHeader : _ => _}
72
+ tHeadPadding={tHeadPadding ? tHeadPadding : configStyles.TABLE.tHeadPadding}
73
+ handleHeaderItemClick={handleHeaderItemClick ? handleHeaderItemClick : _ => _}
74
+ tHeadFontWeight={tHeadFontWeight ? tHeadFontWeight : configStyles.TABLE.tHeadFontWeight}
75
+ borderTopLeftRadius={index === 0 ? tHeadBorderRadius ? tHeadBorderRadius : configStyles.TABLE.tHeadBorderRadius : '0px'}
76
+ borderTopRightRadius={index === header.length - 1 ? tHeadBorderRadius ? tHeadBorderRadius : configStyles.TABLE.tHeadBorderRadius : '0px'}
77
+ />
63
78
  )
64
79
  })
65
80
  }
@@ -68,87 +83,41 @@ const Table = ({
68
83
  }
69
84
 
70
85
  {
71
- tableBodyItems && tableBodyItems.length > 0 && <tbody
86
+ body && body.length > 0 && <tbody
72
87
  style={{
73
- overflow: 'auto',
74
88
  boxShadow: '0px 10px 30px rgba(0, 35, 106, 0.06)'
75
89
  }}
76
90
  >
77
-
78
91
  {
79
-
80
- tableBodyItems.map((item, index) => {
81
- const monst = Object.entries(item);
92
+ body.map((item, index) => {
82
93
  return (
83
- <>
84
- {/* {
85
- tBodyMarginTop ? tBodyMarginTop : configStyles.TABLE.tBodyMarginTop && index === 0 && <tr>
86
- <td
87
- style={{
88
- height: tBodyMarginTop ? tBodyMarginTop : configStyles.TABLE.tBodyMarginTop
89
- }}
90
- >
91
- </td>
92
- </tr>
93
- } */}
94
-
95
- <tr
96
- key={`${item.id}_${index}`}
97
- style={{
98
- borderBottom: index === tableBodyItems.length - 1 ? 'none' : tBodyRowBorder ? tBodyRowBorder : configStyles.TABLE.tBodyRowBorder
99
- }}
100
- >
101
- {
102
- Object.values(item).map((innerItem, innerIndex) => {
103
- if (monst[innerIndex][0] !== 'id') {
104
- return (
105
- <td
106
- key={`${innerItem}_${innerIndex}`}
107
- style={{
108
- color: tBodyColor ? tBodyColor : configStyles.TABLE.tBodyColor,
109
- padding: tBodyPadding ? tBodyPadding : configStyles.TABLE.tBodyPadding,
110
- fontSize: tBodyFontSize ? tBodyFontSize : configStyles.TABLE.tBodyFontSize,
111
- textAlign: tBodyTextAlign ? tBodyTextAlign : configStyles.TABLE.tBodyTextAlign,
112
- fontFamily: tBodyFontFamily ? tBodyFontFamily : configStyles.TABLE.tBodyFontFamily,
113
- fontWeight: tBodyFontWeight ? tBodyFontWeight : configStyles.TABLE.tBodyFontWeight,
114
- borderRight: innerIndex === Object.values(item).length - 1 ? 'none' : configStyles.TABLE.tBodyRowBorder
115
- }}
116
- >
117
- {
118
- Array.isArray(innerItem)
119
- ? innerItem.length > 0
120
- ? innerItem.map((newItem, newIndex) => {
121
- if (newItem && !Array.isArray(newItem) && typeof newItem === 'object') {
122
- return Object.values(newItem).map((actionItem, actionIndex) => {
123
- return (
124
- <span
125
- key={`${actionItem}_${actionIndex}`}
126
- style={{
127
- cursor: 'pointer'
128
- }}
129
- >
130
- { actionItem }
131
- </span>
132
- )
133
- })
134
- } else {
135
- return <span
136
- key={`${newItem}_${newIndex}`}
137
- >
138
- {newItem}
139
- </span>
140
- }
141
- })
142
- : ''
143
- : innerItem
144
- }
145
- </td>
146
- )
147
- }
148
- })
149
- }
150
- </tr>
151
- </>
94
+ <tr
95
+ key={`${item}_${index}`}
96
+ style={{
97
+ borderBottom: index === body.length - 1 ? 'none' : tBodyRowBorder ? tBodyRowBorder : configStyles.TABLE.tBodyRowBorder
98
+ }}
99
+ >
100
+ {
101
+ Object.values(item).map((innerItem, innerIndex) => {
102
+ return (
103
+ <TD
104
+ item={innerItem}
105
+ id={item.id ? item.id : ''}
106
+ key={`${innerItem}_${innerIndex}`}
107
+ handleCheckedBody={handleCheckedBody ? handleCheckedBody : _ => _}
108
+ tBodyColor={tBodyColor ? tBodyColor : configStyles.TABLE.tBodyColor}
109
+ tBodyPadding={tBodyPadding ? tBodyPadding : configStyles.TABLE.tBodyPadding}
110
+ handleBodyActionClick={handleBodyActionClick ? handleBodyActionClick : _ => _}
111
+ tBodyFontSize={tBodyFontSize ? tBodyFontSize : configStyles.TABLE.tBodyFontSize}
112
+ tBodyTextAlign={tBodyTextAlign ? tBodyTextAlign : configStyles.TABLE.tBodyTextAlign}
113
+ tBodyFontFamily={tBodyFontFamily ? tBodyFontFamily : configStyles.TABLE.tBodyFontFamily}
114
+ tBodyFontWeight={tBodyFontWeight ? tBodyFontWeight : configStyles.TABLE.tBodyFontWeight}
115
+ borderRight={innerIndex === Object.values(item).length - 1 ? 'none' : configStyles.TABLE.tBodyRowBorder}
116
+ />
117
+ )
118
+ })
119
+ }
120
+ </tr>
152
121
  )
153
122
  })
154
123
  }
@@ -160,8 +129,8 @@ const Table = ({
160
129
  };
161
130
 
162
131
  Table.propTypes = {
163
- tableHeadItems: PropTypes.array,
164
- tableBodyItems: PropTypes.array,
132
+ dataBody: PropTypes.array,
133
+ dataHeader: PropTypes.array,
165
134
 
166
135
  tHeadColor: PropTypes.string,
167
136
  tHeadFamily: PropTypes.string,
@@ -178,7 +147,11 @@ Table.propTypes = {
178
147
  tBodyFontFamily: PropTypes.string,
179
148
 
180
149
  tBodyRowBorder: PropTypes.string,
181
- tBodyMarginTop: PropTypes.string
150
+
151
+ handleCheckedBody: PropTypes.func,
152
+ handleCheckedHeader: PropTypes.func,
153
+ handleHeaderItemClick: PropTypes.func,
154
+ handleBodyActionClick: PropTypes.func
182
155
  };
183
156
 
184
157
  export default Table;
@@ -0,0 +1,28 @@
1
+ .sorting-arrows::after {
2
+ content: "▲";
3
+ position: absolute;
4
+ right: 0px;
5
+ font-size: 11px;
6
+ top: calc(50% - 12px);
7
+ }
8
+
9
+ .sorting-arrows::before {
10
+ content: "▼";
11
+ position: absolute;
12
+ right: 0px;
13
+ font-size: 11px;
14
+ bottom: calc(50% - 12px);
15
+ }
16
+
17
+ .td-span {
18
+ position: relative;
19
+ display: inline-block;
20
+ cursor: pointer;
21
+ }
22
+
23
+ .td-span > svg {
24
+ position: absolute;
25
+ top: 0px;
26
+ left: 0px;
27
+ z-index: -1;
28
+ }