@xaypay/tui 0.0.72 → 0.0.73

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 CHANGED
@@ -461,7 +461,7 @@ const Typography = ({
461
461
  textTransform: textTransform ? textTransform : configStyles.TYPOGRAPHY['textTransform' + variant],
462
462
  textDecoration: textDecoration ? textDecoration : configStyles.TYPOGRAPHY['textDecoration' + variant],
463
463
  backgroundColor: backgroundColor ? backgroundColor : configStyles.TYPOGRAPHY['backgroundColor' + variant],
464
- color: isHover ? colorHover ? colorHover : configStyles.TYPOGRAPHY['colorHover' + variant] : color ? color : configStyles.TYPOGRAPHY['color' + variant]
464
+ color: isHover ? colorHover ? colorHover : color ? color : configStyles.TYPOGRAPHY['color' + variant] : color ? color : configStyles.TYPOGRAPHY['color' + variant]
465
465
  },
466
466
  ...props,
467
467
  className: classProps,
@@ -1261,7 +1261,13 @@ const Select = ({
1261
1261
  }
1262
1262
  }, [opened]);
1263
1263
  useEffect(() => {
1264
- selected && selected.length > 0 && setNewSelected(isObjectEmpty(selected[0]) ? [] : selected);
1264
+ if (selected) {
1265
+ if (selected.length > 0) {
1266
+ setNewSelected(isObjectEmpty(selected[0]) ? [] : selected);
1267
+ } else {
1268
+ setNewSelected([]);
1269
+ }
1270
+ }
1265
1271
  if (!multiple) {
1266
1272
  options && options.length > 0 && setExistOptions(options);
1267
1273
  } else {
@@ -1278,7 +1284,7 @@ const Select = ({
1278
1284
  });
1279
1285
  setExistOptions(modifiedOptions);
1280
1286
  }
1281
- }, [options, multiple, selected]);
1287
+ }, [options, multiple, selected, selected.length]);
1282
1288
  return /*#__PURE__*/React__default.createElement("div", {
1283
1289
  className: classProps
1284
1290
  }, label ? /*#__PURE__*/React__default.createElement("label", {
@@ -2515,9 +2521,12 @@ const NewFile = ({
2515
2521
  borderColor,
2516
2522
  uploadColor,
2517
2523
  defaultData,
2524
+ formatError,
2518
2525
  errorMessage,
2519
2526
  fileSizeText,
2527
+ maxSizeError,
2520
2528
  progressColor,
2529
+ noChoosenFile,
2521
2530
  fileExtensions,
2522
2531
  listItemHeight,
2523
2532
  backgroundColor,
@@ -2576,20 +2585,20 @@ const NewFile = ({
2576
2585
  change({
2577
2586
  file: file[ix],
2578
2587
  uuid: v4(),
2579
- check: 'ֆայլի սխալ ֆորմատ'
2588
+ check: formatError
2580
2589
  });
2581
2590
  }
2582
2591
  } else {
2583
2592
  change({
2584
2593
  file: file[ix],
2585
2594
  uuid: v4(),
2586
- check: 'առավելագույն ծավալ'
2595
+ check: maxSizeError
2587
2596
  });
2588
2597
  }
2589
2598
  }
2590
2599
  }
2591
2600
  if (file.length === 0 && memoizedItems.length === 0) {
2592
- setError('Ֆայլը ընտրված չէ');
2601
+ setError(noChoosenFile);
2593
2602
  }
2594
2603
  } else {
2595
2604
  if (file[0]) {
@@ -2605,16 +2614,16 @@ const NewFile = ({
2605
2614
  }
2606
2615
  } else {
2607
2616
  setImage(null);
2608
- setError('ֆայլի սխալ ֆորմատ');
2617
+ setError(formatError);
2609
2618
  }
2610
2619
  } else {
2611
2620
  setImage(null);
2612
- setError('առավելագույն ծավալ');
2621
+ setError(maxSizeError);
2613
2622
  }
2614
2623
  }
2615
2624
  if (file.length === 0) {
2616
2625
  setImage(null);
2617
- setError('Ֆայլը ընտրված չէ');
2626
+ setError(noChoosenFile);
2618
2627
  }
2619
2628
  }
2620
2629
  };
@@ -2846,12 +2855,15 @@ NewFile.propTypes = {
2846
2855
  labelSize: PropTypes.string,
2847
2856
  labelColor: PropTypes.string,
2848
2857
  errorColor: PropTypes.string,
2858
+ formatError: PropTypes.string,
2849
2859
  putFileHere: PropTypes.string,
2850
2860
  borderColor: PropTypes.string,
2851
2861
  uploadColor: PropTypes.string,
2852
2862
  defaultData: PropTypes.object,
2863
+ maxSizeError: PropTypes.string,
2853
2864
  errorMessage: PropTypes.string,
2854
2865
  fileSizeText: PropTypes.string,
2866
+ noChoosenFile: PropTypes.string,
2855
2867
  progressColor: PropTypes.string,
2856
2868
  deleteComponent: PropTypes.bool,
2857
2869
  listItemHeight: PropTypes.string,
@@ -3062,7 +3074,7 @@ Textarea.propTypes = {
3062
3074
  labelRequiredColor: PropTypes.string
3063
3075
  };
3064
3076
 
3065
- var css_248z$1 = ".pagination-module_listItem__b1-WN:focus{background-color:#4caf50;color:#fff}.pagination-module_listItem__b1-WN:hover:not(.pagination-module_active__KwBDp){background-color:#ddd}.pagination-module_pagination-bar__MrtYT{display:flex;flex-direction:row;flex-wrap:nowrap;gap:8px;justify-content:center}.pagination-module_pagination-btn__w8Yh8{border:none;border-radius:6px;outline:none}.pagination-module_pagination-btn__w8Yh8,.pagination-module_pagination-item__t3emS,.pagination-module_pagination-jump-next__LAb9Z{align-items:center;background-color:#fff;box-shadow:0 0 0 1px #eee;cursor:pointer;display:flex;height:34px;justify-content:center;width:34px}.pagination-module_pagination-item__t3emS,.pagination-module_pagination-jump-next__LAb9Z{border-radius:6px;flex:0 0 auto;font-size:13px;line-height:16px;position:relative;transition:background-color .24s}.pagination-module_pagination-item__t3emS:hover{background-color:#eee}.pagination-module_pagination-item__t3emS.pagination-module_selected__EXzCA{background-color:#00236a;color:#fff}.pagination-module_pagination-jump-next-arrow__aEVD8,.pagination-module_pagination-jump-next-txt__e7nFj{align-items:center;bottom:0;display:flex;font-size:12px;justify-content:center;left:0;line-height:14px;margin:auto;position:absolute;right:0;top:0;transition:opacity .24s,color .24s}.pagination-module_pagination-jump-next-arrow__aEVD8{opacity:0}.pagination-module_pagination-jump-next__LAb9Z:hover .pagination-module_pagination-jump-next-arrow__aEVD8{opacity:1}.pagination-module_pagination-jump-next__LAb9Z:hover .pagination-module_pagination-jump-next-txt__e7nFj{opacity:0}i{color:#3c393e;font-size:12px;line-height:12px}";
3077
+ var css_248z$1 = ".pagination-module_listItem__b1-WN:focus{background-color:#4caf50;color:#fff}.pagination-module_listItem__b1-WN:hover:not(.pagination-module_active__KwBDp){background-color:#ddd}.pagination-module_pagination-bar__MrtYT{display:flex;flex-direction:row;flex-wrap:nowrap;gap:8px;justify-content:center}.pagination-module_pagination-btn__w8Yh8{border:none;border-radius:6px;outline:none}.pagination-module_pagination-btn__w8Yh8,.pagination-module_pagination-item__t3emS,.pagination-module_pagination-jump-next__LAb9Z{align-items:center;background-color:#fff;box-shadow:0 0 0 1px #eee;cursor:pointer;display:flex;height:34px;justify-content:center;width:34px}.pagination-module_pagination-item__t3emS,.pagination-module_pagination-jump-next__LAb9Z{border-radius:6px;flex:0 0 auto;font-size:13px;line-height:16px;position:relative;transition:background-color .24s}.pagination-module_pagination-item__t3emS:hover{background-color:#eee}.pagination-module_pagination-item__t3emS.pagination-module_selected__EXzCA{background-color:#00236a;color:#fff}.pagination-module_pagination-jump-next-arrow__aEVD8,.pagination-module_pagination-jump-next-txt__e7nFj{align-items:center;bottom:0;display:flex;font-size:12px;justify-content:center;left:0;line-height:14px;margin:auto;position:absolute;right:0;top:0;transition:opacity .24s,color .24s}.pagination-module_pagination-jump-next-arrow__aEVD8{opacity:0}.pagination-module_pagination-jump-next__LAb9Z:hover .pagination-module_pagination-jump-next-arrow__aEVD8{opacity:1}.pagination-module_pagination-jump-next__LAb9Z:hover .pagination-module_pagination-jump-next-txt__e7nFj{opacity:0}i{color:#3c393e;font-size:12px;line-height:12px}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}";
3066
3078
  var styles$1 = {"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"};
3067
3079
  styleInject(css_248z$1);
3068
3080
 
@@ -3151,6 +3163,7 @@ const SvgNextarrow = ({
3151
3163
  }));
3152
3164
 
3153
3165
  const Pagination = ({
3166
+ goTo,
3154
3167
  onChange,
3155
3168
  totalCount,
3156
3169
  siblingCount,
@@ -3158,6 +3171,8 @@ const Pagination = ({
3158
3171
  offset,
3159
3172
  className
3160
3173
  }) => {
3174
+ const [inpVal, setInpVal] = useState('');
3175
+ const [error, setError] = useState(false);
3161
3176
  const [siblingCountNumber, setSibilingCountNumber] = useState(siblingCount);
3162
3177
  const [currentPageNumber, setCurrentPage] = useState(currentPage);
3163
3178
  const [currentTotalCount, setcurrentTotalCount] = useState(totalCount);
@@ -3200,6 +3215,40 @@ const Pagination = ({
3200
3215
  const onPreviousFive = e => {
3201
3216
  currentPageNumber !== 5 ? onPageChange(currentPageNumber - 5) : onPageChange(currentPageNumber - 4);
3202
3217
  };
3218
+ const handleChangeInput = e => {
3219
+ setError(false);
3220
+ if (e.target.value.trim() !== '') {
3221
+ const val = parseInt(e.target.value);
3222
+ if (Number.isInteger(val)) {
3223
+ setInpVal(val);
3224
+ } else {
3225
+ setInpVal('');
3226
+ }
3227
+ } else {
3228
+ setInpVal('');
3229
+ }
3230
+ };
3231
+ const handleKeyDown = e => {
3232
+ const forbiddenKeys = ["e", ".", "+", "-"];
3233
+ if (forbiddenKeys.includes(e.key)) {
3234
+ e.preventDefault();
3235
+ }
3236
+ if (e.keyCode === 13) {
3237
+ if (inpVal === '') {
3238
+ setError(true);
3239
+ } else {
3240
+ if (inpVal <= 1) {
3241
+ setInpVal(1);
3242
+ onPageChange(1);
3243
+ } else if (inpVal >= totalCount / offset) {
3244
+ setInpVal(Math.ceil(totalCount / offset));
3245
+ onPageChange(Math.ceil(totalCount / offset));
3246
+ } else {
3247
+ onPageChange(inpVal);
3248
+ }
3249
+ }
3250
+ }
3251
+ };
3203
3252
  let lastPage = paginationRange[paginationRange.length - 1];
3204
3253
  return /*#__PURE__*/React__default.createElement("ul", {
3205
3254
  className: classProps
@@ -3207,9 +3256,9 @@ const Pagination = ({
3207
3256
  style: {
3208
3257
  transform: 'rotate(180deg)'
3209
3258
  },
3210
- className: `${styles$1["pagination-btn"]} pagination-btn-rem`,
3211
3259
  onClick: onPrevious,
3212
- disabled: currentPage === 1 ? true : false
3260
+ disabled: currentPage === 1 ? true : false,
3261
+ className: `${styles$1["pagination-btn"]} pagination-btn-rem`
3213
3262
  }, /*#__PURE__*/React__default.createElement(SvgNextarrow, null)), paginationRange.map((pageNumber, id) => {
3214
3263
  if (pageNumber === Dots) {
3215
3264
  let currentPageIndex = paginationRange.indexOf(currentPageNumber);
@@ -3238,11 +3287,35 @@ const Pagination = ({
3238
3287
  }, pageNumber);
3239
3288
  }), /*#__PURE__*/React__default.createElement("button", {
3240
3289
  onClick: onNext,
3241
- className: `${styles$1["pagination-btn"]} pagination-btn-rem`,
3242
- disabled: currentPageNumber === lastPage ? true : false
3243
- }, /*#__PURE__*/React__default.createElement(SvgNextarrow, null)));
3290
+ disabled: currentPageNumber === lastPage ? true : false,
3291
+ className: `${styles$1["pagination-btn"]} pagination-btn-rem`
3292
+ }, /*#__PURE__*/React__default.createElement(SvgNextarrow, null)), goTo && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("input", {
3293
+ onKeyDown: handleKeyDown,
3294
+ onInput: handleChangeInput,
3295
+ type: "number",
3296
+ style: {
3297
+ width: '53px',
3298
+ height: '30px',
3299
+ outline: 'none',
3300
+ color: '#3C393E',
3301
+ fontSize: '13px',
3302
+ margin: '0px 6px',
3303
+ fontWeight: '500',
3304
+ textAlign: 'center',
3305
+ border: '1px solid',
3306
+ borderRadius: '6px',
3307
+ borderColor: error ? 'red' : '#00236a'
3308
+ },
3309
+ value: inpVal
3310
+ }), /*#__PURE__*/React__default.createElement("span", {
3311
+ style: {
3312
+ color: '#3C393E',
3313
+ fontSize: '13px'
3314
+ }
3315
+ }, "\u0537\u057B")));
3244
3316
  };
3245
3317
  Pagination.propTypes = {
3318
+ goTo: PropTypes.bool,
3246
3319
  offset: PropTypes.number,
3247
3320
  totalCount: PropTypes.number,
3248
3321
  className: PropTypes.string,
package/dist/index.js CHANGED
@@ -491,7 +491,7 @@ const Typography = ({
491
491
  textTransform: textTransform ? textTransform : configStyles.TYPOGRAPHY['textTransform' + variant],
492
492
  textDecoration: textDecoration ? textDecoration : configStyles.TYPOGRAPHY['textDecoration' + variant],
493
493
  backgroundColor: backgroundColor ? backgroundColor : configStyles.TYPOGRAPHY['backgroundColor' + variant],
494
- color: isHover ? colorHover ? colorHover : configStyles.TYPOGRAPHY['colorHover' + variant] : color ? color : configStyles.TYPOGRAPHY['color' + variant]
494
+ color: isHover ? colorHover ? colorHover : color ? color : configStyles.TYPOGRAPHY['color' + variant] : color ? color : configStyles.TYPOGRAPHY['color' + variant]
495
495
  },
496
496
  ...props,
497
497
  className: classProps,
@@ -1291,7 +1291,13 @@ const Select = ({
1291
1291
  }
1292
1292
  }, [opened]);
1293
1293
  React.useEffect(() => {
1294
- selected && selected.length > 0 && setNewSelected(isObjectEmpty(selected[0]) ? [] : selected);
1294
+ if (selected) {
1295
+ if (selected.length > 0) {
1296
+ setNewSelected(isObjectEmpty(selected[0]) ? [] : selected);
1297
+ } else {
1298
+ setNewSelected([]);
1299
+ }
1300
+ }
1295
1301
  if (!multiple) {
1296
1302
  options && options.length > 0 && setExistOptions(options);
1297
1303
  } else {
@@ -1308,7 +1314,7 @@ const Select = ({
1308
1314
  });
1309
1315
  setExistOptions(modifiedOptions);
1310
1316
  }
1311
- }, [options, multiple, selected]);
1317
+ }, [options, multiple, selected, selected.length]);
1312
1318
  return /*#__PURE__*/React__default["default"].createElement("div", {
1313
1319
  className: classProps
1314
1320
  }, label ? /*#__PURE__*/React__default["default"].createElement("label", {
@@ -2545,9 +2551,12 @@ const NewFile = ({
2545
2551
  borderColor,
2546
2552
  uploadColor,
2547
2553
  defaultData,
2554
+ formatError,
2548
2555
  errorMessage,
2549
2556
  fileSizeText,
2557
+ maxSizeError,
2550
2558
  progressColor,
2559
+ noChoosenFile,
2551
2560
  fileExtensions,
2552
2561
  listItemHeight,
2553
2562
  backgroundColor,
@@ -2606,20 +2615,20 @@ const NewFile = ({
2606
2615
  change({
2607
2616
  file: file[ix],
2608
2617
  uuid: v4(),
2609
- check: 'ֆայլի սխալ ֆորմատ'
2618
+ check: formatError
2610
2619
  });
2611
2620
  }
2612
2621
  } else {
2613
2622
  change({
2614
2623
  file: file[ix],
2615
2624
  uuid: v4(),
2616
- check: 'առավելագույն ծավալ'
2625
+ check: maxSizeError
2617
2626
  });
2618
2627
  }
2619
2628
  }
2620
2629
  }
2621
2630
  if (file.length === 0 && memoizedItems.length === 0) {
2622
- setError('Ֆայլը ընտրված չէ');
2631
+ setError(noChoosenFile);
2623
2632
  }
2624
2633
  } else {
2625
2634
  if (file[0]) {
@@ -2635,16 +2644,16 @@ const NewFile = ({
2635
2644
  }
2636
2645
  } else {
2637
2646
  setImage(null);
2638
- setError('ֆայլի սխալ ֆորմատ');
2647
+ setError(formatError);
2639
2648
  }
2640
2649
  } else {
2641
2650
  setImage(null);
2642
- setError('առավելագույն ծավալ');
2651
+ setError(maxSizeError);
2643
2652
  }
2644
2653
  }
2645
2654
  if (file.length === 0) {
2646
2655
  setImage(null);
2647
- setError('Ֆայլը ընտրված չէ');
2656
+ setError(noChoosenFile);
2648
2657
  }
2649
2658
  }
2650
2659
  };
@@ -2876,12 +2885,15 @@ NewFile.propTypes = {
2876
2885
  labelSize: PropTypes__default["default"].string,
2877
2886
  labelColor: PropTypes__default["default"].string,
2878
2887
  errorColor: PropTypes__default["default"].string,
2888
+ formatError: PropTypes__default["default"].string,
2879
2889
  putFileHere: PropTypes__default["default"].string,
2880
2890
  borderColor: PropTypes__default["default"].string,
2881
2891
  uploadColor: PropTypes__default["default"].string,
2882
2892
  defaultData: PropTypes__default["default"].object,
2893
+ maxSizeError: PropTypes__default["default"].string,
2883
2894
  errorMessage: PropTypes__default["default"].string,
2884
2895
  fileSizeText: PropTypes__default["default"].string,
2896
+ noChoosenFile: PropTypes__default["default"].string,
2885
2897
  progressColor: PropTypes__default["default"].string,
2886
2898
  deleteComponent: PropTypes__default["default"].bool,
2887
2899
  listItemHeight: PropTypes__default["default"].string,
@@ -3092,7 +3104,7 @@ Textarea.propTypes = {
3092
3104
  labelRequiredColor: PropTypes__default["default"].string
3093
3105
  };
3094
3106
 
3095
- var css_248z$1 = ".pagination-module_listItem__b1-WN:focus{background-color:#4caf50;color:#fff}.pagination-module_listItem__b1-WN:hover:not(.pagination-module_active__KwBDp){background-color:#ddd}.pagination-module_pagination-bar__MrtYT{display:flex;flex-direction:row;flex-wrap:nowrap;gap:8px;justify-content:center}.pagination-module_pagination-btn__w8Yh8{border:none;border-radius:6px;outline:none}.pagination-module_pagination-btn__w8Yh8,.pagination-module_pagination-item__t3emS,.pagination-module_pagination-jump-next__LAb9Z{align-items:center;background-color:#fff;box-shadow:0 0 0 1px #eee;cursor:pointer;display:flex;height:34px;justify-content:center;width:34px}.pagination-module_pagination-item__t3emS,.pagination-module_pagination-jump-next__LAb9Z{border-radius:6px;flex:0 0 auto;font-size:13px;line-height:16px;position:relative;transition:background-color .24s}.pagination-module_pagination-item__t3emS:hover{background-color:#eee}.pagination-module_pagination-item__t3emS.pagination-module_selected__EXzCA{background-color:#00236a;color:#fff}.pagination-module_pagination-jump-next-arrow__aEVD8,.pagination-module_pagination-jump-next-txt__e7nFj{align-items:center;bottom:0;display:flex;font-size:12px;justify-content:center;left:0;line-height:14px;margin:auto;position:absolute;right:0;top:0;transition:opacity .24s,color .24s}.pagination-module_pagination-jump-next-arrow__aEVD8{opacity:0}.pagination-module_pagination-jump-next__LAb9Z:hover .pagination-module_pagination-jump-next-arrow__aEVD8{opacity:1}.pagination-module_pagination-jump-next__LAb9Z:hover .pagination-module_pagination-jump-next-txt__e7nFj{opacity:0}i{color:#3c393e;font-size:12px;line-height:12px}";
3107
+ var css_248z$1 = ".pagination-module_listItem__b1-WN:focus{background-color:#4caf50;color:#fff}.pagination-module_listItem__b1-WN:hover:not(.pagination-module_active__KwBDp){background-color:#ddd}.pagination-module_pagination-bar__MrtYT{display:flex;flex-direction:row;flex-wrap:nowrap;gap:8px;justify-content:center}.pagination-module_pagination-btn__w8Yh8{border:none;border-radius:6px;outline:none}.pagination-module_pagination-btn__w8Yh8,.pagination-module_pagination-item__t3emS,.pagination-module_pagination-jump-next__LAb9Z{align-items:center;background-color:#fff;box-shadow:0 0 0 1px #eee;cursor:pointer;display:flex;height:34px;justify-content:center;width:34px}.pagination-module_pagination-item__t3emS,.pagination-module_pagination-jump-next__LAb9Z{border-radius:6px;flex:0 0 auto;font-size:13px;line-height:16px;position:relative;transition:background-color .24s}.pagination-module_pagination-item__t3emS:hover{background-color:#eee}.pagination-module_pagination-item__t3emS.pagination-module_selected__EXzCA{background-color:#00236a;color:#fff}.pagination-module_pagination-jump-next-arrow__aEVD8,.pagination-module_pagination-jump-next-txt__e7nFj{align-items:center;bottom:0;display:flex;font-size:12px;justify-content:center;left:0;line-height:14px;margin:auto;position:absolute;right:0;top:0;transition:opacity .24s,color .24s}.pagination-module_pagination-jump-next-arrow__aEVD8{opacity:0}.pagination-module_pagination-jump-next__LAb9Z:hover .pagination-module_pagination-jump-next-arrow__aEVD8{opacity:1}.pagination-module_pagination-jump-next__LAb9Z:hover .pagination-module_pagination-jump-next-txt__e7nFj{opacity:0}i{color:#3c393e;font-size:12px;line-height:12px}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}";
3096
3108
  var styles$1 = {"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"};
3097
3109
  styleInject(css_248z$1);
3098
3110
 
@@ -3181,6 +3193,7 @@ const SvgNextarrow = ({
3181
3193
  }));
3182
3194
 
3183
3195
  const Pagination = ({
3196
+ goTo,
3184
3197
  onChange,
3185
3198
  totalCount,
3186
3199
  siblingCount,
@@ -3188,6 +3201,8 @@ const Pagination = ({
3188
3201
  offset,
3189
3202
  className
3190
3203
  }) => {
3204
+ const [inpVal, setInpVal] = React.useState('');
3205
+ const [error, setError] = React.useState(false);
3191
3206
  const [siblingCountNumber, setSibilingCountNumber] = React.useState(siblingCount);
3192
3207
  const [currentPageNumber, setCurrentPage] = React.useState(currentPage);
3193
3208
  const [currentTotalCount, setcurrentTotalCount] = React.useState(totalCount);
@@ -3230,6 +3245,40 @@ const Pagination = ({
3230
3245
  const onPreviousFive = e => {
3231
3246
  currentPageNumber !== 5 ? onPageChange(currentPageNumber - 5) : onPageChange(currentPageNumber - 4);
3232
3247
  };
3248
+ const handleChangeInput = e => {
3249
+ setError(false);
3250
+ if (e.target.value.trim() !== '') {
3251
+ const val = parseInt(e.target.value);
3252
+ if (Number.isInteger(val)) {
3253
+ setInpVal(val);
3254
+ } else {
3255
+ setInpVal('');
3256
+ }
3257
+ } else {
3258
+ setInpVal('');
3259
+ }
3260
+ };
3261
+ const handleKeyDown = e => {
3262
+ const forbiddenKeys = ["e", ".", "+", "-"];
3263
+ if (forbiddenKeys.includes(e.key)) {
3264
+ e.preventDefault();
3265
+ }
3266
+ if (e.keyCode === 13) {
3267
+ if (inpVal === '') {
3268
+ setError(true);
3269
+ } else {
3270
+ if (inpVal <= 1) {
3271
+ setInpVal(1);
3272
+ onPageChange(1);
3273
+ } else if (inpVal >= totalCount / offset) {
3274
+ setInpVal(Math.ceil(totalCount / offset));
3275
+ onPageChange(Math.ceil(totalCount / offset));
3276
+ } else {
3277
+ onPageChange(inpVal);
3278
+ }
3279
+ }
3280
+ }
3281
+ };
3233
3282
  let lastPage = paginationRange[paginationRange.length - 1];
3234
3283
  return /*#__PURE__*/React__default["default"].createElement("ul", {
3235
3284
  className: classProps
@@ -3237,9 +3286,9 @@ const Pagination = ({
3237
3286
  style: {
3238
3287
  transform: 'rotate(180deg)'
3239
3288
  },
3240
- className: `${styles$1["pagination-btn"]} pagination-btn-rem`,
3241
3289
  onClick: onPrevious,
3242
- disabled: currentPage === 1 ? true : false
3290
+ disabled: currentPage === 1 ? true : false,
3291
+ className: `${styles$1["pagination-btn"]} pagination-btn-rem`
3243
3292
  }, /*#__PURE__*/React__default["default"].createElement(SvgNextarrow, null)), paginationRange.map((pageNumber, id) => {
3244
3293
  if (pageNumber === Dots) {
3245
3294
  let currentPageIndex = paginationRange.indexOf(currentPageNumber);
@@ -3268,11 +3317,35 @@ const Pagination = ({
3268
3317
  }, pageNumber);
3269
3318
  }), /*#__PURE__*/React__default["default"].createElement("button", {
3270
3319
  onClick: onNext,
3271
- className: `${styles$1["pagination-btn"]} pagination-btn-rem`,
3272
- disabled: currentPageNumber === lastPage ? true : false
3273
- }, /*#__PURE__*/React__default["default"].createElement(SvgNextarrow, null)));
3320
+ disabled: currentPageNumber === lastPage ? true : false,
3321
+ className: `${styles$1["pagination-btn"]} pagination-btn-rem`
3322
+ }, /*#__PURE__*/React__default["default"].createElement(SvgNextarrow, null)), goTo && /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("input", {
3323
+ onKeyDown: handleKeyDown,
3324
+ onInput: handleChangeInput,
3325
+ type: "number",
3326
+ style: {
3327
+ width: '53px',
3328
+ height: '30px',
3329
+ outline: 'none',
3330
+ color: '#3C393E',
3331
+ fontSize: '13px',
3332
+ margin: '0px 6px',
3333
+ fontWeight: '500',
3334
+ textAlign: 'center',
3335
+ border: '1px solid',
3336
+ borderRadius: '6px',
3337
+ borderColor: error ? 'red' : '#00236a'
3338
+ },
3339
+ value: inpVal
3340
+ }), /*#__PURE__*/React__default["default"].createElement("span", {
3341
+ style: {
3342
+ color: '#3C393E',
3343
+ fontSize: '13px'
3344
+ }
3345
+ }, "\u0537\u057B")));
3274
3346
  };
3275
3347
  Pagination.propTypes = {
3348
+ goTo: PropTypes__default["default"].bool,
3276
3349
  offset: PropTypes__default["default"].number,
3277
3350
  totalCount: PropTypes__default["default"].number,
3278
3351
  className: PropTypes__default["default"].string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaypay/tui",
3
- "version": "0.0.72",
3
+ "version": "0.0.73",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -39,9 +39,12 @@ export const NewFile = ({
39
39
  borderColor,
40
40
  uploadColor,
41
41
  defaultData,
42
+ formatError,
42
43
  errorMessage,
43
44
  fileSizeText,
45
+ maxSizeError,
44
46
  progressColor,
47
+ noChoosenFile,
45
48
  fileExtensions,
46
49
  listItemHeight,
47
50
  backgroundColor,
@@ -106,20 +109,20 @@ export const NewFile = ({
106
109
  change({
107
110
  file: file[ix],
108
111
  uuid: uuidv4(),
109
- check: 'ֆայլի սխալ ֆորմատ'
112
+ check: formatError
110
113
  });
111
114
  }
112
115
  } else {
113
116
  change({
114
117
  file: file[ix],
115
118
  uuid: uuidv4(),
116
- check: 'առավելագույն ծավալ'
119
+ check: maxSizeError
117
120
  });
118
121
  }
119
122
  }
120
123
  }
121
124
  if (file.length === 0 && memoizedItems.length === 0) {
122
- setError('Ֆայլը ընտրված չէ');
125
+ setError(noChoosenFile);
123
126
  }
124
127
  } else {
125
128
  if (file[0]) {
@@ -135,16 +138,16 @@ export const NewFile = ({
135
138
  }
136
139
  } else {
137
140
  setImage(null);
138
- setError('ֆայլի սխալ ֆորմատ');
141
+ setError(formatError);
139
142
  }
140
143
  } else {
141
144
  setImage(null);
142
- setError('առավելագույն ծավալ');
145
+ setError(maxSizeError);
143
146
  }
144
147
  }
145
148
  if (file.length === 0) {
146
149
  setImage(null);
147
- setError('Ֆայլը ընտրված չէ');
150
+ setError(noChoosenFile);
148
151
  }
149
152
  }
150
153
  };
@@ -450,12 +453,15 @@ NewFile.propTypes = {
450
453
  labelSize: PropTypes.string,
451
454
  labelColor: PropTypes.string,
452
455
  errorColor: PropTypes.string,
456
+ formatError: PropTypes.string,
453
457
  putFileHere: PropTypes.string,
454
458
  borderColor: PropTypes.string,
455
459
  uploadColor: PropTypes.string,
456
460
  defaultData: PropTypes.object,
461
+ maxSizeError: PropTypes.string,
457
462
  errorMessage: PropTypes.string,
458
463
  fileSizeText: PropTypes.string,
464
+ noChoosenFile: PropTypes.string,
459
465
  progressColor: PropTypes.string,
460
466
  deleteComponent: PropTypes.bool,
461
467
  listItemHeight: PropTypes.string,
@@ -33,7 +33,7 @@ const Template = (args) => {
33
33
  export const Default = Template.bind({});
34
34
  Default.args = {
35
35
  label: 'File component',
36
- deleteComponent: true,
36
+ deleteComponent: false,
37
37
  disabled: false,
38
38
  defaultData: {
39
39
  url: 'https://images.pexels.com/photos/753626/pexels-photo-753626.jpeg?auto=compress&cs=tinysrgb&w=1600',
@@ -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: 4,
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
- selected && selected.length > 0 && setNewSelected(isObjectEmpty(selected[0]) ? []: selected );
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}>
@@ -25,4 +25,3 @@ Default.args = {
25
25
  selected: [{"bbb":"1", "value":"Կենտրոն"}, {"bbb":"2", "value":"Մալաթիա"}],
26
26
  keyNames: {name: 'value', id : 'bbb'}
27
27
  };
28
-
@@ -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['colorHover'+variant] : color ? color : configStyles.TYPOGRAPHY['color'+variant],
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={"#" + Math.floor(Math.random()*16777215).toString(16).padStart(6, '0').toUpperCase()}
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: '0px', // for variant p text align
105
- textAlignh1: '0px', // for variant h1 text align
106
- textAlignh2: '0px', // for variant h2 text align
107
- textAlignh3: '0px', // for variant h3 text align
108
- textAlignh4: '0px', // for variant h4 text align
109
- textAlignh5: '0px', // for variant h5 text align
110
- textAlignh6: '0px', // for variant h6 text align
111
- textAlignspan: '0px', // for variant span text align
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