@foris/avocado-not-front 0.2.1 → 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 +26545 -5191
- package/dist/avocado-not-front.umd.js +132 -95
- package/dist/components/body/Body.d.ts +13 -0
- package/dist/components/button/Button.d.ts +11 -0
- package/dist/components/code-editor/CodeEditor.d.ts +11 -0
- package/dist/components/content-wrapper/ContentWrapper.d.ts +16 -0
- package/dist/components/content-wrapper/index.d.ts +2 -0
- package/dist/components/header/Header.d.ts +23 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/components/text-field/TextField.d.ts +19 -0
- package/dist/hooks/builder/useBuildComponentsList.d.ts +11 -0
- package/dist/hooks/builder/useBuilder.d.ts +12 -0
- package/dist/hooks/builder/usePage.d.ts +9 -0
- package/dist/hooks/components/useCardNotification.d.ts +8 -0
- package/dist/hooks/components/useHeading.d.ts +8 -0
- package/dist/hooks/components/useText.d.ts +8 -0
- package/dist/hooks/index.d.ts +5 -4
- package/dist/hooks/useAction.d.ts +9 -0
- package/dist/services/axios/axiosServices.d.ts +21 -0
- package/dist/services/axios/useFetchAndLoad.d.ts +10 -0
- package/dist/services/not-front/nextUIService.d.ts +3 -0
- package/dist/store/useStore.d.ts +24 -0
- package/dist/style.css +1 -0
- package/dist/types/builder.type.d.ts +78 -0
- package/dist/types/components.type.d.ts +108 -7
- package/dist/types/componentsCore.type.d.ts +14 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +12 -3
- package/dist/hooks/useCardNotification.d.ts +0 -8
- package/dist/hooks/useHeading.d.ts +0 -8
- package/dist/hooks/useText.d.ts +0 -10
- package/dist/types/cardNotification.type.d.ts +0 -8
- package/dist/types/heading.type.d.ts +0 -5
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
import type { ObjectNotFront } from '../../types';
|
|
3
|
+
interface BodyProps extends ObjectNotFront {
|
|
4
|
+
inputs: ReactNode[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Body component that renders a list of dynamic components inside a section.
|
|
8
|
+
*
|
|
9
|
+
* @param props - Props containing inputs (renderable components) and other page data.
|
|
10
|
+
* @returns JSX Element representing the body of the page.
|
|
11
|
+
*/
|
|
12
|
+
declare const Body: FC<BodyProps>;
|
|
13
|
+
export default Body;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ButtonNotFrontProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Extended props for NotFront Button component.
|
|
4
|
+
* Includes context identifiers for the userFlow and pageId.
|
|
5
|
+
*/
|
|
6
|
+
interface ButtonNotFrontExtendedProps extends ButtonNotFrontProps {
|
|
7
|
+
userFlow: string;
|
|
8
|
+
pageId: string;
|
|
9
|
+
}
|
|
10
|
+
declare const ButtonNotFront: (notFrontProps: ButtonNotFrontExtendedProps) => JSX.Element;
|
|
11
|
+
export default ButtonNotFront;
|
|
@@ -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;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
interface ContentWrapperProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
isCentered?: boolean;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Generic content wrapper to provide consistent layout styling.
|
|
9
|
+
*
|
|
10
|
+
* @param className - Additional class names for custom styling.
|
|
11
|
+
* @param isCentered - Whether to center the content horizontally (default: true).
|
|
12
|
+
* @param children - The content to render inside the wrapper.
|
|
13
|
+
* @returns A styled div wrapping the provided children.
|
|
14
|
+
*/
|
|
15
|
+
declare const ContentWrapper: FC<ContentWrapperProps>;
|
|
16
|
+
export default ContentWrapper;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
interface HeaderProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
/**
|
|
5
|
+
* The theme of the Header. Can be 'light', 'dark', or 'auto'.
|
|
6
|
+
* Defaults to 'dark'.
|
|
7
|
+
* This indicates if the Header should react to the theme switch ('auto') or should be always light or dark.
|
|
8
|
+
*/
|
|
9
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
10
|
+
title?: string;
|
|
11
|
+
inputs?: ReactNode[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Header component that renders a title and optional dynamic inputs.
|
|
15
|
+
*
|
|
16
|
+
* @param className - Additional class names for custom styling.
|
|
17
|
+
* @param title - Title text displayed as a Heading.
|
|
18
|
+
* @param theme - Visual theme for the header (light, dark, or auto).
|
|
19
|
+
* @param inputs - List of dynamic components to render inside the header.
|
|
20
|
+
* @returns A styled header component.
|
|
21
|
+
*/
|
|
22
|
+
declare const Header: FC<HeaderProps>;
|
|
23
|
+
export default Header;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Body from './body/Body';
|
|
2
|
+
import Button from './button/Button';
|
|
3
|
+
import CodeEditor from './code-editor/CodeEditor';
|
|
4
|
+
import ContentWrapper from './content-wrapper/ContentWrapper';
|
|
5
|
+
import Header from './header/Header';
|
|
6
|
+
import TextField from './text-field/TextField';
|
|
7
|
+
export { Body, Button, CodeEditor, ContentWrapper, Header, TextField };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TextFieldNotFrontProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Extended props for NotFront TextField component.
|
|
4
|
+
* Includes context identifiers for the userFlow and pageId.
|
|
5
|
+
*/
|
|
6
|
+
interface TextFieldNotFrontExtendedProps extends TextFieldNotFrontProps {
|
|
7
|
+
userFlow: string;
|
|
8
|
+
pageId: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Renders a text field connected to the NotFront store.
|
|
12
|
+
*
|
|
13
|
+
* - Tracks local state.
|
|
14
|
+
* - Appends an asterisk to the label if the field is required.
|
|
15
|
+
* - On change, updates the store (`updateEntries`) for a specific userFlow and pageId.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
declare const TextFieldNotFront: (notFrontProps: TextFieldNotFrontExtendedProps) => JSX.Element;
|
|
19
|
+
export default TextFieldNotFront;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NotFrontComponent } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook that maps a list of NotFront component definitions to rendered React components.
|
|
4
|
+
*
|
|
5
|
+
* @param userFlow - The current user flow identifier.
|
|
6
|
+
* @param pageId - The current page identifier.
|
|
7
|
+
* @param components - An array of NotFront component configuration objects.
|
|
8
|
+
* @returns A list of rendered components or nulls for unrecognized types.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useBuildComponentsList: (userFlow: string, pageId: string, components: NotFrontComponent[] | null) => (JSX.Element | null)[] | undefined;
|
|
11
|
+
export default useBuildComponentsList;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ObjectNotFront } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook that builds and returns a layout component (`Body` or `Header`)
|
|
4
|
+
* populated with dynamically rendered child components based on configuration.
|
|
5
|
+
*
|
|
6
|
+
* @param userFlow - The current user flow identifier.
|
|
7
|
+
* @param pageId - The current page identifier.
|
|
8
|
+
* @param type - Indicates whether to render a 'body' or 'header' layout.
|
|
9
|
+
* @param notFrontObject - The configuration object containing component data.
|
|
10
|
+
* @returns A rendered Header or Body component with its child components or null if the type is unrecognized.
|
|
11
|
+
*/
|
|
12
|
+
export declare const useBuilder: (userFlow: string, pageId: string, type: 'body' | 'header', notFrontObject: ObjectNotFront | null) => JSX.Element | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ApiConfig, Page } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook to manage page rendering based on API or provided JSON configuration.
|
|
4
|
+
*
|
|
5
|
+
* @param apiConfig - API configuration object.
|
|
6
|
+
* @param jsonPage - Optional page configuration object.
|
|
7
|
+
* @returns JSX content to render the page (header and body).
|
|
8
|
+
*/
|
|
9
|
+
export declare const usePage: (userFlow: string, apiConfig: ApiConfig, jsonPage?: Page | null) => JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CardNotificationNotFrontProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Function to create a CardNotification component based on a configuration object.
|
|
4
|
+
*
|
|
5
|
+
* @param json - The CardNotification configuration object.
|
|
6
|
+
* @returns A CardNotification component or null if input is invalid.
|
|
7
|
+
*/
|
|
8
|
+
export declare const cardNotification: (json: CardNotificationNotFrontProps) => JSX.Element | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HeadingNotFrontProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Function to create a Heading component based on a configuration object.
|
|
4
|
+
*
|
|
5
|
+
* @param json - The Heading configuration object.
|
|
6
|
+
* @returns A Heading component or null if invalid input.
|
|
7
|
+
*/
|
|
8
|
+
export declare const heading: (json: HeadingNotFrontProps) => JSX.Element | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TextNotFrontProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Function to create a Text component based on a configuration object.
|
|
4
|
+
*
|
|
5
|
+
* @param json - The Text configuration object.
|
|
6
|
+
* @returns A Text component or null if input is invalid.
|
|
7
|
+
*/
|
|
8
|
+
export declare const text: (json: TextNotFrontProps) => JSX.Element | null;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { cardNotification } from './components/useCardNotification';
|
|
2
|
+
import { heading } from './components/useHeading';
|
|
3
|
+
import { text } from './components/useText';
|
|
4
|
+
import { usePage } from './builder/usePage';
|
|
5
|
+
export { cardNotification, heading, text, usePage };
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
*/
|
|
6
|
+
export declare const useAction: () => {
|
|
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>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AxiosCall } from './useFetchAndLoad';
|
|
2
|
+
export declare const loadAbort: () => AbortController;
|
|
3
|
+
/**
|
|
4
|
+
* Axios Get
|
|
5
|
+
* @param api
|
|
6
|
+
* @param headers
|
|
7
|
+
* @param params
|
|
8
|
+
* @param abort
|
|
9
|
+
* @returns {call, controller }
|
|
10
|
+
*/
|
|
11
|
+
export declare const get: <T>(api: string, headers?: {}, params?: {}, abort?: boolean) => AxiosCall<T>;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param api
|
|
15
|
+
* @param headers
|
|
16
|
+
* @param data
|
|
17
|
+
* @param params
|
|
18
|
+
* @param abort
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare const post: <T>(api: string, headers?: {}, data?: {}, params?: {}, abort?: boolean) => AxiosCall<T>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AxiosResponse } from 'axios';
|
|
2
|
+
export interface AxiosCall<T> {
|
|
3
|
+
call: Promise<AxiosResponse<T>>;
|
|
4
|
+
controller?: AbortController;
|
|
5
|
+
}
|
|
6
|
+
declare const useFetchAndLoad: () => {
|
|
7
|
+
callEndpoint: (axiosCall: AxiosCall<any>) => Promise<AxiosResponse<any, any>>;
|
|
8
|
+
cancelEndpoint: () => void;
|
|
9
|
+
};
|
|
10
|
+
export default useFetchAndLoad;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ApiConfig, Page } from '../types/builder.type';
|
|
2
|
+
export type NotFrontStore = Record<string, UserFlow>;
|
|
3
|
+
export type PageStore = {
|
|
4
|
+
page?: Page | null;
|
|
5
|
+
};
|
|
6
|
+
export type UserFlow = {
|
|
7
|
+
apiConfig: ApiConfig;
|
|
8
|
+
currentPageId: string;
|
|
9
|
+
entries?: {};
|
|
10
|
+
pages: Record<string, PageStore>;
|
|
11
|
+
};
|
|
12
|
+
export declare const useStore: import("zustand").UseBoundStore<import("zustand").StoreApi<NotFrontStore>>;
|
|
13
|
+
export declare const setNotFrontStore: (userFlowId: string, pageId: string, apiConfig: ApiConfig, page: Page | null) => void;
|
|
14
|
+
export declare const setPage: (userFlow: string, page: Page) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Updates the `entries` object of a specific userFlow in the store.
|
|
17
|
+
*
|
|
18
|
+
* - Merges the provided `partial` object into the existing entries.
|
|
19
|
+
* - Preserves all other data in the store (immutably).
|
|
20
|
+
*
|
|
21
|
+
* @param userFlow - The identifier for the current userFlow (e.g., 'piper-editor').
|
|
22
|
+
* @param partial - A key-value map of new form entries to merge into the existing `entries` object.
|
|
23
|
+
*/
|
|
24
|
+
export declare const updateEntries: (userFlow: string, partial: Record<string, any>) => void;
|
package/dist/style.css
ADDED
|
@@ -0,0 +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}._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}}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { NotFrontComponent } from './components.type';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for the configuration required to interact with the API.
|
|
4
|
+
* This interface includes the necessary details for the API connection.
|
|
5
|
+
*/
|
|
6
|
+
export interface ApiConfig {
|
|
7
|
+
/**
|
|
8
|
+
* The base URL or endpoint of the API.
|
|
9
|
+
* Specifies where the API requests should be sent.
|
|
10
|
+
*/
|
|
11
|
+
api: string;
|
|
12
|
+
/**
|
|
13
|
+
* The headers to be used in the API requests.
|
|
14
|
+
* Typically contains authentication and content type details.
|
|
15
|
+
*/
|
|
16
|
+
headers: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Type definition for the page type. Determines if the page is a simple page or a form.
|
|
20
|
+
*/
|
|
21
|
+
export type TypePage = 'page' | 'form';
|
|
22
|
+
/**
|
|
23
|
+
* Interface for the object that holds components and related properties for a NotFront page.
|
|
24
|
+
* Represents a section of the page such as a header or body with its associated components.
|
|
25
|
+
*/
|
|
26
|
+
export interface ObjectNotFront {
|
|
27
|
+
/**
|
|
28
|
+
* A list of components to be rendered in this section.
|
|
29
|
+
* This is an optional property, as a section may not always contain components.
|
|
30
|
+
*/
|
|
31
|
+
components?: NotFrontComponent[];
|
|
32
|
+
/**
|
|
33
|
+
* A unique identifier or hash for the object.
|
|
34
|
+
* Typically used for caching or reference purposes.
|
|
35
|
+
*/
|
|
36
|
+
hash?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The title of the section, displayed at the top of the component.
|
|
39
|
+
* This property is optional and can be used for section identification.
|
|
40
|
+
*/
|
|
41
|
+
title?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The type of the page section, either a simple page or a form.
|
|
44
|
+
* This is an optional property and helps define the structure of the content.
|
|
45
|
+
*/
|
|
46
|
+
type?: TypePage;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Interface for the page data used in the NotFront system.
|
|
50
|
+
* Contains a collection of components, a hash for caching, a title, and optional header and body objects.
|
|
51
|
+
*/
|
|
52
|
+
export interface Page {
|
|
53
|
+
/**
|
|
54
|
+
* A collection of components to be rendered in the page.
|
|
55
|
+
* These components make up the structure of the page content.
|
|
56
|
+
*/
|
|
57
|
+
components: any;
|
|
58
|
+
/**
|
|
59
|
+
* A unique identifier or hash for the page.
|
|
60
|
+
* Used for caching and page state management.
|
|
61
|
+
*/
|
|
62
|
+
hash: string;
|
|
63
|
+
/**
|
|
64
|
+
* The title of the page, displayed as the main header.
|
|
65
|
+
* This is typically used for the page's title in the browser.
|
|
66
|
+
*/
|
|
67
|
+
title: string;
|
|
68
|
+
/**
|
|
69
|
+
* An optional header object containing its components and properties.
|
|
70
|
+
* If not provided, the page will not render a header section.
|
|
71
|
+
*/
|
|
72
|
+
header?: ObjectNotFront | null;
|
|
73
|
+
/**
|
|
74
|
+
* An optional body object containing its components and properties.
|
|
75
|
+
* If not provided, the page will not render a body section.
|
|
76
|
+
*/
|
|
77
|
+
body?: ObjectNotFront | null;
|
|
78
|
+
}
|
|
@@ -1,23 +1,124 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ButtonProps, CardNotificationProps, HeadingProps, TextFieldProps, TextProps } from '../../../avocado-suite';
|
|
2
|
+
import { NotFrontActionType, NotFrontBaseProps, NotFrontDataSource } from './componentsCore.type';
|
|
3
|
+
/**
|
|
4
|
+
* Interface for the props used in the ButtonNotFrontProps component.
|
|
5
|
+
*/
|
|
6
|
+
export interface ButtonNotFrontProps extends NotFrontBaseProps, ButtonProps {
|
|
7
|
+
component: 'button';
|
|
3
8
|
/**
|
|
4
|
-
*
|
|
9
|
+
* Defines the action triggered when the button is clicked.
|
|
10
|
+
*/
|
|
11
|
+
actionType: NotFrontActionType;
|
|
12
|
+
/**
|
|
13
|
+
* The content inside the Button component.
|
|
14
|
+
*/
|
|
15
|
+
content?: string;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use `content` instead.
|
|
18
|
+
* Retained for backward compatibility with legacy backend responses.
|
|
19
|
+
*/
|
|
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;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Interface for the props used in the CardNotificationNotFront component.
|
|
32
|
+
*/
|
|
33
|
+
export interface CardNotificationNotFrontProps extends NotFrontBaseProps, CardNotificationProps {
|
|
34
|
+
component: 'cardNotification';
|
|
35
|
+
/**
|
|
36
|
+
* The content to be displayed inside the CardNotification component.
|
|
37
|
+
* This property is optional and represents the main text or message of the notification.
|
|
5
38
|
*/
|
|
6
|
-
description?: string;
|
|
7
39
|
content?: string;
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Use `content` instead.
|
|
42
|
+
* This property will be removed in the future once the backend stops sending it.
|
|
43
|
+
* Currently kept for backward compatibility with existing implementations.
|
|
44
|
+
*/
|
|
45
|
+
description?: string;
|
|
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;
|
|
8
72
|
}
|
|
9
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Interface for the props used in the HeadingNotFront component.
|
|
75
|
+
*/
|
|
76
|
+
export interface HeadingNotFrontProps extends NotFrontBaseProps, HeadingProps {
|
|
77
|
+
component: 'heading';
|
|
78
|
+
/**
|
|
79
|
+
* The content to be displayed inside the Heading component.
|
|
80
|
+
* This property is optional and represents the text or content shown in the heading.
|
|
81
|
+
*/
|
|
10
82
|
content?: string;
|
|
83
|
+
/**
|
|
84
|
+
* The visual and semantic variant of the heading.
|
|
85
|
+
* Defines the HTML tag and appearance of the heading element.
|
|
86
|
+
*/
|
|
11
87
|
variant?: 'h1' | 'h2' | 'h3' | 'h4';
|
|
12
88
|
}
|
|
13
89
|
/**
|
|
14
90
|
* Interface for the props used in the TextNotFront component.
|
|
15
|
-
* Extends the basic TextProps interface, with a required `content` property.
|
|
16
91
|
*/
|
|
17
|
-
export interface TextNotFrontProps extends TextProps {
|
|
92
|
+
export interface TextNotFrontProps extends NotFrontBaseProps, TextProps {
|
|
93
|
+
component: 'text';
|
|
18
94
|
/**
|
|
19
95
|
* The content to be displayed in the component.
|
|
20
96
|
* This property is required and will define the text shown in the component.
|
|
21
97
|
*/
|
|
22
98
|
content: string;
|
|
23
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Interface for the props used in the TextFieldNotFront component.
|
|
102
|
+
*/
|
|
103
|
+
export interface TextFieldNotFrontProps extends NotFrontBaseProps, TextFieldProps {
|
|
104
|
+
component: 'textField';
|
|
105
|
+
/**
|
|
106
|
+
* Indicates whether the code editor input is mandatory.
|
|
107
|
+
*/
|
|
108
|
+
required: boolean;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Union type representing all possible NotFront component prop types.
|
|
112
|
+
*/
|
|
113
|
+
export type NotFrontComponent = ButtonNotFrontProps | CardNotificationNotFrontProps | CodeEditorNotFrontProps | HeadingNotFrontProps | TextNotFrontProps | TextFieldNotFrontProps;
|
|
114
|
+
/**
|
|
115
|
+
* Mapping of component identifiers (as strings) to their corresponding prop types.
|
|
116
|
+
*/
|
|
117
|
+
export type NotFrontComponentTypeMap = {
|
|
118
|
+
button: ButtonNotFrontProps;
|
|
119
|
+
cardNotification: CardNotificationNotFrontProps;
|
|
120
|
+
code: CodeEditorNotFrontProps;
|
|
121
|
+
heading: HeadingNotFrontProps;
|
|
122
|
+
text: TextNotFrontProps;
|
|
123
|
+
textField: TextFieldNotFrontProps;
|
|
124
|
+
};
|
|
@@ -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/dist/types/index.d.ts
CHANGED
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,13 +18,19 @@
|
|
|
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",
|
|
25
|
+
"axios": "^1.8.4",
|
|
21
26
|
"react": "18.2.0",
|
|
22
27
|
"react-dom": "18.2.0",
|
|
23
28
|
"react-select": "5.8.0",
|
|
24
29
|
"react-select-async-paginate": "0.7.3",
|
|
30
|
+
"zustand": "4.5.4",
|
|
25
31
|
"@foris/avocado-core": "0.10.0",
|
|
26
32
|
"@foris/avocado-icons": "1.13.0",
|
|
27
|
-
"@foris/avocado-suite": "0.
|
|
33
|
+
"@foris/avocado-suite": "0.32.0"
|
|
28
34
|
},
|
|
29
35
|
"devDependencies": {
|
|
30
36
|
"@testing-library/jest-dom": "6.4.0",
|
|
@@ -38,6 +44,7 @@
|
|
|
38
44
|
"classnames": "2.3.2",
|
|
39
45
|
"jsdom": "24.0.0",
|
|
40
46
|
"sass": "1.62.1",
|
|
47
|
+
"stubby": "^5.1.0",
|
|
41
48
|
"typescript": "5.1.3",
|
|
42
49
|
"vite": "5.0.12",
|
|
43
50
|
"vite-plugin-dts": "3.7.1",
|
|
@@ -48,6 +55,8 @@
|
|
|
48
55
|
"react-select-async-paginate": "0.7.3"
|
|
49
56
|
},
|
|
50
57
|
"scripts": {
|
|
51
|
-
"build": "tsc && vite build"
|
|
58
|
+
"build": "tsc && vite build",
|
|
59
|
+
"start:stubby": "stubby -d src/services/stubs/stubby-config.yml -w -s 8200 -q",
|
|
60
|
+
"start:stubby-examples": "stubby -d src/services/stubs/stubby-examples.yml -w -s 8300 -q"
|
|
52
61
|
}
|
|
53
62
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CardNotificationNotFrontProps } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Custom hook to create a CardNotification component
|
|
4
|
-
* @returns { createCardNotification }
|
|
5
|
-
*/
|
|
6
|
-
export declare const useCardNotification: () => {
|
|
7
|
-
createCardNotification: (json: CardNotificationNotFrontProps) => JSX.Element | null;
|
|
8
|
-
};
|
package/dist/hooks/useText.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { TextNotFrontProps } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Custom hook that creates a Text component.
|
|
4
|
-
* This hook takes in the `TextNotFrontProps` and returns a Text component with the specified properties.
|
|
5
|
-
*
|
|
6
|
-
* @returns {Object} Returns an object containing the `createText` function.
|
|
7
|
-
*/
|
|
8
|
-
export declare const useText: () => {
|
|
9
|
-
createText: (json: TextNotFrontProps) => JSX.Element | null;
|
|
10
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CardNotificationProps } from '../../../avocado-suite';
|
|
2
|
-
export interface CardNotificationNotFrontProps extends CardNotificationProps {
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated Use `content` instead. This property will be removed in the future.
|
|
5
|
-
*/
|
|
6
|
-
description?: string;
|
|
7
|
-
content?: string;
|
|
8
|
-
}
|