@xaypay/tui 0.0.72 → 0.0.74
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 +481 -268
- package/dist/index.js +481 -268
- package/package.json +1 -1
- package/src/components/icon/Close.js +19 -0
- package/src/components/icon/index.js +1 -2
- package/src/components/modal/index.js +231 -66
- package/src/components/modal/modal.stories.js +22 -7
- package/src/components/newAutocomplete/NewAutocomplete.stories.js +3 -2
- package/src/components/newAutocomplete/index.js +12 -2
- package/src/components/newFile/index.js +12 -6
- package/src/components/newFile/newFile.stories.js +1 -1
- package/src/components/pagination/index.js +74 -3
- package/src/components/pagination/pagination.module.css +13 -1
- package/src/components/pagination/pagination.stories.js +4 -2
- package/src/components/select/index.js +9 -2
- package/src/components/select/select.stories.js +0 -1
- package/src/components/typography/index.js +1 -1
- package/src/components/typography/typography.stories.js +2 -1
- package/src/stories/configuration.stories.mdx +3 -0
- package/tui.config.js +11 -17
|
@@ -3,12 +3,12 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import classnames from "classnames";
|
|
4
4
|
import styles from "./pagination.module.css";
|
|
5
5
|
import { PaginationRange, Dots } from "./paginationRange";
|
|
6
|
-
import Icon from "../icon/Icon";
|
|
7
6
|
|
|
8
7
|
import DotsIcon from './../../components/icon/Dots';
|
|
9
8
|
import SvgNextarrow from './../../components/icon/Nextarrow';
|
|
10
9
|
|
|
11
10
|
export const Pagination = ({
|
|
11
|
+
goTo,
|
|
12
12
|
onChange,
|
|
13
13
|
totalCount,
|
|
14
14
|
siblingCount,
|
|
@@ -16,6 +16,8 @@ export const Pagination = ({
|
|
|
16
16
|
offset,
|
|
17
17
|
className,
|
|
18
18
|
}) => {
|
|
19
|
+
const [inpVal, setInpVal] = useState('');
|
|
20
|
+
const [error, setError] = useState(false);
|
|
19
21
|
const [siblingCountNumber, setSibilingCountNumber] = useState(siblingCount);
|
|
20
22
|
const [currentPageNumber, setCurrentPage] = useState(currentPage);
|
|
21
23
|
const [currentTotalCount, setcurrentTotalCount] = useState(totalCount);
|
|
@@ -67,6 +69,43 @@ export const Pagination = ({
|
|
|
67
69
|
: onPageChange(currentPageNumber - 4);
|
|
68
70
|
};
|
|
69
71
|
|
|
72
|
+
const handleChangeInput = (e) => {
|
|
73
|
+
setError(false);
|
|
74
|
+
if (e.target.value.trim() !== '') {
|
|
75
|
+
const val = parseInt(e.target.value);
|
|
76
|
+
if (Number.isInteger(val)) {
|
|
77
|
+
setInpVal(val);
|
|
78
|
+
} else {
|
|
79
|
+
setInpVal('');
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
setInpVal('');
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const handleKeyDown = (e) => {
|
|
87
|
+
const forbiddenKeys = ["e", ".", "+", "-"];
|
|
88
|
+
if (forbiddenKeys.includes(e.key)) {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (e.keyCode === 13) {
|
|
93
|
+
if (inpVal === '') {
|
|
94
|
+
setError(true);
|
|
95
|
+
} else {
|
|
96
|
+
if (inpVal <= 1) {
|
|
97
|
+
setInpVal(1);
|
|
98
|
+
onPageChange(1);
|
|
99
|
+
} else if (inpVal >= (totalCount / offset)) {
|
|
100
|
+
setInpVal(Math.ceil(totalCount / offset));
|
|
101
|
+
onPageChange(Math.ceil(totalCount / offset));
|
|
102
|
+
} else {
|
|
103
|
+
onPageChange(inpVal);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
70
109
|
let lastPage = paginationRange[paginationRange.length - 1];
|
|
71
110
|
return (
|
|
72
111
|
<ul className={classProps}>
|
|
@@ -74,9 +113,9 @@ export const Pagination = ({
|
|
|
74
113
|
style={{
|
|
75
114
|
transform: 'rotate(180deg)'
|
|
76
115
|
}}
|
|
77
|
-
className={`${styles["pagination-btn"]} pagination-btn-rem`}
|
|
78
116
|
onClick={onPrevious}
|
|
79
117
|
disabled={currentPage === 1 ? true : false}
|
|
118
|
+
className={`${styles["pagination-btn"]} pagination-btn-rem`}
|
|
80
119
|
>
|
|
81
120
|
<SvgNextarrow />
|
|
82
121
|
</button>
|
|
@@ -157,18 +196,50 @@ export const Pagination = ({
|
|
|
157
196
|
</li>
|
|
158
197
|
);
|
|
159
198
|
})}
|
|
199
|
+
|
|
160
200
|
<button
|
|
161
201
|
onClick={onNext}
|
|
162
|
-
className={`${styles["pagination-btn"]} pagination-btn-rem`}
|
|
163
202
|
disabled={currentPageNumber === lastPage ? true : false}
|
|
203
|
+
className={`${styles["pagination-btn"]} pagination-btn-rem`}
|
|
164
204
|
>
|
|
165
205
|
<SvgNextarrow />
|
|
166
206
|
</button>
|
|
207
|
+
|
|
208
|
+
{
|
|
209
|
+
goTo && <div>
|
|
210
|
+
<input
|
|
211
|
+
onKeyDown={handleKeyDown}
|
|
212
|
+
onInput={handleChangeInput}
|
|
213
|
+
type='number'
|
|
214
|
+
style={{
|
|
215
|
+
width: '53px',
|
|
216
|
+
height: '30px',
|
|
217
|
+
outline: 'none',
|
|
218
|
+
color: '#3C393E',
|
|
219
|
+
fontSize: '13px',
|
|
220
|
+
margin: '0px 6px',
|
|
221
|
+
fontWeight: '500',
|
|
222
|
+
textAlign: 'center',
|
|
223
|
+
border: '1px solid',
|
|
224
|
+
borderRadius: '6px',
|
|
225
|
+
borderColor: error ? 'red' : '#00236a'
|
|
226
|
+
}}
|
|
227
|
+
value={inpVal}
|
|
228
|
+
/>
|
|
229
|
+
<span
|
|
230
|
+
style={{
|
|
231
|
+
color: '#3C393E',
|
|
232
|
+
fontSize: '13px'
|
|
233
|
+
}}
|
|
234
|
+
>Էջ</span>
|
|
235
|
+
</div>
|
|
236
|
+
}
|
|
167
237
|
</ul>
|
|
168
238
|
);
|
|
169
239
|
};
|
|
170
240
|
|
|
171
241
|
Pagination.propTypes = {
|
|
242
|
+
goTo: PropTypes.bool,
|
|
172
243
|
offset: PropTypes.number,
|
|
173
244
|
totalCount: PropTypes.number,
|
|
174
245
|
className: PropTypes.string,
|
|
@@ -78,4 +78,16 @@ i {
|
|
|
78
78
|
font-size: 12px;
|
|
79
79
|
line-height: 12px;
|
|
80
80
|
color: #3C393E;
|
|
81
|
-
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Works for Chrome, Safari, Edge, Opera */
|
|
84
|
+
input::-webkit-outer-spin-button,
|
|
85
|
+
input::-webkit-inner-spin-button {
|
|
86
|
+
-webkit-appearance: none;
|
|
87
|
+
margin: 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Works for Firefox */
|
|
91
|
+
input[type="number"] {
|
|
92
|
+
-moz-appearance: textfield;
|
|
93
|
+
}
|
|
@@ -316,7 +316,7 @@ const data = [
|
|
|
316
316
|
phone: "572-905-5251",
|
|
317
317
|
},
|
|
318
318
|
];
|
|
319
|
-
const Template = ({ offset, currentPage, siblingCount, totalCount }) => {
|
|
319
|
+
const Template = ({ goTo, offset, currentPage, siblingCount, totalCount }) => {
|
|
320
320
|
const [currentPageNumber, setCurrentPageNumber] = useState(currentPage);
|
|
321
321
|
const currentTableData = useMemo(() => {
|
|
322
322
|
const firstPageIndex = (currentPageNumber - 1) * offset;
|
|
@@ -351,6 +351,7 @@ const Template = ({ offset, currentPage, siblingCount, totalCount }) => {
|
|
|
351
351
|
</tbody>
|
|
352
352
|
</table>
|
|
353
353
|
<Pagination
|
|
354
|
+
goTo={goTo}
|
|
354
355
|
currentPage={currentPage}
|
|
355
356
|
totalCount={totalCount}
|
|
356
357
|
offset={offset}
|
|
@@ -364,8 +365,9 @@ const Template = ({ offset, currentPage, siblingCount, totalCount }) => {
|
|
|
364
365
|
export const Default = Template.bind({});
|
|
365
366
|
|
|
366
367
|
Default.args = {
|
|
368
|
+
goTo: false,
|
|
367
369
|
offset: 10,
|
|
368
|
-
currentPage:
|
|
370
|
+
currentPage: 1,
|
|
369
371
|
siblingCount: 2,
|
|
370
372
|
totalCount: 44
|
|
371
373
|
};
|
|
@@ -170,7 +170,14 @@ export const Select = ({
|
|
|
170
170
|
}, [opened]);
|
|
171
171
|
|
|
172
172
|
useEffect(() => {
|
|
173
|
-
|
|
173
|
+
if (selected) {
|
|
174
|
+
if (selected.length > 0) {
|
|
175
|
+
setNewSelected(isObjectEmpty(selected[0]) ? []: selected );
|
|
176
|
+
} else {
|
|
177
|
+
setNewSelected([]);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
174
181
|
if (!multiple) {
|
|
175
182
|
options && options.length > 0 && setExistOptions(options);
|
|
176
183
|
} else {
|
|
@@ -187,7 +194,7 @@ export const Select = ({
|
|
|
187
194
|
});
|
|
188
195
|
setExistOptions(modifiedOptions);
|
|
189
196
|
}
|
|
190
|
-
}, [options, multiple, selected]);
|
|
197
|
+
}, [options, multiple, selected, selected?.length]);
|
|
191
198
|
|
|
192
199
|
return (
|
|
193
200
|
<div className={classProps}>
|
|
@@ -74,7 +74,7 @@ export const Typography = ({
|
|
|
74
74
|
textTransform: textTransform ? textTransform : configStyles.TYPOGRAPHY['textTransform'+variant],
|
|
75
75
|
textDecoration: textDecoration ? textDecoration : configStyles.TYPOGRAPHY['textDecoration'+variant],
|
|
76
76
|
backgroundColor: backgroundColor ? backgroundColor : configStyles.TYPOGRAPHY['backgroundColor'+variant],
|
|
77
|
-
color: isHover ? colorHover ? colorHover : configStyles.TYPOGRAPHY['
|
|
77
|
+
color: isHover ? colorHover ? colorHover : color ? color : configStyles.TYPOGRAPHY['color'+variant] : color ? color : configStyles.TYPOGRAPHY['color'+variant],
|
|
78
78
|
},
|
|
79
79
|
...props,
|
|
80
80
|
className: classProps,
|
|
@@ -13,9 +13,10 @@ export const Template = (args) => <>
|
|
|
13
13
|
{
|
|
14
14
|
staticTag.map((tag,key) => {
|
|
15
15
|
return <Typography
|
|
16
|
+
{...args}
|
|
16
17
|
key={key}
|
|
17
18
|
variant={tag}
|
|
18
|
-
color=
|
|
19
|
+
color='#a3d177'
|
|
19
20
|
>
|
|
20
21
|
{tag}
|
|
21
22
|
</Typography>;
|
|
@@ -556,7 +556,10 @@ import StackAlt from './assets/stackalt.svg';
|
|
|
556
556
|
progressFailedColor: '#E40E00', // for file list item progress backfround color when file upload is failed
|
|
557
557
|
progressSuccessColor: '#069768', // for file list item progress background color when file upload is success
|
|
558
558
|
progressLoadingColor: '#051942', // for file list item progress background color when file upload is loading
|
|
559
|
+
formatError: 'ֆայլի սխալ ֆորմատ', // for file error text when file extention is invalid
|
|
560
|
+
noChoosenFile: 'Ֆայլը ընտրված չէ', // for file error text when file is not choosen
|
|
559
561
|
listItemBackgroundColor: '#F6F8F8', // for file list item background color
|
|
562
|
+
maxSizeError: 'Առավելագույն ծավալ', // for file error text when choosen file size is more then maxSize prop
|
|
560
563
|
putFileHere: 'Տեղադրել ֆայլը այստեղ', // for file place text
|
|
561
564
|
hiddenBackgroundColor: 'rgba(60, 57, 62, 0.4)', // for file place background color when hover on file place and there is a choosen file
|
|
562
565
|
listItemBackgroundErrorColor: 'rgba(255, 0, 0, 0.7)', // for file multiple mode error background color
|
package/tui.config.js
CHANGED
|
@@ -101,14 +101,14 @@ module.exports = {
|
|
|
101
101
|
sizeh6: '14px', // for variant h6 font size
|
|
102
102
|
sizespan: '12px', // for variant span font size
|
|
103
103
|
|
|
104
|
-
textAlignp: '
|
|
105
|
-
textAlignh1: '
|
|
106
|
-
textAlignh2: '
|
|
107
|
-
textAlignh3: '
|
|
108
|
-
textAlignh4: '
|
|
109
|
-
textAlignh5: '
|
|
110
|
-
textAlignh6: '
|
|
111
|
-
textAlignspan: '
|
|
104
|
+
textAlignp: 'left', // for variant p text align
|
|
105
|
+
textAlignh1: 'left', // for variant h1 text align
|
|
106
|
+
textAlignh2: 'left', // for variant h2 text align
|
|
107
|
+
textAlignh3: 'left', // for variant h3 text align
|
|
108
|
+
textAlignh4: 'left', // for variant h4 text align
|
|
109
|
+
textAlignh5: 'left', // for variant h5 text align
|
|
110
|
+
textAlignh6: 'left', // for variant h6 text align
|
|
111
|
+
textAlignspan: 'left', // for variant span text align
|
|
112
112
|
|
|
113
113
|
weightp: '500', // for variant p font weight
|
|
114
114
|
weighth1: '400', // for variant h1 font weight
|
|
@@ -119,15 +119,6 @@ module.exports = {
|
|
|
119
119
|
weighth6: '600', // for variant h6 font weight
|
|
120
120
|
weightspan: '500', // for variant span font weight
|
|
121
121
|
|
|
122
|
-
colorHoverp: '#3C393E', // for variant p color in hover mode
|
|
123
|
-
colorHoverh1: '#3C393E', // for variant h1 color in hover mode
|
|
124
|
-
colorHoverh2: '#3C393E', // for variant h2 color in hover mode
|
|
125
|
-
colorHoverh3: '#3C393E', // for variant h3 color in hover mode
|
|
126
|
-
colorHoverh4: '#3C393E', // for variant h4 color in hover mode
|
|
127
|
-
colorHoverh5: '#3C393E', // for variant h5 color in hover mode
|
|
128
|
-
colorHoverh6: '#3C393E', // for variant h6 color in hover mode
|
|
129
|
-
colorHoverspan: '#3C393E', // for variant span color in hover mode
|
|
130
|
-
|
|
131
122
|
backgroundColorp: 'transparent', // for variant p background color
|
|
132
123
|
backgroundColorh1: 'transparent', // for variant h1 background color
|
|
133
124
|
backgroundColorh2: 'transparent', // for variant h2 background color
|
|
@@ -363,7 +354,10 @@ module.exports = {
|
|
|
363
354
|
progressFailedColor: '#E40E00', // for file list item progress backfround color when file upload is failed
|
|
364
355
|
progressSuccessColor: '#069768', // for file list item progress background color when file upload is success
|
|
365
356
|
progressLoadingColor: '#051942', // for file list item progress background color when file upload is loading
|
|
357
|
+
formatError: 'ֆայլի սխալ ֆորմատ', // for file error text when file extention is invalid
|
|
358
|
+
noChoosenFile: 'Ֆայլը ընտրված չէ', // for file error text when file is not choosen
|
|
366
359
|
listItemBackgroundColor: '#F6F8F8', // for file list item background color
|
|
360
|
+
maxSizeError: 'Առավելագույն ծավալ', // for file error text when choosen file size is more then maxSize prop
|
|
367
361
|
putFileHere: 'Տեղադրել ֆայլը այստեղ', // for file place text
|
|
368
362
|
hiddenBackgroundColor: 'rgba(60, 57, 62, 0.4)', // for file place background color when hover on file place and there is a choosen file
|
|
369
363
|
listItemBackgroundErrorColor: 'rgba(255, 0, 0, 0.7)', // for file multiple mode error background color
|