@xaypay/tui 0.0.76 → 0.0.78
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.
- package/dist/index.es.js +239 -298
- package/dist/index.js +238 -298
- package/package.json +3 -3
- package/src/assets/table-settings-icon.svg +3 -0
- package/src/components/button/button.stories.js +4 -2
- package/src/components/button/index.js +9 -4
- package/src/components/captcha/index.js +2 -0
- package/src/components/input/index.js +35 -4
- package/src/components/input/input.stories.js +1 -1
- package/src/components/newAutocomplete/index.js +11 -12
- package/src/components/newFile/index.js +10 -10
- package/src/components/select/index.js +7 -6
- package/src/components/select/select.module.css +1 -1
- package/src/components/table/index.js +172 -113
- package/src/components/table/table.stories.js +198 -29
- package/src/stories/static/button-usage-icon.png +0 -0
- package/src/stories/usage.stories.mdx +4 -0
- package/src/utils/index.js +3 -16
- package/tui.config.js +29 -6
- package/src/components/table/table.module.css +0 -80
|
@@ -1,125 +1,184 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import classnames from "classnames";
|
|
4
|
-
import styles from "./table.module.css";
|
|
5
|
-
import { Checkbox } from "../checkbox";
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
hearderData,
|
|
13
|
-
keyNames,
|
|
14
|
-
actions,
|
|
15
|
-
...props
|
|
16
|
-
}) => {
|
|
17
|
-
const classProps = classnames(className);
|
|
18
|
-
let tbodyData = jsonData.length ? JSON.parse(jsonData) : [];
|
|
4
|
+
import { compereConfigs } from './../../utils';
|
|
5
|
+
|
|
6
|
+
const Table = ({
|
|
7
|
+
tableHeadItems,
|
|
8
|
+
tableBodyItems,
|
|
19
9
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
tHeadColor,
|
|
11
|
+
tHeadFamily,
|
|
12
|
+
tHeadPadding,
|
|
13
|
+
tHeadFontWeight,
|
|
14
|
+
tHeadBorderRadius,
|
|
15
|
+
tHeadBackgroundColor,
|
|
23
16
|
|
|
24
|
-
|
|
17
|
+
tBodyColor,
|
|
18
|
+
tBodyPadding,
|
|
19
|
+
tBodyFontSize,
|
|
20
|
+
tBodyTextAlign,
|
|
21
|
+
tBodyFontWeight,
|
|
22
|
+
tBodyFontFamily,
|
|
23
|
+
|
|
24
|
+
tBodyRowBorder,
|
|
25
|
+
tBodyMarginTop,
|
|
26
|
+
}) => {
|
|
27
|
+
|
|
28
|
+
const configStyles = compereConfigs();
|
|
25
29
|
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<table
|
|
33
|
+
style={{
|
|
34
|
+
width: '1475px',
|
|
35
|
+
borderCollapse: 'collapse'
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
26
38
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
{
|
|
40
|
+
tableHeadItems && tableHeadItems.length > 0 && <thead>
|
|
41
|
+
<tr
|
|
42
|
+
style={{
|
|
43
|
+
color: tHeadColor ? tHeadColor : configStyles.TABLE.tHeadColor,
|
|
44
|
+
backgroundColor: tHeadBackgroundColor ? tHeadBackgroundColor : configStyles.TABLE.tHeadBackgroundColor
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
{
|
|
48
|
+
tableHeadItems.map((item, index) => {
|
|
49
|
+
return (
|
|
50
|
+
<th
|
|
51
|
+
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>
|
|
63
|
+
)
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
</tr>
|
|
67
|
+
</thead>
|
|
68
|
+
}
|
|
32
69
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{header}
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
})}
|
|
45
|
-
<div className={`${styles["table-bottom"]} table-bottom-rem`}>
|
|
46
|
-
{tbodyData.map((item, key) => {
|
|
47
|
-
return (
|
|
48
|
-
<div className={`${styles["table-bottom-inner"]} table-bottom-inner-rem`} key={key}>
|
|
49
|
-
{keyNames.map((keyName, keyNameKey) => {
|
|
50
|
-
return (
|
|
51
|
-
<div
|
|
52
|
-
className={`${styles["table-items"]} table-items-rem`}
|
|
53
|
-
key={keyNameKey}
|
|
54
|
-
>
|
|
55
|
-
{config.isCheckbox &&
|
|
56
|
-
config.isCheckbox.showCheckbox &&
|
|
57
|
-
config.isCheckbox.showCheckbox(
|
|
58
|
-
item
|
|
59
|
-
) &&
|
|
60
|
-
keyNameKey == 0 && (
|
|
61
|
-
<Checkbox
|
|
62
|
-
onClick={(e) => {
|
|
63
|
-
const id = e.target.id;
|
|
64
|
-
const checkedValue = e.target.checked;
|
|
65
|
-
let ch = [...checked]
|
|
66
|
-
checkedValue ? ch.push(Number(id)) : ch.splice(ch.indexOf(id), 1);
|
|
67
|
-
setChecked(ch);
|
|
68
|
-
config.isCheckbox.onChange(ch);
|
|
69
|
-
}}
|
|
70
|
-
jsonData={`[{"value":"", "name":"", "label":"", "id":${item.id}, "checked":${checked.indexOf(item.id) > -1 ? true : false }}]`}
|
|
71
|
-
/>
|
|
72
|
-
)}
|
|
73
|
-
{typeof keyName === "string" ? (
|
|
74
|
-
item[keyName]
|
|
75
|
-
) : (
|
|
76
|
-
<>
|
|
77
|
-
<i className={keyName.icon} />
|
|
78
|
-
{item[keyName.name]}
|
|
79
|
-
</>
|
|
80
|
-
)}
|
|
81
|
-
</div>
|
|
82
|
-
);
|
|
83
|
-
})}
|
|
70
|
+
{
|
|
71
|
+
tableBodyItems && tableBodyItems.length > 0 && <tbody
|
|
72
|
+
style={{
|
|
73
|
+
overflow: 'auto',
|
|
74
|
+
boxShadow: '0px 10px 30px rgba(0, 35, 106, 0.06)'
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
84
77
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
78
|
+
{
|
|
79
|
+
|
|
80
|
+
tableBodyItems.map((item, index) => {
|
|
81
|
+
const monst = Object.entries(item);
|
|
82
|
+
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
|
+
</>
|
|
152
|
+
)
|
|
153
|
+
})
|
|
154
|
+
}
|
|
155
|
+
</tbody>
|
|
156
|
+
}
|
|
157
|
+
</table>
|
|
158
|
+
</>
|
|
159
|
+
);
|
|
102
160
|
};
|
|
103
161
|
|
|
104
162
|
Table.propTypes = {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
};
|
|
163
|
+
tableHeadItems: PropTypes.array,
|
|
164
|
+
tableBodyItems: PropTypes.array,
|
|
165
|
+
|
|
166
|
+
tHeadColor: PropTypes.string,
|
|
167
|
+
tHeadFamily: PropTypes.string,
|
|
168
|
+
tHeadPadding: PropTypes.string,
|
|
169
|
+
tHeadFontWeight: PropTypes.number,
|
|
170
|
+
tHeadBorderRadius: PropTypes.string,
|
|
171
|
+
tHeadBackgroundColor: PropTypes.string,
|
|
115
172
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
173
|
+
tBodyColor: PropTypes.string,
|
|
174
|
+
tBodyPadding: PropTypes.string,
|
|
175
|
+
tBodyFontSize: PropTypes.string,
|
|
176
|
+
tBodyTextAlign: PropTypes.string,
|
|
177
|
+
tBodyFontWeight: PropTypes.string,
|
|
178
|
+
tBodyFontFamily: PropTypes.string,
|
|
179
|
+
|
|
180
|
+
tBodyRowBorder: PropTypes.string,
|
|
181
|
+
tBodyMarginTop: PropTypes.string
|
|
125
182
|
};
|
|
183
|
+
|
|
184
|
+
export default Table;
|
|
@@ -1,36 +1,205 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Table from './index';
|
|
3
|
+
|
|
4
|
+
import { ReactComponent as ReactSVG } from './../../assets/table-settings-icon.svg';
|
|
3
5
|
|
|
4
6
|
export default {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
component: Table,
|
|
8
|
+
title: 'Components/Table'
|
|
7
9
|
};
|
|
8
10
|
|
|
9
|
-
const Template = (args) =>
|
|
11
|
+
const Template = (args) => {
|
|
12
|
+
const tableDataInfo = {
|
|
13
|
+
header: [
|
|
14
|
+
{
|
|
15
|
+
type: 'show',
|
|
16
|
+
content: 'Հ/Հ'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: 'show',
|
|
20
|
+
content: 'ՀՎՀՀ'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
type: 'show',
|
|
24
|
+
content: 'Վարչ․շրջան'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'show',
|
|
28
|
+
content: 'Վճար'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'show',
|
|
32
|
+
content: 'Ամսաթիվ'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'show',
|
|
36
|
+
content: 'Մուտքի ամս․'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: 'show',
|
|
40
|
+
content: 'Հավելյալ ինֆորմացիա'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: 'show',
|
|
44
|
+
content: 'Ստեղծված'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'show',
|
|
48
|
+
content: 'Գործողություն'
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'show',
|
|
52
|
+
content: <ReactSVG />
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
body: [
|
|
56
|
+
|
|
57
|
+
]
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const tableBodyItems = [
|
|
61
|
+
{ id: 1, hh: 19854, hvhh: 10195524, shrjan: 'Շենգավիթ', pay: 7000, date: '27.05.2022', enterDate: '27.05.2022', info: 'Այլ արտաքին գովազդի տեղադրելու վճար / ԱՁ', create: '27.05.2022', actions: ['item', 'just'] },
|
|
62
|
+
{ id: 3, hh: 22641, hvhh: 12095524, shrjan: 'Շենգավիթ', pay: 7000, date: '27.05.2022', enterDate: '27.05.2022', info: 'Այլ արտաքին գովազդի տեղադրելու վճար / ԱՁ', create: '27.05.2022', actions: 'text' },
|
|
63
|
+
{ id: 4, hh: 25005, hvhh: 15495524, shrjan: 'Շենգավիթ', pay: 7000, date: '27.05.2022', enterDate: '27.05.2022', info: 'Այլ արտաքին գովազդի տեղադրելու վճար / ԱՁ', create: '27.05.2022', actions: [] },
|
|
64
|
+
{ id: 7, hh: 31576, hvhh: 16895524, shrjan: 'Շենգավիթ', pay: 7000, date: '27.05.2022', enterDate: '27.05.2022', info: 'Այլ արտաքին գովազդի տեղադրելու վճար / ԱՁ', create: '27.05.2022', actions: [] },
|
|
65
|
+
{ id: 45, hh: 32586, hvhh: 17495524, shrjan: 'Շենգավիթ', pay: 7000, date: '27.05.2022', enterDate: '27.05.2022', info: 'Այլ արտաքին գովազդի տեղադրելու վճար / ԱՁ', create: '27.05.2022', actions: [] },
|
|
66
|
+
{ id: 78, hh: 32754, hvhh: 20095524, shrjan: 'Շենգավիթ', pay: 7000, date: '27.05.2022', enterDate: '27.05.2022', info: 'Այլ արտաքին գովազդի տեղադրելու վճար / ԱՁ', create: '27.05.2022', actions: [] },
|
|
67
|
+
{ id: 99, hh: 41411, hvhh: 20595524, shrjan: 'Շենգավիթ', pay: 7000, date: '27.05.2022', enterDate: '27.05.2022', info: 'Այլ արտաքին գովազդի տեղադրելու վճար / ԱՁ', create: '27.05.2022', actions: [] },
|
|
68
|
+
{ id: 541, hh: 44547, hvhh: 26595524, shrjan: 'Շենգավիթ', pay: 7000, date: '27.05.2022', enterDate: '27.05.2022', info: 'Այլ արտաքին գովազդի տեղադրելու վճար / ԱՁ', create: '27.05.2022', actions: [] },
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
return <Table tableHeadItems={tableDataInfo.header} tableBodyItems={tableBodyItems} {...args} />;
|
|
72
|
+
};
|
|
10
73
|
|
|
11
74
|
export const Default = Template.bind({});
|
|
75
|
+
Default.args = {};
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
// {
|
|
87
|
+
// header: [
|
|
88
|
+
// "Hello" | <component></component>,
|
|
89
|
+
// "Title 2",
|
|
90
|
+
// {
|
|
91
|
+
// type: 'hide',
|
|
92
|
+
// icon: svg
|
|
93
|
+
// }
|
|
94
|
+
// ]
|
|
95
|
+
|
|
96
|
+
// body: [
|
|
97
|
+
// {
|
|
98
|
+
// color: 'red',
|
|
99
|
+
// colorStatus: 'left' | "row" | "right",
|
|
100
|
+
// data: [
|
|
101
|
+
// "jkashdkjha",
|
|
102
|
+
// "jkashdkjha 1",
|
|
103
|
+
// "jkashdkjha 2",
|
|
104
|
+
// {
|
|
105
|
+
// type: "image",
|
|
106
|
+
// svg: <SVG></SVG>,
|
|
107
|
+
// click: onclick()
|
|
108
|
+
// },
|
|
109
|
+
// {
|
|
110
|
+
// type: "action",
|
|
111
|
+
// data: [
|
|
112
|
+
// {
|
|
113
|
+
// icon: svg,
|
|
114
|
+
// title?: 'sadas',
|
|
115
|
+
// click: onclick()
|
|
116
|
+
// },
|
|
117
|
+
// {
|
|
118
|
+
// icon: svg,
|
|
119
|
+
// group: [
|
|
120
|
+
// {
|
|
121
|
+
// icon: svg,
|
|
122
|
+
// title?: 'sadas',
|
|
123
|
+
// click: onclick()
|
|
124
|
+
// },
|
|
125
|
+
// {
|
|
126
|
+
// icon: svg,
|
|
127
|
+
// title?: 'sadas',
|
|
128
|
+
// click: onclick()
|
|
129
|
+
// }
|
|
130
|
+
// ]
|
|
131
|
+
// }
|
|
132
|
+
// ]
|
|
133
|
+
// },
|
|
134
|
+
// {
|
|
135
|
+
// type: "action",
|
|
136
|
+
// data: [
|
|
137
|
+
// [
|
|
138
|
+
// {
|
|
139
|
+
// icon: svg,
|
|
140
|
+
// title?: 'sadas',
|
|
141
|
+
// click: onclick()
|
|
142
|
+
// },
|
|
143
|
+
// {
|
|
144
|
+
// icon: svg,
|
|
145
|
+
// group: [
|
|
146
|
+
// {
|
|
147
|
+
// icon: svg,
|
|
148
|
+
// title?: 'sadas',
|
|
149
|
+
// click: onclick()
|
|
150
|
+
// },
|
|
151
|
+
// {
|
|
152
|
+
// icon: svg,
|
|
153
|
+
// title?: 'sadas',
|
|
154
|
+
// click: onclick()
|
|
155
|
+
// }
|
|
156
|
+
// ]
|
|
157
|
+
// }
|
|
158
|
+
// ],
|
|
159
|
+
// [
|
|
160
|
+
// {
|
|
161
|
+
// icon: svg,
|
|
162
|
+
// title?: 'sadas',
|
|
163
|
+
// click: onclick()
|
|
164
|
+
// },
|
|
165
|
+
// {
|
|
166
|
+
// icon: svg,
|
|
167
|
+
// group: [
|
|
168
|
+
// {
|
|
169
|
+
// icon: svg,
|
|
170
|
+
// title?: 'sadas',
|
|
171
|
+
// click: onclick()
|
|
172
|
+
// },
|
|
173
|
+
// {
|
|
174
|
+
// icon: svg,
|
|
175
|
+
// title?: 'sadas',
|
|
176
|
+
// click: onclick()
|
|
177
|
+
// }
|
|
178
|
+
// ]
|
|
179
|
+
// }
|
|
180
|
+
// ]
|
|
181
|
+
// ]
|
|
182
|
+
// },
|
|
183
|
+
// {
|
|
184
|
+
// type: "accordion",
|
|
185
|
+
// title: 'asdasdsa',
|
|
186
|
+
// openKeys: [
|
|
187
|
+
// 't1',
|
|
188
|
+
// 't2',
|
|
189
|
+
// 't3'
|
|
190
|
+
// ]
|
|
191
|
+
// },
|
|
192
|
+
// {
|
|
193
|
+
// type: "text",
|
|
194
|
+
// accourdionData: [
|
|
195
|
+
// 'asdasd',
|
|
196
|
+
// <Component></Component>,
|
|
197
|
+
// 'asdasd',
|
|
198
|
+
// 'asdasd'
|
|
199
|
+
// ]
|
|
200
|
+
// }
|
|
201
|
+
// ]
|
|
202
|
+
// }
|
|
203
|
+
// ]
|
|
204
|
+
// }
|
|
12
205
|
|
|
13
|
-
const showCheckbox = (item) => {
|
|
14
|
-
return true;
|
|
15
|
-
// return item.id === 2;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const onChange = (checked) => {
|
|
19
|
-
console.log("project",checked);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const show = () => {
|
|
23
|
-
return true
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const action = (id) => {
|
|
27
|
-
console.log('action from project',id);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
Default.args = {
|
|
31
|
-
config: {isHeader: true, isCheckbox: {showCheckbox: showCheckbox, checked: [], onChange: onChange }},
|
|
32
|
-
jsonData: JSON.stringify([{id:1,name:'Item 1',name2:'Item 1'},{id:2, name:'Item 2',name2:'Item 2'}]),
|
|
33
|
-
actions: [{icon: 'icon-1',show: show, click: action},{icon: 'icon-2'},{icon: 'icon-3'},{icon: 'icon-4'}],
|
|
34
|
-
keyNames: ['name',{name: 'name2', icon: 'icon-temp'}],
|
|
35
|
-
hearderData: ['first Name', 'Last Name','asdas',]
|
|
36
|
-
};
|
|
Binary file
|
|
@@ -17,6 +17,7 @@ import selectImage from './static/select-usage.png';
|
|
|
17
17
|
import toastImage from './static/toaster-usage.png';
|
|
18
18
|
import tooltipImage from './static/tooltip-usage.png';
|
|
19
19
|
import textareaImage from './static/textarea-usage.png';
|
|
20
|
+
import buttonImageIcon from './static/button-usage-icon.png';
|
|
20
21
|
import fileSingleImage from './static/file-single-usage.png';
|
|
21
22
|
import toasterImage from './static/toaster-container-usage.png';
|
|
22
23
|
import autocompleteImage from './static/autocomplete-usage.png';
|
|
@@ -136,6 +137,9 @@ import autocompleteImage from './static/autocomplete-usage.png';
|
|
|
136
137
|
### Button
|
|
137
138
|
<img src={buttonImage} alt="button image" />
|
|
138
139
|
|
|
140
|
+
#### Button with icon prop
|
|
141
|
+
<img src={buttonImageIcon} alt="button image" />
|
|
142
|
+
|
|
139
143
|
### Input
|
|
140
144
|
<img src={inputImage} alt="input image" />
|
|
141
145
|
|
package/src/utils/index.js
CHANGED
|
@@ -2,24 +2,11 @@ const _ = require('lodash');
|
|
|
2
2
|
|
|
3
3
|
export const compereConfigs = () => {
|
|
4
4
|
let projectConfig = {};
|
|
5
|
-
let packageConfig =
|
|
5
|
+
let packageConfig = require(process.env.STORYBOOK_PATH);
|
|
6
6
|
|
|
7
7
|
try {
|
|
8
|
-
|
|
9
|
-
} catch
|
|
10
|
-
try {
|
|
11
|
-
packageConfig = require('../../tui.config.js');
|
|
12
|
-
} catch (err) {
|
|
13
|
-
packageConfig = {};
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
try {
|
|
18
|
-
projectConfig = require('../../../../tui.config.js');
|
|
19
|
-
} catch (error) {
|
|
20
|
-
projectConfig = {};
|
|
21
|
-
// console.log(error, 'Project: if you want to use custom styles, create tui.config.js file in your project root');
|
|
22
|
-
}
|
|
8
|
+
projectConfig = require(`${process.env.STORYBOOK_CONFIG_PATH}`);
|
|
9
|
+
} catch(e) {}
|
|
23
10
|
|
|
24
11
|
return _.merge(packageConfig, projectConfig);
|
|
25
12
|
};
|
package/tui.config.js
CHANGED
|
@@ -40,6 +40,7 @@ module.exports = {
|
|
|
40
40
|
errorColor: '#e00', // for error message color
|
|
41
41
|
labelWeight: '500', // for label font weight
|
|
42
42
|
errorClassName: '', // for error message classname (you can set custom class for your custom css)
|
|
43
|
+
telErrorMessage: '', // for error message when type is tel
|
|
43
44
|
phoneDisplay: 'flex', // for phone extention display, work when input type is tel
|
|
44
45
|
autoComplete: 'off', // for autocomplete fill mode (browser specific, may not work)
|
|
45
46
|
errorBottom: '-20px', // for error message position from bottom (work when errorPosition prop is 'absolute')
|
|
@@ -50,12 +51,15 @@ module.exports = {
|
|
|
50
51
|
labelLineHeight: '22px', // for label line height
|
|
51
52
|
errorLineHeight: '19px', // for error message line height
|
|
52
53
|
boxSizing: 'border-box', // for box sizing
|
|
54
|
+
borderRight: '1px solid', // for type tel right border
|
|
53
55
|
backgroundColor: 'white', // for input and also (if there exist left or right icons) icons block background color
|
|
54
56
|
color: 'rgb(60, 57, 62)', // for input color
|
|
55
57
|
labelMarginBottom: '6px', // for label margin bottom
|
|
56
58
|
phoneAlignItems: 'center', // for phone extention inside item, work when input type is tel
|
|
57
59
|
errorPosition: 'absolute', // for error message position (maybe you want to show error message in custom place)
|
|
58
60
|
transform: 'scale3d(0,0,0)', // for transform (when have error message and errorAnimation prop is true)
|
|
61
|
+
borderRightColor: '#d1d1d1', // for type tel right border
|
|
62
|
+
borderRightColorHover: '#3c393e', // for type tel right border color when hover is active
|
|
59
63
|
phoneJustifyContent: 'center', // for phone extention inside item, work when input type is tel
|
|
60
64
|
boxShadow: '0 0 0 2px #d1d1d1', // for border size and color
|
|
61
65
|
errorAnimationDuration: '240ms', // for animation duration (when have error message and errorAnimation prop is true)
|
|
@@ -194,9 +198,7 @@ module.exports = {
|
|
|
194
198
|
selectedFontWeight: '500', // for selected font weight
|
|
195
199
|
selectedLineHeight: '22px', // for selected line height
|
|
196
200
|
selectedPadding: '0px 15px', // for selected padding
|
|
197
|
-
selectedBorder: '2px solid', // for selected border
|
|
198
201
|
selectedHoverColor: '#373538', // for selected color ( when hover )
|
|
199
|
-
selectedBorderColor: '#D1D1D1', // for selected border color
|
|
200
202
|
selectedBoxSizing: 'border-box', // for selected box sizing
|
|
201
203
|
selectedTransition: 'border-color 240ms', // for selected transition
|
|
202
204
|
|
|
@@ -216,6 +218,9 @@ module.exports = {
|
|
|
216
218
|
optionItemBoxSizing: 'border-box', // for option box sizing
|
|
217
219
|
optionItemBackgroudColor: '#ffffff', // for option background color
|
|
218
220
|
optionItemBackgroudColorHover: 'unset', // for option background color ( when hover )
|
|
221
|
+
|
|
222
|
+
boxShadow: '0 0 0 2px #d1d1d1',
|
|
223
|
+
boxShadowHover: '0 0 0 2px #3c393e'
|
|
219
224
|
},
|
|
220
225
|
// default properties for <Textarea /> component
|
|
221
226
|
TEXTAREA: {
|
|
@@ -276,11 +281,10 @@ module.exports = {
|
|
|
276
281
|
contentTopMaxWidth: '400px', // for autocomplate top block max width
|
|
277
282
|
contentTopLineHeight: '22px', // for autocomplate top block line height
|
|
278
283
|
contentTopPadding: '0px 15px', // for autocomplate top block padding
|
|
279
|
-
contentTopBorder: '2px solid', // for autocomplate top block border
|
|
280
|
-
contentTopBorderColor: '#D1D1D1', // for autocomplate top block border color
|
|
281
284
|
contentTopBoxSizing: 'border-box', // for autocomplate top block box sizing
|
|
282
|
-
|
|
283
|
-
|
|
285
|
+
contentTopBorder: '0 0 0 2px #D1D1D1', // for autocomplate top block border color
|
|
286
|
+
contentTopBorderHover: '0 0 0 2px #3C393E', // for autocomplate top block border hover color
|
|
287
|
+
contentTopBorderActive: '0 0 0 2px #00236A', // for autocomplate top block border active color
|
|
284
288
|
|
|
285
289
|
contentBottomZindex: 1, // for autocomplete bottom block z-index
|
|
286
290
|
contentBottomLeft: '0px', // for autocomplete bottom block left
|
|
@@ -374,5 +378,24 @@ module.exports = {
|
|
|
374
378
|
backgroundColor: 'white', // for modal background color
|
|
375
379
|
padding: '10px 20px 20px', // for modal padding
|
|
376
380
|
layerBackgroundColor: 'rgba(0,0,0,0.4)', // for modal parent layer background color
|
|
381
|
+
},
|
|
382
|
+
// default properties for <Table /> component
|
|
383
|
+
TABLE: {
|
|
384
|
+
tHeadFontWeight: 600,
|
|
385
|
+
tHeadColor: '#FBFBFB',
|
|
386
|
+
tHeadPadding: '11px 20px',
|
|
387
|
+
tHeadBorderRadius: '14px',
|
|
388
|
+
tHeadBackgroundColor: '#00236A',
|
|
389
|
+
tHeadFamily: 'Noto Sans Armenia',
|
|
390
|
+
|
|
391
|
+
tBodyColor: '#3C393E',
|
|
392
|
+
tBodyFontSize: '16px',
|
|
393
|
+
tBodyFontWeight: 500,
|
|
394
|
+
tBodyTextAlign: 'center',
|
|
395
|
+
tBodyPadding: '11px 20px',
|
|
396
|
+
tBodyFontFamily: 'Noto Sans Armenia',
|
|
397
|
+
|
|
398
|
+
tBodyRowBorder: '1px solid #eeeeee',
|
|
399
|
+
tBodyMarginTop: '20px',
|
|
377
400
|
}
|
|
378
401
|
};
|