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.
@@ -0,0 +1,17 @@
1
+ import type { StorybookConfig } from '@storybook/react-vite';
2
+
3
+ const config: StorybookConfig = {
4
+ stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
5
+ addons: [
6
+ '@storybook/addon-onboarding',
7
+ '@storybook/addon-links',
8
+ '@storybook/addon-essentials',
9
+ '@chromatic-com/storybook',
10
+ '@storybook/addon-interactions',
11
+ ],
12
+ framework: {
13
+ name: '@storybook/react-vite',
14
+ options: {},
15
+ },
16
+ };
17
+ export default config;
@@ -0,0 +1,16 @@
1
+ import type { Preview } from '@storybook/react';
2
+ import "./css/bootstrap.min.css";
3
+ import "./css/bootstrap.rtl.only.min.css";
4
+
5
+ const preview: Preview = {
6
+ parameters: {
7
+ controls: {
8
+ matchers: {
9
+ color: /(background|color)$/i,
10
+ date: /Date$/i,
11
+ },
12
+ },
13
+ },
14
+ };
15
+
16
+ export default preview;
@@ -0,0 +1,28 @@
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import reactHooks from 'eslint-plugin-react-hooks'
4
+ import reactRefresh from 'eslint-plugin-react-refresh'
5
+ import tseslint from 'typescript-eslint'
6
+
7
+ export default tseslint.config(
8
+ { ignores: ['dist'] },
9
+ {
10
+ extends: [js.configs.recommended, ...tseslint.configs.recommended],
11
+ files: ['**/*.{ts,tsx}'],
12
+ languageOptions: {
13
+ ecmaVersion: 2020,
14
+ globals: globals.browser,
15
+ },
16
+ plugins: {
17
+ 'react-hooks': reactHooks,
18
+ 'react-refresh': reactRefresh,
19
+ },
20
+ rules: {
21
+ ...reactHooks.configs.recommended.rules,
22
+ 'react-refresh/only-export-components': [
23
+ 'warn',
24
+ { allowConstantExport: true },
25
+ ],
26
+ },
27
+ },
28
+ )
package/package.json CHANGED
@@ -1,63 +1,87 @@
1
- {
2
- "name": "siam-ui-utils",
3
- "version": "2.0.7",
4
- "keywords": [
5
- "ampf-react",
6
- "ampf-utils",
7
- "siam-ui-utils"
8
- ],
9
- "type": "module",
10
- "author": "Ampf Development Team",
11
- "license": "MIT",
12
- "description": "Conjunto de librerias de componentes utiles para AMPF",
13
- "main": "src/index.js",
14
- "browser": "src/index.js",
15
- "types": "index",
16
- "homepage": "https://github.com/ampfgit/siam-ui-utils#readme",
17
- "repository": {
18
- "type": "git",
19
- "url": "https://github.com/ampfgit/siam-ui-utils"
20
- },
21
- "moduleResolution": "nodenext",
22
- "scripts": {
23
- "start": "vite",
24
- "publish-npm": "npm publish"
25
- },
26
- "dependencies": {
27
- "@types/react-intl": "^3.0.0",
28
- "html5-file-selector": "^2.1.0",
29
- "prop-types": "^15.8.1",
30
- "react": "^18.3.1",
31
- "react-dropzone-uploader": "^2.11.0",
32
- "react-intl": "^6.4.2",
33
- "react-notifications": "^1.7.4",
34
- "react-router": "^6.26.2",
35
- "react-router-dom": "^6.26.2",
36
- "react-select": "^5.8.0",
37
- "reactstrap": "^9.2.2",
38
- "siam-utils": "^1.1.4",
39
- "source-map-loader": "^5.0.0",
40
- "styled-components": "^6.1.12",
41
- "typescript": "^5.5.4"
42
- },
43
- "devDependencies": {
44
- "@testing-library/dom": "^10.4.0",
45
- "@testing-library/jest-dom": "^6.4.8",
46
- "@testing-library/react": "^16.0.0",
47
- "@types/react-router-dom": "^5.3.3",
48
- "@typescript-eslint/parser": "^8.2.0",
49
- "@vitejs/plugin-react": "^4.3.1",
50
- "copyfiles": "^2.4.1",
51
- "eslint": "^8.57.0",
52
- "eslint-config-airbnb": "^19.0.4",
53
- "eslint-config-prettier": "^8.8.0",
54
- "eslint-config-react-app": "^7.0.1",
55
- "eslint-plugin-import": "^2.27.5",
56
- "eslint-plugin-jsx-a11y": "^6.7.1",
57
- "eslint-plugin-prettier": "^4.2.1",
58
- "eslint-plugin-react": "^7.33.0",
59
- "vite": "^5.3.4",
60
- "vite-plugin-eslint": "^1.8.1",
61
- "vitest": "^2.0.5"
62
- }
63
- }
1
+ {
2
+ "name": "siam-ui-utils",
3
+ "version": "2.1.0",
4
+ "keywords": [
5
+ "ampf-react",
6
+ "ampf-utils",
7
+ "siam-ui-utils"
8
+ ],
9
+ "type": "module",
10
+ "author": "Ampf Development Team",
11
+ "license": "MIT",
12
+ "description": "Conjunto de librerias de componentes utiles para AMPF",
13
+ "main": "src/index.js",
14
+ "browser": "src/index.js",
15
+ "types": "index",
16
+ "homepage": "https://github.com/ampfgit/siam-ui-utils#readme",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/ampfgit/siam-ui-utils"
20
+ },
21
+ "moduleResolution": "nodenext",
22
+ "scripts": {
23
+ "start": "vite",
24
+ "publish-npm": "npm publish",
25
+ "storybook": "storybook dev -p 6006",
26
+ "build-storybook": "storybook build"
27
+ },
28
+ "dependencies": {
29
+ "@storybook/cli": "^8.3.2",
30
+ "@types/react-intl": "^3.0.0",
31
+ "eslint-plugin-react-hooks": "^4.6.2",
32
+ "eslint-plugin-react-refresh": "^0.4.12",
33
+ "html5-file-selector": "^2.1.0",
34
+ "init": "^0.1.2",
35
+ "prop-types": "^15.8.1",
36
+ "react": "^18.3.1",
37
+ "react-dropzone-uploader": "^2.11.0",
38
+ "react-intl": "^6.4.2",
39
+ "react-notifications": "^1.7.4",
40
+ "react-router": "^6.26.2",
41
+ "react-router-dom": "^6.26.2",
42
+ "react-select": "^5.8.0",
43
+ "reactstrap": "^9.2.2",
44
+ "siam-utils": "^1.1.4",
45
+ "source-map-loader": "^5.0.0",
46
+ "styled-components": "^6.1.12",
47
+ "typescript": "^5.5.4",
48
+ "vite-plugin-commonjs": "^0.10.3"
49
+ },
50
+ "devDependencies": {
51
+ "@chromatic-com/storybook": "^1.9.0",
52
+ "@storybook/addon-essentials": "^8.3.2",
53
+ "@storybook/addon-interactions": "^8.3.2",
54
+ "@storybook/addon-links": "^8.3.2",
55
+ "@storybook/addon-onboarding": "^8.3.2",
56
+ "@storybook/blocks": "^8.3.2",
57
+ "@storybook/react": "^8.3.2",
58
+ "@storybook/react-vite": "^8.3.2",
59
+ "@storybook/test": "^8.3.2",
60
+ "@testing-library/dom": "^10.4.0",
61
+ "@testing-library/jest-dom": "^6.4.8",
62
+ "@testing-library/react": "^16.0.0",
63
+ "@types/react-router-dom": "^5.3.3",
64
+ "@typescript-eslint/eslint-plugin": "^5.0.0",
65
+ "@typescript-eslint/parser": "^5.0.0",
66
+ "@vitejs/plugin-react": "^4.3.1",
67
+ "copyfiles": "^2.4.1",
68
+ "eslint": "^8.57.1",
69
+ "eslint-config-airbnb": "^19.0.4",
70
+ "eslint-config-prettier": "^8.8.0",
71
+ "eslint-config-react-app": "^7.0.1",
72
+ "eslint-plugin-import": "^2.27.5",
73
+ "eslint-plugin-jsx-a11y": "^6.7.1",
74
+ "eslint-plugin-prettier": "^5.0.0-alpha.1",
75
+ "eslint-plugin-react": "^7.33.0",
76
+ "eslint-plugin-storybook": "^0.8.0",
77
+ "storybook": "^8.3.2",
78
+ "vite": "^5.3.4",
79
+ "vite-plugin-eslint": "^1.8.1",
80
+ "vitest": "^2.0.5"
81
+ },
82
+ "eslintConfig": {
83
+ "extends": [
84
+ "plugin:storybook/recommended"
85
+ ]
86
+ }
87
+ }
package/src/App.jsx CHANGED
@@ -1,7 +1,32 @@
1
+ import React, { useState } from "react";
1
2
  import { TomarFoto } from './tomar-foto'
3
+ import { LABEL_BUTTONS } from "./constants";
4
+
5
+ const { TOMAR_FOTO_CELULAR, TOMAR_FOTO_WEB } = LABEL_BUTTONS
6
+
2
7
  function App() {
3
- return (
4
- <TomarFoto />
8
+ const [componentReference, setComponentReference] = useState(undefined);
9
+
10
+ const handleLinkClick = (e) => {
11
+ const { target: { innerText } } = e;
12
+ setComponentReference(innerText);
13
+ }
14
+
15
+ return (
16
+ <div className="d-flex">
17
+ <div id="menu">
18
+ <button onClick={handleLinkClick}>{TOMAR_FOTO_CELULAR}</button>
19
+ <button onClick={handleLinkClick}>{TOMAR_FOTO_WEB}</button>
20
+
21
+ </div>
22
+
23
+ <div id="content">
24
+ {componentReference === TOMAR_FOTO_CELULAR && <TomarFoto isMobile={true} />}
25
+ {componentReference===TOMAR_FOTO_WEB && <TomarFoto isMobile={false} />}
26
+ </div>
27
+ </div>
28
+
29
+
5
30
  // <AnularAyudaIcon
6
31
  // cbuPago='1234'
7
32
  // codDelegacion='AMPF'
@@ -1,3 +1,4 @@
1
+ import React from 'react'
1
2
  import { FormattedMessage, injectIntl } from 'react-intl'
2
3
  const _InjectMassage = (props) => <FormattedMessage {...props} />
3
4
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { useNavigate } from 'react-router';
3
3
 
4
- export const withRouter = (Component) => {
4
+ const withRouter = (Component) => {
5
5
  const Wrapper = (props) => {
6
6
  const history = useNavigate();
7
7
  return <Component history={history} {...props} />;