@vention/machine-apps-components 0.2.8

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/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@vention/machine-apps-components",
3
+ "version": "0.2.8",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/VentionCo/machine-cloud.git"
7
+ },
8
+ "publishConfig": {
9
+ "access": "public",
10
+ "registry": "https://registry.npmjs.org/"
11
+ },
12
+ "license": "MIT",
13
+ "dependencies": {
14
+ "dayjs": "1.11.13",
15
+ "tss-react": "4.9.13"
16
+ },
17
+ "peerDependencies": {
18
+ "react": "17.0.2",
19
+ "react-router-dom": "^6.0.0",
20
+ "@mui/material": "^5.0.0",
21
+ "@ventionco/machine-ui": "3.30.1"
22
+ },
23
+ "devDependencies": {
24
+ "@nx/vite": "21.1.3",
25
+ "@testing-library/react": "12.1.5",
26
+ "@vitejs/plugin-react": "4.5.2",
27
+ "vite": "6.3.5",
28
+ "vitest": "3.2.4"
29
+ },
30
+ "module": "./index.esm.js",
31
+ "type": "module",
32
+ "main": "./index.esm.js",
33
+ "types": "./index.esm.d.ts"
34
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ export * from "./lib/navigation-bar/navigation-bar";
2
+ export * from "./lib/navigation-bar/navigation-confirmation-modal";
3
+ export * from "./lib/navigation-bar/password-protection-modal";
4
+ export * from "./lib/navigation-bar/time-label";
5
+ export * from "./lib/status-top-bar/status-top-bar";
6
+ export * from "./lib/sidebar/sidebar";
7
+ export type { SidebarItem, SidebarProps } from "./lib/sidebar/sidebar";
8
+ export * from "./lib/logs/logs-table";
9
+ export * from "./lib/logs/log-filter-form";
10
+ export * from "./lib/logs/logs-panel";
11
+ export * from "./lib/logs/logs-pagination";
12
+ export type { LogEntry, LogFilterFormValues, SortOrder, LogType, PaginationMode, PaginationConfig, LogsPanelHandle, } from "./lib/logs/logs-panel";
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { LogFilterFormValues } from "./logs-panel";
3
+ interface LogFilterFormProps {
4
+ onFilterChange?: (filters: LogFilterFormValues) => void;
5
+ onReset?: () => void;
6
+ initialFilters?: Partial<LogFilterFormValues>;
7
+ }
8
+ export declare const LogFilterForm: import("react").MemoExoticComponent<({ onFilterChange, onReset, initialFilters }: LogFilterFormProps) => import("react/jsx-runtime").JSX.Element>;
9
+ export default LogFilterForm;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ interface LogsPaginationProps {
3
+ currentPage: number;
4
+ totalPages: number;
5
+ onPageChange: (page: number) => void;
6
+ }
7
+ export declare const LogsPagination: import("react").MemoExoticComponent<({ currentPage, totalPages, onPageChange }: LogsPaginationProps) => import("react/jsx-runtime").JSX.Element>;
8
+ export default LogsPagination;
@@ -0,0 +1,59 @@
1
+ import { ReactNode } from "react";
2
+ export type LogType = "error" | "warning" | "info";
3
+ export interface LogEntry {
4
+ id: string;
5
+ date: string;
6
+ type: LogType;
7
+ code: string;
8
+ message: string;
9
+ description: string;
10
+ }
11
+ export type SortOrder = "latest" | "oldest";
12
+ export interface LogFilterFormValues {
13
+ fromDate?: string;
14
+ toDate?: string;
15
+ logType?: LogType;
16
+ sortOrder: SortOrder;
17
+ }
18
+ export declare const formatDateToInput: (date: Date) => string;
19
+ export declare const parseLogDate: (dateStr: string) => number;
20
+ export type PaginationMode = "pagination" | "infinite-scroll" | "none";
21
+ export interface PaginationConfig {
22
+ mode: PaginationMode;
23
+ pageSize?: number;
24
+ initialPage?: number;
25
+ }
26
+ export interface FetchParams {
27
+ filters: LogFilterFormValues;
28
+ page: number;
29
+ pageSize: number;
30
+ }
31
+ export interface FetchResult {
32
+ logs: LogEntry[];
33
+ totalCount: number;
34
+ totalPages: number;
35
+ currentPage: number;
36
+ hasMorePages: boolean;
37
+ }
38
+ export type DataFetcher = (params: FetchParams) => Promise<FetchResult>;
39
+ export interface LogsPanelHandle {
40
+ refresh: () => Promise<void>;
41
+ resetFilters: () => void;
42
+ applyFilters: (filters: Partial<LogFilterFormValues>) => void;
43
+ getCurrentFilters: () => LogFilterFormValues;
44
+ exportLogs: () => LogEntry[];
45
+ }
46
+ interface LogsPanelProps {
47
+ dataFetcher: DataFetcher;
48
+ initialFilters?: Partial<LogFilterFormValues>;
49
+ onError?: (error: unknown) => void;
50
+ pagination?: PaginationConfig;
51
+ onFilterChange?: (filters: LogFilterFormValues) => void;
52
+ onLogClick?: (log: LogEntry) => void;
53
+ className?: string;
54
+ tableHeight?: string | number;
55
+ emptyStateMessage?: string;
56
+ emptyStateIcon?: ReactNode;
57
+ }
58
+ export declare const LogsPanel: import("react").ForwardRefExoticComponent<LogsPanelProps & import("react").RefAttributes<LogsPanelHandle>>;
59
+ export default LogsPanel;
@@ -0,0 +1,15 @@
1
+ import type { LogEntry } from "./logs-panel";
2
+ import { ReactNode } from "react";
3
+ interface LogsTableProps {
4
+ logs?: LogEntry[];
5
+ isLoading?: boolean;
6
+ error?: string | null;
7
+ onLoadMoreLogs?: () => void;
8
+ hasMoreLogs?: boolean;
9
+ onLogClick?: (log: LogEntry) => void;
10
+ tableHeight?: string | number;
11
+ emptyStateMessage?: string;
12
+ emptyStateIcon?: ReactNode;
13
+ }
14
+ export declare const LogsTable: import("react").MemoExoticComponent<({ logs, isLoading, error, onLoadMoreLogs, hasMoreLogs, onLogClick, tableHeight, emptyStateMessage, emptyStateIcon, }: LogsTableProps) => import("react/jsx-runtime").JSX.Element>;
15
+ export default LogsTable;
@@ -0,0 +1,17 @@
1
+ import { useLocation } from "react-router-dom";
2
+ import { ReactNode } from "react";
3
+ export interface NavigationItemProps {
4
+ id: string;
5
+ label: string;
6
+ path: string;
7
+ icon: ReactNode;
8
+ iconDisabled?: ReactNode;
9
+ onClick?: () => void;
10
+ password?: string;
11
+ isDisabled?: boolean;
12
+ location?: ReturnType<typeof useLocation>;
13
+ handleNavigate?: (path: string) => void;
14
+ currentPassword?: string | null;
15
+ setPasswordProtectedItem?: (item: NavigationItemProps) => void;
16
+ }
17
+ export declare const NavigationBarItem: (props: NavigationItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from "react";
2
+ import { NavigationItemProps } from "./navigation-bar-item";
3
+ export interface NavigationBarProps {
4
+ children: ReactNode;
5
+ showTimer?: boolean;
6
+ onControlCenterClick?: () => void;
7
+ onSupportClick?: () => void;
8
+ disabledNavigationItems?: string[];
9
+ isControlCenterDisabled?: boolean;
10
+ isSupportDisabled?: boolean;
11
+ showControlCenterButton?: boolean;
12
+ showSupportButton?: boolean;
13
+ }
14
+ export declare const NavigationBar: ((props: NavigationBarProps) => import("react/jsx-runtime").JSX.Element) & {
15
+ Item: (props: NavigationItemProps) => import("react/jsx-runtime").JSX.Element;
16
+ };
17
+ export default NavigationBar;
@@ -0,0 +1,7 @@
1
+ interface NavigationConfirmationModalProps {
2
+ isOpen: boolean;
3
+ destination: "controlCenter" | "remoteSupport" | null;
4
+ onClose: () => void;
5
+ }
6
+ export declare const NavigationConfirmationModal: (props: NavigationConfirmationModalProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ interface PasswordProtectionModalProps {
2
+ isOpen: boolean;
3
+ onClose: () => void;
4
+ onSuccess: () => void;
5
+ correctPassword: string;
6
+ }
7
+ export declare const PasswordProtectionModal: (props: PasswordProtectionModalProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface TimeLabelProps {
2
+ className?: string;
3
+ color?: string;
4
+ }
5
+ export declare function TimeLabel({ className, color }: TimeLabelProps): import("react/jsx-runtime").JSX.Element;
6
+ export default TimeLabel;
@@ -0,0 +1,15 @@
1
+ import { type IconType } from "@ventionco/machine-ui";
2
+ import React from "react";
3
+ export interface SidebarItem {
4
+ id: string;
5
+ title: string;
6
+ subtitle?: string;
7
+ icon?: React.ReactNode;
8
+ iconType?: IconType;
9
+ state: "pending" | "active" | "completed" | "disabled";
10
+ onClick?: () => void;
11
+ }
12
+ export interface SidebarProps {
13
+ items: SidebarItem[];
14
+ }
15
+ export declare const Sidebar: (props: SidebarProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from "react";
2
+ export interface StatusTopBarButtonProps {
3
+ id: string;
4
+ label: string;
5
+ onClick?: () => void;
6
+ backgroundColor?: string;
7
+ backgroundColorHover?: string;
8
+ borderColor?: string;
9
+ textColor?: string;
10
+ width?: number;
11
+ height?: number;
12
+ icon?: ReactNode;
13
+ iconDisabled?: ReactNode;
14
+ isDisabled?: boolean;
15
+ visible?: boolean;
16
+ }
17
+ export declare const StatusTopBarButton: (props: StatusTopBarButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from "react";
2
+ import { StatusTopBarButtonProps } from "./status-top-bar-button";
3
+ export interface StatusTopBarProps {
4
+ statusLabel?: string;
5
+ dotColor?: string;
6
+ children?: ReactNode;
7
+ visibleButtons?: string[];
8
+ disabledButtons?: string[];
9
+ }
10
+ export declare const StatusTopBar: ((props: StatusTopBarProps) => import("react/jsx-runtime").JSX.Element) & {
11
+ Button: (props: StatusTopBarButtonProps) => import("react/jsx-runtime").JSX.Element;
12
+ };
13
+ export default StatusTopBar;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Detects if the current device has touch screen capabilities
3
+ * @returns true if the device supports touch events, false otherwise
4
+ */
5
+ export declare const isTouchScreenDevice: () => boolean;
6
+ /**
7
+ * Closes the custom UI by sending a message to the parent window
8
+ */
9
+ export declare const closeCustomUi: () => void;
10
+ /**
11
+ * Navigates to a specific route in the Control Center
12
+ * @param route - The route to navigate to (remoteSupport or controlCenterHomepage)
13
+ */
14
+ export declare const navigateControlCenter: (route: "remoteSupport" | "controlCenterHomepage") => void;
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -0,0 +1,12 @@
1
+ import { ReactElement } from "react";
2
+ import { RenderOptions, RenderResult } from "@testing-library/react";
3
+ interface CustomRenderOptions extends Omit<RenderOptions, "wrapper"> {
4
+ initialRoute?: string;
5
+ }
6
+ /**
7
+ * Custom render function that wraps components with necessary providers:
8
+ * - ThemeProvider with machineUiTheme
9
+ * - MemoryRouter for routing
10
+ */
11
+ export declare const renderWithProviders: (ui: ReactElement, { initialRoute, ...renderOptions }?: CustomRenderOptions) => RenderResult;
12
+ export * from "@testing-library/react";