siam-ui-utils 1.0.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/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # [Siam UI Utils]
2
+
3
+ Compendio de librerias UI útiles para emplear en desarrollo colaborativo
4
+
5
+ ## Acerca de
6
+
7
+ Siam-UI-Utils es un compendio de componentes para el desarrollo colaborativo. Actualmente se encuentra en una fase inicial, pero se irán incorporando nuevos componentes a medida que el producto evolucione.
8
+
9
+ ## Recursos
10
+
11
+ - [Typescript](https://www.typescriptlang.org/)
12
+ - [Vite](https://vitejs.dev/)
13
+
14
+ ## Ejemplos
15
+
16
+ ```js
17
+ (TBD)
18
+ ```
19
+
20
+ ## Licencia
21
+
22
+ Siam-UI-utils cumple con los términos de [MIT license](https://opensource.org/license/mit) para libre uso y distribución.
23
+
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./CustomBootstrap"), exports);
18
+ __exportStar(require("./CustomSelectInput"), exports);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./CustomBootstrap"), exports);
18
+ __exportStar(require("./CustomSelectInput"), exports);
package/index.d.ts ADDED
@@ -0,0 +1,107 @@
1
+ declare module "siam-utils" {
2
+ //UTILS-CURRENCY
3
+ export function currencyToNumber(
4
+ currencyValue: string,
5
+ returnZero?: boolean
6
+ ): number;
7
+
8
+ export function fieldToCurrency(field: number): string;
9
+
10
+ export function fieldToNumber(field: string): number;
11
+
12
+ export function currencyToNumber(
13
+ currencyValue: string,
14
+ returnZero?: boolean
15
+ ): number;
16
+
17
+ export function currencyToPersistence(currencyValue: string): string;
18
+
19
+ //UTILS-DATES
20
+
21
+ export function fieldToDate(field: string): Date;
22
+
23
+ export function dateToPersistence(date: Date): string;
24
+
25
+ export function periodToPersistence(date: Date): string;
26
+
27
+ export function fieldToPersistence(field: string): string;
28
+
29
+ export function dateToDisplay(date: Date, format: string): string;
30
+
31
+ export function fieldToDisplay(field: string, format: string): string;
32
+
33
+ export function fieldPeriodoToDate(field: string): Date;
34
+
35
+ export function dateToDisplayPeriodo(date: Date): string;
36
+
37
+ export function dateToDisplayDiaMes(date: string): string;
38
+
39
+ export function dateToDisplayHoraMinuto(date: string): string;
40
+
41
+ export function fieldPeriodoToDisplay(field: string): string;
42
+
43
+ export function subtractDays(date: Date, days: number): Date;
44
+
45
+ export function addDays(date: Date, days: number): Date;
46
+
47
+ export function diffDateDays(firstDate: any, secondDate: any): number;
48
+
49
+ export function truncDate(date: Date): Date;
50
+
51
+ //UTILS-ERROR
52
+ export function errorMessage(error: {
53
+ message: any;
54
+ response: { data: { message: any; error: any } };
55
+ }): string;
56
+
57
+ //UTILS-NUMBER
58
+
59
+ export function numberToDisplay(
60
+ number: number,
61
+ fractionDigits: number
62
+ ): string;
63
+
64
+ export function numberToDisplayCurrency(number: number): string;
65
+
66
+ export function numberToPersistence(number: string): string | null;
67
+
68
+ export function numberToStringifyPersistence(number: number): string;
69
+
70
+ export function comprobanteToPersistence(comprobanteStr: string): string;
71
+
72
+ //UTILS-PERCENT
73
+
74
+ export function insertSimbol(
75
+ field: string,
76
+ simbol: string,
77
+ position?: string
78
+ ): string;
79
+
80
+ export function persistenceToDisplayPercent(
81
+ field: string,
82
+ position?: string
83
+ ): string;
84
+
85
+ //UTILS
86
+
87
+ export function mapOrder(array: any, order: any, key: any): any;
88
+
89
+ export function getDateWithFormat(): string;
90
+
91
+ export function getCurrentTime(): string;
92
+
93
+ export function idAyudaToKeyAyuda(idAyuda: string): any;
94
+
95
+ export const isLocalhost: boolean;
96
+
97
+ //UTILS-BOOLEAN
98
+
99
+ export function booleanToPersistence(valueBoolean: boolean): string;
100
+
101
+ export function persistenceToBoolean(valueChar: string): boolean;
102
+
103
+ //AUTH-HEADER
104
+ export function authHeader(): any;
105
+
106
+ export function getAuthUser(): any;
107
+ }
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "siam-ui-utils",
3
+ "version": "1.0.0",
4
+ "keywords": [
5
+ "ampf-react",
6
+ "ampf-utils",
7
+ "siam-ui-utils"
8
+ ],
9
+ "author": "Ampf Development Team",
10
+ "license": "MIT",
11
+ "description": "Conjunto de librerias de componentes utiles para AMPF",
12
+ "main": "dist_node/index.js",
13
+ "browser": "dist_browser/index.js",
14
+ "types": "dist_browser/index",
15
+ "homepage": "https://github.com/ampfgit/siam-ui-utils#readme",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/ampfgit/siam-ui-utils"
19
+ },
20
+ "moduleResolution": "nodenext",
21
+ "scripts": {
22
+ "build-node": "npx tsc src/index.ts --outDir dist_node",
23
+ "build-browser": "npx tsc src/index.ts --outDir dist_browser",
24
+ "build": "npm run build-node & npm run build-browser",
25
+ "test": "vitest --clearScreen",
26
+ "test-without-stopping": "vitest --clearScreen --run",
27
+ "publish-npm": "npm run test-without-stopping & npm run build & npm publish"
28
+ },
29
+ "dependencies": {
30
+ "@types/react-intl": "^3.0.0",
31
+ "react": "^18.3.1",
32
+ "react-intl": "^6.6.8",
33
+ "react-select": "^5.8.0",
34
+ "reactstrap": "^9.2.2",
35
+ "source-map-loader": "^5.0.0",
36
+ "typescript": "^5.5.4"
37
+ },
38
+ "devDependencies": {
39
+ "@testing-library/dom": "^10.4.0",
40
+ "@testing-library/jest-dom": "^6.4.8",
41
+ "@testing-library/react": "^16.0.0",
42
+ "@vitejs/plugin-react": "^4.3.1",
43
+ "typescript": "^5.2.2",
44
+ "vite": "^5.3.4",
45
+ "vitest": "^2.0.5"
46
+ }
47
+ }
@@ -0,0 +1,11 @@
1
+ import { JSX } from 'react';
2
+ import React = require('react');
3
+ import { Col, ColProps } from 'reactstrap';
4
+
5
+ const Colxx = (props: JSX.IntrinsicAttributes & JSX.IntrinsicClassAttributes<Col> & Readonly<ColProps>) => (
6
+ <Col {...props} widths={['xxs', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl']} />
7
+ );
8
+ const Separator = ({ className }: { className: string }) => (
9
+ <div className={`separator ${className}`} />
10
+ );
11
+ export { Colxx, Separator };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { components } from 'react-select';
3
+
4
+ const CustomSelectInput = (props: any) => {
5
+ const customProps = { ...props };
6
+ delete customProps.autoCorrect;
7
+ delete customProps.autoCapitalize;
8
+ return <components.Input {...customProps} />;
9
+ };
10
+
11
+ export default CustomSelectInput;
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./CustomBootstrap";
2
+ export * from "./CustomSelectInput";
package/tsconfig.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "lib": [
5
+ "dom",
6
+ "dom.iterable",
7
+ "esnext"
8
+ ],
9
+ "allowJs": false,
10
+ "esModuleInterop": true,
11
+ "skipLibCheck": true,
12
+ "strict": true,
13
+ "forceConsistentCasingInFileNames": true,
14
+ "module": "commonjs",
15
+ "moduleResolution": "node",
16
+ "resolveJsonModule": true,
17
+ "isolatedModules": true,
18
+ "noEmit": true,
19
+ "jsx": "react",
20
+ "noFallthroughCasesInSwitch": true,
21
+ },
22
+ "include": [
23
+ "src",
24
+ "index.d.ts"
25
+ ]
26
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,9 @@
1
+ import react from "@vitejs/plugin-react";
2
+ import { defineConfig } from "vitest/config";
3
+
4
+ export default defineConfig({
5
+ plugins: [react()],
6
+ test: {
7
+ globals: true,
8
+ },
9
+ });