@apia/validations 1.0.4 → 2.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.
Files changed (122) hide show
  1. package/dist/collector/Collector.d.ts +34 -0
  2. package/dist/collector/Collector.d.ts.map +1 -0
  3. package/dist/collector/CollectorField.d.ts +41 -0
  4. package/dist/collector/CollectorField.d.ts.map +1 -0
  5. package/dist/collector/ValidatedCollectorField.d.ts +44 -0
  6. package/dist/collector/ValidatedCollectorField.d.ts.map +1 -0
  7. package/dist/collector/fields/Button.d.ts +13 -0
  8. package/dist/collector/fields/Button.d.ts.map +1 -0
  9. package/dist/collector/fields/Checkbox.d.ts +13 -0
  10. package/dist/collector/fields/Checkbox.d.ts.map +1 -0
  11. package/dist/collector/fields/Input.d.ts +11 -0
  12. package/dist/collector/fields/Input.d.ts.map +1 -0
  13. package/dist/collector/fields/Label.d.ts +13 -0
  14. package/dist/collector/fields/Label.d.ts.map +1 -0
  15. package/dist/collector/fields/Select.d.ts +26 -0
  16. package/dist/collector/fields/Select.d.ts.map +1 -0
  17. package/dist/collector/fields/Textarea.d.ts +11 -0
  18. package/dist/collector/fields/Textarea.d.ts.map +1 -0
  19. package/dist/components/Captcha.d.ts +13 -0
  20. package/dist/components/Captcha.d.ts.map +1 -0
  21. package/dist/components/Checkbox.d.ts +12 -0
  22. package/dist/components/Checkbox.d.ts.map +1 -0
  23. package/dist/components/DeletableInput.d.ts +9 -0
  24. package/dist/components/DeletableInput.d.ts.map +1 -0
  25. package/dist/components/FieldWrapper.d.ts +20 -0
  26. package/dist/components/FieldWrapper.d.ts.map +1 -0
  27. package/dist/components/FileInput.d.ts +11 -0
  28. package/dist/components/FileInput.d.ts.map +1 -0
  29. package/dist/components/Input.d.ts +9 -0
  30. package/dist/components/Input.d.ts.map +1 -0
  31. package/dist/components/NumberInput.d.ts +14 -0
  32. package/dist/components/NumberInput.d.ts.map +1 -0
  33. package/dist/components/Radio.d.ts +14 -0
  34. package/dist/components/Radio.d.ts.map +1 -0
  35. package/dist/components/Select.d.ts +17 -0
  36. package/dist/components/Select.d.ts.map +1 -0
  37. package/dist/components/Switchbox.d.ts +11 -0
  38. package/dist/components/Switchbox.d.ts.map +1 -0
  39. package/dist/components/Textarea.d.ts +9 -0
  40. package/dist/components/Textarea.d.ts.map +1 -0
  41. package/dist/components/ValidationError.d.ts +17 -0
  42. package/dist/components/ValidationError.d.ts.map +1 -0
  43. package/dist/components/types.d.ts +11 -0
  44. package/dist/components/types.d.ts.map +1 -0
  45. package/dist/da.js +30 -0
  46. package/dist/da.js.map +1 -0
  47. package/dist/de.js +26 -0
  48. package/dist/de.js.map +1 -0
  49. package/dist/en.js +32 -0
  50. package/dist/en.js.map +1 -0
  51. package/dist/es.js +32 -0
  52. package/dist/es.js.map +1 -0
  53. package/dist/fa.js +29 -0
  54. package/dist/fa.js.map +1 -0
  55. package/dist/form/Form.d.ts +89 -0
  56. package/dist/form/Form.d.ts.map +1 -0
  57. package/dist/form/FormContext.d.ts +27 -0
  58. package/dist/form/FormContext.d.ts.map +1 -0
  59. package/dist/fr.js +31 -0
  60. package/dist/fr.js.map +1 -0
  61. package/dist/gr.js +24 -0
  62. package/dist/gr.js.map +1 -0
  63. package/dist/hooks/useField.d.ts +76 -0
  64. package/dist/hooks/useField.d.ts.map +1 -0
  65. package/dist/hooks/useFieldStatesClassNames.d.ts +4 -0
  66. package/dist/hooks/useFieldStatesClassNames.d.ts.map +1 -0
  67. package/dist/hooks/useFieldValue.d.ts +8 -0
  68. package/dist/hooks/useFieldValue.d.ts.map +1 -0
  69. package/dist/hooks/useValidationClass.d.ts +49 -0
  70. package/dist/hooks/useValidationClass.d.ts.map +1 -0
  71. package/dist/hr.js +31 -0
  72. package/dist/hr.js.map +1 -0
  73. package/dist/hu.js +29 -0
  74. package/dist/hu.js.map +1 -0
  75. package/dist/index.d.ts +26 -684
  76. package/dist/index.js +865 -1225
  77. package/dist/index.js.map +1 -1
  78. package/dist/it.js +25 -0
  79. package/dist/it.js.map +1 -0
  80. package/dist/ja.js +25 -0
  81. package/dist/ja.js.map +1 -0
  82. package/dist/jp.js +25 -0
  83. package/dist/jp.js.map +1 -0
  84. package/dist/lang/es.d.ts +32 -0
  85. package/dist/lang/es.d.ts.map +1 -0
  86. package/dist/nl.js +26 -0
  87. package/dist/nl.js.map +1 -0
  88. package/dist/pl.js +31 -0
  89. package/dist/pl.js.map +1 -0
  90. package/dist/pt.js +26 -0
  91. package/dist/pt.js.map +1 -0
  92. package/dist/ro.js +30 -0
  93. package/dist/ro.js.map +1 -0
  94. package/dist/types.d.ts +130 -0
  95. package/dist/types.d.ts.map +1 -0
  96. package/dist/util.d.ts +36 -0
  97. package/dist/util.d.ts.map +1 -0
  98. package/dist/validationStore.d.ts +112 -0
  99. package/dist/validationStore.d.ts.map +1 -0
  100. package/package.json +21 -34
  101. package/rollup.validations.mjs +69 -0
  102. package/LICENSE.md +0 -21
  103. package/README.md +0 -28
  104. package/cleanDist.json +0 -3
  105. package/lang/bg.ts +0 -27
  106. package/lang/da.ts +0 -31
  107. package/lang/de.ts +0 -26
  108. package/lang/en.ts +0 -34
  109. package/lang/es.ts +0 -38
  110. package/lang/fa.ts +0 -39
  111. package/lang/fr.ts +0 -36
  112. package/lang/gr.ts +0 -24
  113. package/lang/hr.ts +0 -31
  114. package/lang/hu.ts +0 -30
  115. package/lang/it.ts +0 -25
  116. package/lang/ja.ts +0 -25
  117. package/lang/jp.ts +0 -25
  118. package/lang/nl.ts +0 -26
  119. package/lang/pl.ts +0 -35
  120. package/lang/pt.ts +0 -27
  121. package/lang/ro.ts +0 -37
  122. package/lang/ru.ts +0 -26
@@ -0,0 +1,34 @@
1
+ import { 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
+ add: (field: CollectorField) => void;
27
+ forEach: (cb: (field: CollectorField, i: number) => void) => void;
28
+ show: <FormValues extends Record<string, unknown>>(modalProps?: Partial<Omit<TOpenModal, 'children'>> & Partial<{
29
+ hideConfirm: boolean;
30
+ }>) => Promise<FormValues | null>;
31
+ }
32
+
33
+ export { Collector };
34
+ //# sourceMappingURL=Collector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Collector.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,41 @@
1
+ import * as React from 'react';
2
+ import { FC } from 'react';
3
+ import { EventEmitter } from '@apia/util';
4
+ import { 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
+ functionUpdate: TValidationFunction<ValueType>;
12
+ optionsUpdate: TOption[];
13
+ propsUpdate: Partial<FieldProps>;
14
+ rulesUpdate: TValidationRules;
15
+ }> {
16
+ #private;
17
+ protected _name: string;
18
+ protected label: string;
19
+ /**
20
+ * Este es el componente de implementación de cada campo particular
21
+ */
22
+ abstract Component: FC;
23
+ abstract type: string;
24
+ constructor(_name: string, label: string, properties?: Partial<FieldProps>);
25
+ get name(): string;
26
+ set name(name: string);
27
+ collector: Collector;
28
+ isHidden: () => boolean;
29
+ setIsHidden: (isHidden: boolean) => void;
30
+ protected properties: Partial<FieldProps>;
31
+ setProperties: (newProps: Partial<FieldProps>) => void;
32
+ protected useProperties: () => Partial<FieldProps>;
33
+ /**
34
+ * Este componente se utiliza para controlar propiedades comunes a todos los
35
+ * campos.
36
+ */
37
+ SuperComponent: () => React.JSX.Element | null;
38
+ }
39
+
40
+ export { CollectorField };
41
+ //# sourceMappingURL=CollectorField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CollectorField.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,44 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidatedCollectorField.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Input.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Label.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Textarea.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Captcha.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeletableInput.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldWrapper.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileInput.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Input.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NumberInput.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Radio.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Switchbox.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Textarea.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidationError.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/da.js ADDED
@@ -0,0 +1,30 @@
1
+ const formcheckLanguage = {
2
+ required: "Dette felt skal udfyldes.",
3
+ alpha: "Dette felt accepterer kun alfabetiske tegn.",
4
+ alphanum: "Dette felt accepterer kun alfanumeriske tegn.",
5
+ nodigit: "Cifre ikke accepteret.",
6
+ digit: "Skriv venligst et gyldigt heltal.",
7
+ digitmin: "Tallet skal v\xE6re mindst %0",
8
+ digitltd: "V\xE6rdien skal v\xE6re mellem %0 og %1",
9
+ number: "Skriv venligst et gyldigt nummer.",
10
+ email: "Skriv venligst en gyldig e-mail adresse: <br /><span>F.eks: ditnavn@gmail.com</span>",
11
+ image: "Dette felt b\xF8r kun indeholde gyldige billedtyper.",
12
+ phone: "Skriv venligst et gyldigt telefonnummer.",
13
+ url: "Skriv venligst et gyldigt url: <br /><span>F.eks: http://www.google.com</span>",
14
+ confirm: "Dette felt er forskelligt fra %0",
15
+ differs: "Denne v\xE6rdi skal v\xE6re anderledes end %0",
16
+ length_str: "L\xE6ngden er inkorrekt, den skal v\xE6re mellem %0 og %1",
17
+ length_fix: "L\xE6ngden er inkorrekt, den skal v\xE6re pr\xE6cis %0 tegn.",
18
+ lengthmax: "L\xE6ngden er inkorrekt, den skal max v\xE6re %0",
19
+ lengthmin: "L\xE6ngden er inkorrekt, den skal mindst v\xE6re %0",
20
+ words_min: "Dette felt skal mindst indeholde %0 ord, i\xF8jeblikket: %1 ord",
21
+ words_range: "Dette felt skal indeholde %0-%1 ord, i\xF8jeblikket: %2 ord",
22
+ words_max: "Dette felt m\xE5 max indeholde %0 ord, i\xF8jeblikket: %1 ord",
23
+ checkbox: "Afkryds venligst denne boks.",
24
+ checkboxes_group: "Afkryds venligst mindst %0 boks(e)",
25
+ radios: "Afkryds venligst en af mulighederne.",
26
+ select: "V\xE6lg venligst en af v\xE6rdierne."
27
+ };
28
+
29
+ export { formcheckLanguage as default };
30
+ //# sourceMappingURL=da.js.map
package/dist/da.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"da.js","sources":["../src/lang/da.ts"],"sourcesContent":["const formcheckLanguage = {\n required: 'Dette felt skal udfyldes.',\n alpha: 'Dette felt accepterer kun alfabetiske tegn.',\n alphanum: 'Dette felt accepterer kun alfanumeriske tegn.',\n nodigit: 'Cifre ikke accepteret.',\n digit: 'Skriv venligst et gyldigt heltal.',\n digitmin: 'Tallet skal være mindst %0',\n digitltd: 'Værdien skal være mellem %0 og %1',\n number: 'Skriv venligst et gyldigt nummer.',\n email:\n 'Skriv venligst en gyldig e-mail adresse: <br /><span>F.eks: ditnavn@gmail.com</span>',\n image: 'Dette felt bør kun indeholde gyldige billedtyper.',\n phone: 'Skriv venligst et gyldigt telefonnummer.',\n url: 'Skriv venligst et gyldigt url: <br /><span>F.eks: http://www.google.com</span>',\n\n confirm: 'Dette felt er forskelligt fra %0',\n differs: 'Denne værdi skal være anderledes end %0',\n length_str: 'Længden er inkorrekt, den skal være mellem %0 og %1',\n length_fix: 'Længden er inkorrekt, den skal være præcis %0 tegn.',\n lengthmax: 'Længden er inkorrekt, den skal max være %0',\n lengthmin: 'Længden er inkorrekt, den skal mindst være %0',\n words_min: 'Dette felt skal mindst indeholde %0 ord, iøjeblikket: %1 ord',\n words_range: 'Dette felt skal indeholde %0-%1 ord, iøjeblikket: %2 ord',\n words_max: 'Dette felt må max indeholde %0 ord, iøjeblikket: %1 ord',\n checkbox: 'Afkryds venligst denne boks.',\n checkboxes_group: 'Afkryds venligst mindst %0 boks(e)',\n radios: 'Afkryds venligst en af mulighederne.',\n select: 'Vælg venligst en af værdierne.',\n};\n\nexport default formcheckLanguage;\n"],"names":[],"mappings":"AAAA,MAAM,iBAAoB,GAAA;AAAA,EACxB,QAAU,EAAA,2BAAA;AAAA,EACV,KAAO,EAAA,6CAAA;AAAA,EACP,QAAU,EAAA,+CAAA;AAAA,EACV,OAAS,EAAA,wBAAA;AAAA,EACT,KAAO,EAAA,mCAAA;AAAA,EACP,QAAU,EAAA,+BAAA;AAAA,EACV,QAAU,EAAA,yCAAA;AAAA,EACV,MAAQ,EAAA,mCAAA;AAAA,EACR,KACE,EAAA,sFAAA;AAAA,EACF,KAAO,EAAA,sDAAA;AAAA,EACP,KAAO,EAAA,0CAAA;AAAA,EACP,GAAK,EAAA,gFAAA;AAAA,EAEL,OAAS,EAAA,kCAAA;AAAA,EACT,OAAS,EAAA,+CAAA;AAAA,EACT,UAAY,EAAA,2DAAA;AAAA,EACZ,UAAY,EAAA,8DAAA;AAAA,EACZ,SAAW,EAAA,kDAAA;AAAA,EACX,SAAW,EAAA,qDAAA;AAAA,EACX,SAAW,EAAA,iEAAA;AAAA,EACX,WAAa,EAAA,6DAAA;AAAA,EACb,SAAW,EAAA,+DAAA;AAAA,EACX,QAAU,EAAA,8BAAA;AAAA,EACV,gBAAkB,EAAA,oCAAA;AAAA,EAClB,MAAQ,EAAA,sCAAA;AAAA,EACR,MAAQ,EAAA,sCAAA;AACV;;;;"}
package/dist/de.js ADDED
@@ -0,0 +1,26 @@
1
+ const formcheckLanguage = {
2
+ required: "Dieses Feld ist obligatorisch.",
3
+ alpha: "In diesem Feld sind nur Buchstaben zul&auml;ssig.",
4
+ alphanum: "In diesem Feld sind nur Zahlen zul&auml;ssig.",
5
+ nodigit: "Eingabe von Nummern nicht m&ouml;glich.",
6
+ digit: "Nur Eingabe von Zahlen m&ouml;glich.",
7
+ digitmin: "Die kleinstm&ouml;gliche Zahl ist %0.",
8
+ digitltd: "Der Wert muss zwischen %0 und %1 liegen",
9
+ number: "Geben Sie bitte eine g&uuml;ltige Zahl ein.",
10
+ email: "Geben Sie bitte eine g&uuml;ltige E-mail ein.",
11
+ phone: "Geben Sie bitte eine g&uuml;ltige Telefonnummer ein.",
12
+ url: "Geben Sie bitte eine g&uuml;ltige Internetadresse ein.",
13
+ confirm: "Das Feld ist verschieden von %0.",
14
+ differs: "Der Wert muss unterschiedlich zu %0 sein.",
15
+ length_str: "Das Feld ist verschieden von %0.",
16
+ length_fix: "Falsche L\uFFFDnge, es m\uFFFDssen exakt %0 Buchstaben sein.",
17
+ lengthmax: "Der Wert ist nicht korrekt, maximale Anzahl Charakter %0.",
18
+ lengthmin: "Der Wert ist nicht korrekt, minimale Anzahl Charakter %0.",
19
+ checkbox: "Bitte aktivieren.",
20
+ checkboxes_group: "Bitte kreuzen Sie mindestens %0 Feld(er) an",
21
+ radios: "Bitte einen Wert ausw&auml;hlen.",
22
+ select: "Bitte einen Wert ausw&auml;hlen."
23
+ };
24
+
25
+ export { formcheckLanguage as default };
26
+ //# sourceMappingURL=de.js.map
package/dist/de.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"de.js","sources":["../src/lang/de.ts"],"sourcesContent":["const formcheckLanguage = {\n required: 'Dieses Feld ist obligatorisch.',\n alpha: 'In diesem Feld sind nur Buchstaben zul&auml;ssig.',\n alphanum: 'In diesem Feld sind nur Zahlen zul&auml;ssig.',\n nodigit: 'Eingabe von Nummern nicht m&ouml;glich.',\n digit: 'Nur Eingabe von Zahlen m&ouml;glich.',\n digitmin: 'Die kleinstm&ouml;gliche Zahl ist %0.',\n digitltd: 'Der Wert muss zwischen %0 und %1 liegen',\n number: 'Geben Sie bitte eine g&uuml;ltige Zahl ein.',\n email: 'Geben Sie bitte eine g&uuml;ltige E-mail ein.',\n phone: 'Geben Sie bitte eine g&uuml;ltige Telefonnummer ein.',\n url: 'Geben Sie bitte eine g&uuml;ltige Internetadresse ein.',\n\n confirm: 'Das Feld ist verschieden von %0.',\n differs: 'Der Wert muss unterschiedlich zu %0 sein.',\n length_str: 'Das Feld ist verschieden von %0.',\n length_fix: 'Falsche L�nge, es m�ssen exakt %0 Buchstaben sein.',\n lengthmax: 'Der Wert ist nicht korrekt, maximale Anzahl Charakter %0.',\n lengthmin: 'Der Wert ist nicht korrekt, minimale Anzahl Charakter %0.',\n checkbox: 'Bitte aktivieren.',\n checkboxes_group: 'Bitte kreuzen Sie mindestens %0 Feld(er) an',\n radios: 'Bitte einen Wert ausw&auml;hlen.',\n select: 'Bitte einen Wert ausw&auml;hlen.',\n};\n\nexport default formcheckLanguage;\n"],"names":[],"mappings":"AAAA,MAAM,iBAAoB,GAAA;AAAA,EACxB,QAAU,EAAA,gCAAA;AAAA,EACV,KAAO,EAAA,mDAAA;AAAA,EACP,QAAU,EAAA,+CAAA;AAAA,EACV,OAAS,EAAA,yCAAA;AAAA,EACT,KAAO,EAAA,sCAAA;AAAA,EACP,QAAU,EAAA,uCAAA;AAAA,EACV,QAAU,EAAA,yCAAA;AAAA,EACV,MAAQ,EAAA,6CAAA;AAAA,EACR,KAAO,EAAA,+CAAA;AAAA,EACP,KAAO,EAAA,sDAAA;AAAA,EACP,GAAK,EAAA,wDAAA;AAAA,EAEL,OAAS,EAAA,kCAAA;AAAA,EACT,OAAS,EAAA,2CAAA;AAAA,EACT,UAAY,EAAA,kCAAA;AAAA,EACZ,UAAY,EAAA,8DAAA;AAAA,EACZ,SAAW,EAAA,2DAAA;AAAA,EACX,SAAW,EAAA,2DAAA;AAAA,EACX,QAAU,EAAA,mBAAA;AAAA,EACV,gBAAkB,EAAA,6CAAA;AAAA,EAClB,MAAQ,EAAA,kCAAA;AAAA,EACR,MAAQ,EAAA,kCAAA;AACV;;;;"}
package/dist/en.js ADDED
@@ -0,0 +1,32 @@
1
+ const formcheckLanguage = {
2
+ required: "This field is required.",
3
+ alpha: "This field accepts alphabetic characters only.",
4
+ alphanum: "This field accepts alphanumeric characters only.",
5
+ nodigit: "No digits are accepted.",
6
+ digit: "Please enter a valid integer.",
7
+ digitmin: "The number must be at least %0",
8
+ digitltd: "The value must be between %0 and %1",
9
+ number: "Please enter a valid number.",
10
+ email: "Please enter a valid email: <br /><span>E.g. yourname@domain.com</span>",
11
+ image: "This field should only contain image types",
12
+ phone: "Please enter a valid phone.",
13
+ url: "Please enter a valid url: <br /><span>E.g. http://www.domain.com</span>",
14
+ confirm: "This field is different from %0",
15
+ differs: "This value must be different of %0",
16
+ length_str: "The length is incorrect, it must be between %0 and %1",
17
+ length_fix: "The length is incorrect, it must be exactly %0 characters",
18
+ lengthmax: "The length is incorrect, it must be at max %0",
19
+ lengthmin: "The length is incorrect, it must be at least %0",
20
+ words_min: "This field must concain at least %0 words, currently: %1 words",
21
+ words_range: "This field must contain %0-%1 words, currently: %2 words",
22
+ words_max: "This field must contain at max %0 words, currently: %1 words",
23
+ checkbox: "Please check the box",
24
+ checkboxes_group: "Please check at least %0 box(es)",
25
+ radios: "Please select a radio",
26
+ select: "Please choose a value",
27
+ select_multiple: "Please choose at least one value",
28
+ errorsTitle: "Form errors:"
29
+ };
30
+
31
+ export { formcheckLanguage as default };
32
+ //# sourceMappingURL=en.js.map
package/dist/en.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en.js","sources":["../src/lang/en.ts"],"sourcesContent":["const formcheckLanguage = {\n required: 'This field is required.',\n alpha: 'This field accepts alphabetic characters only.',\n alphanum: 'This field accepts alphanumeric characters only.',\n nodigit: 'No digits are accepted.',\n digit: 'Please enter a valid integer.',\n digitmin: 'The number must be at least %0',\n digitltd: 'The value must be between %0 and %1',\n number: 'Please enter a valid number.',\n email:\n 'Please enter a valid email: <br /><span>E.g. yourname@domain.com</span>',\n image: 'This field should only contain image types',\n phone: 'Please enter a valid phone.',\n url: 'Please enter a valid url: <br /><span>E.g. http://www.domain.com</span>',\n\n confirm: 'This field is different from %0',\n differs: 'This value must be different of %0',\n length_str: 'The length is incorrect, it must be between %0 and %1',\n length_fix: 'The length is incorrect, it must be exactly %0 characters',\n lengthmax: 'The length is incorrect, it must be at max %0',\n lengthmin: 'The length is incorrect, it must be at least %0',\n words_min: 'This field must concain at least %0 words, currently: %1 words',\n words_range: 'This field must contain %0-%1 words, currently: %2 words',\n words_max: 'This field must contain at max %0 words, currently: %1 words',\n checkbox: 'Please check the box',\n checkboxes_group: 'Please check at least %0 box(es)',\n radios: 'Please select a radio',\n select: 'Please choose a value',\n select_multiple: 'Please choose at least one value',\n\n errorsTitle: 'Form errors:',\n};\n\nexport default formcheckLanguage;\n"],"names":[],"mappings":"AAAA,MAAM,iBAAoB,GAAA;AAAA,EACxB,QAAU,EAAA,yBAAA;AAAA,EACV,KAAO,EAAA,gDAAA;AAAA,EACP,QAAU,EAAA,kDAAA;AAAA,EACV,OAAS,EAAA,yBAAA;AAAA,EACT,KAAO,EAAA,+BAAA;AAAA,EACP,QAAU,EAAA,gCAAA;AAAA,EACV,QAAU,EAAA,qCAAA;AAAA,EACV,MAAQ,EAAA,8BAAA;AAAA,EACR,KACE,EAAA,yEAAA;AAAA,EACF,KAAO,EAAA,4CAAA;AAAA,EACP,KAAO,EAAA,6BAAA;AAAA,EACP,GAAK,EAAA,yEAAA;AAAA,EAEL,OAAS,EAAA,iCAAA;AAAA,EACT,OAAS,EAAA,oCAAA;AAAA,EACT,UAAY,EAAA,uDAAA;AAAA,EACZ,UAAY,EAAA,2DAAA;AAAA,EACZ,SAAW,EAAA,+CAAA;AAAA,EACX,SAAW,EAAA,iDAAA;AAAA,EACX,SAAW,EAAA,gEAAA;AAAA,EACX,WAAa,EAAA,0DAAA;AAAA,EACb,SAAW,EAAA,8DAAA;AAAA,EACX,QAAU,EAAA,sBAAA;AAAA,EACV,gBAAkB,EAAA,kCAAA;AAAA,EAClB,MAAQ,EAAA,uBAAA;AAAA,EACR,MAAQ,EAAA,uBAAA;AAAA,EACR,eAAiB,EAAA,kCAAA;AAAA,EAEjB,WAAa,EAAA,cAAA;AACf;;;;"}