@foris/avocado-not-front 0.4.0 → 0.5.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 +26223 -7171
- package/dist/avocado-not-front.umd.js +115 -103
- package/dist/components/code-editor/CodeEditor.d.ts +11 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/hooks/useAction.d.ts +6 -1
- package/dist/style.css +1 -1
- package/dist/types/components.type.d.ts +46 -28
- package/dist/types/componentsCore.type.d.ts +14 -0
- package/package.json +5 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CodeEditorNotFrontProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Extended props for NotFront CodeEditor component.
|
|
4
|
+
* Includes context identifiers for the userFlow and pageId.
|
|
5
|
+
*/
|
|
6
|
+
interface CodeEditorNotFrontExtendedProps extends CodeEditorNotFrontProps {
|
|
7
|
+
userFlow: string;
|
|
8
|
+
pageId: string;
|
|
9
|
+
}
|
|
10
|
+
declare const CodeEditorNotFront: (notFrontProps: CodeEditorNotFrontExtendedProps) => JSX.Element;
|
|
11
|
+
export default CodeEditorNotFront;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Body from './body/Body';
|
|
2
2
|
import Button from './button/Button';
|
|
3
|
+
import CodeEditor from './code-editor/CodeEditor';
|
|
3
4
|
import ContentWrapper from './content-wrapper/ContentWrapper';
|
|
4
5
|
import Header from './header/Header';
|
|
5
6
|
import TextField from './text-field/TextField';
|
|
6
|
-
export { Body, Button, ContentWrapper, Header, TextField };
|
|
7
|
+
export { Body, Button, CodeEditor, ContentWrapper, Header, TextField };
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { NotFrontDataSource } from '../types/componentsCore.type';
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook that encapsulates actions related to navigation and data fetching for dynamic UI flows.
|
|
5
|
+
*/
|
|
2
6
|
export declare const useAction: () => {
|
|
3
|
-
getNextUI: (userFlow: string, pageId: string,
|
|
7
|
+
getNextUI: (userFlow: string, pageId: string, entries: any, responseKey: string) => Promise<AxiosResponse<any, any>>;
|
|
8
|
+
fetchAndGetNextUI: (userFlow: string, pageId: string, entries: any, responseKey: string, dataSource: NotFrontDataSource) => Promise<AxiosResponse<any, any> | undefined>;
|
|
4
9
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._contentWrapper_12gyy_1{max-width:1440px}._contentWrapper_12gyy_1._contentWrapper__centered_12gyy_4{margin:0 auto}._body_content_2k94c_1{padding:2rem 2.75rem}._header_19ove_1{padding:1.5rem 2.75rem;background-color:var(--color-gray-80)}._header_content_19ove_5{display:grid;grid-template-columns:1fr auto;gap:.5rem}._header_content_19ove_5 ._contentLeft_19ove_10{display:flex;flex-direction:column;gap:1.5rem}._header_content_19ove_5 ._contentLeft_19ove_10 ._title_19ove_15{color:var(--color-gray-00)}@media screen and (max-width: 992px){._header_19ove_1{padding:1rem 1.5rem}._header_content_19ove_5 ._contentLeft_19ove_10{gap:2.75rem}._header_content_19ove_5 ._contentLeft_19ove_10 ._title_19ove_15{font-size:1.375rem}}
|
|
1
|
+
._contentWrapper_12gyy_1{max-width:1440px}._contentWrapper_12gyy_1._contentWrapper__centered_12gyy_4{margin:0 auto}._body_content_2k94c_1{padding:2rem 2.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)}._header_19ove_1{padding:1.5rem 2.75rem;background-color:var(--color-gray-80)}._header_content_19ove_5{display:grid;grid-template-columns:1fr auto;gap:.5rem}._header_content_19ove_5 ._contentLeft_19ove_10{display:flex;flex-direction:column;gap:1.5rem}._header_content_19ove_5 ._contentLeft_19ove_10 ._title_19ove_15{color:var(--color-gray-00)}@media screen and (max-width: 992px){._header_19ove_1{padding:1rem 1.5rem}._header_content_19ove_5 ._contentLeft_19ove_10{gap:2.75rem}._header_content_19ove_5 ._contentLeft_19ove_10 ._title_19ove_15{font-size:1.375rem}}
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import { ButtonProps, CardNotificationProps, HeadingProps, TextFieldProps, TextProps } from '../../../avocado-suite';
|
|
2
|
-
|
|
3
|
-
hash: string;
|
|
4
|
-
responseKey: string;
|
|
5
|
-
}
|
|
6
|
-
export type NotFrontActionType = 'GO_TO_NEXT_UI' | 'FETCH_AND_GO_TO_NEXT_UI' | 'REDIRECT';
|
|
2
|
+
import { NotFrontActionType, NotFrontBaseProps, NotFrontDataSource } from './componentsCore.type';
|
|
7
3
|
/**
|
|
8
4
|
* Interface for the props used in the ButtonNotFrontProps component.
|
|
9
|
-
* Extends the base ButtonProps from the Avocado Suite library and
|
|
10
|
-
* the NotFrontBaseProps interface, adding specific properties for dynamic buttons.
|
|
11
5
|
*/
|
|
12
6
|
export interface ButtonNotFrontProps extends NotFrontBaseProps, ButtonProps {
|
|
13
7
|
component: 'button';
|
|
8
|
+
/**
|
|
9
|
+
* Defines the action triggered when the button is clicked.
|
|
10
|
+
*/
|
|
14
11
|
actionType: NotFrontActionType;
|
|
15
12
|
/**
|
|
16
|
-
* The content
|
|
13
|
+
* The content inside the Button component.
|
|
17
14
|
*/
|
|
18
|
-
content
|
|
15
|
+
content?: string;
|
|
19
16
|
/**
|
|
20
17
|
* @deprecated Use `content` instead.
|
|
21
|
-
*
|
|
22
|
-
* Currently kept for backward compatibility with existing implementations.
|
|
18
|
+
* Retained for backward compatibility with legacy backend responses.
|
|
23
19
|
*/
|
|
24
20
|
label?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Optional data source used when the actionType involves fetching data.
|
|
23
|
+
*/
|
|
24
|
+
dataSource: NotFrontDataSource;
|
|
25
|
+
/**
|
|
26
|
+
* Optional URL to redirect the user.
|
|
27
|
+
*/
|
|
28
|
+
redirectUrl: string;
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
27
31
|
* Interface for the props used in the CardNotificationNotFront component.
|
|
28
|
-
* Extends the base CardNotificationProps from the Avocado Suite library and
|
|
29
|
-
* the NotFrontBaseProps interface, adding specific properties for dynamic card notifications.
|
|
30
32
|
*/
|
|
31
33
|
export interface CardNotificationNotFrontProps extends NotFrontBaseProps, CardNotificationProps {
|
|
32
34
|
component: 'cardNotification';
|
|
@@ -42,10 +44,34 @@ export interface CardNotificationNotFrontProps extends NotFrontBaseProps, CardNo
|
|
|
42
44
|
*/
|
|
43
45
|
description?: string;
|
|
44
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Interface for the props used in the CodeEditorNotFront component.
|
|
49
|
+
*/
|
|
50
|
+
export interface CodeEditorNotFrontProps extends NotFrontBaseProps {
|
|
51
|
+
component: 'code';
|
|
52
|
+
/**
|
|
53
|
+
* The label shown above the code editor input.
|
|
54
|
+
*/
|
|
55
|
+
label: string;
|
|
56
|
+
/**
|
|
57
|
+
* Initial or current value of the code editor. Could be string or parsed object.
|
|
58
|
+
*/
|
|
59
|
+
value: any;
|
|
60
|
+
/**
|
|
61
|
+
* Placeholder text displayed when the editor is empty.
|
|
62
|
+
*/
|
|
63
|
+
placeholder: string;
|
|
64
|
+
/**
|
|
65
|
+
* Indicates whether the code editor input is mandatory.
|
|
66
|
+
*/
|
|
67
|
+
required: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Programming language for syntax highlighting (e.g., 'yaml', 'json', 'sql').
|
|
70
|
+
*/
|
|
71
|
+
language: string;
|
|
72
|
+
}
|
|
45
73
|
/**
|
|
46
74
|
* Interface for the props used in the HeadingNotFront component.
|
|
47
|
-
* Extends the basic HeadingProps from the Avocado Suite library and the NotFrontBaseProps interface,
|
|
48
|
-
* adding custom properties specific to the NotFront dynamic heading components.
|
|
49
75
|
*/
|
|
50
76
|
export interface HeadingNotFrontProps extends NotFrontBaseProps, HeadingProps {
|
|
51
77
|
component: 'heading';
|
|
@@ -57,18 +83,11 @@ export interface HeadingNotFrontProps extends NotFrontBaseProps, HeadingProps {
|
|
|
57
83
|
/**
|
|
58
84
|
* The visual and semantic variant of the heading.
|
|
59
85
|
* Defines the HTML tag and appearance of the heading element.
|
|
60
|
-
*
|
|
61
|
-
* Possible values:
|
|
62
|
-
* - 'h1'
|
|
63
|
-
* - 'h2'
|
|
64
|
-
* - 'h3'
|
|
65
|
-
* - 'h4'
|
|
66
86
|
*/
|
|
67
87
|
variant?: 'h1' | 'h2' | 'h3' | 'h4';
|
|
68
88
|
}
|
|
69
89
|
/**
|
|
70
90
|
* Interface for the props used in the TextNotFront component.
|
|
71
|
-
* Extends the basic TextProps from the Avocado Suite library, with a required `content` property.
|
|
72
91
|
*/
|
|
73
92
|
export interface TextNotFrontProps extends NotFrontBaseProps, TextProps {
|
|
74
93
|
component: 'text';
|
|
@@ -80,26 +99,25 @@ export interface TextNotFrontProps extends NotFrontBaseProps, TextProps {
|
|
|
80
99
|
}
|
|
81
100
|
/**
|
|
82
101
|
* Interface for the props used in the TextFieldNotFront component.
|
|
83
|
-
* Extends the basic TextProps from the Avocado Suite library, with a required `content` property.
|
|
84
102
|
*/
|
|
85
103
|
export interface TextFieldNotFrontProps extends NotFrontBaseProps, TextFieldProps {
|
|
86
104
|
component: 'textField';
|
|
105
|
+
/**
|
|
106
|
+
* Indicates whether the code editor input is mandatory.
|
|
107
|
+
*/
|
|
87
108
|
required: boolean;
|
|
88
109
|
}
|
|
89
110
|
/**
|
|
90
111
|
* Union type representing all possible NotFront component prop types.
|
|
91
|
-
*
|
|
92
|
-
* Used to type individual components rendered from a configuration-based schema.
|
|
93
112
|
*/
|
|
94
|
-
export type NotFrontComponent = ButtonNotFrontProps | CardNotificationNotFrontProps | HeadingNotFrontProps | TextNotFrontProps | TextFieldNotFrontProps;
|
|
113
|
+
export type NotFrontComponent = ButtonNotFrontProps | CardNotificationNotFrontProps | CodeEditorNotFrontProps | HeadingNotFrontProps | TextNotFrontProps | TextFieldNotFrontProps;
|
|
95
114
|
/**
|
|
96
115
|
* Mapping of component identifiers (as strings) to their corresponding prop types.
|
|
97
|
-
*
|
|
98
|
-
* Used for dynamic component rendering based on type-safe lookups.
|
|
99
116
|
*/
|
|
100
117
|
export type NotFrontComponentTypeMap = {
|
|
101
118
|
button: ButtonNotFrontProps;
|
|
102
119
|
cardNotification: CardNotificationNotFrontProps;
|
|
120
|
+
code: CodeEditorNotFrontProps;
|
|
103
121
|
heading: HeadingNotFrontProps;
|
|
104
122
|
text: TextNotFrontProps;
|
|
105
123
|
textField: TextFieldNotFrontProps;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface NotFrontBaseProps {
|
|
2
|
+
hash: string;
|
|
3
|
+
responseKey: string;
|
|
4
|
+
}
|
|
5
|
+
export type NotFrontActionType = 'GO_TO_NEXT_UI' | 'FETCH_AND_GO_TO_NEXT_UI' | 'REDIRECT';
|
|
6
|
+
export type NotFrontRequestType = 'rest';
|
|
7
|
+
export type NotFrontRequestMethod = 'post';
|
|
8
|
+
export interface NotFrontDataSource {
|
|
9
|
+
data: any;
|
|
10
|
+
headers: any;
|
|
11
|
+
method: NotFrontRequestMethod;
|
|
12
|
+
type: NotFrontRequestType;
|
|
13
|
+
url: string;
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foris/avocado-not-front",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
+
"@codemirror/lang-json": "6.0.1",
|
|
22
|
+
"@codemirror/lang-sql": "6.8.0",
|
|
23
|
+
"@codemirror/lang-yaml": "6.1.2",
|
|
24
|
+
"@uiw/react-codemirror": "4.23.12",
|
|
21
25
|
"axios": "^1.8.4",
|
|
22
26
|
"react": "18.2.0",
|
|
23
27
|
"react-dom": "18.2.0",
|