@xaypay/tui 0.0.97 → 0.0.98

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
@@ -66,9 +66,9 @@ function styleInject(css, ref) {
66
66
  }
67
67
  }
68
68
 
69
- var css_248z$g = ".file-module_file-form__l13d5{align-items:center;background:#fbfbfb;border:2px dashed;border-radius:6px;cursor:pointer;display:flex;flex-direction:column;height:190px;justify-content:space-between;overflow:hidden;padding:4px 0;position:relative;width:100%}.file-module_file-form-wrap__qY--B:before{background:rgba(60,57,62,.4);border-radius:6px;content:\"\";height:100%;left:0;opacity:0;pointer-events:none;position:absolute;top:0;transition:opacity .24s;width:100%;z-index:1}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover:before{opacity:1;pointer-events:unset}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover .file-module_delete-upload-icon__PWN66{opacity:1}.file-module_file-form-inner-upload__tq3Dn{align-items:center;display:flex;flex-direction:column;justify-content:space-between;padding-bottom:16px;padding-top:48px}.file-module_file-form-inner-upload__tq3Dn>img{display:block;margin-bottom:14px}.file-module_upload-info__a8GFs{margin-bottom:40px;max-width:150px;text-align:center}.file-module_upload-info-txt__l11uN{color:#0da574}.file-module_file-form__l13d5.file-module_default__t7KU0{border-color:#d1d1d1}.file-module_file-form__l13d5.file-module_error__H-M4Z{border-color:#e00!important}.file-module_file-form__l13d5.file-module_accept__WTW6V{border-color:#00236a}.file-module_delete-upload-icon__PWN66{align-items:center;background:#fff;border-radius:6px;cursor:pointer;display:flex;height:26px;justify-content:center;opacity:0;position:absolute;right:10px;top:10px;transition:opacity .24s;width:26px;z-index:11}.file-module_delete-upload-icon__PWN66>i{color:#00236a;font-size:16px}.file-module_upload-file-content__QHMjn{align-items:center;display:flex;height:100%;justify-content:center;max-height:190px;overflow:hidden;position:relative;width:100%}.file-module_upload-file-content__QHMjn>img{display:block;height:auto;max-height:95%;object-fit:contain;width:27.8rem}.file-module_file-form-title__zWTSB{margin-bottom:10px;max-width:390px;word-break:break-all}.file-module_file-form-wrap__qY--B{position:relative;transform:translateZ(0)}";
69
+ var css_248z$f = ".file-module_file-form__l13d5{align-items:center;background:#fbfbfb;border:2px dashed;border-radius:6px;cursor:pointer;display:flex;flex-direction:column;height:190px;justify-content:space-between;overflow:hidden;padding:4px 0;position:relative;width:100%}.file-module_file-form-wrap__qY--B:before{background:rgba(60,57,62,.4);border-radius:6px;content:\"\";height:100%;left:0;opacity:0;pointer-events:none;position:absolute;top:0;transition:opacity .24s;width:100%;z-index:1}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover:before{opacity:1;pointer-events:unset}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover .file-module_delete-upload-icon__PWN66{opacity:1}.file-module_file-form-inner-upload__tq3Dn{align-items:center;display:flex;flex-direction:column;justify-content:space-between;padding-bottom:16px;padding-top:48px}.file-module_file-form-inner-upload__tq3Dn>img{display:block;margin-bottom:14px}.file-module_upload-info__a8GFs{margin-bottom:40px;max-width:150px;text-align:center}.file-module_upload-info-txt__l11uN{color:#0da574}.file-module_file-form__l13d5.file-module_default__t7KU0{border-color:#d1d1d1}.file-module_file-form__l13d5.file-module_error__H-M4Z{border-color:#e00!important}.file-module_file-form__l13d5.file-module_accept__WTW6V{border-color:#00236a}.file-module_delete-upload-icon__PWN66{align-items:center;background:#fff;border-radius:6px;cursor:pointer;display:flex;height:26px;justify-content:center;opacity:0;position:absolute;right:10px;top:10px;transition:opacity .24s;width:26px;z-index:11}.file-module_delete-upload-icon__PWN66>i{color:#00236a;font-size:16px}.file-module_upload-file-content__QHMjn{align-items:center;display:flex;height:100%;justify-content:center;max-height:190px;overflow:hidden;position:relative;width:100%}.file-module_upload-file-content__QHMjn>img{display:block;height:auto;max-height:95%;object-fit:contain;width:27.8rem}.file-module_file-form-title__zWTSB{margin-bottom:10px;max-width:390px;word-break:break-all}.file-module_file-form-wrap__qY--B{position:relative;transform:translateZ(0)}";
70
70
  var styles$c = {"file-form-wrap":"file-module_file-form-wrap__qY--B","file-form":"file-module_file-form__l13d5","active":"file-module_active__L1gPt","delete-upload-icon":"file-module_delete-upload-icon__PWN66","file-form-inner-upload":"file-module_file-form-inner-upload__tq3Dn","upload-info":"file-module_upload-info__a8GFs","upload-info-txt":"file-module_upload-info-txt__l11uN","default":"file-module_default__t7KU0","error":"file-module_error__H-M4Z","accept":"file-module_accept__WTW6V","upload-file-content":"file-module_upload-file-content__QHMjn","file-form-title":"file-module_file-form-title__zWTSB"};
71
- styleInject(css_248z$g);
71
+ styleInject(css_248z$f);
72
72
 
73
73
  const File = ({
74
74
  name,
@@ -190,63 +190,6 @@ 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
-
216
- var css_248z$f = "";
217
- styleInject(css_248z$f);
218
-
219
- const Chart = ({
220
- width,
221
- height
222
- }) => {
223
- compereConfigs();
224
- useEffect(() => {
225
- const canvas = document.getElementById('myChart');
226
- // const canvas = canvasRef.current;
227
- const ctx = canvas.getContext('2d');
228
- const data = [10, 20, 30, 15, 25];
229
- const barWidth = 40;
230
- const chartHeight = 200;
231
- ctx.clearRect(0, 0, canvas.width, canvas.height);
232
- data.forEach((value, index) => {
233
- const x = index * (barWidth + 10);
234
- const y = chartHeight - value;
235
- ctx.fillStyle = 'blue';
236
- ctx.fillRect(x, y, barWidth, value);
237
- });
238
- }, []);
239
- return /*#__PURE__*/React__default.createElement("canvas", {
240
- id: "myChart",
241
- width: width,
242
- height: height
243
- });
244
- };
245
- Chart.propTypes = {
246
- width: PropTypes.number,
247
- height: PropTypes.number
248
- };
249
-
250
193
  const SvgCheckboxUnchecked = ({
251
194
  title,
252
195
  titleId,
@@ -328,6 +271,29 @@ SingleCheckbox.propTypes = {
328
271
  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}";
329
272
  styleInject(css_248z$e);
330
273
 
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
+
331
297
  ({
332
298
  dataBody: PropTypes.array,
333
299
  dataHeader: PropTypes.array,
@@ -490,6 +456,11 @@ const Modal = ({
490
456
  }
491
457
  }
492
458
  };
459
+ const handleESC = e => {
460
+ if (e.key === 'Escape') {
461
+ handleCloseModal();
462
+ }
463
+ };
493
464
  useEffect(() => {
494
465
  if (type === 'images') {
495
466
  if (data) {
@@ -515,9 +486,11 @@ const Modal = ({
515
486
  }
516
487
  }, [selected]);
517
488
  useEffect(() => {
489
+ document.addEventListener('keydown', handleESC, false);
518
490
  return () => {
519
491
  setSelect(0);
520
492
  setInnerData([]);
493
+ document.removeEventListener('keydown', handleESC, false);
521
494
  };
522
495
  }, []);
523
496
  return /*#__PURE__*/React__default.createElement("div", {
@@ -702,7 +675,7 @@ Modal.defaultProps = {
702
675
  type: 'content'
703
676
  };
704
677
 
705
- var css_248z$c = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{-webkit-appearance:none;display:flex;width:100%}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{background-color:inherit!important}.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)}}";
678
+ var css_248z$c = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{-webkit-appearance:none;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)}}";
706
679
  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"};
707
680
  styleInject(css_248z$c);
708
681
 
@@ -3678,14 +3651,21 @@ const Pagination = ({
3678
3651
  }
3679
3652
  };
3680
3653
  let lastPage = paginationRange[paginationRange.length - 1];
3681
- return /*#__PURE__*/React__default.createElement("ul", {
3654
+ return /*#__PURE__*/React__default.createElement("div", {
3655
+ style: {
3656
+ display: 'flex',
3657
+ margin: '0 auto',
3658
+ alignItems: 'center',
3659
+ justifyContent: 'center'
3660
+ }
3661
+ }, /*#__PURE__*/React__default.createElement("ul", {
3682
3662
  className: classProps
3683
3663
  }, /*#__PURE__*/React__default.createElement("button", {
3684
3664
  style: {
3685
3665
  transform: 'rotate(180deg)'
3686
3666
  },
3687
3667
  onClick: onPrevious,
3688
- disabled: currentPage === 1 ? true : false,
3668
+ disabled: currentPageNumber === 1 ? true : false,
3689
3669
  className: `${styles$2["pagination-btn"]} pagination-btn-rem`
3690
3670
  }, /*#__PURE__*/React__default.createElement(SvgNextarrow, null)), paginationRange.map((pageNumber, id) => {
3691
3671
  if (pageNumber === Dots) {
@@ -3717,7 +3697,7 @@ const Pagination = ({
3717
3697
  onClick: onNext,
3718
3698
  disabled: currentPageNumber === lastPage ? true : false,
3719
3699
  className: `${styles$2["pagination-btn"]} pagination-btn-rem`
3720
- }, /*#__PURE__*/React__default.createElement(SvgNextarrow, null)), goTo && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("input", {
3700
+ }, /*#__PURE__*/React__default.createElement(SvgNextarrow, null))), goTo && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("input", {
3721
3701
  onKeyDown: handleKeyDown,
3722
3702
  onInput: handleChangeInput,
3723
3703
  type: "number",
@@ -3975,6 +3955,7 @@ const NewAutocomplete = ({
3975
3955
  const [show, setShow] = useState(false);
3976
3956
  const [isHover, setIsHover] = useState(false);
3977
3957
  const [isFocus, setIsFocus] = useState(false);
3958
+ const [innerError, setInnerError] = useState('');
3978
3959
  const [innerValue, setInnerValue] = useState('');
3979
3960
  const [innerOptions, setInnerOptions] = useState([]);
3980
3961
  const configStyles = compereConfigs();
@@ -4010,6 +3991,7 @@ const NewAutocomplete = ({
4010
3991
  const value = e.target.value;
4011
3992
  const currentId = e.target.id;
4012
3993
  value.length > 0 ? setShow(true) : setShow(false);
3994
+ setInnerError('');
4013
3995
  setInnerValue(value);
4014
3996
  if (value.length >= searchCount) {
4015
3997
  change({
@@ -4075,7 +4057,7 @@ const NewAutocomplete = ({
4075
4057
  backgroundColor: contentBottomRowBackgroundColor ? contentBottomRowBackgroundColor : configStyles.NEWAUTOCOMPLETE.contentBottomRowBackgroundColor
4076
4058
  }
4077
4059
  }, item[keyNames.name]);
4078
- }))) : innerOptions.length <= 0 ? /*#__PURE__*/React__default.createElement("span", {
4060
+ }))) : innerOptions.length <= 0 ? innerError ? '' : /*#__PURE__*/React__default.createElement("span", {
4079
4061
  style: {
4080
4062
  position: 'absolute',
4081
4063
  zIndex: '9999999999',
@@ -4116,6 +4098,9 @@ const NewAutocomplete = ({
4116
4098
  setInnerValue('');
4117
4099
  }
4118
4100
  }, [selected]);
4101
+ useEffect(() => {
4102
+ setInnerError(errorMessage);
4103
+ }, [errorMessage]);
4119
4104
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, label ? /*#__PURE__*/React__default.createElement("label", {
4120
4105
  style: {
4121
4106
  color: labelColor ? labelColor : configStyles.NEWAUTOCOMPLETE.labelColor,
@@ -4169,7 +4154,7 @@ const NewAutocomplete = ({
4169
4154
  flexDirection: contentTopDirection ? contentTopDirection : configStyles.NEWAUTOCOMPLETE.contentTopDirection,
4170
4155
  boxShadow: errorMessage ? errorColor ? `0 0 0 2px ${errorColor}` : `0 0 0 2px ${configStyles.NEWAUTOCOMPLETE.errorColor}` : isFocus ? contentTopBorderActive ? contentTopBorderActive : configStyles.NEWAUTOCOMPLETE.contentTopBorderActive : isHover ? contentTopBorderHover ? contentTopBorderHover : configStyles.NEWAUTOCOMPLETE.contentTopBorderHover : contentTopBorder ? contentTopBorder : configStyles.NEWAUTOCOMPLETE.contentTopBorder
4171
4156
  }
4172
- }, props)), errorMessage ? /*#__PURE__*/React__default.createElement("span", {
4157
+ }, props)), innerError ? /*#__PURE__*/React__default.createElement("span", {
4173
4158
  style: {
4174
4159
  left: '0px',
4175
4160
  position: 'absolute',
@@ -4178,7 +4163,7 @@ const NewAutocomplete = ({
4178
4163
  top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`,
4179
4164
  maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth
4180
4165
  }
4181
- }, errorMessage) : '', optionList));
4166
+ }, innerError) : '', optionList));
4182
4167
  };
4183
4168
  NewAutocomplete.propTypes = {
4184
4169
  label: PropTypes.string,
@@ -4260,4 +4245,4 @@ NewAutocomplete.defaultProps = {
4260
4245
  disabled: false
4261
4246
  };
4262
4247
 
4263
- export { Autocomplate, Button, Captcha, Chart, Checkbox, File, Input, InputTypes, Modal, NewAutocomplete, NewFile, Pagination, Radio, Select, SingleCheckbox, Stepper, Textarea, Toaster, Tooltip, Typography, TypographyType, toast };
4248
+ export { Autocomplate, Button, Captcha, Checkbox, File, Input, InputTypes, Modal, NewAutocomplete, NewFile, Pagination, Radio, Select, SingleCheckbox, Stepper, Textarea, Toaster, Tooltip, Typography, TypographyType, toast };
package/dist/index.js CHANGED
@@ -96,9 +96,9 @@ function styleInject(css, ref) {
96
96
  }
97
97
  }
98
98
 
99
- var css_248z$g = ".file-module_file-form__l13d5{align-items:center;background:#fbfbfb;border:2px dashed;border-radius:6px;cursor:pointer;display:flex;flex-direction:column;height:190px;justify-content:space-between;overflow:hidden;padding:4px 0;position:relative;width:100%}.file-module_file-form-wrap__qY--B:before{background:rgba(60,57,62,.4);border-radius:6px;content:\"\";height:100%;left:0;opacity:0;pointer-events:none;position:absolute;top:0;transition:opacity .24s;width:100%;z-index:1}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover:before{opacity:1;pointer-events:unset}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover .file-module_delete-upload-icon__PWN66{opacity:1}.file-module_file-form-inner-upload__tq3Dn{align-items:center;display:flex;flex-direction:column;justify-content:space-between;padding-bottom:16px;padding-top:48px}.file-module_file-form-inner-upload__tq3Dn>img{display:block;margin-bottom:14px}.file-module_upload-info__a8GFs{margin-bottom:40px;max-width:150px;text-align:center}.file-module_upload-info-txt__l11uN{color:#0da574}.file-module_file-form__l13d5.file-module_default__t7KU0{border-color:#d1d1d1}.file-module_file-form__l13d5.file-module_error__H-M4Z{border-color:#e00!important}.file-module_file-form__l13d5.file-module_accept__WTW6V{border-color:#00236a}.file-module_delete-upload-icon__PWN66{align-items:center;background:#fff;border-radius:6px;cursor:pointer;display:flex;height:26px;justify-content:center;opacity:0;position:absolute;right:10px;top:10px;transition:opacity .24s;width:26px;z-index:11}.file-module_delete-upload-icon__PWN66>i{color:#00236a;font-size:16px}.file-module_upload-file-content__QHMjn{align-items:center;display:flex;height:100%;justify-content:center;max-height:190px;overflow:hidden;position:relative;width:100%}.file-module_upload-file-content__QHMjn>img{display:block;height:auto;max-height:95%;object-fit:contain;width:27.8rem}.file-module_file-form-title__zWTSB{margin-bottom:10px;max-width:390px;word-break:break-all}.file-module_file-form-wrap__qY--B{position:relative;transform:translateZ(0)}";
99
+ var css_248z$f = ".file-module_file-form__l13d5{align-items:center;background:#fbfbfb;border:2px dashed;border-radius:6px;cursor:pointer;display:flex;flex-direction:column;height:190px;justify-content:space-between;overflow:hidden;padding:4px 0;position:relative;width:100%}.file-module_file-form-wrap__qY--B:before{background:rgba(60,57,62,.4);border-radius:6px;content:\"\";height:100%;left:0;opacity:0;pointer-events:none;position:absolute;top:0;transition:opacity .24s;width:100%;z-index:1}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover:before{opacity:1;pointer-events:unset}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover .file-module_delete-upload-icon__PWN66{opacity:1}.file-module_file-form-inner-upload__tq3Dn{align-items:center;display:flex;flex-direction:column;justify-content:space-between;padding-bottom:16px;padding-top:48px}.file-module_file-form-inner-upload__tq3Dn>img{display:block;margin-bottom:14px}.file-module_upload-info__a8GFs{margin-bottom:40px;max-width:150px;text-align:center}.file-module_upload-info-txt__l11uN{color:#0da574}.file-module_file-form__l13d5.file-module_default__t7KU0{border-color:#d1d1d1}.file-module_file-form__l13d5.file-module_error__H-M4Z{border-color:#e00!important}.file-module_file-form__l13d5.file-module_accept__WTW6V{border-color:#00236a}.file-module_delete-upload-icon__PWN66{align-items:center;background:#fff;border-radius:6px;cursor:pointer;display:flex;height:26px;justify-content:center;opacity:0;position:absolute;right:10px;top:10px;transition:opacity .24s;width:26px;z-index:11}.file-module_delete-upload-icon__PWN66>i{color:#00236a;font-size:16px}.file-module_upload-file-content__QHMjn{align-items:center;display:flex;height:100%;justify-content:center;max-height:190px;overflow:hidden;position:relative;width:100%}.file-module_upload-file-content__QHMjn>img{display:block;height:auto;max-height:95%;object-fit:contain;width:27.8rem}.file-module_file-form-title__zWTSB{margin-bottom:10px;max-width:390px;word-break:break-all}.file-module_file-form-wrap__qY--B{position:relative;transform:translateZ(0)}";
100
100
  var styles$c = {"file-form-wrap":"file-module_file-form-wrap__qY--B","file-form":"file-module_file-form__l13d5","active":"file-module_active__L1gPt","delete-upload-icon":"file-module_delete-upload-icon__PWN66","file-form-inner-upload":"file-module_file-form-inner-upload__tq3Dn","upload-info":"file-module_upload-info__a8GFs","upload-info-txt":"file-module_upload-info-txt__l11uN","default":"file-module_default__t7KU0","error":"file-module_error__H-M4Z","accept":"file-module_accept__WTW6V","upload-file-content":"file-module_upload-file-content__QHMjn","file-form-title":"file-module_file-form-title__zWTSB"};
101
- styleInject(css_248z$g);
101
+ styleInject(css_248z$f);
102
102
 
103
103
  const File = ({
104
104
  name,
@@ -220,63 +220,6 @@ 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
-
246
- var css_248z$f = "";
247
- styleInject(css_248z$f);
248
-
249
- const Chart = ({
250
- width,
251
- height
252
- }) => {
253
- compereConfigs();
254
- React.useEffect(() => {
255
- const canvas = document.getElementById('myChart');
256
- // const canvas = canvasRef.current;
257
- const ctx = canvas.getContext('2d');
258
- const data = [10, 20, 30, 15, 25];
259
- const barWidth = 40;
260
- const chartHeight = 200;
261
- ctx.clearRect(0, 0, canvas.width, canvas.height);
262
- data.forEach((value, index) => {
263
- const x = index * (barWidth + 10);
264
- const y = chartHeight - value;
265
- ctx.fillStyle = 'blue';
266
- ctx.fillRect(x, y, barWidth, value);
267
- });
268
- }, []);
269
- return /*#__PURE__*/React__default["default"].createElement("canvas", {
270
- id: "myChart",
271
- width: width,
272
- height: height
273
- });
274
- };
275
- Chart.propTypes = {
276
- width: PropTypes__default["default"].number,
277
- height: PropTypes__default["default"].number
278
- };
279
-
280
223
  const SvgCheckboxUnchecked = ({
281
224
  title,
282
225
  titleId,
@@ -358,6 +301,29 @@ SingleCheckbox.propTypes = {
358
301
  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}";
359
302
  styleInject(css_248z$e);
360
303
 
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
+
361
327
  ({
362
328
  dataBody: PropTypes__default["default"].array,
363
329
  dataHeader: PropTypes__default["default"].array,
@@ -520,6 +486,11 @@ const Modal = ({
520
486
  }
521
487
  }
522
488
  };
489
+ const handleESC = e => {
490
+ if (e.key === 'Escape') {
491
+ handleCloseModal();
492
+ }
493
+ };
523
494
  React.useEffect(() => {
524
495
  if (type === 'images') {
525
496
  if (data) {
@@ -545,9 +516,11 @@ const Modal = ({
545
516
  }
546
517
  }, [selected]);
547
518
  React.useEffect(() => {
519
+ document.addEventListener('keydown', handleESC, false);
548
520
  return () => {
549
521
  setSelect(0);
550
522
  setInnerData([]);
523
+ document.removeEventListener('keydown', handleESC, false);
551
524
  };
552
525
  }, []);
553
526
  return /*#__PURE__*/React__default["default"].createElement("div", {
@@ -732,7 +705,7 @@ Modal.defaultProps = {
732
705
  type: 'content'
733
706
  };
734
707
 
735
- var css_248z$c = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{-webkit-appearance:none;display:flex;width:100%}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{background-color:inherit!important}.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)}}";
708
+ var css_248z$c = ".input-module_input-wrap__NunrE{position:relative;width:100%}.input-module_input-content__kP7lZ{-webkit-appearance:none;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)}}";
736
709
  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"};
737
710
  styleInject(css_248z$c);
738
711
 
@@ -3708,14 +3681,21 @@ const Pagination = ({
3708
3681
  }
3709
3682
  };
3710
3683
  let lastPage = paginationRange[paginationRange.length - 1];
3711
- return /*#__PURE__*/React__default["default"].createElement("ul", {
3684
+ return /*#__PURE__*/React__default["default"].createElement("div", {
3685
+ style: {
3686
+ display: 'flex',
3687
+ margin: '0 auto',
3688
+ alignItems: 'center',
3689
+ justifyContent: 'center'
3690
+ }
3691
+ }, /*#__PURE__*/React__default["default"].createElement("ul", {
3712
3692
  className: classProps
3713
3693
  }, /*#__PURE__*/React__default["default"].createElement("button", {
3714
3694
  style: {
3715
3695
  transform: 'rotate(180deg)'
3716
3696
  },
3717
3697
  onClick: onPrevious,
3718
- disabled: currentPage === 1 ? true : false,
3698
+ disabled: currentPageNumber === 1 ? true : false,
3719
3699
  className: `${styles$2["pagination-btn"]} pagination-btn-rem`
3720
3700
  }, /*#__PURE__*/React__default["default"].createElement(SvgNextarrow, null)), paginationRange.map((pageNumber, id) => {
3721
3701
  if (pageNumber === Dots) {
@@ -3747,7 +3727,7 @@ const Pagination = ({
3747
3727
  onClick: onNext,
3748
3728
  disabled: currentPageNumber === lastPage ? true : false,
3749
3729
  className: `${styles$2["pagination-btn"]} pagination-btn-rem`
3750
- }, /*#__PURE__*/React__default["default"].createElement(SvgNextarrow, null)), goTo && /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("input", {
3730
+ }, /*#__PURE__*/React__default["default"].createElement(SvgNextarrow, null))), goTo && /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("input", {
3751
3731
  onKeyDown: handleKeyDown,
3752
3732
  onInput: handleChangeInput,
3753
3733
  type: "number",
@@ -4005,6 +3985,7 @@ const NewAutocomplete = ({
4005
3985
  const [show, setShow] = React.useState(false);
4006
3986
  const [isHover, setIsHover] = React.useState(false);
4007
3987
  const [isFocus, setIsFocus] = React.useState(false);
3988
+ const [innerError, setInnerError] = React.useState('');
4008
3989
  const [innerValue, setInnerValue] = React.useState('');
4009
3990
  const [innerOptions, setInnerOptions] = React.useState([]);
4010
3991
  const configStyles = compereConfigs();
@@ -4040,6 +4021,7 @@ const NewAutocomplete = ({
4040
4021
  const value = e.target.value;
4041
4022
  const currentId = e.target.id;
4042
4023
  value.length > 0 ? setShow(true) : setShow(false);
4024
+ setInnerError('');
4043
4025
  setInnerValue(value);
4044
4026
  if (value.length >= searchCount) {
4045
4027
  change({
@@ -4105,7 +4087,7 @@ const NewAutocomplete = ({
4105
4087
  backgroundColor: contentBottomRowBackgroundColor ? contentBottomRowBackgroundColor : configStyles.NEWAUTOCOMPLETE.contentBottomRowBackgroundColor
4106
4088
  }
4107
4089
  }, item[keyNames.name]);
4108
- }))) : innerOptions.length <= 0 ? /*#__PURE__*/React__default["default"].createElement("span", {
4090
+ }))) : innerOptions.length <= 0 ? innerError ? '' : /*#__PURE__*/React__default["default"].createElement("span", {
4109
4091
  style: {
4110
4092
  position: 'absolute',
4111
4093
  zIndex: '9999999999',
@@ -4146,6 +4128,9 @@ const NewAutocomplete = ({
4146
4128
  setInnerValue('');
4147
4129
  }
4148
4130
  }, [selected]);
4131
+ React.useEffect(() => {
4132
+ setInnerError(errorMessage);
4133
+ }, [errorMessage]);
4149
4134
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, label ? /*#__PURE__*/React__default["default"].createElement("label", {
4150
4135
  style: {
4151
4136
  color: labelColor ? labelColor : configStyles.NEWAUTOCOMPLETE.labelColor,
@@ -4199,7 +4184,7 @@ const NewAutocomplete = ({
4199
4184
  flexDirection: contentTopDirection ? contentTopDirection : configStyles.NEWAUTOCOMPLETE.contentTopDirection,
4200
4185
  boxShadow: errorMessage ? errorColor ? `0 0 0 2px ${errorColor}` : `0 0 0 2px ${configStyles.NEWAUTOCOMPLETE.errorColor}` : isFocus ? contentTopBorderActive ? contentTopBorderActive : configStyles.NEWAUTOCOMPLETE.contentTopBorderActive : isHover ? contentTopBorderHover ? contentTopBorderHover : configStyles.NEWAUTOCOMPLETE.contentTopBorderHover : contentTopBorder ? contentTopBorder : configStyles.NEWAUTOCOMPLETE.contentTopBorder
4201
4186
  }
4202
- }, props)), errorMessage ? /*#__PURE__*/React__default["default"].createElement("span", {
4187
+ }, props)), innerError ? /*#__PURE__*/React__default["default"].createElement("span", {
4203
4188
  style: {
4204
4189
  left: '0px',
4205
4190
  position: 'absolute',
@@ -4208,7 +4193,7 @@ const NewAutocomplete = ({
4208
4193
  top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`,
4209
4194
  maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth
4210
4195
  }
4211
- }, errorMessage) : '', optionList));
4196
+ }, innerError) : '', optionList));
4212
4197
  };
4213
4198
  NewAutocomplete.propTypes = {
4214
4199
  label: PropTypes__default["default"].string,
@@ -4293,7 +4278,6 @@ NewAutocomplete.defaultProps = {
4293
4278
  exports.Autocomplate = Autocomplate;
4294
4279
  exports.Button = Button;
4295
4280
  exports.Captcha = Captcha;
4296
- exports.Chart = Chart;
4297
4281
  exports.Checkbox = Checkbox;
4298
4282
  exports.File = File;
4299
4283
  exports.Input = Input;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaypay/tui",
3
- "version": "0.0.97",
3
+ "version": "0.0.98",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -16,6 +16,11 @@ input:-webkit-autofill:active {
16
16
  background-color: inherit !important;
17
17
  }
18
18
 
19
+ input::-ms-reveal,
20
+ input::-ms-clear {
21
+ display: none;
22
+ }
23
+
19
24
  .error-message-show {
20
25
  animation-name: error-show;
21
26
  animation-fill-mode: forwards;
@@ -71,6 +71,12 @@ export const Modal = ({
71
71
  }
72
72
  };
73
73
 
74
+ const handleESC = (e) => {
75
+ if (e.key === 'Escape') {
76
+ handleCloseModal();
77
+ }
78
+ };
79
+
74
80
  useEffect(() => {
75
81
  if (type === 'images') {
76
82
  if (data) {
@@ -98,9 +104,11 @@ export const Modal = ({
98
104
  }, [selected]);
99
105
 
100
106
  useEffect(() => {
107
+ document.addEventListener('keydown', handleESC, false);
101
108
  return () => {
102
109
  setSelect(0);
103
110
  setInnerData([]);
111
+ document.removeEventListener('keydown', handleESC, false);
104
112
  }
105
113
  }, []);
106
114
 
@@ -87,6 +87,7 @@ export const NewAutocomplete = ({
87
87
  const [show, setShow] = useState(false);
88
88
  const [isHover, setIsHover] = useState(false);
89
89
  const [isFocus, setIsFocus] = useState(false);
90
+ const [innerError, setInnerError] = useState('');
90
91
  const [innerValue, setInnerValue] = useState('');
91
92
  const [innerOptions, setInnerOptions] = useState([]);
92
93
  const configStyles = compereConfigs();
@@ -131,6 +132,7 @@ export const NewAutocomplete = ({
131
132
  const value = e.target.value;
132
133
  const currentId = e.target.id;
133
134
  value.length > 0 ? setShow(true) : setShow(false);
135
+ setInnerError('');
134
136
  setInnerValue(value);
135
137
  if (value.length >= searchCount) {
136
138
  change({ name: value, id: currentId });
@@ -218,7 +220,7 @@ export const NewAutocomplete = ({
218
220
  </div>
219
221
  : innerOptions.length <= 0
220
222
  ?
221
- <span
223
+ innerError ? '' : <span
222
224
  style={{
223
225
  position: 'absolute',
224
226
  zIndex: '9999999999',
@@ -276,6 +278,10 @@ export const NewAutocomplete = ({
276
278
  setInnerValue('');
277
279
  }
278
280
  }, [selected]);
281
+
282
+ useEffect(() => {
283
+ setInnerError(errorMessage);
284
+ }, [errorMessage]);
279
285
 
280
286
  return (
281
287
  <>
@@ -351,7 +357,7 @@ export const NewAutocomplete = ({
351
357
  />
352
358
 
353
359
  {
354
- errorMessage
360
+ innerError
355
361
  ? <span
356
362
  style={{
357
363
  left: '0px',
@@ -362,7 +368,7 @@ export const NewAutocomplete = ({
362
368
  maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth,
363
369
  }}
364
370
  >
365
- {errorMessage}
371
+ {innerError}
366
372
  </span>
367
373
  : ''
368
374
  }
@@ -108,103 +108,111 @@ export const Pagination = ({
108
108
 
109
109
  let lastPage = paginationRange[paginationRange.length - 1];
110
110
  return (
111
- <ul className={classProps}>
112
- <button
113
- style={{
114
- transform: 'rotate(180deg)'
115
- }}
116
- onClick={onPrevious}
117
- disabled={currentPage === 1 ? true : false}
118
- className={`${styles["pagination-btn"]} pagination-btn-rem`}
119
- >
120
- <SvgNextarrow />
121
- </button>
111
+ <div
112
+ style={{
113
+ display: 'flex',
114
+ margin: '0 auto',
115
+ alignItems: 'center',
116
+ justifyContent: 'center',
117
+ }}
118
+ >
119
+ <ul className={classProps}>
120
+ <button
121
+ style={{
122
+ transform: 'rotate(180deg)'
123
+ }}
124
+ onClick={onPrevious}
125
+ disabled={currentPageNumber === 1 ? true : false}
126
+ className={`${styles["pagination-btn"]} pagination-btn-rem`}
127
+ >
128
+ <SvgNextarrow />
129
+ </button>
130
+
131
+ {paginationRange.map((pageNumber, id) => {
132
+ if (pageNumber === Dots) {
133
+ let currentPageIndex = paginationRange.indexOf(currentPageNumber);
134
+ return (
135
+ <li
136
+ key={id}
137
+ className={classnames(
138
+ `${styles["pagination-jump-next"]} pagination-jump-next-rem`,
139
+ styles.listItem
140
+ )}
141
+ onClick={
142
+ id < currentPageIndex
143
+ ? onPreviousFive
144
+ : onNextFive
145
+ }
146
+ disabled={currentPageIndex === 0 ? true : false}
147
+ >
148
+ {id < currentPageIndex ? (
149
+ <>
150
+ <span
151
+ className={
152
+ `${styles["pagination-jump-next-txt"]} pagination-jump-next-txt-rem`
153
+ }
154
+ >
155
+ <DotsIcon />
156
+ </span>
157
+ <span
158
+ className={
159
+ `${styles["pagination-jump-next-arrow"]} pagination-jump-next-arrow-rem`
160
+ }
161
+ style={{
162
+ transform: 'rotate(180deg)'
163
+ }}
164
+ >
165
+ <SvgNextarrow />
166
+ </span>
167
+ </>
168
+ ) : (
169
+ <>
170
+ <span
171
+ className={
172
+ `${styles["pagination-jump-next-txt"]} pagination-jump-next-txt-rem`
173
+ }
174
+ >
175
+ <DotsIcon />
176
+ </span>
177
+ <span
178
+ className={
179
+ `${styles["pagination-jump-next-arrow"]} pagination-jump-next-arrow-rem`
180
+ }
181
+ >
182
+ <SvgNextarrow />
183
+ </span>
184
+ </>
185
+ )}
186
+ </li>
187
+ );
188
+ }
122
189
 
123
- {paginationRange.map((pageNumber, id) => {
124
- if (pageNumber === Dots) {
125
- let currentPageIndex = paginationRange.indexOf(currentPageNumber);
126
190
  return (
127
191
  <li
192
+ onClick={() => onPageChange(pageNumber)}
128
193
  key={id}
129
194
  className={classnames(
130
- `${styles["pagination-jump-next"]} pagination-jump-next-rem`,
131
- styles.listItem
195
+ `${
196
+ pageNumber === currentPageNumber
197
+ ? styles.selected
198
+ : styles.listItem
199
+ }`,
200
+ `${styles["pagination-item"]} pagination-item-rem`
132
201
  )}
133
- onClick={
134
- id < currentPageIndex
135
- ? onPreviousFive
136
- : onNextFive
137
- }
138
- disabled={currentPageIndex === 0 ? true : false}
139
202
  >
140
- {id < currentPageIndex ? (
141
- <>
142
- <span
143
- className={
144
- `${styles["pagination-jump-next-txt"]} pagination-jump-next-txt-rem`
145
- }
146
- >
147
- <DotsIcon />
148
- </span>
149
- <span
150
- className={
151
- `${styles["pagination-jump-next-arrow"]} pagination-jump-next-arrow-rem`
152
- }
153
- style={{
154
- transform: 'rotate(180deg)'
155
- }}
156
- >
157
- <SvgNextarrow />
158
- </span>
159
- </>
160
- ) : (
161
- <>
162
- <span
163
- className={
164
- `${styles["pagination-jump-next-txt"]} pagination-jump-next-txt-rem`
165
- }
166
- >
167
- <DotsIcon />
168
- </span>
169
- <span
170
- className={
171
- `${styles["pagination-jump-next-arrow"]} pagination-jump-next-arrow-rem`
172
- }
173
- >
174
- <SvgNextarrow />
175
- </span>
176
- </>
177
- )}
203
+ {pageNumber}
178
204
  </li>
179
205
  );
180
- }
181
-
182
- return (
183
- <li
184
- onClick={() => onPageChange(pageNumber)}
185
- key={id}
186
- className={classnames(
187
- `${
188
- pageNumber === currentPageNumber
189
- ? styles.selected
190
- : styles.listItem
191
- }`,
192
- `${styles["pagination-item"]} pagination-item-rem`
193
- )}
194
- >
195
- {pageNumber}
196
- </li>
197
- );
198
- })}
199
-
200
- <button
201
- onClick={onNext}
202
- disabled={currentPageNumber === lastPage ? true : false}
203
- className={`${styles["pagination-btn"]} pagination-btn-rem`}
204
- >
205
- <SvgNextarrow />
206
- </button>
206
+ })}
207
207
 
208
+ <button
209
+ onClick={onNext}
210
+ disabled={currentPageNumber === lastPage ? true : false}
211
+ className={`${styles["pagination-btn"]} pagination-btn-rem`}
212
+ >
213
+ <SvgNextarrow />
214
+ </button>
215
+ </ul>
208
216
  {
209
217
  goTo && <div>
210
218
  <input
@@ -234,7 +242,7 @@ export const Pagination = ({
234
242
  >Էջ</span>
235
243
  </div>
236
244
  }
237
- </ul>
245
+ </div>
238
246
  );
239
247
  };
240
248
 
package/src/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from './components/file';
2
- export * from './components/chart';
3
2
  export * from './components/table';
4
3
  export * from './components/modal';
5
4
  export * from './components/input';
File without changes
@@ -1,16 +0,0 @@
1
- import React from "react";
2
- import { Chart } from './index';
3
-
4
- export default {
5
- component: Chart,
6
- title: "Components/Chart",
7
- };
8
-
9
- const Template = (args) => {
10
- return <Chart width={500} height={200} {...args} />;
11
- };
12
-
13
- export const Default = Template.bind({});
14
- Default.args = {
15
-
16
- };
@@ -1,42 +0,0 @@
1
- import React, { useEffect } from 'react';
2
- import PropTypes from 'prop-types';
3
- import { compereConfigs } from './../../utils';
4
-
5
- import styles from "./chart.module.css";
6
-
7
- export const Chart = ({
8
- width,
9
- height
10
- }) => {
11
- const configStyles = compereConfigs();
12
- useEffect(() => {
13
- const canvas = document.getElementById('myChart');
14
- // const canvas = canvasRef.current;
15
- const ctx = canvas.getContext('2d');
16
-
17
- const data = [10, 20, 30, 15, 25];
18
- const barWidth = 40;
19
- const chartHeight = 200;
20
-
21
- ctx.clearRect(0, 0, canvas.width, canvas.height);
22
-
23
- data.forEach((value, index) => {
24
- const x = index * (barWidth + 10);
25
- const y = chartHeight - value;
26
-
27
- ctx.fillStyle = 'blue';
28
- ctx.fillRect(x, y, barWidth, value);
29
- });
30
-
31
- }, []);
32
-
33
-
34
- return (
35
- <canvas id='myChart' width={width} height={height}></canvas>
36
- );
37
- };
38
-
39
- Chart.propTypes = {
40
- width: PropTypes.number,
41
- height: PropTypes.number,
42
- };