siam-ui-utils 2.0.7 → 2.1.1

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/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,34 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import { DropzoneUploader } from '.';
4
+
5
+ const args = {
6
+ onChangeFiles: () => {
7
+ console.log('Accion despues de seleccionar un archivo');
8
+ },
9
+ totalFiles: 0,
10
+ maxFiles: 3,
11
+ accept: 'image/*, application/pdf',
12
+ capture: null,
13
+ nameFileLabel: 'Subir archivos',
14
+ maxFileSize: 2,
15
+ };
16
+
17
+ const meta = {
18
+ title: 'Components/DropzoneUploader',
19
+ component: DropzoneUploader,
20
+ args: {
21
+ ...args,
22
+ },
23
+ } satisfies Meta<typeof DropzoneUploader>;
24
+
25
+ export default meta;
26
+
27
+ type Story = StoryObj<typeof meta>;
28
+
29
+ export const DropzoneUploaderBasic: Story = {
30
+ args: {
31
+ ...args,
32
+ maxFileSize: 5,
33
+ },
34
+ };
@@ -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 */import React, { useEffect, useState } from 'react'import { getDroppedOrSelectedFiles } from 'html5-file-selector'
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 { IconButtonSvg, pdfImage } from '..'
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,3 @@
1
+ import IconButtonSvg from "./icon-button-svg";
2
+ export { IconButtonSvg };
3
+ export * from "./styled-icon";
@@ -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
@@ -1,7 +1,6 @@
1
- export * from './dropzone-uploader'
2
- export * from './bridges'
3
- export * from './CustomBootstrap'
4
- export * from './CustomSelectInput'
5
- export * from './iconos'
6
- export * from './IntlMessages'
7
- export * from './tomar-foto'
1
+ export * from './dropzone-uploader';
2
+ export * from './bridges';
3
+ export * from './CustomBootstrap';
4
+ export * from './CustomSelectInput';
5
+ export * from './IntlMessages';
6
+ export * from './tomar-foto';
package/src/main.jsx CHANGED
@@ -1,5 +1,4 @@
1
1
  import React from 'react'
2
-
3
2
  import ReactDOM from 'react-dom/client'
4
3
 
5
4
  export const App = React.lazy(
@@ -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
+ };
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable react/prop-types */
2
- import { useState } from 'react'
2
+ import React, { useState } from 'react'
3
3
  import { Row } from 'reactstrap'
4
4
  import { DropzoneUploader, Colxx } from '../'
5
5
  import { TAKE_PHOTO } from '../constants'
package/tsconfig.json CHANGED
@@ -1,26 +1,27 @@
1
1
  {
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
- ]
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/vite.config.ts CHANGED
@@ -3,12 +3,8 @@ import { defineConfig } from "vitest/config";
3
3
  import eslint from 'vite-plugin-eslint';
4
4
 
5
5
  export default defineConfig({
6
- plugins: [react(), eslint()],
6
+ plugins: [react()],
7
7
  test: {
8
8
  globals: true,
9
- },
10
- server: {
11
- port: 3002,
12
- open: true,
13
- },
9
+ }
14
10
  });
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
- }
@@ -1 +0,0 @@
1
- export * from './with-router-bridge'