@foris/avocado-not-front 7.0.0 → 8.0.1

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 (24) hide show
  1. package/dist/avocado-not-front/src/components/file-upload/FileUpload.d.ts +9 -0
  2. package/dist/avocado-not-front/src/components/file-upload/FileUpload.test.d.ts +1 -0
  3. package/dist/avocado-not-front/src/components/file-upload/fileUploadRules.util.d.ts +5 -0
  4. package/dist/avocado-not-front/src/components/file-upload/fileUploadRules.util.test.d.ts +1 -0
  5. package/dist/avocado-not-front/src/components/file-upload/index.d.ts +1 -0
  6. package/dist/avocado-not-front/src/components/index.d.ts +2 -1
  7. package/dist/avocado-not-front/src/components/pill/Pill.test.d.ts +1 -0
  8. package/dist/avocado-not-front/src/components/table/Table.d.ts +1 -1
  9. package/dist/avocado-not-front/src/components/table/Table.viewport.test.d.ts +1 -0
  10. package/dist/avocado-not-front/src/components/table/table.constants.d.ts +17 -0
  11. package/dist/avocado-not-front/src/components/table/table.constants.test.d.ts +1 -0
  12. package/dist/avocado-not-front/src/components/table/tableAvailableHeight.util.d.ts +12 -0
  13. package/dist/avocado-not-front/src/components/table/tableScroll.util.d.ts +20 -0
  14. package/dist/avocado-not-front/src/components/table/tableScroll.util.test.d.ts +1 -0
  15. package/dist/avocado-not-front/src/components/table/useAvailableHeight.d.ts +17 -0
  16. package/dist/avocado-not-front/src/components/table/useAvailableHeight.test.d.ts +1 -0
  17. package/dist/avocado-not-front/src/types/components.type.d.ts +43 -10
  18. package/dist/avocado-not-front/src/types/componentsCore.type.d.ts +6 -1
  19. package/dist/avocado-not-front/src/utils/dataSource.util.d.ts +4 -2
  20. package/dist/avocado-not-front/src/utils/pillVariant.util.d.ts +9 -0
  21. package/dist/avocado-not-front.es.js +1819 -1676
  22. package/dist/avocado-not-front.umd.js +3 -3
  23. package/dist/style.css +1 -1
  24. package/package.json +3 -3
@@ -0,0 +1,9 @@
1
+ import type { FC } from 'react';
2
+ import type { FileUploadNotFrontProps } from '../../types';
3
+ interface FileUploadNotFrontExtendedProps extends FileUploadNotFrontProps {
4
+ userFlow: string;
5
+ pageId: string;
6
+ }
7
+ /** Binds suite FileUpload to `entries[responseKey]`; see `.agents/rules/packages/avocado-not-front.md`. */
8
+ declare const FileUploadNotFront: FC<FileUploadNotFrontExtendedProps>;
9
+ export default FileUploadNotFront;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Maps not-front `rule1` / optional `rule2` JSON fields to suite `rules`.
3
+ * Empty or whitespace-only strings are omitted.
4
+ */
5
+ export declare const buildFileUploadRules: (rule1: string, rule2?: string) => string[];
@@ -0,0 +1 @@
1
+ export { default as FileUploadNotFront } from './FileUpload';
@@ -19,6 +19,7 @@ import ContentWrapper from './content-wrapper/ContentWrapper';
19
19
  import DataCard from './data-card/DataCard';
20
20
  import Divider from './divider/Divider';
21
21
  import Drawer from './drawer/Drawer';
22
+ import FileUploadNotFront from './file-upload/FileUpload';
22
23
  import DropdownButtonNotFront from './dropdown-button/DropdownButton';
23
24
  import Header from './header/Header';
24
25
  import HeaderNavigation from './header-navigation/HeaderNavigation';
@@ -41,4 +42,4 @@ import Toast from './toast/Toast';
41
42
  import Tooltip from './tooltip/Tooltip';
42
43
  import { NotFrontPage } from './not-front-page/NotFrontPage';
43
44
  import { RenderNotFront, renderNotFront, extractNotFrontComponents } from './render-not-front';
44
- export { Accordion, AIChatPanel, AIPromptCodeEditor, AISummaryCard, Body, Box, RadioGroupNotFront, StepperNotFront, ProgressBarNotFront, Breadcrumbs, Button, CardAccordion, CardNotFront, CardNotification, Chart, Checkbox, CodeEditor, ContentWrapper, DataCard, Divider, Drawer, DropdownButtonNotFront, Header, HeaderNavigation, Link, MenuNotFront, Modal, NotFrontPage, OverlayRenderer, RenderNotFront, renderNotFront, extractNotFrontComponents, Pill, PreviewerMarkdown, RoundButton, Row, Select, Spacing, Switch, Table, Tabs, Textarea, TextField, Toast, Tooltip, };
45
+ export { Accordion, AIChatPanel, AIPromptCodeEditor, AISummaryCard, Body, Box, RadioGroupNotFront, StepperNotFront, ProgressBarNotFront, Breadcrumbs, Button, CardAccordion, CardNotFront, CardNotification, Chart, Checkbox, CodeEditor, ContentWrapper, DataCard, Divider, Drawer, FileUploadNotFront, DropdownButtonNotFront, Header, HeaderNavigation, Link, MenuNotFront, Modal, NotFrontPage, OverlayRenderer, RenderNotFront, renderNotFront, extractNotFrontComponents, Pill, PreviewerMarkdown, RoundButton, Row, Select, Spacing, Switch, Table, Tabs, Textarea, TextField, Toast, Tooltip, };
@@ -7,5 +7,5 @@ interface TableNotFrontExtendedProps extends TableNotFrontProps {
7
7
  userFlow: string;
8
8
  pageId: string;
9
9
  }
10
- declare const TableNotFront: ({ userFlow, pageId, responseKey, component, dataSource, rightActions, data: inlineData, pageSize, ...tableProps }: TableNotFrontExtendedProps) => import("react/jsx-runtime").JSX.Element;
10
+ declare const TableNotFront: ({ userFlow, pageId, responseKey, component, dataSource, rightActions, data: inlineData, pageSize, showRowsPerPage, pageSizeOptions, labelRowsPerPage, autoHeight, ...tableProps }: TableNotFrontExtendedProps) => import("react/jsx-runtime").JSX.Element;
11
11
  export default TableNotFront;
@@ -0,0 +1,17 @@
1
+ export declare const DEFAULT_TABLE_PAGE_SIZE = 10;
2
+ export declare const DEFAULT_TABLE_PAGE_SIZE_OPTIONS: number[];
3
+ /** Space reserved below the table for the offset pager (nav + rows-per-page row). */
4
+ export declare const PAGER_RESERVED_HEIGHT = 72;
5
+ /** Minimum scroll container height when the table sits low on the page. */
6
+ export declare const MIN_TABLE_HEIGHT = 120;
7
+ /**
8
+ * Resolves the initial rows-per-page value from JSON config and selectable options.
9
+ *
10
+ * Uses `pageSize` when it is listed in `pageSizeOptions`; otherwise falls back to
11
+ * the first option, or {@link DEFAULT_TABLE_PAGE_SIZE} when options are empty.
12
+ *
13
+ * @param pageSize - Optional page size from table JSON config.
14
+ * @param pageSizeOptions - Allowed values for the rows-per-page selector.
15
+ * @returns The page size used for the first fetch and pager display.
16
+ */
17
+ export declare const resolveInitialPageSize: (pageSize: number | undefined, pageSizeOptions: number[]) => number;
@@ -0,0 +1,12 @@
1
+ type ComputeAvailableHeightArgs = {
2
+ viewportHeight: number;
3
+ elementTop: number;
4
+ pagerReservedHeight?: number;
5
+ minTableHeight?: number;
6
+ };
7
+ /**
8
+ * Computes how much vertical space the table scroll container can use so the
9
+ * pager stays within the viewport.
10
+ */
11
+ export declare const computeAvailableHeight: ({ viewportHeight, elementTop, pagerReservedHeight, minTableHeight, }: ComputeAvailableHeightArgs) => number;
12
+ export {};
@@ -0,0 +1,20 @@
1
+ export type TableScrollLayout = {
2
+ maxHeight?: string | number;
3
+ stickyHeader: boolean;
4
+ };
5
+ type ResolveTableScrollLayoutArgs = {
6
+ maxHeight?: string | number;
7
+ stickyHeader?: boolean;
8
+ autoFitToViewport: boolean;
9
+ availableHeight?: number;
10
+ };
11
+ /**
12
+ * Resolves table scroll layout for EntityHub-style tables.
13
+ *
14
+ * David T.'s criterion: cap the table at the viewport space below it so the
15
+ * pager stays on screen. The suite scroll container grows with content up to
16
+ * that cap; overflow triggers internal scroll and the sticky header keeps
17
+ * column labels visible. Independent of rows-per-page (`autoFitToViewport`).
18
+ */
19
+ export declare const resolveTableScrollLayout: ({ maxHeight, stickyHeader, autoFitToViewport, availableHeight, }: ResolveTableScrollLayoutArgs) => TableScrollLayout;
20
+ export {};
@@ -0,0 +1,17 @@
1
+ type UseAvailableHeightArgs = {
2
+ enabled: boolean;
3
+ };
4
+ /**
5
+ * Measures the vertical space available for the table scroll container.
6
+ *
7
+ * EntityHub pages are JSON-driven and the table cannot assume a flex parent.
8
+ * David T.'s criterion: the table must not grow past the viewport — the pager
9
+ * stays visible and overflow scrolls inside the table. We measure from the
10
+ * container top to the viewport bottom, reserving {@link PAGER_RESERVED_HEIGHT}
11
+ * for the pager below. Recalculates on resize and layout changes, not scroll.
12
+ */
13
+ export declare const useAvailableHeight: ({ enabled }: UseAvailableHeightArgs) => {
14
+ tableContainerRef: import("react").Dispatch<import("react").SetStateAction<HTMLDivElement | null>>;
15
+ availableHeight: number | undefined;
16
+ };
17
+ export {};
@@ -1,4 +1,4 @@
1
- import type { AccordionProps, ButtonProps, CardAccordionProps, CardNotificationProps, CheckboxProps, DataCardPaletteIndex, DataCardV2HeaderStyle, DataCardV2Status, DividerProps, DrawerProps, HeadingProps, HeaderNavigationVisual, LinkProps, ModalProps, PillProps, PreviewerMarkdownProps, RoundButtonProps, SelectProps, SwitchProps, TableColumn, TableProps, TabsProps, TextareaProps, TextFieldProps, TextProps } from '../../../avocado-suite';
1
+ import type { AccordionProps, ButtonProps, CardAccordionProps, CardNotificationProps, CheckboxProps, DataCardPaletteIndex, DataCardV2HeaderStyle, DataCardV2Status, DividerProps, DrawerProps, DropzoneUploadStatus, FileUploadProps, HeadingProps, HeaderNavigationVisual, LinkProps, ModalProps, PillProps, PreviewerMarkdownProps, RoundButtonProps, SelectProps, SwitchProps, TableColumn, TableProps, TabsProps, TextareaProps, TextFieldProps, TextProps } from '../../../avocado-suite';
2
2
  import type { AiAgentTheme, ChatPanelTranslations, SuggestionType, SupportedLocale } from '../../../ai-agent';
3
3
  import type { TooltipCoverageConfig } from '../components/chart/chart.types';
4
4
  import type { ChartSeriesConfig, ChartYAxisConfig } from '../components/chart/chart.types';
@@ -258,6 +258,20 @@ export interface DividerNotFrontProps extends NotFrontBaseProps, DividerProps {
258
258
  /** Set the position vertical */
259
259
  vertical?: boolean;
260
260
  }
261
+ /**
262
+ * Interface for the props used in the FileUploadNotFront component.
263
+ */
264
+ export interface FileUploadNotFrontProps extends NotFrontBaseProps, Omit<FileUploadProps, 'file' | 'rules' | 'onFileChange' | 'onRemove' | 'onTemplateLinkClick' | 'templateHref' | 'disabled' | 'uploadStatus' | 'notificationVisible'> {
265
+ component: 'fileUpload';
266
+ rule1: string;
267
+ rule2?: string;
268
+ disabled?: boolean;
269
+ uploadStatus?: DropzoneUploadStatus;
270
+ notificationVisible?: boolean;
271
+ templateRedirectUrl?: string;
272
+ templateTarget?: '_blank' | '_self';
273
+ dependencies?: NotFrontDependency[];
274
+ }
261
275
  /**
262
276
  * Interface for the props used in the HeadingNotFront component.
263
277
  */
@@ -399,8 +413,8 @@ export interface PillNotFrontProps extends NotFrontBaseProps, Omit<PillProps, 'c
399
413
  content: string;
400
414
  /**
401
415
  * Visual variant that applies predefined color schemes.
402
- * Automatically sets color, textColor, and iconColor based on the variant.
403
- * Default: 'neutral'
416
+ * Resolves color, textColor, and iconColor from the filled or outlined palette
417
+ * depending on `outlined`. Default: 'neutral'
404
418
  */
405
419
  variant?: 'success' | 'warning' | 'error' | 'info' | 'neutral';
406
420
  }
@@ -578,14 +592,32 @@ export interface TableNotFrontProps extends NotFrontBaseProps, Omit<TableProps,
578
592
  */
579
593
  data?: TableProps['data'];
580
594
  /**
581
- * Enables client-side pagination over static `data`. When provided and the
582
- * number of rows exceeds `pageSize`, the table renders one page at a time
583
- * with a pager. When omitted, all static rows are shown at once.
584
- *
585
- * Only applies to static `data`. It is ignored when `dataSource` is present
586
- * (in that case pagination is server-driven via the response).
595
+ * Initial page size. For static `data`, enables client-side pagination when
596
+ * the number of rows exceeds this value. For `dataSource`, sent on the first
597
+ * request and kept in sync when the user changes rows per page.
587
598
  */
588
599
  pageSize?: number;
600
+ /**
601
+ * Shows the rows-per-page selector in the pager. Only applies to offset
602
+ * pagination (not cursor). Default: false.
603
+ */
604
+ showRowsPerPage?: boolean;
605
+ /**
606
+ * Caps the table scroll area to the viewport space below it so the pager
607
+ * stays on screen. Overflow uses internal scroll with a sticky header.
608
+ * Default: true (disabled for cursor pagination). Override with explicit
609
+ * `maxHeight` / `stickyHeader`.
610
+ */
611
+ autoHeight?: boolean;
612
+ /**
613
+ * Options for the rows-per-page selector. The backend may override the
614
+ * default list. Default when omitted: `[10, 20, 50, 100]`.
615
+ */
616
+ pageSizeOptions?: number[];
617
+ /**
618
+ * Label for the rows-per-page selector. Default: "Filas por página:".
619
+ */
620
+ labelRowsPerPage?: string;
589
621
  /**
590
622
  * Data source to load data for table. Required when not providing static data.
591
623
  */
@@ -1338,7 +1370,7 @@ export interface AIPromptCodeEditorNotFrontProps extends NotFrontBaseProps {
1338
1370
  /**
1339
1371
  * Union type representing all possible NotFront component prop types.
1340
1372
  */
1341
- export type NotFrontComponent = HeaderNavigationNotFrontProps | AccordionNotFrontProps | AIChatPanelNotFrontProps | AIPromptCodeEditorNotFrontProps | AISummaryCardNotFrontProps | BoxNotFrontProps | BreadcrumbsNotFrontProps | ButtonNotFrontProps | CardAccordionNotFrontProps | CardNotFrontProps | CardNotificationNotFrontProps | ChartNotFrontProps | CheckboxNotFrontProps | CodeEditorNotFrontProps | DataCardNotFrontProps | DividerNotFrontProps | DrawerNotFrontProps | DropdownButtonNotFrontProps | HeadingNotFrontProps | LinkNotFrontProps | MenuNotFrontProps | ModalNotFrontProps | PillNotFrontProps | PreviewerMarkdownNotFrontProps | RadioGroupNotFrontProps | RoundButtonNotFrontProps | RowNotFrontProps | SelectNotFrontProps | SpacingNotFrontProps | StepperNotFrontProps | ProgressBarNotFrontProps | SwitchNotFrontProps | TableNotFrontProps | TabsNotFrontProps | TextareaNotFrontProps | TextFieldNotFrontProps | TextNotFrontProps | ToastNotFrontProps | TooltipNotFrontProps;
1373
+ export type NotFrontComponent = HeaderNavigationNotFrontProps | AccordionNotFrontProps | AIChatPanelNotFrontProps | AIPromptCodeEditorNotFrontProps | AISummaryCardNotFrontProps | BoxNotFrontProps | BreadcrumbsNotFrontProps | ButtonNotFrontProps | CardAccordionNotFrontProps | CardNotFrontProps | CardNotificationNotFrontProps | ChartNotFrontProps | CheckboxNotFrontProps | CodeEditorNotFrontProps | DataCardNotFrontProps | DividerNotFrontProps | DrawerNotFrontProps | DropdownButtonNotFrontProps | FileUploadNotFrontProps | HeadingNotFrontProps | LinkNotFrontProps | MenuNotFrontProps | ModalNotFrontProps | PillNotFrontProps | PreviewerMarkdownNotFrontProps | RadioGroupNotFrontProps | RoundButtonNotFrontProps | RowNotFrontProps | SelectNotFrontProps | SpacingNotFrontProps | StepperNotFrontProps | ProgressBarNotFrontProps | SwitchNotFrontProps | TableNotFrontProps | TabsNotFrontProps | TextareaNotFrontProps | TextFieldNotFrontProps | TextNotFrontProps | ToastNotFrontProps | TooltipNotFrontProps;
1342
1374
  /**
1343
1375
  * Resolved props for ChatPanel when delegated via onResolveComponentProps.
1344
1376
  * These are the props that the consumer receives to render ChatPanel externally.
@@ -1410,6 +1442,7 @@ export type NotFrontComponentTypeMap = {
1410
1442
  divider: DividerNotFrontProps;
1411
1443
  drawer: DrawerNotFrontProps;
1412
1444
  dropdownButton: DropdownButtonNotFrontProps;
1445
+ fileUpload: FileUploadNotFrontProps;
1413
1446
  heading: HeadingNotFrontProps;
1414
1447
  link: LinkNotFrontProps;
1415
1448
  menu: MenuNotFrontProps;
@@ -24,10 +24,15 @@ interface BaseDataSource {
24
24
  headers?: Record<string, string>;
25
25
  params?: any;
26
26
  }
27
+ export type NotFrontPaginationKeys = {
28
+ page?: string;
29
+ text?: string;
30
+ size?: string;
31
+ };
27
32
  export interface NotFrontDataSourceRest extends BaseDataSource {
28
33
  type: 'rest';
29
34
  data?: any;
30
- paginationKeys?: Record<string, string>;
35
+ paginationKeys?: NotFrontPaginationKeys;
31
36
  }
32
37
  export interface NotFrontDataSourceGraphQL extends BaseDataSource {
33
38
  type: 'graphql';
@@ -13,9 +13,10 @@ export declare const normalizeHttpMethod: (method: string | undefined) => NotFro
13
13
  * @param dataSource - The REST data source configuration.
14
14
  * @param page - The current pagination page number.
15
15
  * @param search - Optional search term to include as a query parameter.
16
+ * @param pageSize - Optional page size to include as a query parameter.
16
17
  * @returns {string} The complete URL with all query parameters combined.
17
18
  */
18
- export declare const buildQueryParams: (dataSource: NotFrontDataSourceRest, page: number, search?: string) => string;
19
+ export declare const buildQueryParams: (dataSource: NotFrontDataSourceRest, page: number, search?: string, pageSize?: number) => string;
19
20
  /**
20
21
  * Utility to build a normalized NotFrontDataSource object for REST or GraphQL requests.
21
22
  *
@@ -28,8 +29,9 @@ export declare const buildQueryParams: (dataSource: NotFrontDataSourceRest, page
28
29
  * @param page - The page number for pagination (default: 1)
29
30
  * @param search - Optional search string (used for filtering, e.g., in selects)
30
31
  * @param cursorPayload - Optional cursor object built from the previous response; merged into the REST request `data` after the flow's original `data`.
32
+ * @param pageSize - Optional page size sent with pagination requests.
31
33
  * @returns A NotFrontDataSource object ready for fetchDataSource
32
34
  * @throws If the dataSource type is not supported
33
35
  */
34
- export declare const buildRequestDataSource: (dataSource: NotFrontDataSource, page: number, search?: string, cursorPayload?: Record<string, unknown> | null) => NotFrontDataSource;
36
+ export declare const buildRequestDataSource: (dataSource: NotFrontDataSource, page: number, search?: string, cursorPayload?: Record<string, unknown> | null, pageSize?: number) => NotFrontDataSource;
35
37
  export {};
@@ -15,6 +15,15 @@ export declare const PILL_VARIANT_COLORS: Record<TablePillVariant, TablePillColo
15
15
  * border. Each variant gets a solid border token and a readable text token.
16
16
  */
17
17
  export declare const PILL_OUTLINED_VARIANT_COLORS: Record<TablePillVariant, TablePillColors>;
18
+ /**
19
+ * The tokens a pill of this variant needs, filled or outlined.
20
+ *
21
+ * `Pill` paints `color` as the border when `outlined` is set, so the two looks
22
+ * cannot share a table: the filled tokens would draw a border the user cannot
23
+ * see. Every caller that renders a pill from a variant has to go through here,
24
+ * or the outlined look silently degrades to an invisible outline.
25
+ */
26
+ export declare const resolvePillColors: (variant: TablePillVariant, outlined?: boolean) => TablePillColors;
18
27
  export declare const TABLE_PILL_OUTLINED_TOKEN = "outlined";
19
28
  export declare const isTablePillVariant: (value: unknown) => value is "success" | "warning" | "error" | "info" | "neutral";
20
29
  export type ParsedTablePill = {