aport-tools 4.5.0 → 4.6.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 (39) hide show
  1. package/package.json +17 -34
  2. package/src/cards/Card.tsx +129 -0
  3. package/src/cards/index.ts +1 -0
  4. package/src/components/Button.tsx +180 -0
  5. package/src/fonts/Text.tsx +137 -0
  6. package/{dist/fonts/index.d.ts → src/fonts/index.ts} +1 -0
  7. package/src/forms/ErrorList.tsx +47 -0
  8. package/src/forms/FORMDOC.md +87 -0
  9. package/{dist/forms/Form.d.ts → src/forms/Form.tsx} +2 -0
  10. package/src/forms/FormContext.tsx +248 -0
  11. package/src/forms/Input.tsx +174 -0
  12. package/src/forms/InputAttach.tsx +184 -0
  13. package/src/forms/InputCheck.tsx +169 -0
  14. package/src/forms/InputList.tsx +304 -0
  15. package/src/forms/Label.tsx +26 -0
  16. package/src/forms/Stepper.tsx +289 -0
  17. package/src/forms/TextArea.tsx +91 -0
  18. package/{dist/forms/index.d.ts → src/forms/index.ts} +4 -2
  19. package/src/index.ts +6 -0
  20. package/dist/cards/Card.d.ts +0 -57
  21. package/dist/cards/index.d.ts +0 -1
  22. package/dist/components/Button.d.ts +0 -52
  23. package/dist/defaults/reanimatedWrapper.d.ts +0 -2
  24. package/dist/fonts/Text.d.ts +0 -64
  25. package/dist/forms/ErrorList.d.ts +0 -6
  26. package/dist/forms/FormContext.d.ts +0 -132
  27. package/dist/forms/Input.d.ts +0 -43
  28. package/dist/forms/InputAttach.d.ts +0 -16
  29. package/dist/forms/InputCheck.d.ts +0 -19
  30. package/dist/forms/InputList.d.ts +0 -93
  31. package/dist/forms/Label.d.ts +0 -7
  32. package/dist/forms/Stepper.d.ts +0 -54
  33. package/dist/forms/TextArea.d.ts +0 -13
  34. package/dist/index.d.ts +0 -4
  35. package/dist/index.esm.js +0 -1493
  36. package/dist/index.esm.js.map +0 -1
  37. package/dist/index.js +0 -1526
  38. package/dist/index.js.map +0 -1
  39. /package/{dist/buttons/index.d.ts → src/buttons/index.ts} +0 -0
@@ -1,132 +0,0 @@
1
- import React from 'react';
2
- interface FormContextProps {
3
- /**
4
- * Stores the current form values as an object.
5
- * Each key is a form field name and each value is the current value of that field.
6
- * Example:
7
- * ```ts
8
- * formValues = { name: "John", email: "john@example.com" };
9
- * ```
10
- */
11
- formValues: Record<string, any>;
12
- /**
13
- * A function to update a specific form field value.
14
- * It takes the `name` of the form field and the new `value` to be set.
15
- * and an optional `firstValue` to track the initial value.
16
- * Example usage:
17
- * ```ts
18
- * setFormValue('email', 'newemail@example.com', 'oldemail@example.com');
19
- * ```
20
- */
21
- setFormValue: (name: string, value: any, firstValue?: any) => void;
22
- /**
23
- * Stores the current form errors as an object.
24
- * Each key is a form field name and the value is an array of error messages for that field.
25
- * Example:
26
- * ```ts
27
- * errors = { email: ['Email is required', 'Invalid email format'] };
28
- * ```
29
- */
30
- errors: Record<string, string[]>;
31
- /**
32
- * A function to update the errors for all form fields.
33
- * It takes an object where each key is a form field name and the value is an array of error messages for that field.
34
- * Example usage:
35
- * ```ts
36
- * setErrors({ email: ['Email is required', 'Invalid email format'] });
37
- * ```
38
- */
39
- setErrors: (errors: Record<string, string[]>) => void;
40
- /**
41
- * A function to trigger the form submission.
42
- * It will invoke the `onSubmit` handler and handle form validation errors.
43
- * Typically, this function would call `onSubmit` and handle errors by updating the `errors` state.
44
- */
45
- handleSubmit: () => void;
46
- handleFormSubmit: (formValues: Record<string, any>) => Promise<Record<string, string[]>>;
47
- }
48
- export declare const setFormValueGlobal: (name: string, value: any, firstValue?: any) => void;
49
- export declare const useFormContext: () => FormContextProps;
50
- interface StepperProps {
51
- /**
52
- * Labels for each step (optional). If provided, these labels will display below each step indicator.
53
- * Example: ['Step 1', 'Step 2', 'Step 3']
54
- */
55
- steps?: string[];
56
- /**
57
- * Current step index (e.g., 0 for step 1, 1 for step 2).
58
- * Determines the active step and progress display.
59
- */
60
- currentStep: number;
61
- /**
62
- * Enables or disables the ability to click on a step to navigate to it.
63
- * Default is `false`.
64
- */
65
- presseable?: boolean;
66
- /**
67
- * Callback function that gets triggered when a step is clicked.
68
- * Passes the index of the clicked step as an argument.
69
- * Example: (stepIndex) => console.log(`Step ${stepIndex} clicked!`)
70
- */
71
- onPress?: (stepIndex: number) => void;
72
- /**
73
- * Determines the shape of the step indicator.
74
- * Options:
75
- * - `'circular'` (default)
76
- * - `'square'`
77
- */
78
- stepStyle?: "circular" | "square";
79
- /**
80
- * Total number of steps in the stepper.
81
- * Must be greater than or equal to 1.
82
- */
83
- totalSteps: number;
84
- /**
85
- * Type of content displayed inside the step indicator.
86
- * Options:
87
- * - `'number'` (default): Displays the step index (e.g., 1, 2, 3).
88
- * - `'icon'`: Displays a custom icon (requires the `icon` prop).
89
- * - `'empty'`: Displays no content inside the step indicator.
90
- */
91
- stepType?: "number" | "icon" | "empty";
92
- /**
93
- * Custom icon(s) to display inside step indicators when `stepType` is set to `'icon'`.
94
- * Accepts:
95
- * - A single icon for all steps (ReactNode or string URI).
96
- * - An array of icons (ReactNode[] or string[]), one for each step.
97
- * Example: ['https://example.com/icon1.png', 'https://example.com/icon2.png']
98
- */
99
- icon?: React.ReactNode | React.ReactNode[];
100
- }
101
- interface FormProps {
102
- /**
103
- * The children elements to render inside the form.
104
- * Typically this will be form fields or custom form components.
105
- * This prop is required and must be passed as ReactNode(s).
106
- */
107
- children: React.ReactNode;
108
- /**
109
- * The callback function to handle form submission.
110
- * It receives the form values as an object (`values`) and must return a promise
111
- * that resolves to an object containing errors for the form fields.
112
- * Example:
113
- * ```ts
114
- * const onSubmit = async (values: Record<string, any>) => {
115
- * // handle the submission and return errors if any
116
- * return { fieldName: ['Error message'] };
117
- * }
118
- * ```
119
- * The return value should be an object where the keys are form field names
120
- * and the values are arrays of error messages for those fields.
121
- */
122
- onSubmit: (values: Record<string, any>) => Promise<Record<string, string[]>>;
123
- /**
124
- * Optional stepper configuration for the form.
125
- * If provided, it will integrate a stepper component to display form steps.
126
- * This is an optional prop, so the form can be used without it.
127
- * The `StepperProps` interface will define the expected props for the stepper.
128
- */
129
- stepper?: StepperProps;
130
- }
131
- export declare const Form: React.FC<FormProps>;
132
- export {};
@@ -1,43 +0,0 @@
1
- import React from "react";
2
- import { TextInputProps } from "react-native";
3
- /**
4
- * Defines the props for the Input component.
5
- */
6
- interface InputProps extends TextInputProps {
7
- /**
8
- * The unique identifier for the input field, used to manage its state within the form.
9
- */
10
- name: string;
11
- /**
12
- * Optional first value if you want to set values with fetch or dont have empty inputs.
13
- */
14
- firstValue?: string | number;
15
- /**
16
- * The text label displayed above the input field.
17
- */
18
- label: string;
19
- /**
20
- * Specifies the type of input and applies corresponding formatting.
21
- * - 'phone': Formats input as a phone number (xxx-xxx-xxxx).
22
- * - 'id': Converts all input characters to uppercase (useful for IDs, passports).
23
- * - 'uppercase': Forces all input characters to uppercase (useful for codes).
24
- * - 'numeric': Restricts input to numeric characters only.
25
- */
26
- inputType?: "phone" | "id" | "uppercase" | "numeric";
27
- }
28
- /**
29
- * Input component that supports labels, error messages, and integrates with the Theme system.
30
- *
31
- * @param {InputProps} props - Props passed to the component.
32
- * @returns {JSX.Element} The rendered Input component.
33
- *
34
- * @example
35
- * <Input
36
- * name="email"
37
- * label="Email"
38
- * keyboardType="email-address"
39
- * inputType="id"
40
- * />
41
- */
42
- export declare const Input: React.FC<InputProps>;
43
- export {};
@@ -1,16 +0,0 @@
1
- import React from "react";
2
- interface FileData {
3
- uri: string;
4
- name: string;
5
- type: string;
6
- }
7
- interface InputAttachProps {
8
- name: string;
9
- type?: string[];
10
- amount?: number;
11
- disabled?: boolean;
12
- placeholder?: string;
13
- firstValue?: FileData[];
14
- }
15
- declare const InputAttach: React.FC<InputAttachProps>;
16
- export default InputAttach;
@@ -1,19 +0,0 @@
1
- import React from "react";
2
- interface InputOption {
3
- id: string;
4
- label?: string;
5
- icon?: string;
6
- value: string;
7
- }
8
- interface InputCheckProps {
9
- name: string;
10
- options: InputOption[];
11
- multi?: boolean;
12
- max?: number;
13
- rowAmount?: number;
14
- iconPosition?: "row" | "column";
15
- disabled?: boolean;
16
- firstValue?: InputOption[];
17
- }
18
- declare const InputCheck: React.FC<InputCheckProps>;
19
- export default InputCheck;
@@ -1,93 +0,0 @@
1
- import React from 'react';
2
- interface Option {
3
- id: number | string;
4
- label: string;
5
- value: any;
6
- }
7
- interface InputListProps {
8
- name: string;
9
- /**
10
- * Placeholder text displayed in the input box when no selection is made.
11
- * @type {string}
12
- * @default "Choose value/s"
13
- */
14
- /**
15
- * Optional first value if you want to set values with fetch or dont have empty inputs.
16
- */
17
- firstValue?: any[];
18
- placeholder?: string;
19
- /**
20
- * Custom styles for the component.
21
- * @type {object}
22
- */
23
- style?: object;
24
- /**
25
- * Array of options to display in the dropdown. Each option should have an id, label, and value.
26
- * @type {Option[]}
27
- */
28
- options: Option[];
29
- /**
30
- * Enables multi-selection mode when true. If enabled, users can select multiple values.
31
- * @type {boolean}
32
- * @default false
33
- */
34
- multi?: boolean;
35
- /**
36
- * Disables the dropdown input when true.
37
- * @type {boolean}
38
- * @default false
39
- */
40
- disabled?: boolean;
41
- /**
42
- * Key used to sort options in the dropdown (e.g., by 'id', 'label').
43
- * @type {keyof Option}
44
- */
45
- sortBy?: keyof Option;
46
- /**
47
- * If true, displays a separator line between each option.
48
- * @type {boolean}
49
- * @default false
50
- */
51
- separator?: boolean;
52
- /**
53
- * Closes the dropdown if the user scrolls the list.
54
- * @type {boolean}
55
- * @default false
56
- */
57
- closeOnScroll?: boolean;
58
- /**
59
- * Closes the dropdown after selecting an item if true (only relevant when multi is false).
60
- * @type {boolean}
61
- * @default true
62
- */
63
- closeOnSelect?: boolean;
64
- /**
65
- * Limits the maximum number of items that can be selected when multi is true.
66
- * Once the limit is reached, the dropdown closes, and no further selections can be made until
67
- * an item is deselected.
68
- * @type {number}
69
- */
70
- maxSelection?: number;
71
- /**
72
- * Callback function called when the selection changes. Useful for conditional field enabling.
73
- * @param {Option | Option[] | null} selection - The updated selection.
74
- */
75
- onChange?: (selection: Option | Option[] | null) => void;
76
- }
77
- /**
78
- * InputList component - A custom dropdown list component for React Native with multi-selection support,
79
- * customizable styling, sorting, and configurable close behavior on selection or scrolling.
80
- *
81
- * @param {string} placeholder - Placeholder text for the input.
82
- * @param {object} style - Custom styles for the component.
83
- * @param {Option[]} options - Array of options to display in the dropdown.
84
- * @param {boolean} multi - Enables multi-selection mode.
85
- * @param {boolean} disabled - Disables the dropdown input.
86
- * @param {keyof Option} sortBy - Key to sort options by (e.g., 'id').
87
- * @param {boolean} separator - If true, adds a separator line between options.
88
- * @param {boolean} closeOnScroll - Closes the dropdown if the user scrolls the list.
89
- * @param {boolean} closeOnSelect - Closes the dropdown on selection in single-select mode.
90
- * @param {number} maxSelection - Maximum number of items selectable in multi-select mode.
91
- */
92
- export declare const InputList: React.FC<InputListProps>;
93
- export {};
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- interface LabelProps {
3
- text: string;
4
- style?: any;
5
- }
6
- declare const Label: React.FC<LabelProps>;
7
- export default Label;
@@ -1,54 +0,0 @@
1
- import React from "react";
2
- interface StepperProps {
3
- /**
4
- * Labels for each step (optional). If provided, these labels will display below each step indicator.
5
- * Example: ['Step 1', 'Step 2', 'Step 3']
6
- */
7
- steps?: string[];
8
- /**
9
- * Current step index (e.g., 0 for step 1, 1 for step 2).
10
- * Determines the active step and progress display.
11
- */
12
- currentStep: number;
13
- /**
14
- * Enables or disables the ability to click on a step to navigate to it.
15
- * Default is `false`.
16
- */
17
- presseable?: boolean;
18
- /**
19
- * Callback function that gets triggered when a step is clicked.
20
- * Passes the index of the clicked step as an argument.
21
- * Example: (stepIndex) => console.log(`Step ${stepIndex} clicked!`)
22
- */
23
- onPress?: (stepIndex: number) => void;
24
- /**
25
- * Determines the shape of the step indicator.
26
- * Options:
27
- * - `'circular'` (default)
28
- * - `'square'`
29
- */
30
- stepStyle?: "circular" | "square";
31
- /**
32
- * Total number of steps in the stepper.
33
- * Must be greater than or equal to 1.
34
- */
35
- totalSteps: number;
36
- /**
37
- * Type of content displayed inside the step indicator.
38
- * Options:
39
- * - `'number'` (default): Displays the step index (e.g., 1, 2, 3).
40
- * - `'icon'`: Displays a custom icon (requires the `icon` prop).
41
- * - `'empty'`: Displays no content inside the step indicator.
42
- */
43
- stepType?: "number" | "icon" | "empty";
44
- /**
45
- * Custom icon(s) to display inside step indicators when `stepType` is set to `'icon'`.
46
- * Accepts:
47
- * - A single icon for all steps (ReactNode or string URI).
48
- * - An array of icons (ReactNode[] or string[]), one for each step.
49
- * Example: ['https://example.com/icon1.png', 'https://example.com/icon2.png']
50
- */
51
- icon?: React.ReactNode | React.ReactNode[];
52
- }
53
- declare const Stepper: React.FC<StepperProps>;
54
- export default Stepper;
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import { TextInputProps } from 'react-native';
3
- interface TextAreaProps extends TextInputProps {
4
- name: string;
5
- /**
6
- * Optional first value if you want to set values with fetch or dont have empty inputs.
7
- */
8
- firstValue?: string;
9
- label: string;
10
- errors?: string[];
11
- }
12
- declare const TextArea: React.FC<TextAreaProps>;
13
- export default TextArea;
package/dist/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './buttons';
2
- export * from './cards';
3
- export * from './fonts';
4
- export * from './forms';