@visiion/forms-library 1.0.0 → 1.0.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.
Files changed (33) hide show
  1. package/dist/components/Common/NavigationButton.d.ts +2 -2
  2. package/dist/components/Common/RadioOption.d.ts +12 -0
  3. package/dist/components/Common/TextInputField.d.ts +26 -0
  4. package/dist/components/Common/index.d.ts +3 -1
  5. package/dist/components/Forms/GenericForm.d.ts +5 -2
  6. package/dist/components/Inputs/AddressInput.d.ts +20 -0
  7. package/dist/components/Inputs/Alert.d.ts +4 -4
  8. package/dist/components/Inputs/CheckboxInput.d.ts +2 -2
  9. package/dist/components/Inputs/DatePicker.d.ts +9 -0
  10. package/dist/components/Inputs/DynamicInput.d.ts +2 -2
  11. package/dist/components/Inputs/GoogleMaps.d.ts +7 -0
  12. package/dist/components/Inputs/InputWrapper.d.ts +7 -1
  13. package/dist/components/Inputs/RadioInput.d.ts +10 -0
  14. package/dist/components/Inputs/RutInput.d.ts +2 -2
  15. package/dist/components/Inputs/SelectInput.d.ts +2 -2
  16. package/dist/components/Inputs/StatusScreen.d.ts +16 -0
  17. package/dist/components/Inputs/SubtitleInput.d.ts +8 -0
  18. package/dist/components/Inputs/SwornDeclaration.d.ts +8 -0
  19. package/dist/components/Inputs/TextInput.d.ts +2 -2
  20. package/dist/components/Inputs/TextareaInput.d.ts +2 -2
  21. package/dist/components/Inputs/index.d.ts +14 -8
  22. package/dist/components/Steppers/Simple.d.ts +13 -0
  23. package/dist/components/Steppers/Stepper.d.ts +13 -0
  24. package/dist/components/Steppers/index.d.ts +1 -0
  25. package/dist/config/theme.d.ts +2 -0
  26. package/dist/contexts/MiDtContext.d.ts +21 -0
  27. package/dist/index.d.ts +12 -6
  28. package/dist/index.esm.js +34384 -328
  29. package/dist/index.esm.js.map +1 -1
  30. package/dist/index.js +34412 -325
  31. package/dist/index.js.map +1 -1
  32. package/dist/utils/Common.d.ts +18 -0
  33. package/package.json +2 -5
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import { NavigationButtonProps } from '../../types';
1
+ import React from "react";
2
+ import { NavigationButtonProps } from "../../types";
3
3
  declare const NavigationButton: React.FC<NavigationButtonProps>;
4
4
  export default NavigationButton;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ interface RadioOptionProps {
3
+ id: string;
4
+ name: string;
5
+ value: string;
6
+ checked: boolean;
7
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
8
+ label: string;
9
+ disabled?: boolean;
10
+ }
11
+ declare const RadioOption: React.FC<RadioOptionProps>;
12
+ export default RadioOption;
@@ -0,0 +1,26 @@
1
+ import React from "react";
2
+ import { TextInputProps } from "flowbite-react";
3
+ import { IconType } from "react-icons";
4
+ interface TextInputFieldProps extends TextInputProps {
5
+ id?: string;
6
+ label?: string;
7
+ type: string;
8
+ placeholder?: string;
9
+ value?: string | number;
10
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
11
+ disabled?: boolean;
12
+ required?: boolean;
13
+ name?: string;
14
+ icon?: IconType;
15
+ addon?: string;
16
+ rightIcon?: IconType;
17
+ containerClassName?: string;
18
+ className?: string;
19
+ color?: string;
20
+ helperText?: React.ReactNode;
21
+ maxLength?: number;
22
+ counterCharacters?: boolean;
23
+ inputClassName?: string;
24
+ }
25
+ declare const TextInputField: React.ForwardRefExoticComponent<TextInputFieldProps & React.RefAttributes<HTMLInputElement>>;
26
+ export default TextInputField;
@@ -1 +1,3 @@
1
- export { default as NavigationButton } from './NavigationButton';
1
+ export { default as NavigationButton } from "./NavigationButton";
2
+ export { default as TextInputField } from "./TextInputField";
3
+ export { default as RadioOption } from "./RadioOption";
@@ -1,5 +1,6 @@
1
- import React from 'react';
2
- import { IFormConfig } from '../../types';
1
+ import React from "react";
2
+ import { IFormConfig } from "../../types";
3
+ import { type CustomFlowbiteTheme } from "flowbite-react";
3
4
  interface IGenericFormProps {
4
5
  config: IFormConfig;
5
6
  stepperData?: any;
@@ -7,6 +8,8 @@ interface IGenericFormProps {
7
8
  changeActiveStep?: (step: number) => void;
8
9
  loading?: boolean;
9
10
  className?: string;
11
+ stepperDataKey?: string;
12
+ flowbiteTheme?: CustomFlowbiteTheme;
10
13
  }
11
14
  export declare const GenericForm: React.FC<IGenericFormProps>;
12
15
  export {};
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { IFormField } from "../../types";
3
+ interface AddressInputProps {
4
+ field: IFormField;
5
+ value: any;
6
+ onChange: (inputData: {
7
+ target: {
8
+ name: string;
9
+ value: any;
10
+ id?: string;
11
+ type?: string;
12
+ };
13
+ }) => void;
14
+ error?: string;
15
+ onSearch?: (value: string | any) => void;
16
+ showMap?: boolean;
17
+ mapHeight?: string;
18
+ }
19
+ declare const AddressInput: React.FC<AddressInputProps>;
20
+ export default AddressInput;
@@ -1,12 +1,12 @@
1
- import React from 'react';
2
- type AlertType = 'info' | 'warning' | 'error';
1
+ import React from "react";
2
+ type AlertType = "info" | "warning" | "error";
3
3
  interface CustomAlertProps {
4
- type?: AlertType | 'warning' | 'info' | 'error' | string;
4
+ type?: AlertType | "warning" | "info" | "error" | string;
5
5
  text: string | null;
6
6
  icon?: React.FC<any> | string;
7
7
  className?: string;
8
8
  iconClassName?: string;
9
9
  textClassName?: string;
10
10
  }
11
- declare const Alert: React.FC<CustomAlertProps>;
11
+ export declare const Alert: ({ type, text, icon, className, iconClassName, textClassName, }: CustomAlertProps) => import("react/jsx-runtime").JSX.Element;
12
12
  export default Alert;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { IFormField } from '../../types';
1
+ import React from "react";
2
+ import { IFormField } from "../../types";
3
3
  interface CheckboxInputProps {
4
4
  field: IFormField;
5
5
  value: boolean;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { IFormField } from "../../types";
3
+ interface DatePickerProps extends IFormField {
4
+ value: string;
5
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
6
+ error?: string;
7
+ }
8
+ declare const DatePicker: React.FC<DatePickerProps>;
9
+ export default DatePicker;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { IFormField } from '../../types';
1
+ import React from "react";
2
+ import { IFormField } from "../../types";
3
3
  interface DynamicInputProps {
4
4
  field: IFormField;
5
5
  value: any;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ interface GoogleMapsProps {
3
+ children: React.ReactNode;
4
+ apiKey?: string;
5
+ }
6
+ export declare const GoogleMaps: React.FC<GoogleMapsProps>;
7
+ export default GoogleMaps;
@@ -1,4 +1,10 @@
1
1
  import React from 'react';
2
- import { InputWrapperProps } from '../../types';
2
+ interface InputWrapperProps {
3
+ id: string;
4
+ label: string;
5
+ error?: string;
6
+ tooltip?: string;
7
+ children: React.ReactNode;
8
+ }
3
9
  declare const InputWrapper: React.FC<InputWrapperProps>;
4
10
  export default InputWrapper;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { IFormField } from "../../types";
3
+ interface RadioInputProps {
4
+ field: IFormField;
5
+ value: string | number;
6
+ onChange: (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
7
+ error?: string;
8
+ }
9
+ declare const RadioInput: React.FC<RadioInputProps>;
10
+ export default RadioInput;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { IFormField } from '../../types';
1
+ import React from "react";
2
+ import { IFormField } from "../../types";
3
3
  interface RutInputProps {
4
4
  field: IFormField;
5
5
  value: any;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { IFormField } from '../../types';
1
+ import React from "react";
2
+ import { IFormField } from "../../types";
3
3
  interface SelectInputProps {
4
4
  field: IFormField;
5
5
  value: string | number;
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ interface StatusScreenProps {
3
+ title?: string;
4
+ message?: string;
5
+ type?: "success" | "error" | "warning" | "info";
6
+ leftButton?: {
7
+ label: string;
8
+ onClick: () => void;
9
+ };
10
+ rightButton?: {
11
+ label: string;
12
+ onClick: () => void;
13
+ };
14
+ }
15
+ declare const StatusScreen: React.FC<StatusScreenProps>;
16
+ export default StatusScreen;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ interface SubtitleInputProps {
3
+ title?: string;
4
+ description?: string;
5
+ className?: string;
6
+ }
7
+ declare const SubtitleInput: React.FC<SubtitleInputProps>;
8
+ export default SubtitleInput;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { IFormField } from "../../types";
3
+ interface SwornDeclarationProps extends IFormField {
4
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
5
+ error?: string;
6
+ }
7
+ declare const SwornDeclaration: React.FC<SwornDeclarationProps>;
8
+ export default SwornDeclaration;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { IFormField } from '../../types';
1
+ import React from "react";
2
+ import { IFormField } from "../../types";
3
3
  interface TextInputProps {
4
4
  field: IFormField;
5
5
  value: string | number;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { IFormField } from '../../types';
1
+ import React from "react";
2
+ import { IFormField } from "../../types";
3
3
  interface TextareaInputProps {
4
4
  field?: IFormField;
5
5
  value?: string;
@@ -1,8 +1,14 @@
1
- export { default as TextInput } from './TextInput';
2
- export { default as SelectInput } from './SelectInput';
3
- export { default as CheckboxInput } from './CheckboxInput';
4
- export { default as TextareaInput } from './TextareaInput';
5
- export { default as RutInput } from './RutInput';
6
- export { default as Alert } from './Alert';
7
- export { default as DynamicInput } from './DynamicInput';
8
- export { default as InputWrapper } from './InputWrapper';
1
+ export { default as TextInput } from "./TextInput";
2
+ export { default as SelectInput } from "./SelectInput";
3
+ export { default as RadioInput } from "./RadioInput";
4
+ export { default as TextareaInput } from "./TextareaInput";
5
+ export { default as CheckboxInput } from "./CheckboxInput";
6
+ export { default as RutInput } from "./RutInput";
7
+ export { default as AddressInput } from "./AddressInput";
8
+ export { default as DynamicInput } from "./DynamicInput";
9
+ export { default as StatusScreen } from "./StatusScreen";
10
+ export { default as SwornDeclaration } from "./SwornDeclaration";
11
+ export { default as DatePicker } from "./DatePicker";
12
+ export { default as SubtitleInput } from "./SubtitleInput";
13
+ export { default as Alert } from "./Alert";
14
+ export { default as InputWrapper } from "./InputWrapper";
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ interface Step {
3
+ label: string;
4
+ value: number;
5
+ }
6
+ interface FormStepperProps {
7
+ activeStep: number;
8
+ steps: Step[];
9
+ completedSteps: number[];
10
+ changeActiveStep: (step: number) => void;
11
+ }
12
+ declare const FormStepper: React.FC<FormStepperProps>;
13
+ export default FormStepper;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ interface Step {
3
+ label: string;
4
+ value: number;
5
+ }
6
+ interface FormStepperProps {
7
+ activeStep: number;
8
+ steps: Step[];
9
+ completedSteps: number[];
10
+ changeActiveStep: (step: number) => void;
11
+ }
12
+ declare const FormStepper: React.FC<FormStepperProps>;
13
+ export default FormStepper;
@@ -0,0 +1 @@
1
+ export { default } from "./Stepper";
@@ -0,0 +1,2 @@
1
+ import { CustomFlowbiteTheme } from 'flowbite-react';
2
+ export declare const customTheme: CustomFlowbiteTheme;
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import { Region, Comuna } from "../utils/Common";
3
+ interface MiDtData {
4
+ allData: {
5
+ metadata: {
6
+ Regiones: Region[];
7
+ Comunas: Comuna[];
8
+ };
9
+ };
10
+ }
11
+ interface MiDtContextType {
12
+ miDtData: MiDtData;
13
+ }
14
+ declare const MiDtContext: React.Context<MiDtContextType>;
15
+ export declare const MiDtProvider: React.FC<{
16
+ children: React.ReactNode;
17
+ regiones?: Region[];
18
+ comunas?: Comuna[];
19
+ }>;
20
+ export declare const useMiDt: () => MiDtContextType;
21
+ export default MiDtContext;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,12 @@
1
- export { GenericForm } from './components/Forms';
2
- export { TextInput, SelectInput, CheckboxInput, TextareaInput, RutInput, Alert, DynamicInput, InputWrapper, } from './components/Inputs';
3
- export { NavigationButton } from './components/Common';
4
- export type { IFormField, IFormConfig, IStepProps, ResponseOnSearch, NavigationButtonProps, DynamicInputProps, InputWrapperProps, StepperContextType, ValidationRule, CommonValidations, } from './types';
5
- export { createValidationSchema, commonValidations, } from './utils/validationSchemas';
6
- export { clean as cleanRut, formatRut, validate as validateRut, maskRut, validateOnlyNumbersAndLetters, } from './utils/rut';
1
+ export { GenericForm } from "./components/Forms";
2
+ export { TextInput, SelectInput, RadioInput, CheckboxInput, TextareaInput, RutInput, AddressInput, Alert, DynamicInput, InputWrapper, StatusScreen, SwornDeclaration, DatePicker, SubtitleInput, } from "./components/Inputs";
3
+ export { NavigationButton, TextInputField, RadioOption, } from "./components/Common";
4
+ export { GoogleMaps } from "./components/Inputs/GoogleMaps";
5
+ export { MiDtProvider, useMiDt } from "./contexts/MiDtContext";
6
+ export { Flowbite } from "flowbite-react";
7
+ export type { CustomFlowbiteTheme } from "flowbite-react";
8
+ export type { IFormField, IFormConfig, IStepProps, ResponseOnSearch, NavigationButtonProps, DynamicInputProps, InputWrapperProps, StepperContextType, ValidationRule, CommonValidations, } from "./types";
9
+ export { createValidationSchema, commonValidations, } from "./utils/validationSchemas";
10
+ export { clean as cleanRut, formatRut, validate as validateRut, maskRut, validateOnlyNumbersAndLetters, } from "./utils/rut";
11
+ export { default as Common } from "./utils/Common";
12
+ export type { Region, Comuna } from "./utils/Common";