@ttoss/forms 0.26.0 → 0.26.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.
Files changed (35) hide show
  1. package/LICENSE +21 -674
  2. package/package.json +11 -11
  3. package/src/Brazil/FormFieldCEP.tsx +0 -25
  4. package/src/Brazil/FormFieldCNPJ.tsx +0 -93
  5. package/src/Brazil/FormFieldPhone.tsx +0 -41
  6. package/src/Brazil/index.ts +0 -4
  7. package/src/Form.tsx +0 -29
  8. package/src/FormErrorMessage.tsx +0 -60
  9. package/src/FormField.tsx +0 -86
  10. package/src/FormFieldCheckbox.tsx +0 -49
  11. package/src/FormFieldCreditCardNumber.tsx +0 -25
  12. package/src/FormFieldCurrencyInput.tsx +0 -36
  13. package/src/FormFieldInput.tsx +0 -43
  14. package/src/FormFieldNumericFormat.tsx +0 -35
  15. package/src/FormFieldPassword.tsx +0 -43
  16. package/src/FormFieldPatternFormat.tsx +0 -36
  17. package/src/FormFieldRadio.tsx +0 -57
  18. package/src/FormFieldSelect.tsx +0 -47
  19. package/src/FormFieldTextarea.tsx +0 -36
  20. package/src/FormGroup.tsx +0 -136
  21. package/src/MultistepForm/MultistepFlowMessage.tsx +0 -14
  22. package/src/MultistepForm/MultistepFlowMessageImageText.tsx +0 -37
  23. package/src/MultistepForm/MultistepFooter.tsx +0 -18
  24. package/src/MultistepForm/MultistepForm.tsx +0 -117
  25. package/src/MultistepForm/MultistepFormStepper.tsx +0 -70
  26. package/src/MultistepForm/MultistepHeader.tsx +0 -78
  27. package/src/MultistepForm/MultistepNavigation.tsx +0 -38
  28. package/src/MultistepForm/MultistepQuestion.tsx +0 -28
  29. package/src/MultistepForm/index.ts +0 -1
  30. package/src/MultistepForm/types.ts +0 -7
  31. package/src/index.ts +0 -35
  32. package/src/yup/i18n.ts +0 -31
  33. package/src/yup/schema.ts +0 -26
  34. package/src/yup/typings.d.ts +0 -14
  35. package/src/yup/yup.ts +0 -4
package/src/index.ts DELETED
@@ -1,35 +0,0 @@
1
- export { yupResolver } from '@hookform/resolvers/yup';
2
- export { yup } from './yup/yup';
3
-
4
- export { Form } from './Form';
5
- export { FormErrorMessage } from './FormErrorMessage';
6
- export { FormField } from './FormField';
7
- export { FormFieldCheckbox } from './FormFieldCheckbox';
8
- export { FormFieldCreditCardNumber } from './FormFieldCreditCardNumber';
9
- export { FormFieldNumericFormat } from './FormFieldNumericFormat';
10
- export { FormFieldPatternFormat } from './FormFieldPatternFormat';
11
- export { FormFieldCurrencyInput } from './FormFieldCurrencyInput';
12
- export { FormFieldInput } from './FormFieldInput';
13
- export { FormFieldPassword } from './FormFieldPassword';
14
- export { FormFieldRadio } from './FormFieldRadio';
15
- export { FormFieldSelect } from './FormFieldSelect';
16
- export { FormFieldTextarea } from './FormFieldTextarea';
17
- export { FormGroup, useFormGroup } from './FormGroup';
18
-
19
- /**
20
- * Export everything from react-hook-form without using export *
21
- * https://github.com/evanw/esbuild/issues/1737
22
- */
23
- export {
24
- useForm,
25
- useFormContext,
26
- useWatch,
27
- useFieldArray,
28
- useController,
29
- useFormState,
30
- Controller,
31
- FormProvider,
32
- } from 'react-hook-form';
33
-
34
- // Export types
35
- export * from 'react-hook-form';
package/src/yup/i18n.ts DELETED
@@ -1,31 +0,0 @@
1
- import { defineMessage } from '@ttoss/react-i18n';
2
- import { setLocale } from 'yup';
3
-
4
- setLocale({
5
- mixed: {
6
- required: defineMessage({
7
- defaultMessage: 'Field is required',
8
- description: 'Field is required',
9
- }),
10
- notType: ({ type }) => {
11
- return {
12
- ...defineMessage({
13
- defaultMessage: 'Invalid Value for Field of type {type}',
14
- description: 'Invalid Value',
15
- }),
16
- values: { type },
17
- };
18
- },
19
- },
20
- string: {
21
- min: ({ min }) => {
22
- return {
23
- ...defineMessage({
24
- defaultMessage: 'Field must be at least {min} characters',
25
- description: 'Min length field',
26
- }),
27
- values: { min },
28
- };
29
- },
30
- },
31
- });
package/src/yup/schema.ts DELETED
@@ -1,26 +0,0 @@
1
- import * as yup from 'yup';
2
- import { isCnpjValid } from '../Brazil/FormFieldCNPJ';
3
- /**
4
- * Need this import to extend yup types on build time.
5
- */
6
- import './typings.d';
7
-
8
- yup.addMethod(yup.string, 'cnpj', function () {
9
- return this.test('valid-cnpj', 'Invalid CNPJ', (value) => {
10
- return isCnpjValid(value);
11
- });
12
- });
13
-
14
- yup.addMethod(
15
- yup.string,
16
- 'password',
17
- function ({ required }: { required?: boolean } = {}) {
18
- const schema = this.trim();
19
-
20
- if (required) {
21
- schema.required('Password is required');
22
- }
23
-
24
- return schema.min(8, 'Password must be at least 8 characters long');
25
- }
26
- );
@@ -1,14 +0,0 @@
1
- import { AnyObject, Flags, Maybe, Schema } from 'yup';
2
-
3
- declare module 'yup' {
4
- interface StringSchema<
5
- TType extends Maybe<string> = string | undefined,
6
- TContext extends AnyObject = AnyObject,
7
- TDefault = undefined,
8
- TFlags extends Flags = '',
9
- > extends Schema<TType, TContext, TDefault, TFlags> {
10
- cnpj(): this;
11
- }
12
- }
13
-
14
- export {};
package/src/yup/yup.ts DELETED
@@ -1,4 +0,0 @@
1
- import './i18n';
2
- import './schema';
3
-
4
- export * as yup from 'yup';