@foris/avocado-not-front 0.14.0 → 0.16.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.
@@ -4,14 +4,14 @@ import Button from './button/Button';
4
4
  import CardNotification from './card-notification/CardNotification';
5
5
  import Checkbox from './checkbox/Checkbox';
6
6
  import CodeEditor from './code-editor/CodeEditor';
7
- import ComponentList from './component-list/ComponentList';
8
7
  import ContentWrapper from './content-wrapper/ContentWrapper';
9
8
  import Divider from './divider/Divider';
10
9
  import Header from './header/Header';
10
+ import OverlayRenderer from './overlay-renderer/OverlayRenderer';
11
11
  import RoundButton from './round-button/RoundButton';
12
12
  import Select from './select';
13
13
  import Switch from './switch/Switch';
14
14
  import Table from './table/Table';
15
15
  import TextField from './text-field/TextField';
16
16
  import Toast from './toast/Toast';
17
- export { Body, Breadcrumbs, Button, CardNotification, Checkbox, CodeEditor, ComponentList, ContentWrapper, Divider, Header, RoundButton, Select, Switch, Table, TextField, Toast, };
17
+ export { Body, Breadcrumbs, Button, CardNotification, Checkbox, CodeEditor, ContentWrapper, Divider, Header, OverlayRenderer, RoundButton, Select, Switch, Table, TextField, Toast, };
@@ -0,0 +1,7 @@
1
+ import { type FC } from 'react';
2
+ interface OverlayRendererProps {
3
+ userFlow: string;
4
+ pageId: string;
5
+ }
6
+ declare const OverlayRenderer: FC<OverlayRendererProps>;
7
+ export default OverlayRenderer;
@@ -1,20 +1,3 @@
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
- * Converts an object of key-value pairs into a URI-encoded query string.
12
- *
13
- * @param {Record<string, any>} params - An object where keys and values represent query parameters.
14
- * Values that are `null` or `undefined` will be skipped.
15
- * @returns {string} A properly URI-encoded query string (e.g., "key1=value1&key2=value2").
16
- */
17
- export declare const buildQueryString: (params: Record<string, any>) => string;
18
1
  /**
19
2
  * Extracts and transforms a list of options from a JSON response using JSONPath expressions.
20
3
  *
@@ -8,4 +8,4 @@ export type TableData = {
8
8
  items: any[];
9
9
  pagination: TablePaginationData;
10
10
  };
11
- export declare function parseDataFromResponse(response: any, jsonPathData: string, mapperData: DataSourceMapperData, jsonPathPagination?: any): TableData;
11
+ export declare const parseDataFromResponse: (response: any, jsonPathData: string, mapperData: DataSourceMapperData, jsonPathPagination?: any) => TableData;
@@ -5,8 +5,8 @@ import type { ObjectNotFront } from '../../types';
5
5
  *
6
6
  * @param userFlow - The current user flow identifier.
7
7
  * @param pageId - The current page identifier.
8
- * @param type - Indicates whether to render a 'body', 'header' or 'components' layout.
8
+ * @param type - Indicates whether to render a 'body', 'header'.
9
9
  * @param notFrontObject - The configuration object containing component data.
10
10
  * @returns A rendered Header, Body or Components with its child components or null if the type is unrecognized.
11
11
  */
12
- export declare const useBuilder: (userFlow: string, pageId: string, type: 'body' | 'header' | 'components', notFrontObject: ObjectNotFront | null) => JSX.Element | null;
12
+ export declare const useBuilder: (userFlow: string, pageId: string, type: 'body' | 'header', notFrontObject: ObjectNotFront | null) => JSX.Element | null;
@@ -1,4 +1,4 @@
1
- import type { ApiConfig, NextUIResponseData, PageContent } from '../types/builder.type';
1
+ import type { ApiConfig, NextUIResponseData, OverlayContent, PageContent } from '../types/builder.type';
2
2
  export type NotFrontStore = Record<string, UserFlow>;
3
3
  export type PageStore = {
4
4
  page?: PageContent | null;
@@ -9,9 +9,24 @@ export type UserFlow = {
9
9
  entries?: {};
10
10
  pages: Record<string, PageStore>;
11
11
  isLoading: boolean;
12
+ overlay: OverlayContent | null;
12
13
  };
13
14
  export declare const useStore: import("zustand").UseBoundStore<import("zustand").StoreApi<NotFrontStore>>;
14
15
  export declare const setNotFrontStore: (userFlowId: string, apiConfig: ApiConfig, page: PageContent) => void;
16
+ /**
17
+ * Clears the overlay for a specific userFlow.
18
+ * Useful for closing toasts, modals, or other overlay components.
19
+ *
20
+ * @param userFlow - The identifier for the current userFlow
21
+ */
22
+ export declare const clearOverlay: (userFlow: string) => void;
23
+ /**
24
+ * Gets the current overlay for a specific userFlow.
25
+ *
26
+ * @param userFlow - The identifier for the current userFlow
27
+ * @returns The current overlay content or null if no overlay is active
28
+ */
29
+ export declare const getOverlay: (userFlow: string) => OverlayContent | null;
15
30
  export declare const setPage: (userFlow: string, response: NextUIResponseData) => void;
16
31
  /**
17
32
  * Updates the `entries` object of a specific userFlow in the store.
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- ._body_14tsv_1{padding:2rem 2.75rem;width:100%}._body_content_14tsv_5{display:flex;flex-direction:column;gap:.75rem;margin:0 auto;max-width:1440px}._cardNotificationNotFront_t7pln_1{max-width:50%}@media (max-width: 992px){._cardNotificationNotFront_t7pln_1{max-width:100%}}._codeEditor_7ct2r_1:not(:first-child){margin:1rem 0 0}._codeEditor_label_7ct2r_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_7ct2r_13{border-radius:.25rem;overflow:hidden;border:1px solid var(--color-neutral-30)}._componentList_1i0g0_1{margin:0 auto;max-width:1440px;padding:2rem 2.75rem;width:100%}._componentList_content_1i0g0_7{display:flex;flex-direction:column;gap:.75rem}._contentWrapper_12gyy_1{max-width:1440px}._contentWrapper_12gyy_1._contentWrapper__centered_12gyy_4{margin:0 auto}._dividerNotFront_tze3j_1{margin:1.25rem 0}._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}._selectNotFront_1yw9q_1{max-width:364px}@media (max-width: 992px){._selectNotFront_1yw9q_1{max-width:364px}}._tableSkeleton_1621g_1{display:flex;flex-direction:column;gap:.5rem}._textFieldNotFront_cps4i_1{max-width:364px}@media (max-width: 992px){._textFieldNotFront_cps4i_1{max-width:364px}}
1
+ ._body_14tsv_1{padding:2rem 2.75rem;width:100%}._body_content_14tsv_5{display:flex;flex-direction:column;gap:.75rem;margin:0 auto;max-width:1440px}._cardNotificationNotFront_t7pln_1{max-width:50%}@media (max-width: 992px){._cardNotificationNotFront_t7pln_1{max-width:100%}}._codeEditor_7ct2r_1:not(:first-child){margin:1rem 0 0}._codeEditor_label_7ct2r_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_7ct2r_13{border-radius:.25rem;overflow:hidden;border:1px solid var(--color-neutral-30)}._contentWrapper_12gyy_1{max-width:1440px}._contentWrapper_12gyy_1._contentWrapper__centered_12gyy_4{margin:0 auto}._dividerNotFront_tze3j_1{margin:1.25rem 0}._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}._selectNotFront_1yw9q_1{max-width:364px}@media (max-width: 992px){._selectNotFront_1yw9q_1{max-width:364px}}._tableSkeleton_1621g_1{display:flex;flex-direction:column;gap:.5rem}._textFieldNotFront_cps4i_1{max-width:364px}@media (max-width: 992px){._textFieldNotFront_cps4i_1{max-width:364px}}
@@ -114,6 +114,10 @@ export interface CardNotificationNotFrontProps extends NotFrontBaseProps, CardNo
114
114
  */
115
115
  export interface CodeEditorNotFrontProps extends NotFrontBaseProps {
116
116
  component: 'code';
117
+ /**
118
+ * Disabled state.
119
+ */
120
+ disabled?: boolean;
117
121
  /**
118
122
  * The label shown above the code editor input.
119
123
  */
@@ -3,17 +3,23 @@ export interface NotFrontBaseProps {
3
3
  responseKey: string;
4
4
  }
5
5
  export type NotFrontActionType = 'GO_TO_NEXT_UI' | 'FETCH_AND_GO_TO_NEXT_UI' | 'REDIRECT' | 'GET_DATA_SOURCE' | 'AUTOCLOSE_AND_REDIRECT';
6
- export type NotFrontRequestType = 'rest';
7
- export type NotFrontRequestMethod = 'post' | 'get';
8
- export interface NotFrontDataSource {
9
- data: any;
10
- headers: any;
11
- method: NotFrontRequestMethod;
12
- params?: any;
13
- type: NotFrontRequestType;
6
+ interface BaseDataSource {
14
7
  url: string;
8
+ method: 'post' | 'get';
9
+ headers?: Record<string, string>;
10
+ params?: any;
11
+ }
12
+ export interface NotFrontDataSourceRest extends BaseDataSource {
13
+ type: 'rest';
14
+ data?: any;
15
+ }
16
+ export interface NotFrontDataSourceGraphQL extends BaseDataSource {
17
+ type: 'graphql';
18
+ query: string;
19
+ variables?: Record<string, any>;
15
20
  }
16
- export interface NotFrontDataSourceSelect extends NotFrontDataSource {
21
+ export type NotFrontDataSource = NotFrontDataSourceRest | NotFrontDataSourceGraphQL;
22
+ export interface SelectDataSource {
17
23
  jsonPathOptions: string;
18
24
  jsonPathLabel: string;
19
25
  jsonPathValue?: string;
@@ -24,15 +30,17 @@ interface MapperDataItem {
24
30
  }
25
31
  type MapperDataValue = string | MapperDataItem;
26
32
  export type DataSourceMapperData = Record<string, MapperDataValue>;
27
- export interface NotFrontDataSourceTable extends NotFrontDataSource {
33
+ export interface TableDataSource {
28
34
  jsonPathData: string;
29
35
  mapperData: DataSourceMapperData;
30
36
  jsonPathPagination?: {
31
- size: string;
37
+ size?: string;
32
38
  total: string;
33
- totalPages: string;
39
+ totalPages?: string;
34
40
  };
35
41
  }
42
+ export type NotFrontDataSourceSelect = NotFrontDataSource & SelectDataSource;
43
+ export type NotFrontDataSourceTable = NotFrontDataSource & TableDataSource;
36
44
  export interface NotFrontDependency {
37
45
  key: string;
38
46
  when: 'empty';
@@ -0,0 +1,33 @@
1
+ import { NotFrontDataSource } from '../types/componentsCore.type';
2
+ /**
3
+ * Constructs a URL with pagination and search query parameters.
4
+ *
5
+ * @param baseUrl - The base URL of the data source.
6
+ * @param search - The search term to include as a query parameter.
7
+ * @param page - The current pagination page number.
8
+ * @returns A string with the full URL including query parameters.
9
+ */
10
+ export declare const buildPaginatedURL: (baseUrl: string, search: string, page: number) => string;
11
+ /**
12
+ * Converts an object of key-value pairs into a URI-encoded query string.
13
+ *
14
+ * @param {Record<string, any>} params - An object where keys and values represent query parameters.
15
+ * Values that are `null` or `undefined` will be skipped.
16
+ * @returns {string} A properly URI-encoded query string (e.g., "key1=value1&key2=value2").
17
+ */
18
+ export declare const buildQueryString: (params: Record<string, any>) => string;
19
+ /**
20
+ * Utility to build a normalized NotFrontDataSource object for REST or GraphQL requests.
21
+ *
22
+ * This function abstracts the construction of the request payload for dynamic data sources,
23
+ * supporting both REST and GraphQL APIs. It handles pagination, search, and parameter merging,
24
+ * ensuring the resulting object is ready to be consumed by fetchDataSource or similar data-fetching utilities.
25
+ *
26
+ *
27
+ * @param dataSource - The original dataSource configuration (REST or GraphQL)
28
+ * @param page - The page number for pagination (default: 1)
29
+ * @param search - Optional search string (used for filtering, e.g., in selects)
30
+ * @returns A NotFrontDataSource object ready for fetchDataSource
31
+ * @throws If the dataSource type is not supported
32
+ */
33
+ export declare const buildRequestDataSource: (dataSource: NotFrontDataSource, page: number, search?: string) => NotFrontDataSource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foris/avocado-not-front",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -30,8 +30,8 @@
30
30
  "react-select-async-paginate": "0.7.3",
31
31
  "zustand": "4.5.4",
32
32
  "@foris/avocado-core": "0.10.0",
33
- "@foris/avocado-suite": "0.35.1",
34
- "@foris/avocado-icons": "1.15.0"
33
+ "@foris/avocado-icons": "1.15.0",
34
+ "@foris/avocado-suite": "0.35.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@testing-library/jest-dom": "6.4.0",
@@ -1,13 +0,0 @@
1
- import type { FC, ReactNode } from 'react';
2
- import type { ObjectNotFront } from '../../types';
3
- interface ComponentListProps extends ObjectNotFront {
4
- inputs: ReactNode[];
5
- }
6
- /**
7
- * `ComponentList` 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 `componentList` of the page.
11
- */
12
- declare const ComponentList: FC<ComponentListProps>;
13
- export default ComponentList;