@foris/avocado-not-front 0.5.0 → 0.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.
- package/dist/avocado-not-front.es.js +27538 -21363
- package/dist/avocado-not-front.umd.js +135 -115
- package/dist/components/header/Header.d.ts +0 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/select/SelectPagination.d.ts +11 -0
- package/dist/components/select/SelectSimple.d.ts +11 -0
- package/dist/components/select/index.d.ts +11 -0
- package/dist/components/select/select.util.d.ts +20 -0
- package/dist/hooks/useAction.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/types/components.type.d.ts +22 -3
- package/dist/types/componentsCore.type.d.ts +7 -2
- package/package.json +3 -2
|
@@ -14,7 +14,6 @@ interface HeaderProps {
|
|
|
14
14
|
* Header component that renders a title and optional dynamic inputs.
|
|
15
15
|
*
|
|
16
16
|
* @param className - Additional class names for custom styling.
|
|
17
|
-
* @param title - Title text displayed as a Heading.
|
|
18
17
|
* @param theme - Visual theme for the header (light, dark, or auto).
|
|
19
18
|
* @param inputs - List of dynamic components to render inside the header.
|
|
20
19
|
* @returns A styled header component.
|
|
@@ -3,5 +3,6 @@ import Button from './button/Button';
|
|
|
3
3
|
import CodeEditor from './code-editor/CodeEditor';
|
|
4
4
|
import ContentWrapper from './content-wrapper/ContentWrapper';
|
|
5
5
|
import Header from './header/Header';
|
|
6
|
+
import Select from './select';
|
|
6
7
|
import TextField from './text-field/TextField';
|
|
7
|
-
export { Body, Button, CodeEditor, ContentWrapper, Header, TextField };
|
|
8
|
+
export { Body, Button, CodeEditor, ContentWrapper, Header, Select, TextField };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SelectNotFrontProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Extended props for NotFront Select component.
|
|
4
|
+
* Includes context identifiers for the userFlow and pageId.
|
|
5
|
+
*/
|
|
6
|
+
interface SelectPaginationNotFrontExtendedProps extends SelectNotFrontProps {
|
|
7
|
+
userFlow: string;
|
|
8
|
+
pageId: string;
|
|
9
|
+
}
|
|
10
|
+
declare const SelectPaginationNotFront: ({ userFlow, pageId, component, hash, responseKey, required, dataSource, actionType, ...otherProps }: SelectPaginationNotFrontExtendedProps) => JSX.Element;
|
|
11
|
+
export default SelectPaginationNotFront;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SelectNotFrontProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Extended props for NotFront Select component.
|
|
4
|
+
* Includes context identifiers for the userFlow and pageId.
|
|
5
|
+
*/
|
|
6
|
+
interface SelectSimpleNotFrontExtendedProps extends SelectNotFrontProps {
|
|
7
|
+
userFlow: string;
|
|
8
|
+
pageId: string;
|
|
9
|
+
}
|
|
10
|
+
declare const SelectSimpleNotFront: ({ userFlow, pageId, responseKey, dataSource, required, actionType, ...otherProps }: SelectSimpleNotFrontExtendedProps) => JSX.Element;
|
|
11
|
+
export default SelectSimpleNotFront;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SelectNotFrontProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Extended props for NotFront Select component.
|
|
4
|
+
* Includes context identifiers for the userFlow and pageId.
|
|
5
|
+
*/
|
|
6
|
+
interface SelectNotFrontExtendedProps extends SelectNotFrontProps {
|
|
7
|
+
userFlow: string;
|
|
8
|
+
pageId: string;
|
|
9
|
+
}
|
|
10
|
+
declare const SelectNotFront: (notFrontProps: SelectNotFrontExtendedProps) => JSX.Element;
|
|
11
|
+
export default SelectNotFront;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constructs a URL with pagination and search query parameters.
|
|
3
|
+
*
|
|
4
|
+
* @param baseUrl - The base URL of the data source.
|
|
5
|
+
* @param search - The search term to include as a query parameter.
|
|
6
|
+
* @param page - The current pagination page number.
|
|
7
|
+
* @returns A string with the full URL including query parameters.
|
|
8
|
+
*/
|
|
9
|
+
export declare const buildPaginatedURL: (baseUrl: string, search: string, page: number) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Extracts and transforms a list of options from a JSON response using JSONPath expressions.
|
|
12
|
+
*
|
|
13
|
+
* @param data - The response data object from the data source.
|
|
14
|
+
* @param jsonPathOptions - JSONPath expression to extract the list of option items.
|
|
15
|
+
* @param jsonPathLabel - JSONPath expression to extract the label.
|
|
16
|
+
* @param jsonPathValue - Optional JSONPath expression to extract the value.
|
|
17
|
+
* If not provided, the full item is used as the value.
|
|
18
|
+
* @returns An array of options formatted as `{ label, value }` objects.
|
|
19
|
+
*/
|
|
20
|
+
export declare const parseOptionsFromResponse: (data: any, jsonPathOptions: string, jsonPathLabel: string, jsonPathValue?: string) => any;
|
|
@@ -5,5 +5,6 @@ import { NotFrontDataSource } from '../types/componentsCore.type';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const useAction: () => {
|
|
7
7
|
getNextUI: (userFlow: string, pageId: string, entries: any, responseKey: string) => Promise<AxiosResponse<any, any>>;
|
|
8
|
+
fetchDataSource: (dataSource: NotFrontDataSource) => Promise<AxiosResponse<any, any> | undefined>;
|
|
8
9
|
fetchAndGetNextUI: (userFlow: string, pageId: string, entries: any, responseKey: string, dataSource: NotFrontDataSource) => Promise<AxiosResponse<any, any> | undefined>;
|
|
9
10
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._body_1crqw_1{padding:2rem 2.75rem}._body_content_1crqw_4{display:flex;flex-direction:column;gap:.75rem}._codeEditor_1viyo_1:not(:first-child){margin:1rem 0 0}._codeEditor_label_1viyo_4{color:var(--color-neutral-90);display:block;font-family:Roboto,sans-serif;font-size:.75rem;font-weight:700;line-height:.875rem;margin:0 0 .5rem}._codeEditor_input_1viyo_13{border-radius:.25rem;overflow:hidden;max-width:800px;border:1px solid var(--color-neutral-30)}._contentWrapper_12gyy_1{max-width:1440px}._contentWrapper_12gyy_1._contentWrapper__centered_12gyy_4{margin:0 auto}._header_1lcyj_1{padding:1.5rem 2.75rem;background-color:var(--color-gray-80)}._header_content_1lcyj_5{display:flex;flex-direction:column;gap:.75rem}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ButtonProps, CardNotificationProps, HeadingProps, TextFieldProps, TextProps } from '../../../avocado-suite';
|
|
2
|
-
import { NotFrontActionType, NotFrontBaseProps, NotFrontDataSource } from './componentsCore.type';
|
|
1
|
+
import { ButtonProps, CardNotificationProps, HeadingProps, SelectProps, TextFieldProps, TextProps } from '../../../avocado-suite';
|
|
2
|
+
import { NotFrontActionType, NotFrontBaseProps, NotFrontDataSource, NotFrontDataSourceSelect } from './componentsCore.type';
|
|
3
3
|
/**
|
|
4
4
|
* Interface for the props used in the ButtonNotFrontProps component.
|
|
5
5
|
*/
|
|
@@ -86,6 +86,24 @@ export interface HeadingNotFrontProps extends NotFrontBaseProps, HeadingProps {
|
|
|
86
86
|
*/
|
|
87
87
|
variant?: 'h1' | 'h2' | 'h3' | 'h4';
|
|
88
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Interface for the props used in the SelectNotFront component.
|
|
91
|
+
*/
|
|
92
|
+
export interface SelectNotFrontProps extends NotFrontBaseProps, SelectProps {
|
|
93
|
+
component: 'select';
|
|
94
|
+
/**
|
|
95
|
+
* Defines the action triggered when the option is selected.
|
|
96
|
+
*/
|
|
97
|
+
actionType: NotFrontActionType;
|
|
98
|
+
/**
|
|
99
|
+
* Optional data source used when involves fetching data.
|
|
100
|
+
*/
|
|
101
|
+
dataSource: NotFrontDataSourceSelect;
|
|
102
|
+
/**
|
|
103
|
+
* Indicates whether the component is mandatory.
|
|
104
|
+
*/
|
|
105
|
+
required: boolean;
|
|
106
|
+
}
|
|
89
107
|
/**
|
|
90
108
|
* Interface for the props used in the TextNotFront component.
|
|
91
109
|
*/
|
|
@@ -110,7 +128,7 @@ export interface TextFieldNotFrontProps extends NotFrontBaseProps, TextFieldProp
|
|
|
110
128
|
/**
|
|
111
129
|
* Union type representing all possible NotFront component prop types.
|
|
112
130
|
*/
|
|
113
|
-
export type NotFrontComponent = ButtonNotFrontProps | CardNotificationNotFrontProps | CodeEditorNotFrontProps | HeadingNotFrontProps | TextNotFrontProps | TextFieldNotFrontProps;
|
|
131
|
+
export type NotFrontComponent = ButtonNotFrontProps | CardNotificationNotFrontProps | CodeEditorNotFrontProps | HeadingNotFrontProps | SelectNotFrontProps | TextNotFrontProps | TextFieldNotFrontProps;
|
|
114
132
|
/**
|
|
115
133
|
* Mapping of component identifiers (as strings) to their corresponding prop types.
|
|
116
134
|
*/
|
|
@@ -119,6 +137,7 @@ export type NotFrontComponentTypeMap = {
|
|
|
119
137
|
cardNotification: CardNotificationNotFrontProps;
|
|
120
138
|
code: CodeEditorNotFrontProps;
|
|
121
139
|
heading: HeadingNotFrontProps;
|
|
140
|
+
select: SelectNotFrontProps;
|
|
122
141
|
text: TextNotFrontProps;
|
|
123
142
|
textField: TextFieldNotFrontProps;
|
|
124
143
|
};
|
|
@@ -2,9 +2,9 @@ export interface NotFrontBaseProps {
|
|
|
2
2
|
hash: string;
|
|
3
3
|
responseKey: string;
|
|
4
4
|
}
|
|
5
|
-
export type NotFrontActionType = 'GO_TO_NEXT_UI' | 'FETCH_AND_GO_TO_NEXT_UI' | 'REDIRECT';
|
|
5
|
+
export type NotFrontActionType = 'GO_TO_NEXT_UI' | 'FETCH_AND_GO_TO_NEXT_UI' | 'REDIRECT' | 'GET_DATA_SOURCE';
|
|
6
6
|
export type NotFrontRequestType = 'rest';
|
|
7
|
-
export type NotFrontRequestMethod = 'post';
|
|
7
|
+
export type NotFrontRequestMethod = 'post' | 'get';
|
|
8
8
|
export interface NotFrontDataSource {
|
|
9
9
|
data: any;
|
|
10
10
|
headers: any;
|
|
@@ -12,3 +12,8 @@ export interface NotFrontDataSource {
|
|
|
12
12
|
type: NotFrontRequestType;
|
|
13
13
|
url: string;
|
|
14
14
|
}
|
|
15
|
+
export interface NotFrontDataSourceSelect extends NotFrontDataSource {
|
|
16
|
+
jsonPathOptions: string;
|
|
17
|
+
jsonPathLabel: string;
|
|
18
|
+
jsonPathValue?: string;
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foris/avocado-not-front",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"@codemirror/lang-yaml": "6.1.2",
|
|
24
24
|
"@uiw/react-codemirror": "4.23.12",
|
|
25
25
|
"axios": "^1.8.4",
|
|
26
|
+
"jsonpath": "1.1.1",
|
|
26
27
|
"react": "18.2.0",
|
|
27
28
|
"react-dom": "18.2.0",
|
|
28
29
|
"react-select": "5.8.0",
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"zustand": "4.5.4",
|
|
31
32
|
"@foris/avocado-core": "0.10.0",
|
|
32
33
|
"@foris/avocado-icons": "1.13.0",
|
|
33
|
-
"@foris/avocado-suite": "0.32.
|
|
34
|
+
"@foris/avocado-suite": "0.32.1"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@testing-library/jest-dom": "6.4.0",
|