@apia/validations 2.0.11 → 3.0.2
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/dist/index.d.ts +785 -25
- package/dist/index.js +131 -82
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/rollup.validations.mjs +3 -3
- package/dist/collector/Collector.d.ts +0 -39
- package/dist/collector/Collector.d.ts.map +0 -1
- package/dist/collector/CollectorField.d.ts +0 -40
- package/dist/collector/CollectorField.d.ts.map +0 -1
- package/dist/collector/ValidatedCollectorField.d.ts +0 -44
- package/dist/collector/ValidatedCollectorField.d.ts.map +0 -1
- package/dist/collector/fields/Button.d.ts +0 -13
- package/dist/collector/fields/Button.d.ts.map +0 -1
- package/dist/collector/fields/Checkbox.d.ts +0 -13
- package/dist/collector/fields/Checkbox.d.ts.map +0 -1
- package/dist/collector/fields/Input.d.ts +0 -11
- package/dist/collector/fields/Input.d.ts.map +0 -1
- package/dist/collector/fields/Label.d.ts +0 -13
- package/dist/collector/fields/Label.d.ts.map +0 -1
- package/dist/collector/fields/Select.d.ts +0 -26
- package/dist/collector/fields/Select.d.ts.map +0 -1
- package/dist/collector/fields/Textarea.d.ts +0 -11
- package/dist/collector/fields/Textarea.d.ts.map +0 -1
- package/dist/components/Captcha.d.ts +0 -13
- package/dist/components/Captcha.d.ts.map +0 -1
- package/dist/components/Checkbox.d.ts +0 -12
- package/dist/components/Checkbox.d.ts.map +0 -1
- package/dist/components/DeletableInput.d.ts +0 -9
- package/dist/components/DeletableInput.d.ts.map +0 -1
- package/dist/components/FieldWrapper.d.ts +0 -20
- package/dist/components/FieldWrapper.d.ts.map +0 -1
- package/dist/components/FileInput.d.ts +0 -11
- package/dist/components/FileInput.d.ts.map +0 -1
- package/dist/components/Input.d.ts +0 -9
- package/dist/components/Input.d.ts.map +0 -1
- package/dist/components/NumberInput.d.ts +0 -14
- package/dist/components/NumberInput.d.ts.map +0 -1
- package/dist/components/Radio.d.ts +0 -14
- package/dist/components/Radio.d.ts.map +0 -1
- package/dist/components/Select.d.ts +0 -17
- package/dist/components/Select.d.ts.map +0 -1
- package/dist/components/Switchbox.d.ts +0 -11
- package/dist/components/Switchbox.d.ts.map +0 -1
- package/dist/components/Textarea.d.ts +0 -9
- package/dist/components/Textarea.d.ts.map +0 -1
- package/dist/components/ValidationError.d.ts +0 -17
- package/dist/components/ValidationError.d.ts.map +0 -1
- package/dist/components/types.d.ts +0 -11
- package/dist/components/types.d.ts.map +0 -1
- package/dist/form/Form.d.ts +0 -89
- package/dist/form/Form.d.ts.map +0 -1
- package/dist/form/FormContext.d.ts +0 -27
- package/dist/form/FormContext.d.ts.map +0 -1
- package/dist/hooks/useField.d.ts +0 -76
- package/dist/hooks/useField.d.ts.map +0 -1
- package/dist/hooks/useFieldStatesClassNames.d.ts +0 -4
- package/dist/hooks/useFieldStatesClassNames.d.ts.map +0 -1
- package/dist/hooks/useFieldValue.d.ts +0 -8
- package/dist/hooks/useFieldValue.d.ts.map +0 -1
- package/dist/hooks/useValidationClass.d.ts +0 -49
- package/dist/hooks/useValidationClass.d.ts.map +0 -1
- package/dist/lang/es.d.ts +0 -32
- package/dist/lang/es.d.ts.map +0 -1
- package/dist/types.d.ts +0 -152
- package/dist/types.d.ts.map +0 -1
- package/dist/util.d.ts +0 -36
- package/dist/util.d.ts.map +0 -1
- package/dist/validationStore.d.ts +0 -105
- package/dist/validationStore.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apia/validations",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"./dist/lang/*.ts"
|
|
6
6
|
],
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"libWatch": "rollup --watch --config ./rollup.validations.mjs --environment MODE:development,ENTRY:index.ts,WATCH:true"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@apia/components": "^
|
|
19
|
-
"@apia/notifications": "^
|
|
20
|
-
"@apia/theme": "^
|
|
21
|
-
"@apia/util": "^
|
|
18
|
+
"@apia/components": "^3.0.2",
|
|
19
|
+
"@apia/notifications": "^3.0.2",
|
|
20
|
+
"@apia/theme": "^3.0.2",
|
|
21
|
+
"@apia/util": "^3.0.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/react": "^18.2.43",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"access": "public",
|
|
35
35
|
"registry": "https://registry.npmjs.org/"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "1be67c2956d7c0964b4e8a18173af7cde3fc534e"
|
|
38
38
|
}
|
package/rollup.validations.mjs
CHANGED
|
@@ -34,12 +34,12 @@ export default [{
|
|
|
34
34
|
dir: 'dist',
|
|
35
35
|
format: 'es',
|
|
36
36
|
sourcemap: buildSourcemaps,
|
|
37
|
-
preserveModules:
|
|
38
|
-
preserveModulesRoot: 'src',
|
|
37
|
+
preserveModules: false,
|
|
38
|
+
//preserveModulesRoot: 'src',
|
|
39
39
|
}],
|
|
40
40
|
plugins: [
|
|
41
41
|
dts(),
|
|
42
|
-
cleaner({
|
|
42
|
+
!shouldWatch && cleaner({
|
|
43
43
|
targets: ['./dist']
|
|
44
44
|
})
|
|
45
45
|
].filter(Boolean),
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ApiaUtilModalHandler, TOpenModal } from '@apia/components';
|
|
2
|
-
import { CollectorField } from './CollectorField.js';
|
|
3
|
-
import { CollectorCheckbox } from './fields/Checkbox.js';
|
|
4
|
-
import { CollectorInput } from './fields/Input.js';
|
|
5
|
-
import { CollectorSelect } from './fields/Select.js';
|
|
6
|
-
import { CollectorTextarea } from './fields/Textarea.js';
|
|
7
|
-
import { CollectorLabel } from './fields/Label.js';
|
|
8
|
-
import { CollectorButton } from './fields/Button.js';
|
|
9
|
-
|
|
10
|
-
declare class Collector {
|
|
11
|
-
#private;
|
|
12
|
-
fields: {
|
|
13
|
-
button: typeof CollectorButton;
|
|
14
|
-
checkbox: typeof CollectorCheckbox;
|
|
15
|
-
input: typeof CollectorInput;
|
|
16
|
-
/**
|
|
17
|
-
* Muestra una etiqueta con tag personalizable: h1...h6, p, label. (Por
|
|
18
|
-
* defecto: label)
|
|
19
|
-
*/
|
|
20
|
-
label: typeof CollectorLabel;
|
|
21
|
-
select: typeof CollectorSelect;
|
|
22
|
-
textarea: typeof CollectorTextarea;
|
|
23
|
-
};
|
|
24
|
-
private private__id;
|
|
25
|
-
get id(): string;
|
|
26
|
-
modal: ApiaUtilModalHandler | null;
|
|
27
|
-
add: (...fields: CollectorField[]) => this;
|
|
28
|
-
forEach: (cb: (field: CollectorField, i: number) => void) => void;
|
|
29
|
-
show: <FormValues extends Record<string, unknown>>(modalProps?: (Partial<Omit<TOpenModal, "children" | "onConfirm" | "onCancel" | "confirmProps">> & Partial<{
|
|
30
|
-
hideConfirm: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Si este método devuelve false, el modal no se cerrará
|
|
33
|
-
*/
|
|
34
|
-
onConfirm?: ((res: FormValues | null) => boolean) | undefined;
|
|
35
|
-
}>) | undefined) => Promise<FormValues | null>;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { Collector };
|
|
39
|
-
//# sourceMappingURL=Collector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Collector.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ReactNode, FC } from 'react';
|
|
3
|
-
import { EventEmitter } from '@apia/util';
|
|
4
|
-
import { TFocusRetriever, TValidationFunction, TValidationRules } from '../types.js';
|
|
5
|
-
import '../components/FieldWrapper.js';
|
|
6
|
-
import '../components/NumberInput.js';
|
|
7
|
-
import { TOption } from '../components/Select.js';
|
|
8
|
-
import { Collector } from './Collector.js';
|
|
9
|
-
|
|
10
|
-
declare abstract class CollectorField<ValueType = any, FieldProps = any> extends EventEmitter<{
|
|
11
|
-
focusFunctionUpdate: TFocusRetriever;
|
|
12
|
-
functionUpdate: TValidationFunction<ValueType>;
|
|
13
|
-
optionsUpdate: TOption[];
|
|
14
|
-
propsUpdate: Partial<FieldProps>;
|
|
15
|
-
rulesUpdate: TValidationRules;
|
|
16
|
-
}> {
|
|
17
|
-
#private;
|
|
18
|
-
readonly name: string;
|
|
19
|
-
protected label: ReactNode;
|
|
20
|
-
/**
|
|
21
|
-
* Este es el componente de implementación de cada campo particular
|
|
22
|
-
*/
|
|
23
|
-
abstract Component: FC;
|
|
24
|
-
abstract type: string;
|
|
25
|
-
constructor(name: string, label: ReactNode, properties?: Partial<FieldProps>);
|
|
26
|
-
collector: Collector;
|
|
27
|
-
isHidden: () => boolean;
|
|
28
|
-
setIsHidden: (isHidden: boolean) => void;
|
|
29
|
-
protected properties: Partial<FieldProps>;
|
|
30
|
-
setProperties: (newProps: Partial<FieldProps>) => void;
|
|
31
|
-
protected useProperties: () => Partial<FieldProps>;
|
|
32
|
-
/**
|
|
33
|
-
* Este componente se utiliza para controlar propiedades comunes a todos los
|
|
34
|
-
* campos.
|
|
35
|
-
*/
|
|
36
|
-
SuperComponent: () => React.JSX.Element | null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { CollectorField };
|
|
40
|
-
//# sourceMappingURL=CollectorField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CollectorField.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { CollectorField } from './CollectorField.js';
|
|
2
|
-
import { TValidationFunction, TValidationRules } from '../types.js';
|
|
3
|
-
|
|
4
|
-
declare abstract class ValidatedCollectorField<ValueType = any, FieldProps = any> extends CollectorField<ValueType, FieldProps> {
|
|
5
|
-
#private;
|
|
6
|
-
protected _name: string;
|
|
7
|
-
protected label: string;
|
|
8
|
-
protected initialValue: ValueType;
|
|
9
|
-
constructor(_name: string, label: string, config?: Partial<{
|
|
10
|
-
initialValue: ValueType;
|
|
11
|
-
properties: Partial<FieldProps>;
|
|
12
|
-
validationFunction: TValidationFunction<ValueType>;
|
|
13
|
-
validationRules: TValidationRules;
|
|
14
|
-
}>);
|
|
15
|
-
setInitialValue: (newValue: ValueType) => void;
|
|
16
|
-
setValidationFunction: (newFunction: TValidationFunction<ValueType>) => void;
|
|
17
|
-
setValidationRules: (newRules: TValidationRules) => void;
|
|
18
|
-
setValue: (newValue: ValueType) => void;
|
|
19
|
-
protected useValidationFunction: () => TValidationFunction<ValueType>;
|
|
20
|
-
protected useValidationRules: () => Partial<Omit<Record<"number" | "required" | "alpha" | "alphanum" | "nodigit" | "digit" | "digitmin" | "digitltd" | "email" | "image" | "phone" | "url" | "confirm" | "differs" | "length_str" | "length_fix" | "lengthmax" | "lengthmin" | "words_min" | "words_max" | "words_range" | "checkbox" | "checkboxes_group" | "radios" | "select" | "select_multiple" | "errorsTitle", boolean>, "digitmin" | "digitltd" | "confirm" | "differs" | "length_str" | "length_fix" | "words_min" | "words_max" | "words_range" | "checkboxes_group"> & {
|
|
21
|
-
digitmin: number;
|
|
22
|
-
digitltd: [number, number];
|
|
23
|
-
confirm: string;
|
|
24
|
-
differs: string;
|
|
25
|
-
length_str: [number, number];
|
|
26
|
-
length_fix: number;
|
|
27
|
-
words_min: number;
|
|
28
|
-
words_max: number;
|
|
29
|
-
words_range: [number, number];
|
|
30
|
-
checkboxes_group: number;
|
|
31
|
-
} & {
|
|
32
|
-
patternMessage: string;
|
|
33
|
-
pattern: string | RegExp;
|
|
34
|
-
digitmax: number;
|
|
35
|
-
validName?: string | undefined;
|
|
36
|
-
maxLength: number;
|
|
37
|
-
minLength: number;
|
|
38
|
-
min: number;
|
|
39
|
-
max: number;
|
|
40
|
-
}> | undefined;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export { ValidatedCollectorField };
|
|
44
|
-
//# sourceMappingURL=ValidatedCollectorField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ValidatedCollectorField.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { CollectorField } from '../CollectorField.js';
|
|
3
|
-
import { ButtonProps } from '@apia/theme';
|
|
4
|
-
|
|
5
|
-
declare class CollectorButton extends CollectorField<null, Omit<ButtonProps, 'children'>> {
|
|
6
|
-
protected label: string;
|
|
7
|
-
type: string;
|
|
8
|
-
constructor(label: string, properties?: Omit<ButtonProps, 'children'>);
|
|
9
|
-
Component: () => React.JSX.Element;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { CollectorButton };
|
|
13
|
-
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import '../../components/FieldWrapper.js';
|
|
3
|
-
import { TCheckboxProps } from '../../components/Checkbox.js';
|
|
4
|
-
import '../../components/NumberInput.js';
|
|
5
|
-
import { ValidatedCollectorField } from '../ValidatedCollectorField.js';
|
|
6
|
-
|
|
7
|
-
declare class CollectorCheckbox extends ValidatedCollectorField<string | boolean, Omit<TCheckboxProps, 'name'>> {
|
|
8
|
-
type: string;
|
|
9
|
-
Component: () => React.JSX.Element;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { CollectorCheckbox };
|
|
13
|
-
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { InputProps } from '@apia/theme';
|
|
3
|
-
import { ValidatedCollectorField } from '../ValidatedCollectorField.js';
|
|
4
|
-
|
|
5
|
-
declare class CollectorInput extends ValidatedCollectorField<string, Omit<InputProps, 'name'>> {
|
|
6
|
-
type: string;
|
|
7
|
-
Component: () => React.JSX.Element;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { CollectorInput };
|
|
11
|
-
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { CollectorField } from '../CollectorField.js';
|
|
3
|
-
|
|
4
|
-
declare class CollectorLabel extends CollectorField {
|
|
5
|
-
private kind;
|
|
6
|
-
private static maxId;
|
|
7
|
-
type: string;
|
|
8
|
-
constructor(label: string, kind?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'label');
|
|
9
|
-
Component: () => React.JSX.Element;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { CollectorLabel };
|
|
13
|
-
//# sourceMappingURL=Label.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Label.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { TValidationFunction, TValidationRules } from '../../types.js';
|
|
3
|
-
import '../../components/FieldWrapper.js';
|
|
4
|
-
import '../../components/NumberInput.js';
|
|
5
|
-
import { TSelectProps, TOption } from '../../components/Select.js';
|
|
6
|
-
import { ValidatedCollectorField } from '../ValidatedCollectorField.js';
|
|
7
|
-
|
|
8
|
-
declare class CollectorSelect extends ValidatedCollectorField<string, Omit<TSelectProps, 'name'>> {
|
|
9
|
-
#private;
|
|
10
|
-
protected _name: string;
|
|
11
|
-
protected label: string;
|
|
12
|
-
type: string;
|
|
13
|
-
constructor(_name: string, label: string, config?: Partial<{
|
|
14
|
-
initialValue: string;
|
|
15
|
-
options: TOption[];
|
|
16
|
-
properties: Partial<Omit<TSelectProps, 'name'>>;
|
|
17
|
-
validationFunction: TValidationFunction<string>;
|
|
18
|
-
validationRules: TValidationRules;
|
|
19
|
-
}>);
|
|
20
|
-
addOption: (newOption: TOption) => void;
|
|
21
|
-
setOptions: (newOptions: TOption[]) => void;
|
|
22
|
-
Component: () => React.JSX.Element;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { CollectorSelect };
|
|
26
|
-
//# sourceMappingURL=Select.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { TextareaProps } from '@apia/theme';
|
|
3
|
-
import { ValidatedCollectorField } from '../ValidatedCollectorField.js';
|
|
4
|
-
|
|
5
|
-
declare class CollectorTextarea extends ValidatedCollectorField<string, Omit<TextareaProps, 'name'>> {
|
|
6
|
-
type: string;
|
|
7
|
-
Component: () => React.JSX.Element;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { CollectorTextarea };
|
|
11
|
-
//# sourceMappingURL=Textarea.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { TDefaultFieldType } from './types.js';
|
|
2
|
-
import React__default from 'react';
|
|
3
|
-
|
|
4
|
-
type TCaptchaProps = {
|
|
5
|
-
name: string;
|
|
6
|
-
imageUrl: string;
|
|
7
|
-
className?: string;
|
|
8
|
-
};
|
|
9
|
-
type TCaptcha = TCaptchaProps & Omit<TDefaultFieldType, 'validationFunction' | 'validationRules' | 'validationClass'>;
|
|
10
|
-
declare const InnerCaptcha: ({ className, name, imageUrl, avoidRegisterIfExists, avoidSemicolon, formName, label, removeOnUnmount, submitName, submitValueParser, validationValueParser, }: TCaptcha) => React__default.JSX.Element;
|
|
11
|
-
|
|
12
|
-
export { InnerCaptcha as Captcha };
|
|
13
|
-
//# sourceMappingURL=Captcha.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Captcha.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { ButtonProps, InputProps } from '@apia/theme';
|
|
3
|
-
import { TDefaultFieldType } from './types.js';
|
|
4
|
-
|
|
5
|
-
type TCheckboxProps = Omit<ButtonProps, 'onChange' | 'defaultChecked' | 'defaultValue'> & Pick<InputProps, 'onChange'>;
|
|
6
|
-
type TCheckbox = TCheckboxProps & TDefaultFieldType<boolean | string> & {
|
|
7
|
-
native?: boolean;
|
|
8
|
-
};
|
|
9
|
-
declare const Checkbox: React__default.ForwardRefExoticComponent<Omit<TCheckbox, "ref"> & React__default.RefAttributes<HTMLButtonElement>>;
|
|
10
|
-
|
|
11
|
-
export { Checkbox, type TCheckbox, type TCheckboxProps };
|
|
12
|
-
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { InputProps } from '@apia/theme';
|
|
3
|
-
import { TDefaultFieldType } from './types.js';
|
|
4
|
-
|
|
5
|
-
type TDeletableInput = InputProps & TDefaultFieldType;
|
|
6
|
-
declare const DeletableInput: React__default.ForwardRefExoticComponent<Omit<TDeletableInput, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
|
|
7
|
-
|
|
8
|
-
export { DeletableInput };
|
|
9
|
-
//# sourceMappingURL=DeletableInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeletableInput.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { BoxProps } from '@apia/theme';
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
interface Window {
|
|
6
|
-
SHOW_REQUIRED_POSITION: string;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
interface IWrapper extends BoxProps {
|
|
10
|
-
avoidSemicolon?: boolean;
|
|
11
|
-
children: React__default.ReactNode;
|
|
12
|
-
label?: string;
|
|
13
|
-
name: string;
|
|
14
|
-
required?: boolean;
|
|
15
|
-
type?: 'checkbox';
|
|
16
|
-
}
|
|
17
|
-
declare const FieldWrapper: ({ name, label, avoidSemicolon, children, className, as, type, ...props }: IWrapper) => React__default.JSX.Element;
|
|
18
|
-
|
|
19
|
-
export { FieldWrapper, type IWrapper };
|
|
20
|
-
//# sourceMappingURL=FieldWrapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FieldWrapper.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { InputProps } from '@apia/theme';
|
|
3
|
-
import { TUseField } from '../hooks/useField.js';
|
|
4
|
-
import { IWrapper } from './FieldWrapper.js';
|
|
5
|
-
import { TDefaultFieldType } from './types.js';
|
|
6
|
-
|
|
7
|
-
type TFileInput = Omit<InputProps, 'onChange' | 'type' | 'value' | 'multiple'> & TDefaultFieldType<File | null> & Pick<TUseField, 'removeOnUnmount'> & Pick<IWrapper, 'avoidSemicolon'>;
|
|
8
|
-
declare const FileInput: React__default.MemoExoticComponent<React__default.ForwardRefExoticComponent<Omit<TFileInput, "ref"> & React__default.RefAttributes<HTMLInputElement>>>;
|
|
9
|
-
|
|
10
|
-
export { FileInput };
|
|
11
|
-
//# sourceMappingURL=FileInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { InputProps } from '@apia/theme';
|
|
3
|
-
import { TDefaultFieldType } from './types.js';
|
|
4
|
-
|
|
5
|
-
type TInput = InputProps & TDefaultFieldType;
|
|
6
|
-
declare const Input: React__default.MemoExoticComponent<React__default.ForwardRefExoticComponent<Omit<TInput, "ref"> & React__default.RefAttributes<HTMLInputElement>>>;
|
|
7
|
-
|
|
8
|
-
export { Input, type TInput };
|
|
9
|
-
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TNumberInput } from '@apia/components';
|
|
2
|
-
import React__default from 'react';
|
|
3
|
-
import { TDefaultFieldType } from './types.js';
|
|
4
|
-
|
|
5
|
-
declare global {
|
|
6
|
-
interface Window {
|
|
7
|
-
GNR_NUMERIC: string;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
type TInput = TNumberInput & TDefaultFieldType;
|
|
11
|
-
declare const NumberInputf: React__default.MemoExoticComponent<React__default.ForwardRefExoticComponent<Omit<TInput, "ref"> & React__default.RefAttributes<HTMLInputElement>>>;
|
|
12
|
-
|
|
13
|
-
export { NumberInputf };
|
|
14
|
-
//# sourceMappingURL=NumberInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { RadioProps } from '@apia/theme';
|
|
3
|
-
import { TDefaultFieldType } from './types.js';
|
|
4
|
-
|
|
5
|
-
type TRadio = RadioProps & TDefaultFieldType & {
|
|
6
|
-
options: {
|
|
7
|
-
value: string;
|
|
8
|
-
label: string;
|
|
9
|
-
}[];
|
|
10
|
-
};
|
|
11
|
-
declare const Radio: React__default.ForwardRefExoticComponent<Omit<TRadio, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
|
|
12
|
-
|
|
13
|
-
export { Radio, type TRadio };
|
|
14
|
-
//# sourceMappingURL=Radio.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { SelectProps } from '@apia/theme';
|
|
3
|
-
import { TDefaultFieldType } from './types.js';
|
|
4
|
-
import { TId } from '@apia/util';
|
|
5
|
-
|
|
6
|
-
type TOption = {
|
|
7
|
-
value: TId;
|
|
8
|
-
label: string;
|
|
9
|
-
};
|
|
10
|
-
type TSelectProps = Omit<SelectProps, 'defaultValue'>;
|
|
11
|
-
type TSelect = TSelectProps & TDefaultFieldType & {
|
|
12
|
-
options: TOption[];
|
|
13
|
-
};
|
|
14
|
-
declare const Select: React__default.ForwardRefExoticComponent<Omit<TSelect, "ref"> & React__default.RefAttributes<HTMLSelectElement>>;
|
|
15
|
-
|
|
16
|
-
export { Select, type TOption, type TSelect, type TSelectProps };
|
|
17
|
-
//# sourceMappingURL=Select.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { SwitchProps, InputProps } from '@apia/theme';
|
|
3
|
-
import { TDefaultFieldType } from './types.js';
|
|
4
|
-
|
|
5
|
-
type TSwitchbox = Omit<SwitchProps, 'onChange'> & Pick<InputProps, 'onChange'> & TDefaultFieldType & {
|
|
6
|
-
reverse?: boolean;
|
|
7
|
-
};
|
|
8
|
-
declare const Switchbox: React__default.ForwardRefExoticComponent<Omit<TSwitchbox, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
|
|
9
|
-
|
|
10
|
-
export { Switchbox, type TSwitchbox };
|
|
11
|
-
//# sourceMappingURL=Switchbox.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Switchbox.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { TextareaProps } from '@apia/theme';
|
|
3
|
-
import { TDefaultFieldType } from './types.js';
|
|
4
|
-
|
|
5
|
-
type TTextarea = TextareaProps & TDefaultFieldType;
|
|
6
|
-
declare const Textarea: React__default.ForwardRefExoticComponent<Omit<TTextarea, "ref"> & React__default.RefAttributes<HTMLTextAreaElement>>;
|
|
7
|
-
|
|
8
|
-
export { Textarea };
|
|
9
|
-
//# sourceMappingURL=Textarea.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Renderiza los errores del campo con el nombre pasado
|
|
5
|
-
* como prop. En caso de que no exista error, no renderiza
|
|
6
|
-
* nada.
|
|
7
|
-
*
|
|
8
|
-
* @props
|
|
9
|
-
* *name:* El nombre del campo cuyos errores se quieren
|
|
10
|
-
* renderizar.
|
|
11
|
-
*/
|
|
12
|
-
declare const ValidationError: ({ name }: {
|
|
13
|
-
name: string;
|
|
14
|
-
}) => React.JSX.Element | null;
|
|
15
|
-
|
|
16
|
-
export { ValidationError };
|
|
17
|
-
//# sourceMappingURL=ValidationError.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationError.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { TUseField } from '../hooks/useField.js';
|
|
2
|
-
import { IWrapper } from './FieldWrapper.js';
|
|
3
|
-
|
|
4
|
-
type TDefaultFieldType<ValueType = string> = Omit<TUseField<ValueType>, 'error' | 'value' | 'isTouched'> & {
|
|
5
|
-
label?: string;
|
|
6
|
-
initialValue?: ValueType;
|
|
7
|
-
validationClass?: string;
|
|
8
|
-
} & Pick<IWrapper, 'avoidSemicolon'>;
|
|
9
|
-
|
|
10
|
-
export type { TDefaultFieldType };
|
|
11
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/form/Form.d.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { TValidationResult } from '../types.js';
|
|
3
|
-
|
|
4
|
-
type TOnValidate<ValueType extends Record<string, unknown> = Record<string, unknown>, SubmitValueType extends Record<keyof ValueType, unknown> = ValueType> = (validationResult: TValidationResult<ValueType, SubmitValueType>) => unknown;
|
|
5
|
-
interface IForm<ValueType extends Record<string, unknown>, SubmitValueType extends Record<keyof ValueType, unknown> = ValueType> {
|
|
6
|
-
/**
|
|
7
|
-
* Si se pasa en true, los campos que se registren en este form no
|
|
8
|
-
* sobreescribirán valores previos si es que existen, sin importar el valor de
|
|
9
|
-
* avoidRegisterIfExists pasado al useField.
|
|
10
|
-
*/
|
|
11
|
-
avoidFieldsOverride?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Impide que se apliquen los estilos que indican que un campo fue alterado.
|
|
14
|
-
*/
|
|
15
|
-
avoidFieldsTouch?: boolean;
|
|
16
|
-
children: React__default.ReactNode;
|
|
17
|
-
className?: string;
|
|
18
|
-
initialValues?: Partial<ValueType>;
|
|
19
|
-
name?: string;
|
|
20
|
-
onUnmount?: () => unknown;
|
|
21
|
-
/**
|
|
22
|
-
* Cuando se ejecuta una acción de validación desde
|
|
23
|
-
* algún lugar de la aplicación se llama a este método
|
|
24
|
-
* con el resultado de dicha ejecución.
|
|
25
|
-
*/
|
|
26
|
-
onValidate?: TOnValidate<ValueType, SubmitValueType>;
|
|
27
|
-
/**
|
|
28
|
-
* Permite definir si el formulario va a ser borrado de la validación al ser
|
|
29
|
-
* desmontado
|
|
30
|
-
*/
|
|
31
|
-
unregisterOnUnmount?: boolean;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Cuando se desea usar el sistema de validación,
|
|
35
|
-
* se debe utilizar este componente como form contenedor
|
|
36
|
-
* de todos los campos que quieran validarse.
|
|
37
|
-
*
|
|
38
|
-
* Es importante que no se coloquen formularios dentro
|
|
39
|
-
* de formularios ya que esto podría afectar negativamente
|
|
40
|
-
* el proceso de validación.
|
|
41
|
-
*
|
|
42
|
-
* @props
|
|
43
|
-
* *name:* Se puede pasar un nombre para identificar
|
|
44
|
-
* el form. Este nombre será utilizado para almacenar
|
|
45
|
-
* la información en Redux, por lo que si se desea
|
|
46
|
-
* acceder a la información recolectada por la librería,
|
|
47
|
-
* es conveniente pasar un nombre conocido y único. En
|
|
48
|
-
* caso de no se pase ningún nombre, la aplicación
|
|
49
|
-
* generará un nombre único automaticamente.
|
|
50
|
-
*
|
|
51
|
-
* *onValidate:* Un callback que será llamado cuando
|
|
52
|
-
* se invoque el método validateForm del store o cuando
|
|
53
|
-
* se lance el evento de submit del elemento form (por
|
|
54
|
-
* ejemplo mediante un click en un botón que no tenga
|
|
55
|
-
* type="button"), con el resultado de la validación.
|
|
56
|
-
*
|
|
57
|
-
* avoidFieldsOverride
|
|
58
|
-
* avoidFieldsTouch
|
|
59
|
-
*
|
|
60
|
-
* @see useField
|
|
61
|
-
* @see useForm
|
|
62
|
-
*
|
|
63
|
-
* @important Debido a que este hook renderiza un elemento
|
|
64
|
-
* form en el DOM, es importante agregar el atributo
|
|
65
|
-
* type="button" a todos los botones dentro del formulario
|
|
66
|
-
* que no se desea que disparen la validación.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* Para ver un ejemplo funcional, mira el componente
|
|
70
|
-
* Invitations.tsx
|
|
71
|
-
*
|
|
72
|
-
* // IMPORTANTE: El tipado del componente Form es genérico
|
|
73
|
-
* // por lo que es posible instanciarlo como se muestra a
|
|
74
|
-
* // continuación, lo que nos da el tipado correcto en el
|
|
75
|
-
* // callback onValidate.
|
|
76
|
-
* <Form<FormDataType> onValidate={(res) => {
|
|
77
|
-
* if(hasSucceedValidation(res)) {
|
|
78
|
-
* // Do something with submitValues
|
|
79
|
-
* } else {
|
|
80
|
-
* // Do something with errors
|
|
81
|
-
* }
|
|
82
|
-
* }}>
|
|
83
|
-
* ...{children}
|
|
84
|
-
* </Form>
|
|
85
|
-
*/
|
|
86
|
-
declare const Form: <ValueType extends Record<string, unknown>, SubmitValueType extends Record<keyof ValueType, unknown> = ValueType>({ avoidFieldsOverride, avoidFieldsTouch, children, className, name, initialValues, onUnmount, onValidate, unregisterOnUnmount, }: IForm<ValueType, SubmitValueType>) => React__default.JSX.Element | null;
|
|
87
|
-
|
|
88
|
-
export { Form, type IForm, type TOnValidate };
|
|
89
|
-
//# sourceMappingURL=Form.d.ts.map
|
package/dist/form/Form.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|