@juantroconisf/lib 1.8.2 → 1.9.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,7 @@
1
+ {
2
+ "recommendations": [
3
+ "ms-vscode.vscode-typescript-next",
4
+ "esbenp.prettier-vscode",
5
+ "christian-kohler.path-intellisense"
6
+ ]
7
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
3
+ "editor.formatOnSave": true,
4
+ "editor.suggest.localityBonus": true,
5
+ "editor.snippetSuggestions": "inline",
6
+ "editor.suggestSelection": "first",
7
+ "typescript.disableAutomaticTypeAcquisition": false,
8
+ "emmet.includeLanguages": {
9
+ "javascript": "javascriptreact"
10
+ },
11
+ "javascript.suggest.autoImports": true,
12
+ "javascript.preferences.importModuleSpecifier": "relative",
13
+ "typescript.suggest.paths": true,
14
+ "javascript.suggest.paths": true
15
+ }
package/dist/index.d.mts CHANGED
@@ -1,4 +1,2 @@
1
- declare const sayHello: () => string;
2
- declare const greetUser: (name: string) => string;
3
1
 
4
- export { greetUser, sayHello };
2
+ export { }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,2 @@
1
- declare const sayHello: () => string;
2
- declare const greetUser: (name: string) => string;
3
1
 
4
- export { greetUser, sayHello };
2
+ export { }
package/dist/index.js CHANGED
@@ -1,12 +1,7 @@
1
- "use strict";
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
5
  var __copyProps = (to, from, except, desc) => {
11
6
  if (from && typeof from === "object" || typeof from === "function") {
12
7
  for (let key of __getOwnPropNames(from))
@@ -19,17 +14,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
14
 
20
15
  // src/index.ts
21
16
  var src_exports = {};
22
- __export(src_exports, {
23
- greetUser: () => greetUser,
24
- sayHello: () => sayHello
25
- });
26
17
  module.exports = __toCommonJS(src_exports);
27
18
 
28
- // src/functions.ts
29
- var sayHello = () => "Hello world!";
30
- var greetUser = (name) => `Hello ${name}!`;
31
- // Annotate the CommonJS export names for ESM import in node:
32
- 0 && (module.exports = {
33
- greetUser,
34
- sayHello
35
- });
19
+ // src/hooks/useFormChange.tsx
20
+ var import_react = require("react");
package/dist/index.mjs CHANGED
@@ -1,7 +1,2 @@
1
- // src/functions.ts
2
- var sayHello = () => "Hello world!";
3
- var greetUser = (name) => `Hello ${name}!`;
4
- export {
5
- greetUser,
6
- sayHello
7
- };
1
+ // src/hooks/useFormChange.tsx
2
+ import { useState } from "react";
package/lang/en.json ADDED
@@ -0,0 +1 @@
1
+ {"BIRTH_DATE":"Birth date","DAY":"Day","DAY_PLACEHOLDER":"Choose a day","MONTH":"Month","MONTH_PLACEHOLDER":"Choose a month","YEAR":"Year","YEAR_PLACEHOLDER":"Choose a year","PRICING":"Pricing","PRICING_TABLE":"Pricing table","OUR_PRICING_PLAN":"Our pricing plan","PRICING_DESCRIPTION":"Level up your experience. Discover the plan that unlocks the features you need.","VALUE_STORAGE":"{{value}} storage","GOOGLE_CALENDAR_SYNC":"Google Calendar Sync","INTERNAL_REMINDERS":"Internal reminders","WHATSAPP_AUTOMATED_REMINDERS":"WhatsApp Automated Reminders","PROFESSIONAL":"Professional","PROFESSIONAL_PLAN_DESCRIPTION":"For single doctors looking to level up their practice","DIGITAL_PRESCRIPTIONS":"Digital prescriptions","DICOM_VIEWER":"DICOM Viewer","VERIFIED_MEDICAL_CREDENTIALS":"Verified medical credentials","PATIENT_SELF_MANAGEMENT":"Patient self management","BUY_NOW":"Buy now","ORGANIZATION":"Organization","ORGANIZATION_PLAN_DESCRIPTION":"For organizations with multiple users looking to share information","UP_TO_VALUE_STORAGE":"Up to {{value}} storage","CONFIGURABLE_USER_PERMISSIONS":"Configurable user permissions","CALCULATE_PRICING":"Calculate pricing","DOCTORS":"Doctors","ASSISTANTS":"Assistants","BASIC":"Basic","BASIC_PLAN_DESCRIPTION":"For starters in the medical industry","USER":"User","TYPE_A_VALUE":"Type a value","STORAGE":"Storage","PASSWORD":"Password","PASSWORD_PLACEHOLDER":"Enter your password","REQUIRED":"Required","TOO_SHORT":"Too short","TOO_LONG":"Too long","VALUE_LOW":"Value is too low","VALUE_HIGH":"Value is too high","PATTERN_INVALID":"Pattern is not valid","INVALID_EMAIL":"Invalid email","SHOW_PASSWORD":"Show password","HIDE_PASSWORD":"Hide password","GROUP_PRICING_CALCULATOR":"Group Pricing Calculator","VERIFIED_ACCOUNT":"Verified account","VERIFIED_ACCOUNT_TEXT":"This account has been verified by Clinikos, as well as its affiliations with the following institutions","PHONE_NUMBER":"Phone number","PHONE_NUMBER_PLACEHOLDER":"Enter your phone number","SEND_MESSAGE":"Send message","BOOK_MEETING":"Book meeting","SIGN_UP":"Sign up","INVALID_PASSWORD":"Your password doesn't meet the security criteria.","NOT_EQUAL":"Values are not equal","GENDER":"Gender","FEMALE":"Female","MALE":"Male","CLOSE":"Close","MANDATORY_FIELDS_WARNING":"","INVALID_FIELDS_WARNING":"","COUNTRY":"Country","COUNTRY_PLACEHOLDER":"Select a country","STATE":"State","STATE_PLACEHOLDER":"Select a state","CITY":"City","CITY_PLACEHOLDER":"Select a city","TIMEZONE":"Timezone","TIMEZONE_PLACEHOLDER":"Selecte a timezone","NAME":"Name","OK":"Ok","PAGE_NOT_FOUND":"Page not found","PAGE_NOT_FOUND_DESCRIPTION":"The link you clicked may be broken or the page may have been removed or renamed","TODAY":"Today","WEEK":"Week","CALENDAR":"Calendar","EVENT":"Event","NO_INFORMATION":"No information","SYNC_GOOGLE_CALENDAR":"Sync Google Calendar","NO_RESULTS":"No results were found","GOOGLE_MEET":"Google Meet","LONG_TIME_AGO":"Long time ago","TOMORROW":"Tomorrow","CHOOSE_PLAN":"Choose a plan","CHOOSE_PLAN_DESCRIPTION":"Choose a plan that fits your needs!","PRIVACY_POLICY":"","OPTIONAL":"Optional","RESULTS":"Results","LOCATION":"Location","ADDRESS":"Address","ADDRESS_PLACEHOLDER":"Enter your address","COPY_TO_CLIPBOARD":"Copy to clipboard","ACTIONS":"Actions","MIN":"Minimum","MAX":"Maximum","DUE_DATE":"Due date","QUICK_SEARCH":"Quick search","MONTHLY":"Monthly","WEEKLY":"Weekly","GOOGLE_MAPS_LINK":"Google maps link","MINUTE":"Minute","MINUTES":"Minutes","HOUR":"Hour","HOURS":"Hours","VE_ID":"Identity card","ACCOUNT_VERIFIED_BY_CLINIKOS":"This account has been verified by Clinikos, as well as its affiliations with the following institutions","INBOX":"Inbox","ACCEPTED":"Accepted","DECLINED":"Declined","NEEDS_ACTION":"Needs action","OVERDUE":"Overdue","FILTER_BY":"Filter by","REFRESH":"Refresh","LOADING":"Loading","MINUTE_LEFT":"One minute left","VALUE_MINUTES_LEFT":"{{value}} minutes left","PLAY":"Play","PAUSE":"Pause","STOP":"Stop","LOAD_MORE":"Load more","BILLING":"Billing","DOCTOR":"Doctor","ASSISTANT":"Assistant","NUMBER_OF_DOCTORS":"Number of Doctors","NUMBER_OF_ASSISTANTS":"Number of Assistants","EACH_DOCTOR":"Each doctor","EACH_ASSISTANT":"Each assistant","ROLE":"Role","PAYMENT_METHODS":"Payment methods","UPGRADE":"Upgrade","TOTAL":"Total","BUY":"Buy","TYPE":"Type","RECURRENT":"Recurrent","ACCEPT":"Accept","DECLINE":"Decline","PREFERENCES":"Preferences","BOOKING":"Booking","PATTERN_NOT_VALID":"Pattern is not valid"}
package/lang/es.json ADDED
@@ -0,0 +1 @@
1
+ {"BIRTH_DATE":"Fecha de nacimiento","DAY":"Día","DAY_PLACEHOLDER":"Elige un día","MONTH":"Mes","MONTH_PLACEHOLDER":"Elige un mes","YEAR":"Año","YEAR_PLACEHOLDER":"Elige un año","PRICING":"Precio","PRICING_TABLE":"Tabla de precios","OUR_PRICING_PLAN":"Nuestros precios","PRICING_DESCRIPTION":"Mejora tu experiencia. Descubre el plan que desbloquea las funciones que necesitas.","VALUE_STORAGE":"{{value}} almacenamiento","GOOGLE_CALENDAR_SYNC":"Google Calenar Sync","INTERNAL_REMINDERS":"Recordatorios internos","WHATSAPP_AUTOMATED_REMINDERS":"Recordatorios automatizados de WhatsApp","PROFESSIONAL":"Profesional","PROFESSIONAL_PLAN_DESCRIPTION":"Para doctores individuales que buscan elevar sus prácticas","DIGITAL_PRESCRIPTIONS":"Recipes digitales","DICOM_VIEWER":"Visualizador DICOM","VERIFIED_MEDICAL_CREDENTIALS":"Credenciales médicas verificadas","PATIENT_SELF_MANAGEMENT":"Auto gestión para pacientes","BUY_NOW":"Comprar ahora","ORGANIZATION":"Organización","ORGANIZATION_PLAN_DESCRIPTION":"Para organizaciones con múltiples usuarios que buscan compartir información","UP_TO_VALUE_STORAGE":"Hasta {{value}} de almacenamiento","CONFIGURABLE_USER_PERMISSIONS":"Permisología configurable para usuarios","CALCULATE_PRICING":"Calcular precio","DOCTORS":"Doctores","ASSISTANTS":"Asistentes","BASIC":"Básico","BASIC_PLAN_DESCRIPTION":"Para iniciar en la industria médica","USER":"Usuario","TYPE_A_VALUE":"Ingresa un valor","STORAGE":"Almacenamiento","PASSWORD":"Contraseña","PASSWORD_PLACEHOLDER":"Ingresa tu contraseña","REQUIRED":"Requerido","TOO_SHORT":"Demasiado corto","TOO_LONG":"Demasiado largo","VALUE_LOW":"El valor es muy bajo","VALUE_HIGH":"El valor es muy alto","PATTERN_INVALID":"El patrón no es válido","INVALID_EMAIL":"Correo inválido","SHOW_PASSWORD":"Mostrar contraseña","HIDE_PASSWORD":"Esconder contraseña","GROUP_PRICING_CALCULATOR":"Calculadora de precios grupal","VERIFIED_ACCOUNT":"Cuenta verificada","VERIFIED_ACCOUNT_TEXT":"Esta cuenta ha sido verificada por Clinikos, así como sus afiliaciones con las siguientes instituciones","PHONE_NUMBER":"Número de teléfono","PHONE_NUMBER_PLACEHOLDER":"Ingrese su número de teléfono","SEND_MESSAGE":"Enviar mensaje","BOOK_MEETING":"Agendar cita","SIGN_UP":"Regístrate","INVALID_PASSWORD":"Tu contraseña no cumple con los requisitos de seguridad.","NOT_EQUAL":"Los valores no son iguales","GENDER":"Género","FEMALE":"Femenino","MALE":"Masculino","CLOSE":"Cerrar","MANDATORY_FIELDS_WARNING":"","INVALID_FIELDS_WARNING":"","COUNTRY":"País","COUNTRY_PLACEHOLDER":"Selecciona un país","STATE":"Estado","STATE_PLACEHOLDER":"Selecciona un estado","CITY":"Ciudad","CITY_PLACEHOLDER":"Selecciona una ciudad","TIMEZONE":"Zona horaria","TIMEZONE_PLACEHOLDER":"Selecciona una zora horaria","NAME":"Nombre","OK":"Ok","PAGE_NOT_FOUND":"Página no encontrada","PAGE_NOT_FOUND_DESCRIPTION":"El enlace en el que hiciste click puede que esté roto o la página puede haber sido eliminada o renombrada","TODAY":"Hoy","WEEK":"Semana","CALENDAR":"Calendario","EVENT":"Evento","NO_INFORMATION":"Sin información","SYNC_GOOGLE_CALENDAR":"Vincular Calendario de Google","NO_RESULTS":"No se encontraron resultados","GOOGLE_MEET":"Google Meet","LONG_TIME_AGO":"Hace mucho tiempo","TOMORROW":"Mañana","CHOOSE_PLAN":"Elige un plan","CHOOSE_PLAN_DESCRIPTION":"¡Elige el plan que se ajuste a tus necesidades!","PRIVACY_POLICY":"","OPTIONAL":"Opcional","RESULTS":"Resultados","LOCATION":"Ubicación","ADDRESS":"Dirección","ADDRESS_PLACEHOLDER":"Ingresa tu dirección","COPY_TO_CLIPBOARD":"Copiar al portapapeles","ACTIONS":"Acciones","MIN":"Mínimo","MAX":"Máximo","DUE_DATE":"Fecha límite","QUICK_SEARCH":"Búsqueda rápida","MONTHLY":"Mensual","WEEKLY":"Semanal","GOOGLE_MAPS_LINK":"Link de Google Maps","MINUTE":"Minuto","MINUTES":"Minutos","HOUR":"Hora","HOURS":"Horas","VE_ID":"Cédula de Identidad","ACCOUNT_VERIFIED_BY_CLINIKOS":"Esta cuenta ha sido verificada por Clinikos, así como sus afiliaciones con las siguientes instituciones","INBOX":"Bandeja de entrada","ACCEPTED":"Aceptado","DECLINED":"Declinado","NEEDS_ACTION":"Necesita acción","OVERDUE":"Atrasado","FILTER_BY":"Filtrar por","REFRESH":"Refrescar","LOADING":"Cargando","MINUTE_LEFT":"Un minuto restante","VALUE_MINUTES_LEFT":"{{value}} minutos restantes","PLAY":"Reproducir","PAUSE":"Pausar","STOP":"Detener","LOAD_MORE":"Cargar más","BILLING":"Facturación","DOCTOR":"Doctor","ASSISTANT":"Asistente","NUMBER_OF_DOCTORS":"Número de Doctores","NUMBER_OF_ASSISTANTS":"Número de Asistentes","EACH_DOCTOR":"Cada doctor","EACH_ASSISTANT":"Cada asistente","ROLE":"Rol","PAYMENT_METHODS":"Métodos de pago","UPGRADE":"Mejorar","TOTAL":"Total","BUY":"Comprar","TYPE":"Tipo","RECURRENT":"Recurrente","ACCEPT":"Aceptar","DECLINE":"Declinar","PREFERENCES":"Preferencias","BOOKING":"Agendar cita","PATTERN_NOT_VALID":"El patrón no es válido"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juantroconisf/lib",
3
- "version": "1.8.2",
3
+ "version": "1.9.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -17,7 +17,12 @@
17
17
  "typings": "dist/index.d.ts",
18
18
  "homepage": "https://github.com/juandiegotroconis/lib#readme",
19
19
  "devDependencies": {
20
+ "@types/node": "^22.1.0",
21
+ "@types/react": "^18.3.3",
20
22
  "tsup": "^8.2.4",
21
23
  "typescript": "^5.5.4"
24
+ },
25
+ "dependencies": {
26
+ "react": "^18.3.1"
22
27
  }
23
28
  }
@@ -0,0 +1,91 @@
1
+ type ValidatorFunction<T, U> = (val: T, ...args: U[]) => boolean;
2
+
3
+ interface Validator<T, U = any> {
4
+ validate: ValidatorFunction<T, U>;
5
+ msg: string;
6
+ }
7
+
8
+ interface ValidatorTypes {
9
+ required: Validator<string | number, boolean>;
10
+ min: Validator<number, number>;
11
+ max: Validator<number, number>;
12
+ minLength: Validator<string, number>;
13
+ maxLength: Validator<string, number>;
14
+ pattern: Validator<string, RegExp>;
15
+ equal: Validator<string, string>;
16
+ numberIsEqual: Validator<number, number>;
17
+ email: Validator<string, boolean>;
18
+ password: Validator<string, boolean>;
19
+ }
20
+
21
+ export type ValidatorParams = {
22
+ [K in keyof ValidatorTypes]: ValidatorTypes[K] extends Validator<any, infer U>
23
+ ? U
24
+ : never;
25
+ };
26
+ export type ValidatorErrorMessage = {
27
+ [K in keyof ValidatorTypes]: string;
28
+ };
29
+
30
+ const regex = {
31
+ email:
32
+ /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
33
+ password:
34
+ /^(?!.*\s)(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~`!@#$%^&*()--+={}[\]|:;"'<>,.?/_₹]).{8,24}$/,
35
+ };
36
+
37
+ export const errors: ValidatorTypes = {
38
+ required: {
39
+ validate: (val) => Boolean(val),
40
+ msg: "REQUIRED",
41
+ },
42
+ min: {
43
+ validate: (val, min) => val >= min,
44
+ msg: "VALUE_LOW",
45
+ },
46
+ max: {
47
+ validate: (val, max) => val <= max,
48
+ msg: "VALUE_HIGH",
49
+ },
50
+ minLength: {
51
+ validate: (val = "", min) => val.length >= min,
52
+ msg: "TOO_SHORT",
53
+ },
54
+ maxLength: {
55
+ validate: (val = "", max) => val.length <= max,
56
+ msg: "TOO_LONG",
57
+ },
58
+ pattern: {
59
+ validate: (val, pattern) => new RegExp(pattern).test(val),
60
+ msg: "PATTERN_INVALID",
61
+ },
62
+ equal: {
63
+ validate: (val, comparison) => val === comparison,
64
+ msg: "NOT_EQUAL",
65
+ },
66
+ numberIsEqual: {
67
+ validate: (val, comparison) => val === comparison,
68
+ msg: "NOT_EQUAL",
69
+ },
70
+ email: {
71
+ validate: (val) => new RegExp(regex.email).test(val),
72
+ msg: "INVALID_EMAIL",
73
+ },
74
+ password: {
75
+ validate: (val) => new RegExp(regex.password).test(val),
76
+ msg: "INVALID_PASSWORD",
77
+ },
78
+ };
79
+
80
+ class NextUIError {
81
+ isInvalid: boolean;
82
+ errorMessage: string;
83
+
84
+ constructor(bool: boolean = false, msg: string = "") {
85
+ this.isInvalid = bool;
86
+ this.errorMessage = bool ? msg : "";
87
+ }
88
+ }
89
+
90
+ export const nxError = (bool?: boolean, msg?: string) =>
91
+ new NextUIError(bool, msg);
package/types/types.ts CHANGED
@@ -0,0 +1,9 @@
1
+ import en from "../lang/en.json";
2
+ import es from "../lang/es.json";
3
+
4
+ export const langMap = {
5
+ en,
6
+ es,
7
+ };
8
+
9
+ export * from "./errors";