@xaypay/tui 0.0.71 → 0.0.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/index.es.js +537 -176
  2. package/dist/index.js +537 -176
  3. package/package.json +1 -1
  4. package/src/components/autocomplate/autocomplate.stories.js +1 -1
  5. package/src/components/icon/ListItemJpeg.js +21 -0
  6. package/src/components/icon/ListItemPng.js +21 -0
  7. package/src/components/icon/index.js +2 -1
  8. package/src/components/input/index.js +22 -15
  9. package/src/components/input/input.stories.js +11 -5
  10. package/src/components/newAutocomplete/NewAutocomplete.stories.js +26 -26
  11. package/src/components/newAutocomplete/index.js +113 -92
  12. package/src/components/newFile/fileItem.js +213 -0
  13. package/src/components/newFile/index.js +161 -130
  14. package/src/components/newFile/newFile.stories.js +6 -3
  15. package/src/components/pagination/index.js +74 -3
  16. package/src/components/pagination/pagination.module.css +13 -1
  17. package/src/components/pagination/pagination.stories.js +4 -2
  18. package/src/components/select/index.js +9 -2
  19. package/src/components/select/select.stories.js +0 -1
  20. package/src/components/textarea/index.js +30 -1
  21. package/src/components/typography/index.js +1 -1
  22. package/src/components/typography/typography.stories.js +2 -1
  23. package/src/stories/configuration.stories.mdx +45 -0
  24. package/src/stories/static/autocomplete-usage.png +0 -0
  25. package/src/stories/static/file-single-usage.png +0 -0
  26. package/src/stories/static/file-usage.png +0 -0
  27. package/src/stories/static/input-usage.png +0 -0
  28. package/src/stories/static/tooltip-usage.png +0 -0
  29. package/src/stories/usage.stories.mdx +17 -8
  30. package/tui.config.js +31 -19
  31. package/src/stories/static/input-tooltip-usage.png +0 -0
  32. package/src/stories/static/new-autocomplete-usage.png +0 -0
@@ -316,7 +316,7 @@ const data = [
316
316
  phone: "572-905-5251",
317
317
  },
318
318
  ];
319
- const Template = ({ offset, currentPage, siblingCount, totalCount }) => {
319
+ const Template = ({ goTo, offset, currentPage, siblingCount, totalCount }) => {
320
320
  const [currentPageNumber, setCurrentPageNumber] = useState(currentPage);
321
321
  const currentTableData = useMemo(() => {
322
322
  const firstPageIndex = (currentPageNumber - 1) * offset;
@@ -351,6 +351,7 @@ const Template = ({ offset, currentPage, siblingCount, totalCount }) => {
351
351
  </tbody>
352
352
  </table>
353
353
  <Pagination
354
+ goTo={goTo}
354
355
  currentPage={currentPage}
355
356
  totalCount={totalCount}
356
357
  offset={offset}
@@ -364,8 +365,9 @@ const Template = ({ offset, currentPage, siblingCount, totalCount }) => {
364
365
  export const Default = Template.bind({});
365
366
 
366
367
  Default.args = {
368
+ goTo: false,
367
369
  offset: 10,
368
- currentPage: 4,
370
+ currentPage: 1,
369
371
  siblingCount: 2,
370
372
  totalCount: 44
371
373
  };
@@ -170,7 +170,14 @@ export const Select = ({
170
170
  }, [opened]);
171
171
 
172
172
  useEffect(() => {
173
- selected && selected.length > 0 && setNewSelected(isObjectEmpty(selected[0]) ? []: selected );
173
+ if (selected) {
174
+ if (selected.length > 0) {
175
+ setNewSelected(isObjectEmpty(selected[0]) ? []: selected );
176
+ } else {
177
+ setNewSelected([]);
178
+ }
179
+ }
180
+
174
181
  if (!multiple) {
175
182
  options && options.length > 0 && setExistOptions(options);
176
183
  } else {
@@ -187,7 +194,7 @@ export const Select = ({
187
194
  });
188
195
  setExistOptions(modifiedOptions);
189
196
  }
190
- }, [options, multiple, selected]);
197
+ }, [options, multiple, selected, selected.length]);
191
198
 
192
199
  return (
193
200
  <div className={classProps}>
@@ -25,4 +25,3 @@ Default.args = {
25
25
  selected: [{"bbb":"1", "value":"Կենտրոն"}, {"bbb":"2", "value":"Մալաթիա"}],
26
26
  keyNames: {name: 'value', id : 'bbb'}
27
27
  };
28
-
@@ -24,17 +24,21 @@ export const Textarea = ({
24
24
  boxSizing,
25
25
  maxLength,
26
26
  labelSize,
27
+ errorSize,
27
28
  labelColor,
29
+ errorColor,
28
30
  borderColor,
29
31
  labelWeight,
30
32
  placeholder,
31
33
  labelDisplay,
34
+ errorMesaage,
32
35
  backgroundColor,
33
36
  borderFocusColor,
34
37
  borderHoverColor,
35
38
  showCharacterCount,
36
39
  labelRequiredColor
37
40
  }) => {
41
+ const [error, setError] = useState('');
38
42
  const [isHover, setIsHover] = useState(false);
39
43
  const [isFocus, setIsFocus] = useState(false);
40
44
  const [innerValue, setInnerValue] = useState('');
@@ -63,10 +67,16 @@ export const Textarea = ({
63
67
  if (maxLength) {
64
68
  if (value.length > maxLength) {
65
69
  onChange(value.substr(0, maxLength));
70
+ setError('Նիշերի քանակը գերազանցում է');
71
+ } else {
72
+ setError('');
66
73
  }
67
74
  } else {
68
75
  if (value.length > configStyles.TEXTAREA.maxLength) {
76
+ setError('Նիշերի քանակը գերազանցում է');
69
77
  onChange(value.substr(0, configStyles.TEXTAREA.maxLength));
78
+ } else {
79
+ setError('');
70
80
  }
71
81
  }
72
82
  };
@@ -83,6 +93,14 @@ export const Textarea = ({
83
93
  setInnerValue(value);
84
94
  }, [value, onChange]);
85
95
 
96
+ useEffect(() => {
97
+ if (errorMesaage) {
98
+ setError(errorMesaage);
99
+ } else {
100
+ setError('');
101
+ }
102
+ }, [errorMesaage]);
103
+
86
104
  return (
87
105
  <div
88
106
  style={{
@@ -140,7 +158,8 @@ export const Textarea = ({
140
158
  maxHeight: maxHeight ? maxHeight : configStyles.TEXTAREA.maxHeight,
141
159
  boxSizing: boxSizing ? boxSizing : configStyles.TEXTAREA.boxSizing,
142
160
  backgroundColor: backgroundColor ? backgroundColor : configStyles.TEXTAREA.backgroundColor,
143
- borderColor: isFocus ? borderFocusColor ? borderFocusColor : configStyles.TEXTAREA.borderFocusColor :
161
+ borderColor: error ? errorColor ? errorColor : configStyles.TEXTAREA.errorColor :
162
+ isFocus ? borderFocusColor ? borderFocusColor : configStyles.TEXTAREA.borderFocusColor :
144
163
  isHover ? borderHoverColor ? borderHoverColor : configStyles.TEXTAREA.borderHoverColor :
145
164
  borderColor ? borderColor : configStyles.TEXTAREA.borderColor,
146
165
  resize: resize ? resize : configStyles.TEXTAREA.resize,
@@ -153,6 +172,16 @@ export const Textarea = ({
153
172
  onMouseEnter={handleMouseEnter}
154
173
  onMouseLeave={handleMouseLeave}
155
174
  ></textarea>
175
+ {
176
+ error ? <span
177
+ style={{
178
+ marginTop: '6px',
179
+ display: 'inline-block',
180
+ fontSize: errorSize ? errorSize : configStyles.TEXTAREA.errorSize,
181
+ color: errorColor ? errorColor : configStyles.TEXTAREA.errorColor,
182
+ }}
183
+ >{ error }</span> : ''
184
+ }
156
185
  </div>
157
186
  );
158
187
  };
@@ -74,7 +74,7 @@ export const Typography = ({
74
74
  textTransform: textTransform ? textTransform : configStyles.TYPOGRAPHY['textTransform'+variant],
75
75
  textDecoration: textDecoration ? textDecoration : configStyles.TYPOGRAPHY['textDecoration'+variant],
76
76
  backgroundColor: backgroundColor ? backgroundColor : configStyles.TYPOGRAPHY['backgroundColor'+variant],
77
- color: isHover ? colorHover ? colorHover : configStyles.TYPOGRAPHY['colorHover'+variant] : color ? color : configStyles.TYPOGRAPHY['color'+variant],
77
+ color: isHover ? colorHover ? colorHover : color ? color : configStyles.TYPOGRAPHY['color'+variant] : color ? color : configStyles.TYPOGRAPHY['color'+variant],
78
78
  },
79
79
  ...props,
80
80
  className: classProps,
@@ -13,9 +13,10 @@ export const Template = (args) => <>
13
13
  {
14
14
  staticTag.map((tag,key) => {
15
15
  return <Typography
16
+ {...args}
16
17
  key={key}
17
18
  variant={tag}
18
- color={"#" + Math.floor(Math.random()*16777215).toString(16).padStart(6, '0').toUpperCase()}
19
+ color='#a3d177'
19
20
  >
20
21
  {tag}
21
22
  </Typography>;
@@ -519,4 +519,49 @@ import StackAlt from './assets/stackalt.svg';
519
519
  range: 'for example. 72', // for captcha range (add itself on each component)
520
520
  getRange: 'is must be function', // for captcha get current range (add itself on each component)
521
521
  }
522
+ ```
523
+
524
+ ### NewFile
525
+ ```
526
+ {
527
+ or: 'կամ', // for file place text
528
+ weight: 400, // for file place font weight
529
+ size: '12px', // for file font size
530
+ radius: '6px', // for file place border radius
531
+ width: '440px', // for file width
532
+ height: '200px', // for file choose place height
533
+ color: '#3C393E', // for file place color
534
+ upload: 'Բեռնել', // for file place text
535
+ labelSize: '16px', // for file font size
536
+ border: '2px dashed', // for file choose place border
537
+ errorColor: '#ee0000', // for file error message color
538
+ labelColor: '#4A4A4D', // for file color
539
+ errorColor: '#ee0000', // for file place error color
540
+ borderColor: '#D1D1D1', // for file choose place border color
541
+ listItemHeight: '70px', // for file list item height
542
+ uploadColor: '#0DA574', // for file place upload text color
543
+ progressColor: '#4A4A4D', // for file progress bar color
544
+ progressFontSize: '16px', // for file progress bar font size
545
+ listItemErrorSize: '16px', // for file multiple mode error font size
546
+ backgroundColor: '#F8F8F8', // for file choose place background color
547
+ listItemErrorColor: 'black', // for file multiple mode error color
548
+ borderHoverColor: '#00236A', // for file border color, when hover is happening
549
+ fileAreaImageHeight: 'auto', // for file place choosen image preview height
550
+ listItemPadding: '14px 20px', // for file list item padding
551
+ fileSizeText: 'Առավելագույնը', // for file place file size text
552
+ fileAreaImageWidth: '27.8rem', // for file place choosen image preview width
553
+ labelRequiredColor: '#ee0000', // for file label required color
554
+ progressTrackColor: '#E5E8E8', // for file item progress track background color
555
+ extentionsRowMarginTop: '40px', // for file extentions row margin top
556
+ progressFailedColor: '#E40E00', // for file list item progress backfround color when file upload is failed
557
+ progressSuccessColor: '#069768', // for file list item progress background color when file upload is success
558
+ progressLoadingColor: '#051942', // for file list item progress background color when file upload is loading
559
+ formatError: 'ֆայլի սխալ ֆորմատ', // for file error text when file extention is invalid
560
+ noChoosenFile: 'Ֆայլը ընտրված չէ', // for file error text when file is not choosen
561
+ listItemBackgroundColor: '#F6F8F8', // for file list item background color
562
+ maxSizeError: 'Առավելագույն ծավալ', // for file error text when choosen file size is more then maxSize prop
563
+ putFileHere: 'Տեղադրել ֆայլը այստեղ', // for file place text
564
+ hiddenBackgroundColor: 'rgba(60, 57, 62, 0.4)', // for file place background color when hover on file place and there is a choosen file
565
+ listItemBackgroundErrorColor: 'rgba(255, 0, 0, 0.7)', // for file multiple mode error background color
566
+ }
522
567
  ```
@@ -8,14 +8,17 @@ import Plugin from './assets/plugin.svg';
8
8
  import Repo from './assets/repo.svg';
9
9
  import StackAlt from './assets/stackalt.svg';
10
10
 
11
+ import fileImage from './static/file-usage.png';
11
12
  import captcha from './static/captcha-usage.png';
13
+ import inputImage from './static/input-usage.png';
12
14
  import buttonImage from './static/button-usage.png';
13
15
  import selectImage from './static/select-usage.png';
14
16
  import toastImage from './static/toaster-usage.png';
17
+ import tooltipImage from './static/tooltip-usage.png';
15
18
  import textareaImage from './static/textarea-usage.png';
19
+ import fileSingleImage from './static/file-single-usage.png';
16
20
  import toasterImage from './static/toaster-container-usage.png';
17
- import inputTooltipImage from './static/input-tooltip-usage.png';
18
- import newAutocompleteImage from './static/new-autocomplete-usage.png';
21
+ import autocompleteImage from './static/autocomplete-usage.png';
19
22
 
20
23
  <Meta title="Intro/Usage" />
21
24
 
@@ -130,15 +133,15 @@ import newAutocompleteImage from './static/new-autocomplete-usage.png';
130
133
  # Usage
131
134
 
132
135
  ### Button
133
-
134
136
  <img src={buttonImage} alt="button image" />
135
137
 
136
- ### Input / Tooltip
138
+ ### Input
139
+ <img src={inputImage} alt="input image" />
137
140
 
138
- <img src={inputTooltipImage} alt="input tooltip image" />
141
+ ### Tooltip
142
+ <img src={tooltipImage} alt="tooltip image" />
139
143
 
140
144
  ### Select
141
-
142
145
  <img src={selectImage} alt="select image" />
143
146
 
144
147
  ### Toaster
@@ -153,7 +156,13 @@ import newAutocompleteImage from './static/new-autocomplete-usage.png';
153
156
  <img src={textareaImage} alt="textarea image" />
154
157
 
155
158
  ### NewAutocomplete
156
- <img src={newAutocompleteImage} alt="autocomplete image" />
159
+ <img src={autocompleteImage} alt="autocomplete image" />
157
160
 
158
161
  ### Captcha
159
- <img src={captcha} alt="captcha image" />
162
+ <img src={captcha} alt="captcha image" />
163
+
164
+ ### NewFile in Multiple Mode
165
+ <img src={fileImage} alt="file image" />
166
+
167
+ ### NewFile in Single Mode
168
+ <img src={fileSingleImage} alt="file image" />
package/tui.config.js CHANGED
@@ -101,14 +101,14 @@ module.exports = {
101
101
  sizeh6: '14px', // for variant h6 font size
102
102
  sizespan: '12px', // for variant span font size
103
103
 
104
- textAlignp: '0px', // for variant p text align
105
- textAlignh1: '0px', // for variant h1 text align
106
- textAlignh2: '0px', // for variant h2 text align
107
- textAlignh3: '0px', // for variant h3 text align
108
- textAlignh4: '0px', // for variant h4 text align
109
- textAlignh5: '0px', // for variant h5 text align
110
- textAlignh6: '0px', // for variant h6 text align
111
- textAlignspan: '0px', // for variant span text align
104
+ textAlignp: 'left', // for variant p text align
105
+ textAlignh1: 'left', // for variant h1 text align
106
+ textAlignh2: 'left', // for variant h2 text align
107
+ textAlignh3: 'left', // for variant h3 text align
108
+ textAlignh4: 'left', // for variant h4 text align
109
+ textAlignh5: 'left', // for variant h5 text align
110
+ textAlignh6: 'left', // for variant h6 text align
111
+ textAlignspan: 'left', // for variant span text align
112
112
 
113
113
  weightp: '500', // for variant p font weight
114
114
  weighth1: '400', // for variant h1 font weight
@@ -119,15 +119,6 @@ module.exports = {
119
119
  weighth6: '600', // for variant h6 font weight
120
120
  weightspan: '500', // for variant span font weight
121
121
 
122
- colorHoverp: '#3C393E', // for variant p color in hover mode
123
- colorHoverh1: '#3C393E', // for variant h1 color in hover mode
124
- colorHoverh2: '#3C393E', // for variant h2 color in hover mode
125
- colorHoverh3: '#3C393E', // for variant h3 color in hover mode
126
- colorHoverh4: '#3C393E', // for variant h4 color in hover mode
127
- colorHoverh5: '#3C393E', // for variant h5 color in hover mode
128
- colorHoverh6: '#3C393E', // for variant h6 color in hover mode
129
- colorHoverspan: '#3C393E', // for variant span color in hover mode
130
-
131
122
  backgroundColorp: 'transparent', // for variant p background color
132
123
  backgroundColorh1: 'transparent', // for variant h1 background color
133
124
  backgroundColorh2: 'transparent', // for variant h2 background color
@@ -238,10 +229,12 @@ module.exports = {
238
229
  minWidth: '200px', // for minimum width
239
230
  maxWidth: '500px', // for maximum width
240
231
  labelSize: '16px', // for label font size
232
+ errorSize: '12px', // for error font size
241
233
  minHeight: '100px', // for minimum height
242
234
  maxHeight: '300px', // for maximum height
243
235
  border: '2px solid', // for border
244
236
  padding: '12px 15px', // for padding
237
+ errorColor: '#E40E00', // for error color
245
238
  labelColor: '#3C393E', // for label color
246
239
  labelWeight: 'normal', // for label font weight
247
240
  labelDisplay: 'block', // for label display
@@ -329,25 +322,44 @@ module.exports = {
329
322
  },
330
323
  // default properties for <File /> component
331
324
  File: {
325
+ or: 'կամ', // for file place text
332
326
  weight: 400, // for file place font weight
333
327
  size: '12px', // for file font size
334
- radius: '6px',
328
+ radius: '6px', // for file place border radius
335
329
  width: '440px', // for file width
336
330
  height: '200px', // for file choose place height
337
331
  color: '#3C393E', // for file place color
332
+ upload: 'Բեռնել', // for file place text
338
333
  labelSize: '16px', // for file font size
339
334
  border: '2px dashed', // for file choose place border
340
335
  errorColor: '#ee0000', // for file error message color
341
336
  labelColor: '#4A4A4D', // for file color
342
337
  errorColor: '#ee0000', // for file place error color
343
338
  borderColor: '#D1D1D1', // for file choose place border color
339
+ listItemHeight: '70px', // for file list item height
344
340
  uploadColor: '#0DA574', // for file place upload text color
341
+ progressColor: '#4A4A4D', // for file progress bar color
342
+ progressFontSize: '16px', // for file progress bar font size
343
+ listItemErrorSize: '16px', // for file multiple mode error font size
345
344
  backgroundColor: '#F8F8F8', // for file choose place background color
345
+ listItemErrorColor: 'black', // for file multiple mode error color
346
346
  borderHoverColor: '#00236A', // for file border color, when hover is happening
347
+ fileAreaImageHeight: 'auto', // for file place choosen image preview height
348
+ listItemPadding: '14px 20px', // for file list item padding
349
+ fileSizeText: 'Առավելագույնը', // for file place file size text
350
+ fileAreaImageWidth: '27.8rem', // for file place choosen image preview width
347
351
  labelRequiredColor: '#ee0000', // for file label required color
348
352
  progressTrackColor: '#E5E8E8', // for file item progress track background color
349
353
  extentionsRowMarginTop: '40px', // for file extentions row margin top
350
- hiddenBackgroundColor: 'rgba(60, 57, 62, 0.4)', // for file place background color when hover on file place and there is a choosen file
354
+ progressFailedColor: '#E40E00', // for file list item progress backfround color when file upload is failed
355
+ progressSuccessColor: '#069768', // for file list item progress background color when file upload is success
356
+ progressLoadingColor: '#051942', // for file list item progress background color when file upload is loading
357
+ formatError: 'ֆայլի սխալ ֆորմատ', // for file error text when file extention is invalid
358
+ noChoosenFile: 'Ֆայլը ընտրված չէ', // for file error text when file is not choosen
351
359
  listItemBackgroundColor: '#F6F8F8', // for file list item background color
360
+ maxSizeError: 'Առավելագույն ծավալ', // for file error text when choosen file size is more then maxSize prop
361
+ putFileHere: 'Տեղադրել ֆայլը այստեղ', // for file place text
362
+ hiddenBackgroundColor: 'rgba(60, 57, 62, 0.4)', // for file place background color when hover on file place and there is a choosen file
363
+ listItemBackgroundErrorColor: 'rgba(255, 0, 0, 0.7)', // for file multiple mode error background color
352
364
  }
353
365
  };