siam-ui-utils 2.0.7 → 2.1.0
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/.eslintrc +73 -0
- package/.eslintrc.mjs +53 -0
- package/.prettierrc +7 -0
- package/.prettierrc.js +5 -0
- package/.storybook/css/bootstrap.min.css +6 -0
- package/.storybook/css/bootstrap.rtl.only.min.css +1428 -0
- package/.storybook/main.ts +17 -0
- package/.storybook/preview.ts +16 -0
- package/eslint.config.js +28 -0
- package/package.json +87 -63
- package/src/App.jsx +27 -2
- package/src/IntlMessages.jsx +1 -0
- package/src/bridges/{with-router-bridge.jsx → index.jsx} +1 -1
- package/src/constants-svg.js +659 -0
- package/src/constants.js +9 -0
- package/src/dropzone-uploader/DropzoneUploader.stories.tsx +32 -0
- package/src/dropzone-uploader/dropzone-uploader.css +66 -0
- package/src/dropzone-uploader/index.jsx +6 -2
- package/src/iconos/icon-button-svg.jsx +49 -0
- package/src/iconos/index.js +3 -0
- package/src/iconos/styled-icon.jsx +25 -0
- package/src/index.js +1 -1
- package/src/main.jsx +0 -1
- package/src/tomar-foto/TomarFoto.stories.tsx +29 -0
- package/src/tomar-foto/index.jsx +1 -1
- package/tsconfig.json +25 -24
- package/.eslintrc.json +0 -29
- package/src/bridges/index.js +0 -1
package/src/constants.js
CHANGED
|
@@ -5,3 +5,12 @@ export const TAKE_PHOTO = {
|
|
|
5
5
|
'La carga de una foto Selfie de frente junto a tu DNI solo es accesible desde su teléfono',
|
|
6
6
|
TAKE_PHOTO_MESSAGE: 'Hacer Foto',
|
|
7
7
|
}
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const LABEL_BUTTONS = {
|
|
11
|
+
TOMAR_FOTO_CELULAR: 'Tomar Foto CELULAR',
|
|
12
|
+
TOMAR_FOTO_WEB: 'Tomar Foto WEB',
|
|
13
|
+
SUBIR_ARCHIVO_MAX_3: 'Subir archivos (maximo 3)',
|
|
14
|
+
SUBIR_ARCHIVO_MAX_7: 'Subir archivos (maximo 7)'
|
|
15
|
+
|
|
16
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { DropzoneUploader } from '.';
|
|
4
|
+
|
|
5
|
+
const args={
|
|
6
|
+
onChangeFiles: () => {console.log('Dispatch an action onchange file')},
|
|
7
|
+
totalFiles: 0,
|
|
8
|
+
maxFiles: 3,
|
|
9
|
+
accept : 'image/*, application/pdf',
|
|
10
|
+
capture : null,
|
|
11
|
+
nameFileLabel : 'Subir archivos',
|
|
12
|
+
maxFileSize: 2
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const meta = {
|
|
16
|
+
title: 'Components/DropzoneUploader',
|
|
17
|
+
component: DropzoneUploader,
|
|
18
|
+
args: {
|
|
19
|
+
...args
|
|
20
|
+
},
|
|
21
|
+
} satisfies Meta<typeof DropzoneUploader>;
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
|
|
26
|
+
export const DropzoneUploaderBasic: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
...args,
|
|
29
|
+
maxFileSize: 7
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
.dropzone-upload-button{
|
|
2
|
+
padding: 25;
|
|
3
|
+
border-radius: 5px !important;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
color: #fff;
|
|
6
|
+
width: 10rem !important;
|
|
7
|
+
height: 2rem !important;
|
|
8
|
+
line-height: 1.5 !important;
|
|
9
|
+
font-size: 13px;
|
|
10
|
+
text-align: center;
|
|
11
|
+
vertical-align: middle !important;
|
|
12
|
+
border: none;
|
|
13
|
+
padding-top: 0.5rem;
|
|
14
|
+
margin-top: 0.5rem;
|
|
15
|
+
background-color: #af251b;
|
|
16
|
+
&:hover {
|
|
17
|
+
background-color: rgb(108, 31, 1);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
.dropzone-upload-frame{
|
|
21
|
+
border: 0px !important;
|
|
22
|
+
overflow: 'none' !important;
|
|
23
|
+
}
|
|
24
|
+
.dropzone-upload-previewContainer {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: row;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
position: relative;
|
|
30
|
+
width: 100px;
|
|
31
|
+
min-height: 60px;
|
|
32
|
+
z-index: 1;
|
|
33
|
+
border-bottom: 1px solid #ECECEC;
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.dropzone-upload-previewImage {
|
|
38
|
+
width: 60rem;
|
|
39
|
+
max-height: 60px;
|
|
40
|
+
max-width: 10rem;
|
|
41
|
+
border-radius: 4px;
|
|
42
|
+
padding-right: 1rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.dropzone-upload-delete-btn {
|
|
46
|
+
width: 2rem;
|
|
47
|
+
line-height: 1.5;
|
|
48
|
+
border : 0;
|
|
49
|
+
color: #ff0000;
|
|
50
|
+
background-color: #f8f8f8;
|
|
51
|
+
padding-right:1rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.dropzone-upload-file-name-container {
|
|
55
|
+
position: relative;
|
|
56
|
+
display: inline-block;
|
|
57
|
+
max-width: 150px; /* Ajusta este valor para aumentar el ancho */
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.dropzone-upload-file-name {
|
|
61
|
+
padding-right: 1rem;
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
text-overflow: ellipsis;
|
|
65
|
+
max-width: 150px; /* Ajusta este valor para aumentar el ancho */
|
|
66
|
+
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
/* eslint-disable react/prop-types */
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React, { useEffect, useState } from 'react'
|
|
3
|
+
import { getDroppedOrSelectedFiles } from 'html5-file-selector'
|
|
2
4
|
import Dropzone from 'react-dropzone-uploader'
|
|
3
5
|
import { NotificationManager } from 'react-notifications'
|
|
4
6
|
import 'react-dropzone-uploader/dist/styles.css'
|
|
5
|
-
import
|
|
7
|
+
import IconButtonSvg from '../iconos/icon-button-svg'
|
|
8
|
+
import { pdfImage } from '../constants-svg'
|
|
9
|
+
import "./dropzone-uploader.css"
|
|
6
10
|
|
|
7
11
|
const maxSize = 7 //en MB
|
|
8
12
|
export const DropzoneUploader = ({
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { withTheme } from 'styled-components';
|
|
3
|
+
import { Icon } from './styled-icon';
|
|
4
|
+
|
|
5
|
+
const useSvgToReactEncoded = (svg) => {
|
|
6
|
+
const svgWrapperRef = React.useRef();
|
|
7
|
+
React.useEffect(() => {
|
|
8
|
+
svgWrapperRef.current.innerHTML = svg;
|
|
9
|
+
}, [svg]);
|
|
10
|
+
|
|
11
|
+
return svgWrapperRef;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const IconButtonSvg = (props) => {
|
|
15
|
+
const {
|
|
16
|
+
sublabel = '',
|
|
17
|
+
onClick = () => {
|
|
18
|
+
undefined;
|
|
19
|
+
},
|
|
20
|
+
onTouchStart = () => {
|
|
21
|
+
undefined;
|
|
22
|
+
},
|
|
23
|
+
svg,
|
|
24
|
+
svgOver,
|
|
25
|
+
height = '3rem',
|
|
26
|
+
width = '3rem',
|
|
27
|
+
title,
|
|
28
|
+
} = props || {};
|
|
29
|
+
const [svgActive, setSvgActive] = useState(svg);
|
|
30
|
+
const svgWrapperRef = useSvgToReactEncoded(svgActive);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Icon
|
|
34
|
+
title={title}
|
|
35
|
+
display={sublabel !== '' ? 'block' : 'none'}
|
|
36
|
+
onClick={onClick}
|
|
37
|
+
onTouchStart={onTouchStart}
|
|
38
|
+
onMouseOver={() => setSvgActive(svgOver || svg)}
|
|
39
|
+
onMouseOut={() => setSvgActive(svg)}
|
|
40
|
+
width={width}
|
|
41
|
+
height={height}
|
|
42
|
+
>
|
|
43
|
+
<div ref={svgWrapperRef} />
|
|
44
|
+
<label>{sublabel}</label>
|
|
45
|
+
</Icon>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
IconButtonSvg.defaultProps = { theme: {} };
|
|
49
|
+
export default withTheme(IconButtonSvg);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { styled } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line react/react-in-jsx-scope
|
|
4
|
+
const IconDiv = (props) => <div {...props} />;
|
|
5
|
+
|
|
6
|
+
export const Icon = styled(IconDiv)`
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
align-items: center;
|
|
11
|
+
svg {
|
|
12
|
+
margin: 0.1rem;
|
|
13
|
+
margin-right: 0.1rem;
|
|
14
|
+
margin-top: 0.1rem;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
color: red;
|
|
17
|
+
width: ${(props) => props.width || '3rem'};
|
|
18
|
+
height: ${(props) => props.height || props.width || '3rem'};
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
}
|
|
21
|
+
label {
|
|
22
|
+
display: ${(props) => props.display || 'none'};
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
export default Icon;
|
package/src/index.js
CHANGED
package/src/main.jsx
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { TomarFoto } from '.';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Components/TomarFoto',
|
|
7
|
+
component: TomarFoto,
|
|
8
|
+
args: {
|
|
9
|
+
onFilesSelectedSelfie:() => { },
|
|
10
|
+
isMobile:false
|
|
11
|
+
},
|
|
12
|
+
} satisfies Meta<typeof TomarFoto>;
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
|
|
17
|
+
export const TomarFotoWebApplication: Story = {
|
|
18
|
+
args: {
|
|
19
|
+
isMobile: false
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export const TomarFotoMobileApplication: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
isMobile: true,
|
|
25
|
+
onFilesSelectedSelfie: () => {
|
|
26
|
+
console.log('Dispatch an action')
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
};
|
package/src/tomar-foto/index.jsx
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es6",
|
|
4
|
+
"lib": [
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.iterable",
|
|
7
|
+
"esnext"
|
|
8
|
+
],
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
|
+
"module": "commonjs",
|
|
15
|
+
"moduleResolution": "node",
|
|
16
|
+
"noImplicitReturns": true,
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"isolatedModules": true,
|
|
19
|
+
"noEmit": true,
|
|
20
|
+
"jsx": "preserve",
|
|
21
|
+
},
|
|
22
|
+
"include": [
|
|
23
|
+
"src",
|
|
24
|
+
"index.d.ts",
|
|
25
|
+
"eslint.config.js"
|
|
26
|
+
]
|
|
26
27
|
}
|
package/.eslintrc.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": [
|
|
3
|
-
"eslint:recommended",
|
|
4
|
-
"plugin:react/all",
|
|
5
|
-
"plugin:react-hooks/recommended"
|
|
6
|
-
],
|
|
7
|
-
"plugins": [
|
|
8
|
-
"react",
|
|
9
|
-
"react-hooks"
|
|
10
|
-
],
|
|
11
|
-
"parserOptions": {
|
|
12
|
-
"ecmaVersion": 2020,
|
|
13
|
-
"sourceType": "module",
|
|
14
|
-
"ecmaFeatures": {
|
|
15
|
-
"jsx": true
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"env": {
|
|
19
|
-
"browser": true,
|
|
20
|
-
"es2020": true
|
|
21
|
-
},
|
|
22
|
-
"rules": {
|
|
23
|
-
"react/react-in-jsx-scope": "off",
|
|
24
|
-
"react/jsx-uses-react": "error",
|
|
25
|
-
"react/jsx-uses-vars": "error",
|
|
26
|
-
"react/jsx-indent-props": "off",
|
|
27
|
-
"react/jsx-indent": "off"
|
|
28
|
-
}
|
|
29
|
-
}
|
package/src/bridges/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './with-router-bridge'
|