@coval-ai/components v0.6.1
@coval-ai/components
A lightweight component library for Coval applications.
Installation
npm install @coval-ai/componentsOr using yarn:
yarn add @coval-ai/componentsRequirements
This package has the following peer dependencies:
- React 16.8+ / 17 / 18
- ReactDOM 16.8+ / 17 / 18
- Recharts 2.0+
- Axios 1.0+ (for API requests)
- axios-cache-interceptor 1.8+ (for request caching)
- axios-retry 4.5+ (for automatic retries)
Usage
CovalProvider
The CovalProvider is required to set up API configuration for the components. Authentication is handled automatically via cookies.
import { CovalProvider } from '@coval-ai/components';
function App() {
return (
<CovalProvider token="pk_coval_1234567890">
<YourAppComponents />
</CovalProvider>
);
}LatencyChart
A chart component for visualizing latency data from the Coval API.
import { LatencyChart } from '@coval-ai/components';
function Dashboard() {
return (
<div>
<h1>Latency Dashboard</h1>
<LatencyChart />
</div>
);
}API Reference
CovalProvider
| Prop | Type | Required | Description |
|---|---|---|---|
| apiUrl | string | No | Base URL for the Coval API (default: API endpoint) |
| children | ReactNode | Yes | Child components |
LatencyBarChart
The LatencyBarChart component fetches and displays latency data automatically when mounted.
Development
To start the development server:
npm run devBuild
To build the package:
npm run buildLinting and Type Checking
npm run lint # Run ESLint
npm run type # Run TypeScript type checking
npm run format # Format code with Prettier
npm run check # Run lint and type checking togetherGit Hooks
This project uses Lefthook for Git hooks and lint-staged to run linters on staged files. This ensures code quality before commits.
The Git hooks run automatically when you commit changes. The pre-commit hook runs ESLint and Prettier on staged files, and checks for TypeScript errors.
License
MIT © Coval
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago