@xaypay/tui 0.0.80 → 0.0.82

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.
Files changed (57) hide show
  1. package/dist/index.es.js +220 -146
  2. package/dist/index.js +220 -146
  3. package/package.json +1 -1
  4. package/src/assets/attach.svg +4 -0
  5. package/src/assets/delete.svg +4 -0
  6. package/src/assets/down-arrow.svg +4 -0
  7. package/src/assets/minus.svg +4 -0
  8. package/src/assets/plus.svg +4 -0
  9. package/src/assets/up-arrow.svg +4 -0
  10. package/src/components/icon/Arrow.js +2 -2
  11. package/src/components/icon/CaptchaArrowDown.js +2 -2
  12. package/src/components/icon/CaptchaArrowUp.js +2 -2
  13. package/src/components/icon/CheckboxChecked.js +2 -2
  14. package/src/components/icon/CheckboxUnchecked.js +2 -2
  15. package/src/components/icon/Close.js +2 -2
  16. package/src/components/icon/CloseIcon.js +2 -2
  17. package/src/components/icon/CloseSlide.js +2 -2
  18. package/src/components/icon/DeleteComponent.js +2 -2
  19. package/src/components/icon/Dots.js +2 -2
  20. package/src/components/icon/HeartFilled.js +2 -2
  21. package/src/components/icon/HeartOutline.js +2 -2
  22. package/src/components/icon/ListItemDelete.js +2 -2
  23. package/src/components/icon/ListItemJpeg.js +2 -2
  24. package/src/components/icon/ListItemJpg.js +2 -2
  25. package/src/components/icon/ListItemPdf.js +2 -2
  26. package/src/components/icon/ListItemPng.js +2 -2
  27. package/src/components/icon/Next.js +2 -2
  28. package/src/components/icon/Nextarrow.js +2 -2
  29. package/src/components/icon/PDF.js +2 -2
  30. package/src/components/icon/Prev.js +2 -2
  31. package/src/components/icon/RangeArrowDefault.js +2 -2
  32. package/src/components/icon/RangeArrowError.js +2 -2
  33. package/src/components/icon/RangeArrowSuccess.js +2 -2
  34. package/src/components/icon/RemoveFile.js +2 -2
  35. package/src/components/icon/ToasterClose.js +2 -2
  36. package/src/components/icon/ToasterError.js +2 -2
  37. package/src/components/icon/ToasterInfo.js +2 -2
  38. package/src/components/icon/ToasterSuccess.js +2 -2
  39. package/src/components/icon/ToasterWarning.js +2 -2
  40. package/src/components/icon/Tooltip.js +2 -2
  41. package/src/components/icon/Upload.js +2 -2
  42. package/src/components/input/index.js +11 -21
  43. package/src/components/modal/index.js +28 -20
  44. package/src/components/modal/modal.stories.js +1 -1
  45. package/src/components/newAutocomplete/index.js +9 -5
  46. package/src/components/newFile/index.js +4 -3
  47. package/src/components/select/index.js +9 -2
  48. package/src/components/singleCheckbox/index.js +27 -5
  49. package/src/components/table/index.js +70 -97
  50. package/src/components/table/table.module.css +28 -0
  51. package/src/components/table/table.stories.js +391 -172
  52. package/src/components/table/td.js +133 -0
  53. package/src/components/table/th.js +55 -0
  54. package/src/components/textarea/index.js +21 -15
  55. package/src/components/textarea/textarea.stories.js +4 -0
  56. package/src/stories/configuration.stories.mdx +17 -5
  57. package/tui.config.js +18 -7
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- const SvgUpload = ({ title, titleId, ...props }) => (
2
+ const SvgUpload = ({ title, titleId, fillColor, ...props }) => (
3
3
  <svg
4
4
  width="51"
5
5
  height="35"
@@ -18,7 +18,7 @@ const SvgUpload = ({ title, titleId, ...props }) => (
18
18
  fillRule="evenodd"
19
19
  clipRule="evenodd"
20
20
  d="M41.822 17.245c-4.864 0-8.822 3.982-8.822 8.878C33 31.018 36.958 35 41.822 35c4.864 0 8.822-3.982 8.822-8.877 0-4.896-3.959-8.878-8.822-8.878Zm-.536 13.005v-6.689l-3.067 3.22a.69.69 0 0 1-1.01 0 .777.777 0 0 1 0-1.06l4.286-4.5A.71.71 0 0 1 42 21a.684.684 0 0 1 .505.22l4.286 4.5a.777.777 0 0 1 0 1.06.69.69 0 0 1-1.01 0l-3.067-3.22v6.69c0 .414-.32.75-.714.75-.395 0-.714-.336-.714-.75Z"
21
- fill="#0DA574"
21
+ fill={fillColor ? fillColor : '#0DA574'}
22
22
  />
23
23
  </svg>
24
24
  );
@@ -12,7 +12,7 @@ export const InputTypes = {
12
12
  PASSWORD: "password",
13
13
  };
14
14
 
15
- const P = styled.p`
15
+ const P = styled.span`
16
16
  animation: ${props => props.errorAnimation ? props.animation : 'none'};
17
17
  `;
18
18
 
@@ -33,6 +33,7 @@ export const Input = ({
33
33
  leftIcon,
34
34
  required,
35
35
  disabled,
36
+ marginTop,
36
37
  transform,
37
38
  iconWidth,
38
39
  rightIcon,
@@ -48,7 +49,6 @@ export const Input = ({
48
49
  borderRight,
49
50
  placeholder,
50
51
  errorZindex,
51
- errorBottom,
52
52
  labelWeight,
53
53
  phoneDisplay,
54
54
  errorMessage,
@@ -112,10 +112,6 @@ export const Input = ({
112
112
  if (!phoneNumberRegex.test(currentValue)) {
113
113
  if (currentValue === '') {
114
114
  setInnerErrorMessage('');
115
- setInnerValue('');
116
- if (change) {
117
- change('');
118
- }
119
115
  } else {
120
116
  telErrorMessage ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage(configStyles.INPUT.telErrorMessage);
121
117
  setInnerValue(prevValue);
@@ -130,11 +126,6 @@ export const Input = ({
130
126
  if (change) {
131
127
  change(currentValue.substr(0, 8));
132
128
  }
133
- } else {
134
- setInnerValue(currentValue);
135
- if (change) {
136
- change(currentValue);
137
- }
138
129
  }
139
130
  }
140
131
  }
@@ -181,16 +172,14 @@ export const Input = ({
181
172
  } else {
182
173
  telErrorMessage ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage(configStyles.INPUT.telErrorMessage);
183
174
  }
184
- setInnerValue('');
185
175
  } else {
186
- setInnerErrorMessage('');
187
- if (value.length > 8) {
176
+ if (value.length < 8) {
177
+ telErrorMessage ? setInnerErrorMessage(telErrorMessage) : setInnerErrorMessage(configStyles.INPUT.telErrorMessage);
178
+ } else if (value.length > 8) {
188
179
  setInnerValue(value.substr(0, 8));
189
- } else {
190
- setInnerValue(value);
191
180
  }
192
181
  }
193
- }
182
+ }
194
183
 
195
184
  if (maxLength && value.length > maxLength && type !== 'tel') {
196
185
  setInnerValue(value.substr(0, maxLength));
@@ -301,8 +290,8 @@ export const Input = ({
301
290
  padding: padding ? padding : configStyles.INPUT.padding,
302
291
  borderRadius: radius ? radius : configStyles.INPUT.radius,
303
292
  boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
304
- backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
305
293
  color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
294
+ backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
306
295
  }}
307
296
  />
308
297
  {
@@ -336,13 +325,14 @@ export const Input = ({
336
325
  animation={animation}
337
326
  style={{
338
327
  margin: '0px',
328
+ position: 'absolute',
329
+ width: width ? width : configStyles.INPUT.width,
339
330
  left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
340
331
  color: errorColor ? errorColor : configStyles.INPUT.errorColor,
341
332
  fontSize: errorSize ? errorSize : configStyles.INPUT.errorSize,
342
- bottom: errorBottom ? errorBottom : configStyles.INPUT.errorBottom,
343
333
  zIndex: errorZindex ? errorZindex : configStyles.INPUT.errorZindex,
344
- position: errorPosition ? errorPosition : configStyles.INPUT.errorPosition,
345
334
  lineHeight: errorLineHeight ? errorLineHeight : configStyles.INPUT.errorLineHeight,
335
+ top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`,
346
336
  transform: !errorAnimation ? 'scale3d(1,1,1)' : transform ? transform : configStyles.INPUT.transform,
347
337
  }}
348
338
  className={errorClassName ? errorClassName : configStyles.INPUT.errorClassName}
@@ -368,6 +358,7 @@ Input.propTypes = {
368
358
  padding: PropTypes.string,
369
359
  fontSize: PropTypes.string,
370
360
  tooltip: PropTypes.element,
361
+ marginTop: PropTypes.string,
371
362
  transform: PropTypes.string,
372
363
  className: PropTypes.string,
373
364
  iconWidth: PropTypes.string,
@@ -382,7 +373,6 @@ Input.propTypes = {
382
373
  borderRight: PropTypes.string,
383
374
  placeholder: PropTypes.string,
384
375
  errorZindex: PropTypes.string,
385
- errorBottom: PropTypes.string,
386
376
  labelWeight: PropTypes.string,
387
377
  errorMessage: PropTypes.string,
388
378
  phoneDisplay: PropTypes.string,
@@ -13,7 +13,9 @@ import SvgCloseSlide from './../icon/CloseSlide';
13
13
  export const Modal = ({
14
14
  type,
15
15
  data,
16
+ width,
16
17
  radius,
18
+ height,
17
19
  padding,
18
20
  setShow,
19
21
  selected,
@@ -21,13 +23,18 @@ export const Modal = ({
21
23
  minWidth,
22
24
  minHeight,
23
25
  className,
26
+ mMaxWidth,
27
+ alignItems,
28
+ mMaxHeight,
24
29
  headerText,
25
30
  imageWidth,
26
31
  headerSize,
27
32
  imageHeight,
28
33
  headerColor,
34
+ outsideClose,
29
35
  headerWeight,
30
36
  headerHeight,
37
+ justifyContent,
31
38
  backgroundColor,
32
39
  layerBackgroundColor,
33
40
  }) => {
@@ -45,8 +52,7 @@ export const Modal = ({
45
52
  e.stopPropagation();
46
53
  };
47
54
 
48
- const handleGoTo = (e) => {
49
- const goTo = e.target.getAttribute('data-go');
55
+ const handleGoTo = (goTo) => {
50
56
  if (goTo === 'next') {
51
57
  if (select >= data.length - 1) {
52
58
  setSelect(0);
@@ -97,7 +103,7 @@ export const Modal = ({
97
103
 
98
104
  return (
99
105
  <div
100
- onClick={handleCloseModal}
106
+ onClick={outsideClose || configStyles.MODAL.outsideClose ? handleCloseModal : _ => _}
101
107
  style={{
102
108
  top: '0px',
103
109
  left: '0px',
@@ -111,31 +117,28 @@ export const Modal = ({
111
117
  <div
112
118
  style={{
113
119
  position: 'relative',
120
+ display: 'flex',
114
121
  width: '100%',
115
- height: '100vh'
122
+ height: '100vh',
123
+ alignItems: alignItems ? alignItems : configStyles.MODAL.alignItems,
124
+ justifyContent: justifyContent ? justifyContent : configStyles.MODAL.justifyContent
116
125
  }}
117
126
  >
118
127
  <div
119
128
  className={`${classProps} ${styles['animation__modal']}`}
120
129
  onClick={handleStopClosing}
121
130
  style={{
122
- top: '0px',
123
- left: '0px',
124
- right: '0px',
125
- bottom: '0px',
126
- margin: 'auto',
127
- maxWidth: '95%',
128
131
  overflow: 'auto',
129
- maxHeight: '95vh',
130
- position: 'absolute',
131
- width: 'fit-content',
132
- height: 'fit-content',
133
132
  boxSizing: 'border-box',
133
+ width: width ? width : configStyles.MODAL.width,
134
+ height: height ? height : configStyles.MODAL.height,
134
135
  borderRadius: radius ? radius : configStyles.MODAL.radius,
135
- minWidth: type === 'content' ? minWidth ? minWidth : '' : '',
136
- minHeight: type === 'content' ? minHeight ? minHeight : '' : '',
136
+ maxWidth: mMaxWidth ? mMaxWidth : configStyles.MODAL.mMaxWidth,
137
+ maxHeight: mMaxHeight ? mMaxHeight : configStyles.MODAL.mMaxHeight,
138
+ minWidth: type === 'content' ? minWidth ? minWidth : configStyles.MODAL.minWidth : '',
137
139
  padding: type === 'content' ? padding ? padding : configStyles.MODAL.padding : '10px',
138
140
  backgroundColor: backgroundColor ? backgroundColor : configStyles.MODAL.backgroundColor,
141
+ minHeight: type === 'content' ? minHeight ? minHeight : configStyles.MODAL.minHeight : '',
139
142
  }}
140
143
  >
141
144
  <div
@@ -249,8 +252,7 @@ export const Modal = ({
249
252
  {
250
253
  innerData && innerData.length > 1 && <>
251
254
  <button
252
- onClick={handleGoTo}
253
- data-go='prev'
255
+ onClick={_ => handleGoTo('prev')}
254
256
  style={{
255
257
  position: 'absolute',
256
258
  left: '14px',
@@ -267,8 +269,7 @@ export const Modal = ({
267
269
  <SvgPrev />
268
270
  </button>
269
271
  <button
270
- onClick={handleGoTo}
271
- data-go='next'
272
+ onClick={_ => handleGoTo('next')}
272
273
  style={{
273
274
  position: 'absolute',
274
275
  width: '24px',
@@ -300,19 +301,26 @@ Modal.propTypes = {
300
301
  data: PropTypes.array,
301
302
  type: PropTypes.string,
302
303
  setShow: PropTypes.func,
304
+ width: PropTypes.string,
303
305
  radius: PropTypes.string,
306
+ height: PropTypes.string,
304
307
  padding: PropTypes.string,
305
308
  selected: PropTypes.number,
306
309
  minWidth: PropTypes.string,
310
+ mMaxWidth: PropTypes.string,
307
311
  minHeight: PropTypes.string,
308
312
  className: PropTypes.string,
313
+ alignItems: PropTypes.string,
314
+ mMaxHeight: PropTypes.string,
309
315
  headerText: PropTypes.string,
310
316
  imageWidth: PropTypes.string,
311
317
  headerSize: PropTypes.string,
318
+ outsideClose: PropTypes.bool,
312
319
  headerColor: PropTypes.string,
313
320
  imageHeight: PropTypes.string,
314
321
  headerWeight: PropTypes.string,
315
322
  headerHeight: PropTypes.string,
323
+ justifyContent: PropTypes.string,
316
324
  backgroundColor: PropTypes.string,
317
325
  layerBackgroundColor: PropTypes.string,
318
326
  };
@@ -55,7 +55,7 @@ const Template = ({ headerText, className }) => {
55
55
  style={{ cursor: 'pointer', padding: '8px', fontSize: '16px' }}
56
56
  >Change type to {type === 'content' ? 'images' : 'content'}</button>
57
57
  {show && (
58
- <Modal type={type} selected={0} data={data} setShow={setShow} minHeight='400px' minWidth='600px' className={className}>
58
+ <Modal type={type} selected={0} data={data} setShow={setShow} className={className}>
59
59
  <p>
60
60
  Children content
61
61
  </p>
@@ -15,6 +15,7 @@ export const NewAutocomplete = ({
15
15
  selected,
16
16
  errorSize,
17
17
  labelSize,
18
+ marginTop,
18
19
  errorColor,
19
20
  labelColor,
20
21
  labelWeight,
@@ -209,11 +210,12 @@ export const NewAutocomplete = ({
209
210
  </div>
210
211
  : innerOptions.length <= 0
211
212
  ?
212
- <p
213
+ <span
213
214
  style={{
214
- margin: '0px',
215
+ position: 'absolute',
215
216
  color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
216
217
  fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
218
+ top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`,
217
219
  height: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
218
220
  padding: contentBottomRowPadding ? contentBottomRowPadding : configStyles.NEWAUTOCOMPLETE.contentBottomRowPadding,
219
221
  lineHeight: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
@@ -225,7 +227,7 @@ export const NewAutocomplete = ({
225
227
  ? 'Նման տվյալ առկա չէ'
226
228
  : `Լրացնել առնվազն ${searchCount} նիշ`
227
229
  }
228
- </p>
230
+ </span>
229
231
  : ''
230
232
  : ''
231
233
  }
@@ -339,10 +341,11 @@ export const NewAutocomplete = ({
339
341
  errorMessage
340
342
  ? <span
341
343
  style={{
342
- margin: '0px',
343
- display: 'inline-block',
344
+ left: '0px',
345
+ position: 'absolute',
344
346
  color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
345
347
  fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
348
+ top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`,
346
349
  maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth,
347
350
  }}
348
351
  >
@@ -365,6 +368,7 @@ NewAutocomplete.propTypes = {
365
368
  disabled: PropTypes.bool,
366
369
  selected: PropTypes.string,
367
370
  errorSize: PropTypes.string,
371
+ marginTop: PropTypes.string,
368
372
  labelSize: PropTypes.string,
369
373
  errorColor: PropTypes.string,
370
374
  labelColor: PropTypes.string,
@@ -18,7 +18,6 @@ export const NewFile = ({
18
18
  name,
19
19
  color,
20
20
  label,
21
- width,
22
21
  weight,
23
22
  height,
24
23
  radius,
@@ -26,6 +25,7 @@ export const NewFile = ({
26
25
  border,
27
26
  upload,
28
27
  maxSize,
28
+ maxWidth,
29
29
  disabled,
30
30
  multiple,
31
31
  required,
@@ -227,7 +227,8 @@ export const NewFile = ({
227
227
  <div
228
228
  ref={ref}
229
229
  style={{
230
- width: width ? width : configStyles.File.width
230
+ width: '100%',
231
+ maxWidth: maxWidth ? maxWidth : configStyles.File.maxWidth
231
232
  }}
232
233
  >
233
234
  <div
@@ -441,7 +442,6 @@ NewFile.propTypes = {
441
442
  or: PropTypes.string,
442
443
  size: PropTypes.string,
443
444
  label: PropTypes.string,
444
- width: PropTypes.string,
445
445
  color: PropTypes.string,
446
446
  height: PropTypes.string,
447
447
  disabled: PropTypes.bool,
@@ -451,6 +451,7 @@ NewFile.propTypes = {
451
451
  upload: PropTypes.string,
452
452
  weight: PropTypes.number,
453
453
  maxSize: PropTypes.number,
454
+ maxWidth: PropTypes.string,
454
455
  removeFile: PropTypes.func,
455
456
  errorSize: PropTypes.string,
456
457
  labelSize: PropTypes.string,
@@ -18,8 +18,10 @@ export const Select = ({
18
18
  keyNames,
19
19
  selected,
20
20
  className,
21
+ marginTop,
21
22
  arrowIcon,
22
23
  closeIcon,
24
+ errorZindex,
23
25
  errorMessage,
24
26
  defaultOption,
25
27
  multipleCheckbox,
@@ -198,7 +200,7 @@ export const Select = ({
198
200
  }, [options, multiple, selected, selected?.length]);
199
201
 
200
202
  return (
201
- <div className={classProps}>
203
+ <div className={classProps} style={{ position: 'relative' }}>
202
204
  {
203
205
  label ?
204
206
  <label
@@ -338,8 +340,11 @@ export const Select = ({
338
340
  errorMessage ?
339
341
  <span
340
342
  style={{
343
+ position: 'absolute',
341
344
  color: errorColor ? errorColor : configStyles.SELECT.errorColor,
342
- fontSize: errorSize ? errorSize : configStyles.SELECT.errorSize
345
+ fontSize: errorSize ? errorSize : configStyles.SELECT.errorSize,
346
+ zIndex: errorZindex ? errorZindex : configStyles.SELECT.errorZindex,
347
+ top: marginTop ? `calc(100% + ${marginTop})` : `calc(100% + ${configStyles.INPUT.marginTop})`
343
348
  }}
344
349
  >
345
350
  {errorMessage}
@@ -358,9 +363,11 @@ Select.propTypes = {
358
363
  disabled: PropTypes.bool,
359
364
  selected: PropTypes.array,
360
365
  keyNames: PropTypes.object,
366
+ marginTop: PropTypes.string,
361
367
  className: PropTypes.string,
362
368
  arrowIcon: PropTypes.element,
363
369
  closeIcon: PropTypes.element,
370
+ errorZindex: PropTypes.number,
364
371
  errorMessage: PropTypes.string,
365
372
  defaultOption: PropTypes.string,
366
373
  multipleCheckbox: PropTypes.bool,
@@ -1,20 +1,42 @@
1
- import React from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
4
  import ReactCheckbox from '../icon/CheckboxUnchecked';
5
5
  import ReactCheckboxChecked from '../icon/CheckboxChecked';
6
6
 
7
- export const SingleCheckbox = ({ checked }) => {
7
+ export const SingleCheckbox = ({
8
+ id,
9
+ float,
10
+ checked,
11
+ onClick,
12
+ content,
13
+ disabled,
14
+ checkedColor,
15
+ unCheckedColor
16
+ }) => {
17
+ const [innerCheckd, setInnerChecked] = useState(false);
8
18
 
19
+ useEffect(() => {
20
+ setInnerChecked(checked);
21
+ }, [checked]);
9
22
  return <div
10
23
  style={{
11
- marginRight: '9px'
24
+ width: '16px',
25
+ height: '16px',
26
+ marginRight: '9px',
27
+ display: 'inline-block',
28
+ float: float ? float : '',
29
+ cursor: !disabled && onClick ? 'pointer' : 'normal'
12
30
  }}
13
31
  >
14
- { checked ? <ReactCheckboxChecked /> : <ReactCheckbox /> }
32
+ { innerCheckd
33
+ ? <ReactCheckboxChecked onClick={!disabled && onClick ? (e) => onClick(e, content, id) : _ => _} fillColor={checkedColor ? checkedColor : ''} />
34
+ : <ReactCheckbox onClick={!disabled && onClick ? (e) => onClick(e, content, id) : _ => _} fillColor={unCheckedColor ? unCheckedColor : ''} />
35
+ }
15
36
  </div>;
16
37
  };
17
38
 
18
39
  SingleCheckbox.propTypes = {
19
- checked: PropTypes.bool,
40
+ disabled: PropTypes.bool,
41
+ checked: PropTypes.bool.isRequired,
20
42
  }