@xaypay/tui 0.0.103 → 0.0.105
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 +107 -74
- package/dist/index.js +107 -74
- package/package.json +1 -1
- package/src/components/input/input.module.css +2 -1
- package/src/components/modal/index.js +2 -0
- package/src/components/newAutocomplete/autocomplete.module.css +3 -2
- package/src/components/newAutocomplete/index.js +8 -1
- package/src/components/pagination/index.js +5 -11
- package/src/components/pagination/pagination.stories.js +1 -3
- package/src/components/pagination/paginationRange.js +20 -34
- package/src/components/singleCheckbox/Checkbox.js +56 -0
- package/src/components/singleCheckbox/index.js +35 -26
- package/src/components/singleCheckbox/singleCheckbox.stories.js +17 -3
- package/src/components/table/table.stories.js +1 -1
- package/src/components/table/th.js +1 -1
- package/src/stories/configuration.stories.mdx +10 -0
- package/tui.config.js +7 -1
package/dist/index.es.js
CHANGED
|
@@ -190,6 +190,29 @@ File.defaultProps = {
|
|
|
190
190
|
fileExtensions: ['jpg', 'jpeg', 'png', 'pdf']
|
|
191
191
|
};
|
|
192
192
|
|
|
193
|
+
const _ = require('lodash');
|
|
194
|
+
const compereConfigs = () => {
|
|
195
|
+
let projectConfig = {};
|
|
196
|
+
let packageConfig = {};
|
|
197
|
+
try {
|
|
198
|
+
packageConfig = require('../tui.config.js');
|
|
199
|
+
} catch (e) {
|
|
200
|
+
try {
|
|
201
|
+
packageConfig = require('../../tui.config.js');
|
|
202
|
+
} catch (err) {
|
|
203
|
+
packageConfig = {};
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
try {
|
|
207
|
+
projectConfig = require('../../../../tui.config.js');
|
|
208
|
+
} catch (error) {
|
|
209
|
+
projectConfig = {};
|
|
210
|
+
// console.log(error, 'Project: if you want to use custom styles, create tui.config.js file in your project root');
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return _.merge(packageConfig, projectConfig);
|
|
214
|
+
};
|
|
215
|
+
|
|
193
216
|
const SvgCheckboxUnchecked = ({
|
|
194
217
|
title,
|
|
195
218
|
titleId,
|
|
@@ -232,17 +255,24 @@ const SvgCheckboxChecked = ({
|
|
|
232
255
|
fill: fillColor ? fillColor : '#00236A'
|
|
233
256
|
}));
|
|
234
257
|
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
258
|
+
const Checkbox$1 = ({
|
|
259
|
+
data,
|
|
260
|
+
styles,
|
|
238
261
|
checked,
|
|
239
|
-
onClick,
|
|
240
|
-
content,
|
|
241
262
|
disabled,
|
|
242
263
|
checkedColor,
|
|
264
|
+
handleChecked,
|
|
243
265
|
unCheckedColor
|
|
244
266
|
}) => {
|
|
245
|
-
const
|
|
267
|
+
const configStyles = compereConfigs();
|
|
268
|
+
const [innerChecked, setInnerChecked] = useState(false);
|
|
269
|
+
const [innerDisabled, setInnerDisabled] = useState(false);
|
|
270
|
+
const handleClick = e => {
|
|
271
|
+
handleChecked(data, e);
|
|
272
|
+
};
|
|
273
|
+
useEffect(() => {
|
|
274
|
+
setInnerDisabled(disabled);
|
|
275
|
+
}, [disabled]);
|
|
246
276
|
useEffect(() => {
|
|
247
277
|
setInnerChecked(checked);
|
|
248
278
|
}, [checked]);
|
|
@@ -252,48 +282,61 @@ const SingleCheckbox = ({
|
|
|
252
282
|
height: '16px',
|
|
253
283
|
marginRight: '9px',
|
|
254
284
|
display: 'inline-block',
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
fillColor: checkedColor ? checkedColor :
|
|
285
|
+
cursor: !innerDisabled ? 'pointer' : 'not-allowed',
|
|
286
|
+
...styles
|
|
287
|
+
},
|
|
288
|
+
onClick: !innerDisabled && handleChecked ? handleClick : _ => _
|
|
289
|
+
}, innerChecked && !innerDisabled ? /*#__PURE__*/React__default.createElement(SvgCheckboxChecked, {
|
|
290
|
+
fillColor: checkedColor ? checkedColor : configStyles.SINGLECHECKBOX.checkedColor
|
|
261
291
|
}) : /*#__PURE__*/React__default.createElement(SvgCheckboxUnchecked, {
|
|
262
|
-
|
|
263
|
-
fillColor: unCheckedColor ? unCheckedColor : ''
|
|
292
|
+
fillColor: unCheckedColor ? unCheckedColor : configStyles.SINGLECHECKBOX.unCheckedColor
|
|
264
293
|
}));
|
|
265
294
|
};
|
|
295
|
+
|
|
296
|
+
const SingleCheckbox = ({
|
|
297
|
+
data,
|
|
298
|
+
styles,
|
|
299
|
+
checked,
|
|
300
|
+
disabled,
|
|
301
|
+
checkedColor,
|
|
302
|
+
handleChecked,
|
|
303
|
+
unCheckedColor
|
|
304
|
+
}) => {
|
|
305
|
+
const [innerData, setInnerData] = useState(null);
|
|
306
|
+
useEffect(() => {
|
|
307
|
+
// if (data) {
|
|
308
|
+
// if (typeof data === 'object' && data.constructor === Object) {
|
|
309
|
+
// setInnerData(data);
|
|
310
|
+
// } else {
|
|
311
|
+
// alert('Data props on Checkbox component must be an object');
|
|
312
|
+
// }
|
|
313
|
+
// } else {
|
|
314
|
+
// alert('Please add data props on Checkbox component');
|
|
315
|
+
// }
|
|
316
|
+
setInnerData(data);
|
|
317
|
+
}, [data]);
|
|
318
|
+
return /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
319
|
+
styles: styles,
|
|
320
|
+
data: innerData,
|
|
321
|
+
checked: checked,
|
|
322
|
+
disabled: disabled,
|
|
323
|
+
checkedColor: checkedColor,
|
|
324
|
+
handleChecked: handleChecked,
|
|
325
|
+
unCheckedColor: unCheckedColor
|
|
326
|
+
});
|
|
327
|
+
};
|
|
266
328
|
SingleCheckbox.propTypes = {
|
|
329
|
+
onClick: PropTypes.func,
|
|
330
|
+
styles: PropTypes.object,
|
|
267
331
|
disabled: PropTypes.bool,
|
|
268
|
-
|
|
332
|
+
checkedColor: PropTypes.string,
|
|
333
|
+
unCheckedColor: PropTypes.string,
|
|
334
|
+
data: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired
|
|
269
335
|
};
|
|
270
336
|
|
|
271
337
|
var css_248z$e = ".table-module_sorting-arrows__BaN-G:after{content:\"▲\";font-size:11px;position:absolute;right:0;top:calc(50% - 12px)}.table-module_sorting-arrows__BaN-G:before{bottom:calc(50% - 12px);content:\"▼\";font-size:11px;position:absolute;right:0}.table-module_td-span__XHo6k{cursor:pointer;display:inline-block;position:relative}.table-module_td-span__XHo6k>svg{left:0;position:absolute;top:0;z-index:-1}";
|
|
272
338
|
styleInject(css_248z$e);
|
|
273
339
|
|
|
274
|
-
const _ = require('lodash');
|
|
275
|
-
const compereConfigs = () => {
|
|
276
|
-
let projectConfig = {};
|
|
277
|
-
let packageConfig = {};
|
|
278
|
-
try {
|
|
279
|
-
packageConfig = require('../tui.config.js');
|
|
280
|
-
} catch (e) {
|
|
281
|
-
try {
|
|
282
|
-
packageConfig = require('../../tui.config.js');
|
|
283
|
-
} catch (err) {
|
|
284
|
-
packageConfig = {};
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
try {
|
|
288
|
-
projectConfig = require('../../../../tui.config.js');
|
|
289
|
-
} catch (error) {
|
|
290
|
-
projectConfig = {};
|
|
291
|
-
// console.log(error, 'Project: if you want to use custom styles, create tui.config.js file in your project root');
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
return _.merge(packageConfig, projectConfig);
|
|
295
|
-
};
|
|
296
|
-
|
|
297
340
|
({
|
|
298
341
|
dataBody: PropTypes.array,
|
|
299
342
|
dataHeader: PropTypes.array,
|
|
@@ -616,9 +659,11 @@ const Modal = ({
|
|
|
616
659
|
} else {
|
|
617
660
|
return /*#__PURE__*/React__default.createElement("img", {
|
|
618
661
|
style: {
|
|
662
|
+
display: 'block',
|
|
619
663
|
objectFit: 'cover',
|
|
620
664
|
objectPosition: 'center',
|
|
621
665
|
borderRadius: radius ? radius : configStyles.MODAL.radius,
|
|
666
|
+
width: imageWidth ? imageWidth : configStyles.MODAL.imageWidth,
|
|
622
667
|
height: imageHeight ? imageHeight : configStyles.MODAL.imageHeight
|
|
623
668
|
},
|
|
624
669
|
src: item.url,
|
|
@@ -690,7 +735,7 @@ Modal.defaultProps = {
|
|
|
690
735
|
type: 'content'
|
|
691
736
|
};
|
|
692
737
|
|
|
693
|
-
var css_248z$c = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{
|
|
738
|
+
var css_248z$c = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{appearance:none!important;-webkit-appearance:none!important;display:flex;width:100%}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{background-color:inherit!important}input::-ms-clear,input::-ms-reveal{display:none}.input-module_error-message-show__OrVSo{animation-fill-mode:forwards;animation-name:input-module_error-show__9MP6k}.input-module_inp-num__vH7HL::-webkit-inner-spin-button,.input-module_inp-num__vH7HL::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.input-module_inp-num__vH7HL[type=number]{-moz-appearance:textfield}@keyframes input-module_error-show__9MP6k{to{bottom:-20px;transform:scaleX(1);-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);-o-transform:scaleX(1)}}";
|
|
694
739
|
var styles$a = {"input-wrap":"input-module_input-wrap__NunrE","input-content":"input-module_input-content__kP7lZ","error-message-show":"input-module_error-message-show__OrVSo","error-show":"input-module_error-show__9MP6k","inp-num":"input-module_inp-num__vH7HL"};
|
|
695
740
|
styleInject(css_248z$c);
|
|
696
741
|
|
|
@@ -3574,8 +3619,6 @@ var css_248z$2 = ".pagination-module_listItem__b1-WN:focus{background-color:#4ca
|
|
|
3574
3619
|
var styles$2 = {"listItem":"pagination-module_listItem__b1-WN","active":"pagination-module_active__KwBDp","pagination-bar":"pagination-module_pagination-bar__MrtYT","pagination-btn":"pagination-module_pagination-btn__w8Yh8","pagination-item":"pagination-module_pagination-item__t3emS","pagination-jump-next":"pagination-module_pagination-jump-next__LAb9Z","selected":"pagination-module_selected__EXzCA","pagination-jump-next-txt":"pagination-module_pagination-jump-next-txt__e7nFj","pagination-jump-next-arrow":"pagination-module_pagination-jump-next-arrow__aEVD8"};
|
|
3575
3620
|
styleInject(css_248z$2);
|
|
3576
3621
|
|
|
3577
|
-
// import styles from "./pagination.module.scss";
|
|
3578
|
-
|
|
3579
3622
|
const Dots = "...";
|
|
3580
3623
|
const range = (start, end) => {
|
|
3581
3624
|
const length = end - start + 1;
|
|
@@ -3584,41 +3627,36 @@ const range = (start, end) => {
|
|
|
3584
3627
|
}, (_, idx) => idx + start);
|
|
3585
3628
|
};
|
|
3586
3629
|
const PaginationRange = ({
|
|
3587
|
-
currentTotalCount,
|
|
3588
3630
|
offset,
|
|
3589
|
-
|
|
3631
|
+
currentTotalCount,
|
|
3590
3632
|
currentPageNumber
|
|
3591
3633
|
}) => {
|
|
3592
3634
|
const paginationRange = useMemo(() => {
|
|
3635
|
+
const firstPageIndex = 1;
|
|
3593
3636
|
const totalPageCount = Math.ceil(currentTotalCount / offset);
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
const totalPageNumber = siblingCountNumber + 5;
|
|
3597
|
-
if (totalPageNumber >= totalPageCount) {
|
|
3637
|
+
const lastPageIndex = totalPageCount;
|
|
3638
|
+
if (7 >= totalPageCount) {
|
|
3598
3639
|
return range(1, totalPageCount);
|
|
3599
3640
|
}
|
|
3600
|
-
const
|
|
3601
|
-
const
|
|
3641
|
+
const leftSiblingIndex = Math.max(currentPageNumber - 1, 1);
|
|
3642
|
+
const rightSiblingIndex = Math.min(currentPageNumber + 1, totalPageCount);
|
|
3602
3643
|
const shouldShowLeftDots = leftSiblingIndex > 2;
|
|
3603
3644
|
const shouldShowRightDots = rightSiblingIndex < totalPageCount - 2;
|
|
3604
|
-
const firstPageIndex = 1;
|
|
3605
|
-
const lastPageIndex = totalPageCount;
|
|
3606
3645
|
if (!shouldShowLeftDots && shouldShowRightDots) {
|
|
3607
|
-
let leftItemCount = currentPageNumber === 4 && lastPageIndex
|
|
3646
|
+
let leftItemCount = currentPageNumber === 4 && lastPageIndex >= 7 ? 5 : 4;
|
|
3608
3647
|
let leftRange = range(1, leftItemCount);
|
|
3609
3648
|
return [...leftRange, Dots, totalPageCount];
|
|
3610
|
-
}
|
|
3611
|
-
|
|
3612
|
-
let rightItemCount = 0;
|
|
3613
|
-
currentPageNumber === lastPageIndex - 3 && lastPageIndex > 7 ? rightItemCount = 4 + siblingCountNumber : rightItemCount = 3 + siblingCountNumber;
|
|
3649
|
+
} else if (shouldShowLeftDots && !shouldShowRightDots) {
|
|
3650
|
+
let rightItemCount = currentPageNumber === lastPageIndex - 3 && lastPageIndex >= 7 ? 4 : 3;
|
|
3614
3651
|
let rightRange = range(totalPageCount - rightItemCount + 1, totalPageCount);
|
|
3615
3652
|
return [firstPageIndex, Dots, ...rightRange];
|
|
3616
|
-
}
|
|
3617
|
-
if (shouldShowLeftDots && shouldShowRightDots) {
|
|
3653
|
+
} else if (shouldShowLeftDots && shouldShowRightDots) {
|
|
3618
3654
|
let middleRange = range(leftSiblingIndex, rightSiblingIndex);
|
|
3619
3655
|
return [firstPageIndex, Dots, ...middleRange, Dots, lastPageIndex];
|
|
3656
|
+
} else {
|
|
3657
|
+
return range(firstPageIndex, totalPageCount);
|
|
3620
3658
|
}
|
|
3621
|
-
}, [currentTotalCount, offset,
|
|
3659
|
+
}, [currentTotalCount, offset, currentPageNumber]);
|
|
3622
3660
|
return paginationRange;
|
|
3623
3661
|
};
|
|
3624
3662
|
|
|
@@ -3662,24 +3700,19 @@ const SvgNextarrow = ({
|
|
|
3662
3700
|
|
|
3663
3701
|
const Pagination = ({
|
|
3664
3702
|
goTo,
|
|
3703
|
+
offset,
|
|
3665
3704
|
onChange,
|
|
3705
|
+
className,
|
|
3666
3706
|
totalCount,
|
|
3667
|
-
|
|
3668
|
-
currentPage,
|
|
3669
|
-
offset,
|
|
3670
|
-
className
|
|
3707
|
+
currentPage
|
|
3671
3708
|
}) => {
|
|
3672
3709
|
const [inpVal, setInpVal] = useState('');
|
|
3673
3710
|
const [error, setError] = useState(false);
|
|
3674
|
-
const [siblingCountNumber, setSibilingCountNumber] = useState(siblingCount);
|
|
3675
3711
|
const [currentPageNumber, setCurrentPage] = useState(currentPage);
|
|
3676
3712
|
const [currentTotalCount, setcurrentTotalCount] = useState(totalCount);
|
|
3677
3713
|
useEffect(() => {
|
|
3678
3714
|
setcurrentTotalCount(totalCount);
|
|
3679
3715
|
}, [totalCount]);
|
|
3680
|
-
useEffect(() => {
|
|
3681
|
-
setSibilingCountNumber(siblingCount);
|
|
3682
|
-
}, [siblingCount]);
|
|
3683
3716
|
useEffect(() => {
|
|
3684
3717
|
setCurrentPage(currentPage);
|
|
3685
3718
|
}, [currentPage]);
|
|
@@ -3694,10 +3727,9 @@ const Pagination = ({
|
|
|
3694
3727
|
const paginationRange = PaginationRange({
|
|
3695
3728
|
currentPageNumber,
|
|
3696
3729
|
currentTotalCount,
|
|
3697
|
-
siblingCountNumber,
|
|
3698
3730
|
offset
|
|
3699
3731
|
});
|
|
3700
|
-
if (currentPageNumber === 0 || paginationRange
|
|
3732
|
+
if (currentPageNumber === 0 || paginationRange?.length < 2) {
|
|
3701
3733
|
return null;
|
|
3702
3734
|
}
|
|
3703
3735
|
const classProps = classnames(styles$2.list, className ? className : `${styles$2["pagination-bar"]} pagination-bar-rem`);
|
|
@@ -3824,12 +3856,10 @@ Pagination.propTypes = {
|
|
|
3824
3856
|
offset: PropTypes.number,
|
|
3825
3857
|
totalCount: PropTypes.number,
|
|
3826
3858
|
className: PropTypes.string,
|
|
3827
|
-
siblingCount: PropTypes.number,
|
|
3828
3859
|
currentPage: PropTypes.number
|
|
3829
3860
|
};
|
|
3830
3861
|
Pagination.defaultProps = {
|
|
3831
|
-
offset: 2
|
|
3832
|
-
siblingCount: 2
|
|
3862
|
+
offset: 2
|
|
3833
3863
|
};
|
|
3834
3864
|
|
|
3835
3865
|
var css_248z$1 = ".autocomplate-module_autocomplate-content__UbIUT{display:flex;flex-direction:column;position:relative}.autocomplate-module_autocomplate-content-top__FVgCp{border:2px solid #d1d1d1;border-radius:6px;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;flex-direction:row;font-size:16px;font-weight:500;height:46px;line-height:22px;max-width:400px;padding:0 15px;transition:border-color .24s}.autocomplate-module_autocomplate-content-top__FVgCp.autocomplate-module_active__40fdV{border-color:#00236a}.autocomplate-module_autocomplate-content-top__FVgCp:hover{border-color:#3c393e}.autocomplate-module_autocomplate-content-bottom__yk0zP{animation:autocomplate-module_select-show__7Uap4 .64s linear forwards;background:#fbfbfb;border-radius:6px;box-shadow:0 0 10px rgba(60,57,62,.08);left:0;max-height:0;max-width:400px;overflow:hidden;position:absolute;top:52px;width:100%;z-index:1}.autocomplate-module_autocomplate-content-bottom-inner__rF5IF{display:flex;flex-direction:column;max-height:234px;overflow-x:hidden;overflow-y:auto}@keyframes autocomplate-module_select-show__7Uap4{to{max-height:400px}}.autocomplate-module_autocomplate-content-bottom-row__dRsZa{align-items:center;background:#fff;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;font-size:16px;font-weight:500;height:46px;line-height:22px;margin-bottom:2px;padding:0 15px;transition:background .24s,color .24s}.autocomplate-module_autocomplate-content-bottom-row__dRsZa .autocomplate-module_no-option__xv0-E{color:red}.autocomplate-module_autocomplate-content-bottom-row__dRsZa:hover{background:unset;color:#00236a}.autocomplate-module_option-active__WuH4I .autocomplate-module_autocomplate-content-bottom-row__dRsZa{color:#00236a}.autocomplate-module_autocomplate-title__3Qxqz{color:#3c393e;display:block;font-size:16px;font-weight:500;line-height:22px;margin-bottom:6px;text-transform:none}.autocomplate-module_errorBorder__LV-nb{border:2px solid #e00!important}.autocomplate-module_errorMessage__Gchpc{color:#e00!important}";
|
|
@@ -3968,7 +3998,7 @@ Autocomplate.defaultProps = {
|
|
|
3968
3998
|
required: false
|
|
3969
3999
|
};
|
|
3970
4000
|
|
|
3971
|
-
var css_248z = ".autocomplete-module_auto-complete__tdYkw{
|
|
4001
|
+
var css_248z = ".autocomplete-module_auto-complete__tdYkw{appearance:none!important;-webkit-appearance:none!important}";
|
|
3972
4002
|
var styles = {"auto-complete":"autocomplete-module_auto-complete__tdYkw"};
|
|
3973
4003
|
styleInject(css_248z);
|
|
3974
4004
|
|
|
@@ -3981,6 +4011,7 @@ const NewAutocomplete = ({
|
|
|
3981
4011
|
required,
|
|
3982
4012
|
disabled,
|
|
3983
4013
|
selected,
|
|
4014
|
+
className,
|
|
3984
4015
|
errorSize,
|
|
3985
4016
|
labelSize,
|
|
3986
4017
|
marginTop,
|
|
@@ -4056,6 +4087,7 @@ const NewAutocomplete = ({
|
|
|
4056
4087
|
const [innerValue, setInnerValue] = useState('');
|
|
4057
4088
|
const [innerOptions, setInnerOptions] = useState([]);
|
|
4058
4089
|
const configStyles = compereConfigs();
|
|
4090
|
+
const classProps = classnames(className ? className : configStyles.NEWAUTOCOMPLETE.className, styles['auto-complete']);
|
|
4059
4091
|
const showOption = keyframes`
|
|
4060
4092
|
100% {
|
|
4061
4093
|
max-height: 400px;
|
|
@@ -4230,7 +4262,7 @@ const NewAutocomplete = ({
|
|
|
4230
4262
|
onInput: handleChange,
|
|
4231
4263
|
onMouseEnter: handleMouseEnter,
|
|
4232
4264
|
onMouseLeave: handleMouseLeave,
|
|
4233
|
-
className:
|
|
4265
|
+
className: classProps,
|
|
4234
4266
|
placeholder: placeHolder ? placeHolder : '',
|
|
4235
4267
|
autoComplete: autoComplete ? autoComplete : configStyles.NEWAUTOCOMPLETE.autoComplete,
|
|
4236
4268
|
style: {
|
|
@@ -4268,6 +4300,7 @@ NewAutocomplete.propTypes = {
|
|
|
4268
4300
|
disabled: PropTypes.bool,
|
|
4269
4301
|
keyNames: PropTypes.object,
|
|
4270
4302
|
selected: PropTypes.object,
|
|
4303
|
+
className: PropTypes.string,
|
|
4271
4304
|
errorSize: PropTypes.string,
|
|
4272
4305
|
marginTop: PropTypes.string,
|
|
4273
4306
|
labelSize: PropTypes.string,
|
package/dist/index.js
CHANGED
|
@@ -220,6 +220,29 @@ File.defaultProps = {
|
|
|
220
220
|
fileExtensions: ['jpg', 'jpeg', 'png', 'pdf']
|
|
221
221
|
};
|
|
222
222
|
|
|
223
|
+
const _ = require('lodash');
|
|
224
|
+
const compereConfigs = () => {
|
|
225
|
+
let projectConfig = {};
|
|
226
|
+
let packageConfig = {};
|
|
227
|
+
try {
|
|
228
|
+
packageConfig = require('../tui.config.js');
|
|
229
|
+
} catch (e) {
|
|
230
|
+
try {
|
|
231
|
+
packageConfig = require('../../tui.config.js');
|
|
232
|
+
} catch (err) {
|
|
233
|
+
packageConfig = {};
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
try {
|
|
237
|
+
projectConfig = require('../../../../tui.config.js');
|
|
238
|
+
} catch (error) {
|
|
239
|
+
projectConfig = {};
|
|
240
|
+
// console.log(error, 'Project: if you want to use custom styles, create tui.config.js file in your project root');
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return _.merge(packageConfig, projectConfig);
|
|
244
|
+
};
|
|
245
|
+
|
|
223
246
|
const SvgCheckboxUnchecked = ({
|
|
224
247
|
title,
|
|
225
248
|
titleId,
|
|
@@ -262,17 +285,24 @@ const SvgCheckboxChecked = ({
|
|
|
262
285
|
fill: fillColor ? fillColor : '#00236A'
|
|
263
286
|
}));
|
|
264
287
|
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
|
|
288
|
+
const Checkbox$1 = ({
|
|
289
|
+
data,
|
|
290
|
+
styles,
|
|
268
291
|
checked,
|
|
269
|
-
onClick,
|
|
270
|
-
content,
|
|
271
292
|
disabled,
|
|
272
293
|
checkedColor,
|
|
294
|
+
handleChecked,
|
|
273
295
|
unCheckedColor
|
|
274
296
|
}) => {
|
|
275
|
-
const
|
|
297
|
+
const configStyles = compereConfigs();
|
|
298
|
+
const [innerChecked, setInnerChecked] = React.useState(false);
|
|
299
|
+
const [innerDisabled, setInnerDisabled] = React.useState(false);
|
|
300
|
+
const handleClick = e => {
|
|
301
|
+
handleChecked(data, e);
|
|
302
|
+
};
|
|
303
|
+
React.useEffect(() => {
|
|
304
|
+
setInnerDisabled(disabled);
|
|
305
|
+
}, [disabled]);
|
|
276
306
|
React.useEffect(() => {
|
|
277
307
|
setInnerChecked(checked);
|
|
278
308
|
}, [checked]);
|
|
@@ -282,48 +312,61 @@ const SingleCheckbox = ({
|
|
|
282
312
|
height: '16px',
|
|
283
313
|
marginRight: '9px',
|
|
284
314
|
display: 'inline-block',
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
fillColor: checkedColor ? checkedColor :
|
|
315
|
+
cursor: !innerDisabled ? 'pointer' : 'not-allowed',
|
|
316
|
+
...styles
|
|
317
|
+
},
|
|
318
|
+
onClick: !innerDisabled && handleChecked ? handleClick : _ => _
|
|
319
|
+
}, innerChecked && !innerDisabled ? /*#__PURE__*/React__default["default"].createElement(SvgCheckboxChecked, {
|
|
320
|
+
fillColor: checkedColor ? checkedColor : configStyles.SINGLECHECKBOX.checkedColor
|
|
291
321
|
}) : /*#__PURE__*/React__default["default"].createElement(SvgCheckboxUnchecked, {
|
|
292
|
-
|
|
293
|
-
fillColor: unCheckedColor ? unCheckedColor : ''
|
|
322
|
+
fillColor: unCheckedColor ? unCheckedColor : configStyles.SINGLECHECKBOX.unCheckedColor
|
|
294
323
|
}));
|
|
295
324
|
};
|
|
325
|
+
|
|
326
|
+
const SingleCheckbox = ({
|
|
327
|
+
data,
|
|
328
|
+
styles,
|
|
329
|
+
checked,
|
|
330
|
+
disabled,
|
|
331
|
+
checkedColor,
|
|
332
|
+
handleChecked,
|
|
333
|
+
unCheckedColor
|
|
334
|
+
}) => {
|
|
335
|
+
const [innerData, setInnerData] = React.useState(null);
|
|
336
|
+
React.useEffect(() => {
|
|
337
|
+
// if (data) {
|
|
338
|
+
// if (typeof data === 'object' && data.constructor === Object) {
|
|
339
|
+
// setInnerData(data);
|
|
340
|
+
// } else {
|
|
341
|
+
// alert('Data props on Checkbox component must be an object');
|
|
342
|
+
// }
|
|
343
|
+
// } else {
|
|
344
|
+
// alert('Please add data props on Checkbox component');
|
|
345
|
+
// }
|
|
346
|
+
setInnerData(data);
|
|
347
|
+
}, [data]);
|
|
348
|
+
return /*#__PURE__*/React__default["default"].createElement(Checkbox$1, {
|
|
349
|
+
styles: styles,
|
|
350
|
+
data: innerData,
|
|
351
|
+
checked: checked,
|
|
352
|
+
disabled: disabled,
|
|
353
|
+
checkedColor: checkedColor,
|
|
354
|
+
handleChecked: handleChecked,
|
|
355
|
+
unCheckedColor: unCheckedColor
|
|
356
|
+
});
|
|
357
|
+
};
|
|
296
358
|
SingleCheckbox.propTypes = {
|
|
359
|
+
onClick: PropTypes__default["default"].func,
|
|
360
|
+
styles: PropTypes__default["default"].object,
|
|
297
361
|
disabled: PropTypes__default["default"].bool,
|
|
298
|
-
|
|
362
|
+
checkedColor: PropTypes__default["default"].string,
|
|
363
|
+
unCheckedColor: PropTypes__default["default"].string,
|
|
364
|
+
data: PropTypes__default["default"].oneOfType([PropTypes__default["default"].object, PropTypes__default["default"].array]).isRequired
|
|
299
365
|
};
|
|
300
366
|
|
|
301
367
|
var css_248z$e = ".table-module_sorting-arrows__BaN-G:after{content:\"▲\";font-size:11px;position:absolute;right:0;top:calc(50% - 12px)}.table-module_sorting-arrows__BaN-G:before{bottom:calc(50% - 12px);content:\"▼\";font-size:11px;position:absolute;right:0}.table-module_td-span__XHo6k{cursor:pointer;display:inline-block;position:relative}.table-module_td-span__XHo6k>svg{left:0;position:absolute;top:0;z-index:-1}";
|
|
302
368
|
styleInject(css_248z$e);
|
|
303
369
|
|
|
304
|
-
const _ = require('lodash');
|
|
305
|
-
const compereConfigs = () => {
|
|
306
|
-
let projectConfig = {};
|
|
307
|
-
let packageConfig = {};
|
|
308
|
-
try {
|
|
309
|
-
packageConfig = require('../tui.config.js');
|
|
310
|
-
} catch (e) {
|
|
311
|
-
try {
|
|
312
|
-
packageConfig = require('../../tui.config.js');
|
|
313
|
-
} catch (err) {
|
|
314
|
-
packageConfig = {};
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
try {
|
|
318
|
-
projectConfig = require('../../../../tui.config.js');
|
|
319
|
-
} catch (error) {
|
|
320
|
-
projectConfig = {};
|
|
321
|
-
// console.log(error, 'Project: if you want to use custom styles, create tui.config.js file in your project root');
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
return _.merge(packageConfig, projectConfig);
|
|
325
|
-
};
|
|
326
|
-
|
|
327
370
|
({
|
|
328
371
|
dataBody: PropTypes__default["default"].array,
|
|
329
372
|
dataHeader: PropTypes__default["default"].array,
|
|
@@ -646,9 +689,11 @@ const Modal = ({
|
|
|
646
689
|
} else {
|
|
647
690
|
return /*#__PURE__*/React__default["default"].createElement("img", {
|
|
648
691
|
style: {
|
|
692
|
+
display: 'block',
|
|
649
693
|
objectFit: 'cover',
|
|
650
694
|
objectPosition: 'center',
|
|
651
695
|
borderRadius: radius ? radius : configStyles.MODAL.radius,
|
|
696
|
+
width: imageWidth ? imageWidth : configStyles.MODAL.imageWidth,
|
|
652
697
|
height: imageHeight ? imageHeight : configStyles.MODAL.imageHeight
|
|
653
698
|
},
|
|
654
699
|
src: item.url,
|
|
@@ -720,7 +765,7 @@ Modal.defaultProps = {
|
|
|
720
765
|
type: 'content'
|
|
721
766
|
};
|
|
722
767
|
|
|
723
|
-
var css_248z$c = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{
|
|
768
|
+
var css_248z$c = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{appearance:none!important;-webkit-appearance:none!important;display:flex;width:100%}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{background-color:inherit!important}input::-ms-clear,input::-ms-reveal{display:none}.input-module_error-message-show__OrVSo{animation-fill-mode:forwards;animation-name:input-module_error-show__9MP6k}.input-module_inp-num__vH7HL::-webkit-inner-spin-button,.input-module_inp-num__vH7HL::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.input-module_inp-num__vH7HL[type=number]{-moz-appearance:textfield}@keyframes input-module_error-show__9MP6k{to{bottom:-20px;transform:scaleX(1);-webkit-transform:scaleX(1);-moz-transform:scaleX(1);-ms-transform:scaleX(1);-o-transform:scaleX(1)}}";
|
|
724
769
|
var styles$a = {"input-wrap":"input-module_input-wrap__NunrE","input-content":"input-module_input-content__kP7lZ","error-message-show":"input-module_error-message-show__OrVSo","error-show":"input-module_error-show__9MP6k","inp-num":"input-module_inp-num__vH7HL"};
|
|
725
770
|
styleInject(css_248z$c);
|
|
726
771
|
|
|
@@ -3604,8 +3649,6 @@ var css_248z$2 = ".pagination-module_listItem__b1-WN:focus{background-color:#4ca
|
|
|
3604
3649
|
var styles$2 = {"listItem":"pagination-module_listItem__b1-WN","active":"pagination-module_active__KwBDp","pagination-bar":"pagination-module_pagination-bar__MrtYT","pagination-btn":"pagination-module_pagination-btn__w8Yh8","pagination-item":"pagination-module_pagination-item__t3emS","pagination-jump-next":"pagination-module_pagination-jump-next__LAb9Z","selected":"pagination-module_selected__EXzCA","pagination-jump-next-txt":"pagination-module_pagination-jump-next-txt__e7nFj","pagination-jump-next-arrow":"pagination-module_pagination-jump-next-arrow__aEVD8"};
|
|
3605
3650
|
styleInject(css_248z$2);
|
|
3606
3651
|
|
|
3607
|
-
// import styles from "./pagination.module.scss";
|
|
3608
|
-
|
|
3609
3652
|
const Dots = "...";
|
|
3610
3653
|
const range = (start, end) => {
|
|
3611
3654
|
const length = end - start + 1;
|
|
@@ -3614,41 +3657,36 @@ const range = (start, end) => {
|
|
|
3614
3657
|
}, (_, idx) => idx + start);
|
|
3615
3658
|
};
|
|
3616
3659
|
const PaginationRange = ({
|
|
3617
|
-
currentTotalCount,
|
|
3618
3660
|
offset,
|
|
3619
|
-
|
|
3661
|
+
currentTotalCount,
|
|
3620
3662
|
currentPageNumber
|
|
3621
3663
|
}) => {
|
|
3622
3664
|
const paginationRange = React.useMemo(() => {
|
|
3665
|
+
const firstPageIndex = 1;
|
|
3623
3666
|
const totalPageCount = Math.ceil(currentTotalCount / offset);
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
const totalPageNumber = siblingCountNumber + 5;
|
|
3627
|
-
if (totalPageNumber >= totalPageCount) {
|
|
3667
|
+
const lastPageIndex = totalPageCount;
|
|
3668
|
+
if (7 >= totalPageCount) {
|
|
3628
3669
|
return range(1, totalPageCount);
|
|
3629
3670
|
}
|
|
3630
|
-
const
|
|
3631
|
-
const
|
|
3671
|
+
const leftSiblingIndex = Math.max(currentPageNumber - 1, 1);
|
|
3672
|
+
const rightSiblingIndex = Math.min(currentPageNumber + 1, totalPageCount);
|
|
3632
3673
|
const shouldShowLeftDots = leftSiblingIndex > 2;
|
|
3633
3674
|
const shouldShowRightDots = rightSiblingIndex < totalPageCount - 2;
|
|
3634
|
-
const firstPageIndex = 1;
|
|
3635
|
-
const lastPageIndex = totalPageCount;
|
|
3636
3675
|
if (!shouldShowLeftDots && shouldShowRightDots) {
|
|
3637
|
-
let leftItemCount = currentPageNumber === 4 && lastPageIndex
|
|
3676
|
+
let leftItemCount = currentPageNumber === 4 && lastPageIndex >= 7 ? 5 : 4;
|
|
3638
3677
|
let leftRange = range(1, leftItemCount);
|
|
3639
3678
|
return [...leftRange, Dots, totalPageCount];
|
|
3640
|
-
}
|
|
3641
|
-
|
|
3642
|
-
let rightItemCount = 0;
|
|
3643
|
-
currentPageNumber === lastPageIndex - 3 && lastPageIndex > 7 ? rightItemCount = 4 + siblingCountNumber : rightItemCount = 3 + siblingCountNumber;
|
|
3679
|
+
} else if (shouldShowLeftDots && !shouldShowRightDots) {
|
|
3680
|
+
let rightItemCount = currentPageNumber === lastPageIndex - 3 && lastPageIndex >= 7 ? 4 : 3;
|
|
3644
3681
|
let rightRange = range(totalPageCount - rightItemCount + 1, totalPageCount);
|
|
3645
3682
|
return [firstPageIndex, Dots, ...rightRange];
|
|
3646
|
-
}
|
|
3647
|
-
if (shouldShowLeftDots && shouldShowRightDots) {
|
|
3683
|
+
} else if (shouldShowLeftDots && shouldShowRightDots) {
|
|
3648
3684
|
let middleRange = range(leftSiblingIndex, rightSiblingIndex);
|
|
3649
3685
|
return [firstPageIndex, Dots, ...middleRange, Dots, lastPageIndex];
|
|
3686
|
+
} else {
|
|
3687
|
+
return range(firstPageIndex, totalPageCount);
|
|
3650
3688
|
}
|
|
3651
|
-
}, [currentTotalCount, offset,
|
|
3689
|
+
}, [currentTotalCount, offset, currentPageNumber]);
|
|
3652
3690
|
return paginationRange;
|
|
3653
3691
|
};
|
|
3654
3692
|
|
|
@@ -3692,24 +3730,19 @@ const SvgNextarrow = ({
|
|
|
3692
3730
|
|
|
3693
3731
|
const Pagination = ({
|
|
3694
3732
|
goTo,
|
|
3733
|
+
offset,
|
|
3695
3734
|
onChange,
|
|
3735
|
+
className,
|
|
3696
3736
|
totalCount,
|
|
3697
|
-
|
|
3698
|
-
currentPage,
|
|
3699
|
-
offset,
|
|
3700
|
-
className
|
|
3737
|
+
currentPage
|
|
3701
3738
|
}) => {
|
|
3702
3739
|
const [inpVal, setInpVal] = React.useState('');
|
|
3703
3740
|
const [error, setError] = React.useState(false);
|
|
3704
|
-
const [siblingCountNumber, setSibilingCountNumber] = React.useState(siblingCount);
|
|
3705
3741
|
const [currentPageNumber, setCurrentPage] = React.useState(currentPage);
|
|
3706
3742
|
const [currentTotalCount, setcurrentTotalCount] = React.useState(totalCount);
|
|
3707
3743
|
React.useEffect(() => {
|
|
3708
3744
|
setcurrentTotalCount(totalCount);
|
|
3709
3745
|
}, [totalCount]);
|
|
3710
|
-
React.useEffect(() => {
|
|
3711
|
-
setSibilingCountNumber(siblingCount);
|
|
3712
|
-
}, [siblingCount]);
|
|
3713
3746
|
React.useEffect(() => {
|
|
3714
3747
|
setCurrentPage(currentPage);
|
|
3715
3748
|
}, [currentPage]);
|
|
@@ -3724,10 +3757,9 @@ const Pagination = ({
|
|
|
3724
3757
|
const paginationRange = PaginationRange({
|
|
3725
3758
|
currentPageNumber,
|
|
3726
3759
|
currentTotalCount,
|
|
3727
|
-
siblingCountNumber,
|
|
3728
3760
|
offset
|
|
3729
3761
|
});
|
|
3730
|
-
if (currentPageNumber === 0 || paginationRange
|
|
3762
|
+
if (currentPageNumber === 0 || paginationRange?.length < 2) {
|
|
3731
3763
|
return null;
|
|
3732
3764
|
}
|
|
3733
3765
|
const classProps = classnames__default["default"](styles$2.list, className ? className : `${styles$2["pagination-bar"]} pagination-bar-rem`);
|
|
@@ -3854,12 +3886,10 @@ Pagination.propTypes = {
|
|
|
3854
3886
|
offset: PropTypes__default["default"].number,
|
|
3855
3887
|
totalCount: PropTypes__default["default"].number,
|
|
3856
3888
|
className: PropTypes__default["default"].string,
|
|
3857
|
-
siblingCount: PropTypes__default["default"].number,
|
|
3858
3889
|
currentPage: PropTypes__default["default"].number
|
|
3859
3890
|
};
|
|
3860
3891
|
Pagination.defaultProps = {
|
|
3861
|
-
offset: 2
|
|
3862
|
-
siblingCount: 2
|
|
3892
|
+
offset: 2
|
|
3863
3893
|
};
|
|
3864
3894
|
|
|
3865
3895
|
var css_248z$1 = ".autocomplate-module_autocomplate-content__UbIUT{display:flex;flex-direction:column;position:relative}.autocomplate-module_autocomplate-content-top__FVgCp{border:2px solid #d1d1d1;border-radius:6px;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;flex-direction:row;font-size:16px;font-weight:500;height:46px;line-height:22px;max-width:400px;padding:0 15px;transition:border-color .24s}.autocomplate-module_autocomplate-content-top__FVgCp.autocomplate-module_active__40fdV{border-color:#00236a}.autocomplate-module_autocomplate-content-top__FVgCp:hover{border-color:#3c393e}.autocomplate-module_autocomplate-content-bottom__yk0zP{animation:autocomplate-module_select-show__7Uap4 .64s linear forwards;background:#fbfbfb;border-radius:6px;box-shadow:0 0 10px rgba(60,57,62,.08);left:0;max-height:0;max-width:400px;overflow:hidden;position:absolute;top:52px;width:100%;z-index:1}.autocomplate-module_autocomplate-content-bottom-inner__rF5IF{display:flex;flex-direction:column;max-height:234px;overflow-x:hidden;overflow-y:auto}@keyframes autocomplate-module_select-show__7Uap4{to{max-height:400px}}.autocomplate-module_autocomplate-content-bottom-row__dRsZa{align-items:center;background:#fff;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;font-size:16px;font-weight:500;height:46px;line-height:22px;margin-bottom:2px;padding:0 15px;transition:background .24s,color .24s}.autocomplate-module_autocomplate-content-bottom-row__dRsZa .autocomplate-module_no-option__xv0-E{color:red}.autocomplate-module_autocomplate-content-bottom-row__dRsZa:hover{background:unset;color:#00236a}.autocomplate-module_option-active__WuH4I .autocomplate-module_autocomplate-content-bottom-row__dRsZa{color:#00236a}.autocomplate-module_autocomplate-title__3Qxqz{color:#3c393e;display:block;font-size:16px;font-weight:500;line-height:22px;margin-bottom:6px;text-transform:none}.autocomplate-module_errorBorder__LV-nb{border:2px solid #e00!important}.autocomplate-module_errorMessage__Gchpc{color:#e00!important}";
|
|
@@ -3998,7 +4028,7 @@ Autocomplate.defaultProps = {
|
|
|
3998
4028
|
required: false
|
|
3999
4029
|
};
|
|
4000
4030
|
|
|
4001
|
-
var css_248z = ".autocomplete-module_auto-complete__tdYkw{
|
|
4031
|
+
var css_248z = ".autocomplete-module_auto-complete__tdYkw{appearance:none!important;-webkit-appearance:none!important}";
|
|
4002
4032
|
var styles = {"auto-complete":"autocomplete-module_auto-complete__tdYkw"};
|
|
4003
4033
|
styleInject(css_248z);
|
|
4004
4034
|
|
|
@@ -4011,6 +4041,7 @@ const NewAutocomplete = ({
|
|
|
4011
4041
|
required,
|
|
4012
4042
|
disabled,
|
|
4013
4043
|
selected,
|
|
4044
|
+
className,
|
|
4014
4045
|
errorSize,
|
|
4015
4046
|
labelSize,
|
|
4016
4047
|
marginTop,
|
|
@@ -4086,6 +4117,7 @@ const NewAutocomplete = ({
|
|
|
4086
4117
|
const [innerValue, setInnerValue] = React.useState('');
|
|
4087
4118
|
const [innerOptions, setInnerOptions] = React.useState([]);
|
|
4088
4119
|
const configStyles = compereConfigs();
|
|
4120
|
+
const classProps = classnames__default["default"](className ? className : configStyles.NEWAUTOCOMPLETE.className, styles['auto-complete']);
|
|
4089
4121
|
const showOption = styled.keyframes`
|
|
4090
4122
|
100% {
|
|
4091
4123
|
max-height: 400px;
|
|
@@ -4260,7 +4292,7 @@ const NewAutocomplete = ({
|
|
|
4260
4292
|
onInput: handleChange,
|
|
4261
4293
|
onMouseEnter: handleMouseEnter,
|
|
4262
4294
|
onMouseLeave: handleMouseLeave,
|
|
4263
|
-
className:
|
|
4295
|
+
className: classProps,
|
|
4264
4296
|
placeholder: placeHolder ? placeHolder : '',
|
|
4265
4297
|
autoComplete: autoComplete ? autoComplete : configStyles.NEWAUTOCOMPLETE.autoComplete,
|
|
4266
4298
|
style: {
|
|
@@ -4298,6 +4330,7 @@ NewAutocomplete.propTypes = {
|
|
|
4298
4330
|
disabled: PropTypes__default["default"].bool,
|
|
4299
4331
|
keyNames: PropTypes__default["default"].object,
|
|
4300
4332
|
selected: PropTypes__default["default"].object,
|
|
4333
|
+
className: PropTypes__default["default"].string,
|
|
4301
4334
|
errorSize: PropTypes__default["default"].string,
|
|
4302
4335
|
marginTop: PropTypes__default["default"].string,
|
|
4303
4336
|
labelSize: PropTypes__default["default"].string,
|
package/package.json
CHANGED
|
@@ -261,9 +261,11 @@ export const Modal = ({
|
|
|
261
261
|
return (
|
|
262
262
|
<img
|
|
263
263
|
style={{
|
|
264
|
+
display: 'block',
|
|
264
265
|
objectFit: 'cover',
|
|
265
266
|
objectPosition: 'center',
|
|
266
267
|
borderRadius: radius ? radius : configStyles.MODAL.radius,
|
|
268
|
+
width: imageWidth ? imageWidth : configStyles.MODAL.imageWidth,
|
|
267
269
|
height: imageHeight ? imageHeight : configStyles.MODAL.imageHeight
|
|
268
270
|
}}
|
|
269
271
|
src={item.url}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
|
+
import classnames from 'classnames';
|
|
4
5
|
import { keyframes, css } from 'styled-components';
|
|
5
6
|
|
|
6
7
|
import { compereConfigs } from './../../utils';
|
|
@@ -16,6 +17,7 @@ export const NewAutocomplete = ({
|
|
|
16
17
|
required,
|
|
17
18
|
disabled,
|
|
18
19
|
selected,
|
|
20
|
+
className,
|
|
19
21
|
errorSize,
|
|
20
22
|
labelSize,
|
|
21
23
|
marginTop,
|
|
@@ -91,6 +93,10 @@ export const NewAutocomplete = ({
|
|
|
91
93
|
const [innerValue, setInnerValue] = useState('');
|
|
92
94
|
const [innerOptions, setInnerOptions] = useState([]);
|
|
93
95
|
const configStyles = compereConfigs();
|
|
96
|
+
const classProps = classnames(
|
|
97
|
+
className ? className : configStyles.NEWAUTOCOMPLETE.className,
|
|
98
|
+
styles['auto-complete']
|
|
99
|
+
);
|
|
94
100
|
|
|
95
101
|
const showOption = keyframes`
|
|
96
102
|
100% {
|
|
@@ -328,7 +334,7 @@ export const NewAutocomplete = ({
|
|
|
328
334
|
onInput={handleChange}
|
|
329
335
|
onMouseEnter={handleMouseEnter}
|
|
330
336
|
onMouseLeave={handleMouseLeave}
|
|
331
|
-
className={
|
|
337
|
+
className={classProps}
|
|
332
338
|
placeholder={placeHolder ? placeHolder : ''}
|
|
333
339
|
autoComplete={autoComplete ? autoComplete : configStyles.NEWAUTOCOMPLETE.autoComplete}
|
|
334
340
|
style={{
|
|
@@ -387,6 +393,7 @@ NewAutocomplete.propTypes = {
|
|
|
387
393
|
disabled: PropTypes.bool,
|
|
388
394
|
keyNames: PropTypes.object,
|
|
389
395
|
selected: PropTypes.object,
|
|
396
|
+
className: PropTypes.string,
|
|
390
397
|
errorSize: PropTypes.string,
|
|
391
398
|
marginTop: PropTypes.string,
|
|
392
399
|
labelSize: PropTypes.string,
|
|
@@ -9,24 +9,19 @@ import SvgNextarrow from './../../components/icon/Nextarrow';
|
|
|
9
9
|
|
|
10
10
|
export const Pagination = ({
|
|
11
11
|
goTo,
|
|
12
|
+
offset,
|
|
12
13
|
onChange,
|
|
14
|
+
className,
|
|
13
15
|
totalCount,
|
|
14
|
-
siblingCount,
|
|
15
16
|
currentPage,
|
|
16
|
-
offset,
|
|
17
|
-
className,
|
|
18
17
|
}) => {
|
|
19
18
|
const [inpVal, setInpVal] = useState('');
|
|
20
19
|
const [error, setError] = useState(false);
|
|
21
|
-
const [siblingCountNumber, setSibilingCountNumber] = useState(siblingCount);
|
|
22
20
|
const [currentPageNumber, setCurrentPage] = useState(currentPage);
|
|
23
21
|
const [currentTotalCount, setcurrentTotalCount] = useState(totalCount);
|
|
24
22
|
useEffect(() => {
|
|
25
23
|
setcurrentTotalCount(totalCount);
|
|
26
24
|
}, [totalCount]);
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
setSibilingCountNumber(siblingCount);
|
|
29
|
-
}, [siblingCount]);
|
|
30
25
|
useEffect(() => {
|
|
31
26
|
setCurrentPage(currentPage);
|
|
32
27
|
}, [currentPage]);
|
|
@@ -41,10 +36,10 @@ export const Pagination = ({
|
|
|
41
36
|
const paginationRange = PaginationRange({
|
|
42
37
|
currentPageNumber,
|
|
43
38
|
currentTotalCount,
|
|
44
|
-
siblingCountNumber,
|
|
45
39
|
offset,
|
|
46
40
|
});
|
|
47
|
-
|
|
41
|
+
|
|
42
|
+
if (currentPageNumber === 0 || paginationRange?.length < 2) {
|
|
48
43
|
return null;
|
|
49
44
|
}
|
|
50
45
|
const classProps = classnames(styles.list, className ? className : `${styles["pagination-bar"]} pagination-bar-rem`);
|
|
@@ -251,8 +246,7 @@ Pagination.propTypes = {
|
|
|
251
246
|
offset: PropTypes.number,
|
|
252
247
|
totalCount: PropTypes.number,
|
|
253
248
|
className: PropTypes.string,
|
|
254
|
-
siblingCount: PropTypes.number,
|
|
255
249
|
currentPage: PropTypes.number,
|
|
256
250
|
};
|
|
257
251
|
|
|
258
|
-
Pagination.defaultProps = { offset: 2
|
|
252
|
+
Pagination.defaultProps = { offset: 2 };
|
|
@@ -316,7 +316,7 @@ const data = [
|
|
|
316
316
|
phone: "572-905-5251",
|
|
317
317
|
},
|
|
318
318
|
];
|
|
319
|
-
const Template = ({ goTo, offset, currentPage,
|
|
319
|
+
const Template = ({ goTo, offset, currentPage, totalCount }) => {
|
|
320
320
|
const [currentPageNumber, setCurrentPageNumber] = useState(currentPage);
|
|
321
321
|
const currentTableData = useMemo(() => {
|
|
322
322
|
const firstPageIndex = (currentPageNumber - 1) * offset;
|
|
@@ -355,7 +355,6 @@ const Template = ({ goTo, offset, currentPage, siblingCount, totalCount }) => {
|
|
|
355
355
|
currentPage={currentPage}
|
|
356
356
|
totalCount={totalCount}
|
|
357
357
|
offset={offset}
|
|
358
|
-
siblingCount={siblingCount}
|
|
359
358
|
onChange={(page) => setCurrentPageNumber(page)}
|
|
360
359
|
/>
|
|
361
360
|
</>
|
|
@@ -368,6 +367,5 @@ Default.args = {
|
|
|
368
367
|
goTo: false,
|
|
369
368
|
offset: 10,
|
|
370
369
|
currentPage: 1,
|
|
371
|
-
siblingCount: 2,
|
|
372
370
|
totalCount: 44
|
|
373
371
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
|
-
// import styles from "./pagination.module.scss";
|
|
3
2
|
|
|
4
3
|
export const Dots = "...";
|
|
5
4
|
|
|
@@ -9,62 +8,49 @@ const range = (start, end) => {
|
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
export const PaginationRange = ({
|
|
12
|
-
currentTotalCount,
|
|
13
11
|
offset,
|
|
14
|
-
|
|
12
|
+
currentTotalCount,
|
|
15
13
|
currentPageNumber,
|
|
16
14
|
}) => {
|
|
17
15
|
const paginationRange = useMemo(() => {
|
|
16
|
+
const firstPageIndex = 1;
|
|
18
17
|
const totalPageCount = Math.ceil(currentTotalCount / offset);
|
|
18
|
+
const lastPageIndex = totalPageCount;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
const totalPageNumber = siblingCountNumber + 5;
|
|
22
|
-
if (totalPageNumber >= totalPageCount) {
|
|
20
|
+
if (7 >= totalPageCount) {
|
|
23
21
|
return range(1, totalPageCount);
|
|
24
22
|
}
|
|
25
|
-
const rightSiblingIndex = Math.min(
|
|
26
|
-
currentPageNumber + siblingCountNumber,
|
|
27
|
-
totalPageCount
|
|
28
|
-
);
|
|
29
23
|
|
|
30
|
-
const leftSiblingIndex = Math.max(
|
|
31
|
-
|
|
32
|
-
1
|
|
33
|
-
);
|
|
24
|
+
const leftSiblingIndex = Math.max(currentPageNumber - 1, 1);
|
|
25
|
+
const rightSiblingIndex = Math.min(currentPageNumber + 1, totalPageCount);
|
|
34
26
|
|
|
35
27
|
const shouldShowLeftDots = leftSiblingIndex > 2;
|
|
36
28
|
const shouldShowRightDots = rightSiblingIndex < totalPageCount - 2;
|
|
37
|
-
|
|
38
|
-
const lastPageIndex = totalPageCount;
|
|
29
|
+
|
|
39
30
|
if (!shouldShowLeftDots && shouldShowRightDots) {
|
|
40
|
-
let leftItemCount =
|
|
41
|
-
currentPageNumber === 4 && lastPageIndex > 7
|
|
42
|
-
? 4 + siblingCountNumber
|
|
43
|
-
: 3 + siblingCountNumber;
|
|
44
31
|
|
|
45
|
-
let
|
|
32
|
+
let leftItemCount = currentPageNumber === 4 && lastPageIndex >= 7 ? 5 : 4;
|
|
46
33
|
|
|
34
|
+
let leftRange = range(1, leftItemCount);
|
|
47
35
|
return [...leftRange, Dots, totalPageCount];
|
|
48
|
-
}
|
|
49
36
|
|
|
50
|
-
if (shouldShowLeftDots && !shouldShowRightDots) {
|
|
51
|
-
let rightItemCount = 0;
|
|
52
|
-
currentPageNumber === lastPageIndex - 3 && lastPageIndex > 7
|
|
53
|
-
? (rightItemCount = 4 + siblingCountNumber)
|
|
54
|
-
: (rightItemCount = 3 + siblingCountNumber);
|
|
37
|
+
} else if (shouldShowLeftDots && !shouldShowRightDots) {
|
|
55
38
|
|
|
56
|
-
let
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
);
|
|
39
|
+
let rightItemCount = currentPageNumber === lastPageIndex - 3 && lastPageIndex >= 7 ? 4 : 3;
|
|
40
|
+
|
|
41
|
+
let rightRange = range(totalPageCount - rightItemCount + 1, totalPageCount);
|
|
60
42
|
return [firstPageIndex, Dots, ...rightRange];
|
|
61
|
-
}
|
|
62
43
|
|
|
63
|
-
if (shouldShowLeftDots && shouldShowRightDots) {
|
|
44
|
+
} else if (shouldShowLeftDots && shouldShowRightDots) {
|
|
45
|
+
|
|
64
46
|
let middleRange = range(leftSiblingIndex, rightSiblingIndex);
|
|
65
47
|
return [firstPageIndex, Dots, ...middleRange, Dots, lastPageIndex];
|
|
48
|
+
|
|
49
|
+
} else {
|
|
50
|
+
return range(firstPageIndex, totalPageCount);
|
|
66
51
|
}
|
|
67
|
-
|
|
52
|
+
|
|
53
|
+
}, [currentTotalCount, offset, currentPageNumber]);
|
|
68
54
|
|
|
69
55
|
return paginationRange;
|
|
70
56
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { compereConfigs } from './../../utils';
|
|
4
|
+
|
|
5
|
+
import ReactCheckbox from '../icon/CheckboxUnchecked';
|
|
6
|
+
import ReactCheckboxChecked from '../icon/CheckboxChecked';
|
|
7
|
+
|
|
8
|
+
const Checkbox = ({
|
|
9
|
+
data,
|
|
10
|
+
styles,
|
|
11
|
+
checked,
|
|
12
|
+
disabled,
|
|
13
|
+
checkedColor,
|
|
14
|
+
handleChecked,
|
|
15
|
+
unCheckedColor
|
|
16
|
+
}) => {
|
|
17
|
+
const configStyles = compereConfigs();
|
|
18
|
+
|
|
19
|
+
const [ innerChecked, setInnerChecked ] = useState(false);
|
|
20
|
+
const [ innerDisabled, setInnerDisabled ] = useState(false);
|
|
21
|
+
|
|
22
|
+
const handleClick = (e) => {
|
|
23
|
+
handleChecked(data, e);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
setInnerDisabled(disabled);
|
|
28
|
+
}, [disabled]);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setInnerChecked(checked);
|
|
32
|
+
}, [checked]);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
style={{
|
|
37
|
+
width: '16px',
|
|
38
|
+
height: '16px',
|
|
39
|
+
marginRight: '9px',
|
|
40
|
+
display: 'inline-block',
|
|
41
|
+
cursor: !innerDisabled ? 'pointer' : 'not-allowed',
|
|
42
|
+
...styles
|
|
43
|
+
}}
|
|
44
|
+
onClick={!innerDisabled && handleChecked ? handleClick : _ => _}
|
|
45
|
+
>
|
|
46
|
+
{ innerChecked && !innerDisabled
|
|
47
|
+
? <ReactCheckboxChecked fillColor={checkedColor ? checkedColor : configStyles.SINGLECHECKBOX.checkedColor} />
|
|
48
|
+
: <ReactCheckbox fillColor={unCheckedColor ? unCheckedColor : configStyles.SINGLECHECKBOX.unCheckedColor} />
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
{/* {label && <span>{ label }</span>} */}
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default Checkbox;
|
|
@@ -1,42 +1,51 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import ReactCheckboxChecked from '../icon/CheckboxChecked';
|
|
4
|
+
import Checkbox from './Checkbox';
|
|
6
5
|
|
|
7
6
|
export const SingleCheckbox = ({
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
data,
|
|
8
|
+
styles,
|
|
10
9
|
checked,
|
|
11
|
-
onClick,
|
|
12
|
-
content,
|
|
13
10
|
disabled,
|
|
14
11
|
checkedColor,
|
|
12
|
+
handleChecked,
|
|
15
13
|
unCheckedColor
|
|
16
14
|
}) => {
|
|
17
|
-
|
|
15
|
+
|
|
16
|
+
const [ innerData, setInnerData ] = useState(null);
|
|
18
17
|
|
|
19
18
|
useEffect(() => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
// if (data) {
|
|
20
|
+
// if (typeof data === 'object' && data.constructor === Object) {
|
|
21
|
+
// setInnerData(data);
|
|
22
|
+
// } else {
|
|
23
|
+
// alert('Data props on Checkbox component must be an object');
|
|
24
|
+
// }
|
|
25
|
+
// } else {
|
|
26
|
+
// alert('Please add data props on Checkbox component');
|
|
27
|
+
// }
|
|
28
|
+
setInnerData(data);
|
|
29
|
+
}, [data]);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Checkbox
|
|
33
|
+
styles={styles}
|
|
34
|
+
data={innerData}
|
|
35
|
+
checked={checked}
|
|
36
|
+
disabled={disabled}
|
|
37
|
+
checkedColor={checkedColor}
|
|
38
|
+
handleChecked={handleChecked}
|
|
39
|
+
unCheckedColor={unCheckedColor}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
SingleCheckbox.propTypes = {
|
|
45
|
+
onClick: PropTypes.func,
|
|
46
|
+
styles: PropTypes.object,
|
|
40
47
|
disabled: PropTypes.bool,
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
checkedColor: PropTypes.string,
|
|
49
|
+
unCheckedColor: PropTypes.string,
|
|
50
|
+
data: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired
|
|
51
|
+
};
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { SingleCheckbox } from ".";
|
|
3
3
|
export default {
|
|
4
4
|
component: SingleCheckbox,
|
|
5
5
|
title: "Components/SingleCheckbox",
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
const Template = (args) =>
|
|
8
|
+
const Template = (args) => {
|
|
9
|
+
const [ check, setCheck ] = useState(false);
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
const handleChecked = (data, e) => {
|
|
12
|
+
console.log(e, 'target event');
|
|
13
|
+
console.log(data, 'data');
|
|
14
|
+
setCheck(!check);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return <SingleCheckbox checked={check} data={[1,2,3]} handleChecked={handleChecked} {...args} />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Default = Template.bind({});
|
|
21
|
+
Default.args = {
|
|
22
|
+
checkedColor: '#00236A',
|
|
23
|
+
unCheckedColor: '#D1D1D1'
|
|
24
|
+
};
|
|
@@ -40,7 +40,7 @@ const TH = ({
|
|
|
40
40
|
float='left'
|
|
41
41
|
checked={item.checkBox.checked}
|
|
42
42
|
content={item.content ? item.content : ''}
|
|
43
|
-
|
|
43
|
+
handleChecked={handleCheckedHeader ? handleCheckedHeader : _ => _}
|
|
44
44
|
checkedColor={item.checkBox.checkedColor ? item.checkBox.checkedColor : ''}
|
|
45
45
|
unCheckedColor={item.checkBox.unCheckedColor ? item.checkBox.unCheckedColor : ''}
|
|
46
46
|
/>
|
|
@@ -461,6 +461,7 @@ import StackAlt from './assets/stackalt.svg';
|
|
|
461
461
|
labelTextTransform: 'none', // for label text transform
|
|
462
462
|
labelRequiredColor: '#ee0000', // for label required mark color
|
|
463
463
|
|
|
464
|
+
className: '', // for autocomplete class if it need
|
|
464
465
|
searchCount: 3, // for autocomplete show result logic
|
|
465
466
|
errorSize: '16px', // for error font size
|
|
466
467
|
autoComplete: 'off', // for off auto fill functionality ( browser specific, maybe will not work )
|
|
@@ -595,6 +596,7 @@ import StackAlt from './assets/stackalt.svg';
|
|
|
595
596
|
minHeight: '200px', // for modal min height
|
|
596
597
|
headerWeight: '600', // for modal header font weight
|
|
597
598
|
imageHeight: '100%', // for modal image height on images mode
|
|
599
|
+
imageWidth: '', // for modal image width on images mode
|
|
598
600
|
headerHeight: '30px', // for modal header height
|
|
599
601
|
grayDecorHeight: '80px', // for modal top decoration when show slider
|
|
600
602
|
width: 'fit-content', // for modal width
|
|
@@ -607,3 +609,11 @@ import StackAlt from './assets/stackalt.svg';
|
|
|
607
609
|
borderStyle: 'solid', // for modal border style
|
|
608
610
|
}
|
|
609
611
|
```
|
|
612
|
+
|
|
613
|
+
### SingleCheckbox
|
|
614
|
+
```
|
|
615
|
+
{
|
|
616
|
+
checkedColor: '#00236A', // for checkbox background ( fill ) color
|
|
617
|
+
unCheckedColor: '#D1D1D1', // for checkbox border color
|
|
618
|
+
}
|
|
619
|
+
```
|
package/tui.config.js
CHANGED
|
@@ -270,7 +270,8 @@ module.exports = {
|
|
|
270
270
|
labelMarginBottom: '6px', // for label margin bottom
|
|
271
271
|
labelTextTransform: 'none', // for label text transform
|
|
272
272
|
labelRequiredColor: '#ee0000', // for label required mark color
|
|
273
|
-
|
|
273
|
+
|
|
274
|
+
className: '', // for autocomplete class if it need
|
|
274
275
|
searchCount: 3, // for autocomplete show result logic
|
|
275
276
|
errorSize: '16px', // for error font size
|
|
276
277
|
autoComplete: 'off', // for off auto fill functionality ( browser specific, maybe will not work )
|
|
@@ -390,6 +391,7 @@ module.exports = {
|
|
|
390
391
|
minHeight: '200px', // for modal min height
|
|
391
392
|
headerWeight: '600', // for modal header font weight
|
|
392
393
|
imageHeight: '100%', // for modal image height on images mode
|
|
394
|
+
imageWidth: '', // for modal image width on images mode
|
|
393
395
|
headerHeight: '30px', // for modal header height
|
|
394
396
|
grayDecorHeight: '80px', // for modal top decoration when show slider
|
|
395
397
|
width: 'fit-content', // for modal width
|
|
@@ -402,6 +404,10 @@ module.exports = {
|
|
|
402
404
|
borderStyle: 'solid', // for modal border style
|
|
403
405
|
borderColor: 'transparent', // for modal border color
|
|
404
406
|
},
|
|
407
|
+
SINGLECHECKBOX: {
|
|
408
|
+
checkedColor: '#00236A', // for checkbox background ( fill ) color
|
|
409
|
+
unCheckedColor: '#D1D1D1', // for checkbox border color
|
|
410
|
+
},
|
|
405
411
|
// default properties for <Table /> component
|
|
406
412
|
TABLE: {
|
|
407
413
|
tHeadFontWeight: 600,
|