@xaypay/tui 0.0.94 → 0.0.96

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$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)}";
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)}";
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$f);
71
+ styleInject(css_248z$g);
72
72
 
73
73
  const File = ({
74
74
  name,
@@ -190,6 +190,63 @@ 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
+
193
250
  const SvgCheckboxUnchecked = ({
194
251
  title,
195
252
  titleId,
@@ -271,29 +328,6 @@ SingleCheckbox.propTypes = {
271
328
  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
329
  styleInject(css_248z$e);
273
330
 
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
331
  ({
298
332
  dataBody: PropTypes.array,
299
333
  dataHeader: PropTypes.array,
@@ -421,6 +455,8 @@ const Modal = ({
421
455
  headerSize,
422
456
  imageHeight,
423
457
  headerColor,
458
+ borderStyle,
459
+ borderWidth,
424
460
  outsideClose,
425
461
  headerWeight,
426
462
  headerHeight,
@@ -507,39 +543,38 @@ const Modal = ({
507
543
  className: `${classProps} ${styles$b['animation__modal']}`,
508
544
  onClick: handleStopClosing,
509
545
  style: {
510
- overflow: 'auto',
511
- boxSizing: 'border-box',
512
546
  width: width ? width : configStyles.MODAL.width,
513
547
  height: height ? height : configStyles.MODAL.height,
548
+ position: 'relative',
549
+ display: 'grid',
550
+ overflow: 'hidden',
551
+ boxSizing: 'border-box',
552
+ gridTemplateRows: 'auto 10fr',
514
553
  borderRadius: radius ? radius : configStyles.MODAL.radius,
515
554
  maxWidth: mMaxWidth ? mMaxWidth : configStyles.MODAL.mMaxWidth,
516
555
  maxHeight: mMaxHeight ? mMaxHeight : configStyles.MODAL.mMaxHeight,
517
556
  minWidth: type === 'content' ? minWidth ? minWidth : configStyles.MODAL.minWidth : '',
518
- padding: type === 'content' ? padding ? padding : configStyles.MODAL.padding : '10px',
519
557
  backgroundColor: backgroundColor ? backgroundColor : configStyles.MODAL.backgroundColor,
520
558
  minHeight: type === 'content' ? minHeight ? minHeight : configStyles.MODAL.minHeight : ''
521
559
  }
522
- }, /*#__PURE__*/React__default.createElement("div", {
523
- style: {
524
- position: 'relative',
525
- width: '100%',
526
- height: '100%'
527
- }
528
560
  }, type === 'content' ? /*#__PURE__*/React__default.createElement("div", {
529
561
  style: {
530
562
  width: '100%',
531
563
  display: 'flex',
532
564
  alignItems: 'center',
565
+ backgroundColor: '#FBFBFB',
566
+ boxSizing: 'border-box',
567
+ justifyContent: headerText && type === 'content' ? 'space-between' : 'flex-end',
533
568
  height: headerHeight ? headerHeight : configStyles.MODAL.headerHeight,
534
- justifyContent: headerText && type === 'content' ? 'space-between' : 'flex-end'
569
+ padding: padding ? padding : configStyles.MODAL.padding
535
570
  }
536
571
  }, headerText && type === 'content' && /*#__PURE__*/React__default.createElement("p", {
537
572
  style: {
573
+ flex: '1',
538
574
  overflow: 'hidden',
539
575
  whiteSpace: 'nowrap',
540
576
  textOverflow: 'ellipsis',
541
577
  margin: '0px 16px 0px 0px',
542
- maxWidth: 'calc(100% - 30px)',
543
578
  fontSize: headerSize ? headerSize : configStyles.MODAL.headerSize,
544
579
  color: headerColor ? headerColor : configStyles.MODAL.headerColor,
545
580
  fontWeight: headerWeight ? headerWeight : configStyles.MODAL.headerWeight
@@ -562,15 +597,21 @@ const Modal = ({
562
597
  border: 'none',
563
598
  outline: 'none',
564
599
  cursor: 'pointer',
600
+ zIndex: '1',
565
601
  backgroundColor: 'transparent'
566
602
  }
567
603
  }, /*#__PURE__*/React__default.createElement(SvgCloseSlide, null)), /*#__PURE__*/React__default.createElement("div", {
568
604
  style: {
569
605
  display: 'flex',
606
+ position: 'relative',
607
+ width: '100%',
608
+ height: '100%',
570
609
  alignItems: 'center',
571
610
  boxSizing: 'border-box',
572
611
  justifyContent: 'center',
573
- paddingTop: type === 'content' ? '10px' : '0px'
612
+ overflow: 'auto',
613
+ borderWidth: borderWidth ? borderWidth : configStyles.MODAL.borderWidth,
614
+ borderStyle: borderStyle ? borderStyle : configStyles.MODAL.borderStyle
574
615
  }
575
616
  }, type === 'content' ? children ? children : '' : /*#__PURE__*/React__default.createElement("div", {
576
617
  style: {
@@ -624,7 +665,7 @@ const Modal = ({
624
665
  top: 'calc(50% - 12px)',
625
666
  backgroundColor: 'transparent'
626
667
  }
627
- }, /*#__PURE__*/React__default.createElement(SvgNext, null)))))))));
668
+ }, /*#__PURE__*/React__default.createElement(SvgNext, null))))))));
628
669
  };
629
670
  Modal.propTypes = {
630
671
  data: PropTypes.array,
@@ -645,6 +686,8 @@ Modal.propTypes = {
645
686
  imageWidth: PropTypes.string,
646
687
  headerSize: PropTypes.string,
647
688
  outsideClose: PropTypes.bool,
689
+ borderStyle: PropTypes.string,
690
+ borderWidth: PropTypes.string,
648
691
  headerColor: PropTypes.string,
649
692
  imageHeight: PropTypes.string,
650
693
  headerWeight: PropTypes.string,
@@ -752,7 +795,7 @@ const Input = ({
752
795
  const handleChange = event => {
753
796
  const currentValue = event.target.value;
754
797
  let prevValue = innerValue;
755
- setInnerValue(currentValue);
798
+ setInnerValue(() => currentValue);
756
799
  if (change) {
757
800
  change(currentValue);
758
801
  }
@@ -780,9 +823,10 @@ const Input = ({
780
823
  if (type === 'number') {
781
824
  const regNum = /^\d+(\.)?(\d+)?$/;
782
825
  if (!regNum.test(currentValue)) {
783
- setInnerValue(prevValue);
826
+ const newStr = currentValue.replace(/[^\d+]/g, '');
827
+ setInnerValue(newStr);
784
828
  if (change) {
785
- change(prevValue);
829
+ change(newStr);
786
830
  }
787
831
  }
788
832
  if (minNumSize && currentValue < minNumSize) {
@@ -807,6 +851,15 @@ const Input = ({
807
851
  change(`${int}.${float.substr(0, floatToFix)}`);
808
852
  }
809
853
  }
854
+ } else if (floatToFix === 0) {
855
+ const floatNumParts = typeof currentValue === 'string' ? currentValue.split('.') : currentValue;
856
+ const int = floatNumParts[0];
857
+ if (floatNumParts && floatNumParts.length > 0 && floatToFix === 0) {
858
+ setInnerValue(`${int}`);
859
+ if (change) {
860
+ change(`${int}`);
861
+ }
862
+ }
810
863
  }
811
864
  if (currentValue === '') {
812
865
  setInnerValue('');
@@ -866,9 +919,10 @@ const Input = ({
866
919
  if (type === 'number') {
867
920
  const regNum = /^\d+(\.)?(\d+)?$/;
868
921
  if (!regNum.test(value)) {
869
- setInnerValue('');
922
+ const newStr = value.replace(/[^\d+]/g, '');
923
+ setInnerValue(newStr);
870
924
  if (change) {
871
- change('');
925
+ change(newStr);
872
926
  }
873
927
  }
874
928
  if (minNumSize && value < minNumSize) {
@@ -4204,4 +4258,4 @@ NewAutocomplete.defaultProps = {
4204
4258
  disabled: false
4205
4259
  };
4206
4260
 
4207
- export { Autocomplate, Button, Captcha, Checkbox, File, Input, InputTypes, Modal, NewAutocomplete, NewFile, Pagination, Radio, Select, SingleCheckbox, Stepper, Textarea, Toaster, Tooltip, Typography, TypographyType, toast };
4261
+ export { Autocomplate, Button, Captcha, Chart, 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$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)}";
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)}";
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$f);
101
+ styleInject(css_248z$g);
102
102
 
103
103
  const File = ({
104
104
  name,
@@ -220,6 +220,63 @@ 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
+
223
280
  const SvgCheckboxUnchecked = ({
224
281
  title,
225
282
  titleId,
@@ -301,29 +358,6 @@ SingleCheckbox.propTypes = {
301
358
  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
359
  styleInject(css_248z$e);
303
360
 
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
361
  ({
328
362
  dataBody: PropTypes__default["default"].array,
329
363
  dataHeader: PropTypes__default["default"].array,
@@ -451,6 +485,8 @@ const Modal = ({
451
485
  headerSize,
452
486
  imageHeight,
453
487
  headerColor,
488
+ borderStyle,
489
+ borderWidth,
454
490
  outsideClose,
455
491
  headerWeight,
456
492
  headerHeight,
@@ -537,39 +573,38 @@ const Modal = ({
537
573
  className: `${classProps} ${styles$b['animation__modal']}`,
538
574
  onClick: handleStopClosing,
539
575
  style: {
540
- overflow: 'auto',
541
- boxSizing: 'border-box',
542
576
  width: width ? width : configStyles.MODAL.width,
543
577
  height: height ? height : configStyles.MODAL.height,
578
+ position: 'relative',
579
+ display: 'grid',
580
+ overflow: 'hidden',
581
+ boxSizing: 'border-box',
582
+ gridTemplateRows: 'auto 10fr',
544
583
  borderRadius: radius ? radius : configStyles.MODAL.radius,
545
584
  maxWidth: mMaxWidth ? mMaxWidth : configStyles.MODAL.mMaxWidth,
546
585
  maxHeight: mMaxHeight ? mMaxHeight : configStyles.MODAL.mMaxHeight,
547
586
  minWidth: type === 'content' ? minWidth ? minWidth : configStyles.MODAL.minWidth : '',
548
- padding: type === 'content' ? padding ? padding : configStyles.MODAL.padding : '10px',
549
587
  backgroundColor: backgroundColor ? backgroundColor : configStyles.MODAL.backgroundColor,
550
588
  minHeight: type === 'content' ? minHeight ? minHeight : configStyles.MODAL.minHeight : ''
551
589
  }
552
- }, /*#__PURE__*/React__default["default"].createElement("div", {
553
- style: {
554
- position: 'relative',
555
- width: '100%',
556
- height: '100%'
557
- }
558
590
  }, type === 'content' ? /*#__PURE__*/React__default["default"].createElement("div", {
559
591
  style: {
560
592
  width: '100%',
561
593
  display: 'flex',
562
594
  alignItems: 'center',
595
+ backgroundColor: '#FBFBFB',
596
+ boxSizing: 'border-box',
597
+ justifyContent: headerText && type === 'content' ? 'space-between' : 'flex-end',
563
598
  height: headerHeight ? headerHeight : configStyles.MODAL.headerHeight,
564
- justifyContent: headerText && type === 'content' ? 'space-between' : 'flex-end'
599
+ padding: padding ? padding : configStyles.MODAL.padding
565
600
  }
566
601
  }, headerText && type === 'content' && /*#__PURE__*/React__default["default"].createElement("p", {
567
602
  style: {
603
+ flex: '1',
568
604
  overflow: 'hidden',
569
605
  whiteSpace: 'nowrap',
570
606
  textOverflow: 'ellipsis',
571
607
  margin: '0px 16px 0px 0px',
572
- maxWidth: 'calc(100% - 30px)',
573
608
  fontSize: headerSize ? headerSize : configStyles.MODAL.headerSize,
574
609
  color: headerColor ? headerColor : configStyles.MODAL.headerColor,
575
610
  fontWeight: headerWeight ? headerWeight : configStyles.MODAL.headerWeight
@@ -592,15 +627,21 @@ const Modal = ({
592
627
  border: 'none',
593
628
  outline: 'none',
594
629
  cursor: 'pointer',
630
+ zIndex: '1',
595
631
  backgroundColor: 'transparent'
596
632
  }
597
633
  }, /*#__PURE__*/React__default["default"].createElement(SvgCloseSlide, null)), /*#__PURE__*/React__default["default"].createElement("div", {
598
634
  style: {
599
635
  display: 'flex',
636
+ position: 'relative',
637
+ width: '100%',
638
+ height: '100%',
600
639
  alignItems: 'center',
601
640
  boxSizing: 'border-box',
602
641
  justifyContent: 'center',
603
- paddingTop: type === 'content' ? '10px' : '0px'
642
+ overflow: 'auto',
643
+ borderWidth: borderWidth ? borderWidth : configStyles.MODAL.borderWidth,
644
+ borderStyle: borderStyle ? borderStyle : configStyles.MODAL.borderStyle
604
645
  }
605
646
  }, type === 'content' ? children ? children : '' : /*#__PURE__*/React__default["default"].createElement("div", {
606
647
  style: {
@@ -654,7 +695,7 @@ const Modal = ({
654
695
  top: 'calc(50% - 12px)',
655
696
  backgroundColor: 'transparent'
656
697
  }
657
- }, /*#__PURE__*/React__default["default"].createElement(SvgNext, null)))))))));
698
+ }, /*#__PURE__*/React__default["default"].createElement(SvgNext, null))))))));
658
699
  };
659
700
  Modal.propTypes = {
660
701
  data: PropTypes__default["default"].array,
@@ -675,6 +716,8 @@ Modal.propTypes = {
675
716
  imageWidth: PropTypes__default["default"].string,
676
717
  headerSize: PropTypes__default["default"].string,
677
718
  outsideClose: PropTypes__default["default"].bool,
719
+ borderStyle: PropTypes__default["default"].string,
720
+ borderWidth: PropTypes__default["default"].string,
678
721
  headerColor: PropTypes__default["default"].string,
679
722
  imageHeight: PropTypes__default["default"].string,
680
723
  headerWeight: PropTypes__default["default"].string,
@@ -782,7 +825,7 @@ const Input = ({
782
825
  const handleChange = event => {
783
826
  const currentValue = event.target.value;
784
827
  let prevValue = innerValue;
785
- setInnerValue(currentValue);
828
+ setInnerValue(() => currentValue);
786
829
  if (change) {
787
830
  change(currentValue);
788
831
  }
@@ -810,9 +853,10 @@ const Input = ({
810
853
  if (type === 'number') {
811
854
  const regNum = /^\d+(\.)?(\d+)?$/;
812
855
  if (!regNum.test(currentValue)) {
813
- setInnerValue(prevValue);
856
+ const newStr = currentValue.replace(/[^\d+]/g, '');
857
+ setInnerValue(newStr);
814
858
  if (change) {
815
- change(prevValue);
859
+ change(newStr);
816
860
  }
817
861
  }
818
862
  if (minNumSize && currentValue < minNumSize) {
@@ -837,6 +881,15 @@ const Input = ({
837
881
  change(`${int}.${float.substr(0, floatToFix)}`);
838
882
  }
839
883
  }
884
+ } else if (floatToFix === 0) {
885
+ const floatNumParts = typeof currentValue === 'string' ? currentValue.split('.') : currentValue;
886
+ const int = floatNumParts[0];
887
+ if (floatNumParts && floatNumParts.length > 0 && floatToFix === 0) {
888
+ setInnerValue(`${int}`);
889
+ if (change) {
890
+ change(`${int}`);
891
+ }
892
+ }
840
893
  }
841
894
  if (currentValue === '') {
842
895
  setInnerValue('');
@@ -896,9 +949,10 @@ const Input = ({
896
949
  if (type === 'number') {
897
950
  const regNum = /^\d+(\.)?(\d+)?$/;
898
951
  if (!regNum.test(value)) {
899
- setInnerValue('');
952
+ const newStr = value.replace(/[^\d+]/g, '');
953
+ setInnerValue(newStr);
900
954
  if (change) {
901
- change('');
955
+ change(newStr);
902
956
  }
903
957
  }
904
958
  if (minNumSize && value < minNumSize) {
@@ -4237,6 +4291,7 @@ NewAutocomplete.defaultProps = {
4237
4291
  exports.Autocomplate = Autocomplate;
4238
4292
  exports.Button = Button;
4239
4293
  exports.Captcha = Captcha;
4294
+ exports.Chart = Chart;
4240
4295
  exports.Checkbox = Checkbox;
4241
4296
  exports.File = File;
4242
4297
  exports.Input = Input;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaypay/tui",
3
- "version": "0.0.94",
3
+ "version": "0.0.96",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
File without changes
@@ -0,0 +1,16 @@
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
+ };
@@ -0,0 +1,42 @@
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
+ };
@@ -108,7 +108,7 @@ export const Input = ({
108
108
 
109
109
  let prevValue = innerValue;
110
110
 
111
- setInnerValue(currentValue);
111
+ setInnerValue(() => currentValue);
112
112
  if (change) {
113
113
  change(currentValue);
114
114
  }
@@ -138,9 +138,10 @@ export const Input = ({
138
138
  if (type === 'number') {
139
139
  const regNum = /^\d+(\.)?(\d+)?$/;
140
140
  if (!regNum.test(currentValue)) {
141
- setInnerValue(prevValue);
141
+ const newStr = currentValue.replace(/[^\d+]/g, '');
142
+ setInnerValue(newStr);
142
143
  if (change) {
143
- change(prevValue);
144
+ change(newStr);
144
145
  }
145
146
  }
146
147
  if (minNumSize && currentValue < minNumSize) {
@@ -165,8 +166,18 @@ export const Input = ({
165
166
  if (change) {
166
167
  change(`${int}.${float.substr(0, floatToFix)}`);
167
168
  }
168
- }
169
+ }
170
+ } else if (floatToFix === 0) {
171
+ const floatNumParts = typeof currentValue === 'string' ? currentValue.split('.') : currentValue;
172
+ const int = floatNumParts[0];
173
+ if (floatNumParts && floatNumParts.length > 0 && floatToFix === 0) {
174
+ setInnerValue(`${int}`);
175
+ if (change) {
176
+ change(`${int}`);
177
+ }
178
+ }
169
179
  }
180
+
170
181
  if (currentValue === '') {
171
182
  setInnerValue('');
172
183
  if (change) {
@@ -233,9 +244,10 @@ export const Input = ({
233
244
  if (type === 'number') {
234
245
  const regNum = /^\d+(\.)?(\d+)?$/;
235
246
  if (!regNum.test(value)) {
236
- setInnerValue('');
247
+ const newStr = value.replace(/[^\d+]/g, '');
248
+ setInnerValue(newStr);
237
249
  if (change) {
238
- change('');
250
+ change(newStr);
239
251
  }
240
252
  }
241
253
  if (minNumSize && value < minNumSize) {
@@ -31,6 +31,8 @@ export const Modal = ({
31
31
  headerSize,
32
32
  imageHeight,
33
33
  headerColor,
34
+ borderStyle,
35
+ borderWidth,
34
36
  outsideClose,
35
37
  headerWeight,
36
38
  headerHeight,
@@ -128,26 +130,21 @@ export const Modal = ({
128
130
  className={`${classProps} ${styles['animation__modal']}`}
129
131
  onClick={handleStopClosing}
130
132
  style={{
131
- overflow: 'auto',
132
- boxSizing: 'border-box',
133
133
  width: width ? width : configStyles.MODAL.width,
134
134
  height: height ? height : configStyles.MODAL.height,
135
+ position: 'relative',
136
+ display: 'grid',
137
+ overflow: 'hidden',
138
+ boxSizing: 'border-box',
139
+ gridTemplateRows: 'auto 10fr',
135
140
  borderRadius: radius ? radius : configStyles.MODAL.radius,
136
141
  maxWidth: mMaxWidth ? mMaxWidth : configStyles.MODAL.mMaxWidth,
137
142
  maxHeight: mMaxHeight ? mMaxHeight : configStyles.MODAL.mMaxHeight,
138
143
  minWidth: type === 'content' ? minWidth ? minWidth : configStyles.MODAL.minWidth : '',
139
- padding: type === 'content' ? padding ? padding : configStyles.MODAL.padding : '10px',
140
144
  backgroundColor: backgroundColor ? backgroundColor : configStyles.MODAL.backgroundColor,
141
145
  minHeight: type === 'content' ? minHeight ? minHeight : configStyles.MODAL.minHeight : '',
142
146
  }}
143
147
  >
144
- <div
145
- style={{
146
- position: 'relative',
147
- width: '100%',
148
- height: '100%'
149
- }}
150
- >
151
148
  {
152
149
  type === 'content'
153
150
  ?
@@ -156,18 +153,21 @@ export const Modal = ({
156
153
  width: '100%',
157
154
  display: 'flex',
158
155
  alignItems: 'center',
159
- height: headerHeight ? headerHeight : configStyles.MODAL.headerHeight,
156
+ backgroundColor: '#FBFBFB',
157
+ boxSizing: 'border-box',
160
158
  justifyContent: headerText && type === 'content' ? 'space-between' : 'flex-end',
159
+ height: headerHeight ? headerHeight : configStyles.MODAL.headerHeight,
160
+ padding: padding ? padding : configStyles.MODAL.padding
161
161
  }}
162
162
  >
163
163
  {
164
164
  headerText && type === 'content' && <p
165
165
  style={{
166
+ flex: '1',
166
167
  overflow: 'hidden',
167
168
  whiteSpace: 'nowrap',
168
169
  textOverflow: 'ellipsis',
169
170
  margin: '0px 16px 0px 0px',
170
- maxWidth: 'calc(100% - 30px)',
171
171
  fontSize: headerSize ? headerSize : configStyles.MODAL.headerSize,
172
172
  color: headerColor ? headerColor : configStyles.MODAL.headerColor,
173
173
  fontWeight: headerWeight ? headerWeight : configStyles.MODAL.headerWeight
@@ -197,6 +197,7 @@ export const Modal = ({
197
197
  border: 'none',
198
198
  outline: 'none',
199
199
  cursor: 'pointer',
200
+ zIndex: '1',
200
201
  backgroundColor: 'transparent'
201
202
  }}
202
203
  >
@@ -207,10 +208,15 @@ export const Modal = ({
207
208
  <div
208
209
  style={{
209
210
  display: 'flex',
211
+ position: 'relative',
212
+ width: '100%',
213
+ height: '100%',
210
214
  alignItems: 'center',
211
215
  boxSizing: 'border-box',
212
216
  justifyContent: 'center',
213
- paddingTop: type === 'content' ? '10px' : '0px'
217
+ overflow: 'auto',
218
+ borderWidth: borderWidth ? borderWidth : configStyles.MODAL.borderWidth,
219
+ borderStyle: borderStyle ? borderStyle : configStyles.MODAL.borderStyle
214
220
  }}
215
221
  >
216
222
  {
@@ -290,7 +296,7 @@ export const Modal = ({
290
296
  </div>
291
297
  }
292
298
  </div>
293
- </div>
299
+ {/* </div> */}
294
300
  </div>
295
301
  </div>
296
302
  </div>
@@ -316,6 +322,8 @@ Modal.propTypes = {
316
322
  imageWidth: PropTypes.string,
317
323
  headerSize: PropTypes.string,
318
324
  outsideClose: PropTypes.bool,
325
+ borderStyle: PropTypes.string,
326
+ borderWidth: PropTypes.string,
319
327
  headerColor: PropTypes.string,
320
328
  imageHeight: PropTypes.string,
321
329
  headerWeight: PropTypes.string,
package/src/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './components/file';
2
+ export * from './components/chart';
2
3
  export * from './components/table';
3
4
  export * from './components/modal';
4
5
  export * from './components/input';
@@ -599,5 +599,7 @@ import StackAlt from './assets/stackalt.svg';
599
599
  backgroundColor: 'white', // for modal background color
600
600
  padding: '10px 20px 20px', // for modal padding
601
601
  layerBackgroundColor: 'rgba(0,0,0,0.4)', // for modal parent layer background color
602
+ borderWidth: '20px', // for modal padding from border transparent
603
+ borderStyle: 'solid', // for modal border style
602
604
  }
603
- ```
605
+ ```
package/tui.config.js CHANGED
@@ -388,13 +388,15 @@ module.exports = {
388
388
  imageWidth: '600px', // for modal image width on images mode
389
389
  headerWeight: '600', // for modal header font weight
390
390
  imageHeight: '300px', // for modal image height on images mode
391
- headerHeight: '27px', // for modal header height
391
+ headerHeight: '30px', // for modal header height
392
392
  width: 'fit-content', // for modal width
393
393
  height: 'fit-content', // for modal width
394
394
  headerColor: '#00236a', // for modal header color
395
395
  backgroundColor: 'white', // for modal background color
396
- padding: '10px 20px 20px', // for modal padding
396
+ padding: '20px 20px 20px', // for modal padding
397
397
  layerBackgroundColor: 'rgba(0,0,0,0.4)', // for modal parent layer background color
398
+ borderWidth: '20px', // for modal padding from border transparent
399
+ borderStyle: 'solid', // for modal border style
398
400
  },
399
401
  // default properties for <Table /> component
400
402
  TABLE: {