@xaypay/tui 0.0.23 → 0.0.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaypay/tui",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -1,5 +1,5 @@
1
1
  .btn {
2
- text-transform: capitalize;
2
+ text-transform: none;
3
3
  font-size: 16px;
4
4
  line-height: 20px;
5
5
  padding: 12px 20px;
@@ -0,0 +1,11 @@
1
+ .file-Form{
2
+ display: flex;
3
+ flex-direction: column;
4
+ justify-content: center;
5
+ align-items: center;
6
+ border: 3px dashed rgb(161, 160, 160);
7
+ width: 300px;
8
+ height: 200px;
9
+ cursor: pointer;
10
+ border-radius: 5px;
11
+ }
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { File } from "./index";
3
+
4
+ export default {
5
+ component: File,
6
+ title: "Components/File",
7
+ };
8
+
9
+ const Template = (args) => <File {...args} />;
10
+
11
+ export const Default = Template.bind({});
12
+ Default.args = {
13
+ label: 'ssa',
14
+ onChange: (aa) => {
15
+ console.log('barev', aa);
16
+
17
+ },
18
+ defaultData: {
19
+ url: 'https://images.pexels.com/photos/753626/pexels-photo-753626.jpeg?auto=compress&cs=tinysrgb&w=1600',
20
+ type: "image/png",
21
+ },
22
+ name: 'sss'
23
+
24
+ };
@@ -0,0 +1,117 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import PropTypes from "prop-types";
3
+ import classnames from "classnames";
4
+ import styles from "./file.module.css";
5
+
6
+ export const File = ({
7
+ className,
8
+ label,
9
+ required,
10
+ disabled,
11
+ onChange,
12
+ defaultData,
13
+ errorMesage,
14
+ name,
15
+ ...props
16
+ }) => {
17
+ const pdfImageName = 'https://play-lh.googleusercontent.com/kIwlXqs28otssKK_9AKwdkB6gouex_U2WmtLshTACnwIJuvOqVvJEzewpzuYBXwXQQ'
18
+ const [image, setImage] = useState(defaultData ?
19
+ defaultData.type != 'application/pdf' ?
20
+ defaultData.url : pdfImageName : null);
21
+ const [error, setError] = useState(errorMesage);
22
+ const [fileName, setFileName] = useState('no selected file');
23
+ function fileType(file) {
24
+ if (file.size <= 5000000) {
25
+ if (file.type === 'image/jpeg' || file.type === 'image/png') {
26
+ setImage(URL.createObjectURL(file))
27
+ setError('')
28
+
29
+ }
30
+ else if (file.type === 'application/pdf') {
31
+ setImage(pdfImageName)
32
+ setError('')
33
+
34
+ }
35
+ else {
36
+ setImage(null)
37
+ setFileName('no selected file');
38
+ setError('ֆայլի սխալ ֆորմատ')
39
+ }
40
+ }
41
+ else {
42
+ setImage(null)
43
+ setFileName('no selected file');
44
+ setError('առավելագույն ծավալ')
45
+ }
46
+ }
47
+
48
+ return (
49
+ <>
50
+ <label>{label}</label>
51
+ <div>
52
+ <div
53
+ className={styles['file-Form']}
54
+ onChange={(e) => { console.log(e) }}
55
+ style={error ? { borderColor: 'red' } : {}}
56
+ onClick={() => {
57
+ document.querySelector(`.${name}`).click()
58
+ }}
59
+ >
60
+ <input type='file' className={name} hidden disabled={disabled}
61
+ onChange={({ target: { files } }) => {
62
+ onChange({ target: { files } })
63
+ files[0] && setFileName(files[0].name)
64
+ if (files[0]) {
65
+ fileType(files[0])
66
+ }
67
+ }}
68
+ />
69
+ {
70
+ image ?
71
+ <div>
72
+ <div
73
+ onClick={() => {
74
+ setFileName('no selected file');
75
+ setImage(null)
76
+ }}
77
+ >
78
+ x
79
+ </div>
80
+ <img
81
+ src={image}
82
+ height={120}
83
+ alt={fileName}
84
+ />
85
+ </div> :
86
+ <div>
87
+ <div>
88
+ <img src='https://uxwing.com/wp-content/themes/uxwing/download/web-app-development/cloud-upload-icon.png' width={100} />
89
+ </div>
90
+ <div>
91
+ <span>Տեղադրել ֆայլը այստեղ կամ Բեռնել</span>
92
+ </div>
93
+ <div>
94
+ <span>Առավելագույնը 5ՄԲ ( jpg, jpeg, png, pdf)</span>
95
+ </div>
96
+ </div>
97
+ }
98
+ </div>
99
+ </div>
100
+ {
101
+ error ? <span style={{ color: 'red' }}>{error}</span> : null
102
+ }
103
+ </>
104
+ );
105
+ };
106
+
107
+ File.propTypes = {
108
+ className: PropTypes.string,
109
+ label: PropTypes.string,
110
+ required: PropTypes.bool,
111
+ disabled: PropTypes.bool,
112
+ onChange: PropTypes.func,
113
+ errorMesage: PropTypes.string,
114
+ defaultData: PropTypes.object
115
+ };
116
+
117
+
@@ -16,7 +16,7 @@
16
16
  position: relative;
17
17
  }
18
18
  .input {
19
- text-transform: capitalize;
19
+ text-transform: none;
20
20
  font-size: 16px;
21
21
  line-height: 20px;
22
22
  border-radius: 6px;
@@ -3,7 +3,7 @@
3
3
  }
4
4
  .multi-select-title {
5
5
  display: block;
6
- text-transform: capitalize;
6
+ text-transform: none;
7
7
  font-size: 16px;
8
8
  color: #3C393E;
9
9
  line-height: 22px;
@@ -48,7 +48,7 @@ export const PaginationRange = ({
48
48
  }
49
49
 
50
50
  if (shouldShowLeftDots && !shouldShowRightDots) {
51
- let rightItemCount =
51
+ let rightItemCount = 0;
52
52
  currentPageNumber === lastPageIndex - 3 && lastPageIndex > 7
53
53
  ? (rightItemCount = 4 + siblingCountNumber)
54
54
  : (rightItemCount = 3 + siblingCountNumber);
@@ -1,6 +1,6 @@
1
1
  .select-title {
2
2
  display: block;
3
- text-transform: capitalize;
3
+ text-transform: none;
4
4
  font-size: 16px;
5
5
  color: #3C393E;
6
6
  line-height: 22px;
@@ -34,21 +34,21 @@ h5 {
34
34
  }
35
35
 
36
36
  h5 {
37
- text-transform: capitalize;
37
+ text-transform: none;
38
38
  font-size: 16px;
39
39
  line-height: 22px;
40
40
  font-weight: 600;
41
41
  }
42
42
 
43
43
  p {
44
- text-transform: capitalize;
44
+ text-transform: none;
45
45
  font-size: 14px;
46
46
  line-height: 20px;
47
47
  font-weight: 600;
48
48
  }
49
49
 
50
50
  span {
51
- text-transform: capitalize;
51
+ text-transform: none;
52
52
  font-size: 12px;
53
53
  line-height: 16px;
54
54
  font-weight: 500;
package/src/index.js CHANGED
@@ -8,4 +8,5 @@ export * from './components/pagination';
8
8
  export * from './components/radio';
9
9
  export * from './components/captcha';
10
10
  export * from './components/stepper';
11
- export * from './components/select';
11
+ export * from './components/select';
12
+ export * from './components/file';