Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(frontend): align shared wrapper prop types

Josué338238ebff68
diff --git a/control-ui/components/TableEmptyRow/types.ts b/control-ui/components/TableEmptyRow/types.ts
index 2665606bb..0357dc5e0 100644
--- a/control-ui/components/TableEmptyRow/types.ts
+++ b/control-ui/components/TableEmptyRow/types.ts
@@ -1,9 +1,9 @@
-import type { ReactNode } from 'react'
+import type { TableStateRowProps } from '@clerum/frontend-components'
export type TableEmptyRowProps = {
/** Number of columns to span. Must match the table's header row. */
colSpan: number
- message?: ReactNode
+ message?: TableStateRowProps['message']
/** Offer this when the empty state is the result of a filter the user can undo. */
action?: {
label: string
diff --git a/control-ui/components/TableHeaderRow/types.ts b/control-ui/components/TableHeaderRow/types.ts
index f1c2f482a..f202a7714 100644
--- a/control-ui/components/TableHeaderRow/types.ts
+++ b/control-ui/components/TableHeaderRow/types.ts
@@ -1,16 +1,15 @@
-import type { ReactNode } from 'react'
-import type { SortDirection } from '@clerum/frontend-components'
+import type { SortDirection, TableHeaderCellProps } from '@clerum/frontend-components'
export type TableHeaderColumn = {
align?: 'left' | 'right' | 'center'
ariaLabel?: string
key: string
- label?: ReactNode
+ label?: TableHeaderCellProps['label']
minWidth?: string
title?: string
width?: string
activeDirection?: SortDirection | null
defaultDirection?: SortDirection
onSort?: () => void
- sortLabel?: ReactNode
+ sortLabel?: TableHeaderCellProps['sortLabel']
}
diff --git a/control-ui/components/TablePanelHeader/types.ts b/control-ui/components/TablePanelHeader/types.ts
index 70856d39a..fbd63c360 100644
--- a/control-ui/components/TablePanelHeader/types.ts
+++ b/control-ui/components/TablePanelHeader/types.ts
@@ -1,12 +1,12 @@
-import type { ReactNode } from 'react'
+import type { DataViewHeaderProps } from '@clerum/frontend-components'
export type TablePanelHeaderProps = {
actionsClassName?: string
- primaryAction?: ReactNode
- refreshAction?: ReactNode
- search?: ReactNode
- secondaryActions?: ReactNode
- subtitle?: ReactNode
- title: ReactNode
- titleActions?: ReactNode
+ primaryAction?: DataViewHeaderProps['actions']
+ refreshAction?: DataViewHeaderProps['actions']
+ search?: DataViewHeaderProps['actions']
+ secondaryActions?: DataViewHeaderProps['actions']
+ subtitle?: DataViewHeaderProps['description']
+ title: DataViewHeaderProps['title']
+ titleActions?: DataViewHeaderProps['actions']
}
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 08c982e46..af6abea20 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.521",
+ "version": "0.1.522",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.521",
+ "version": "0.1.522",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --git a/control-ui/package.json b/control-ui/package.json
index d57361d99..c63cb8a13 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.521",
+ "version": "0.1.522",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/packages/frontend-components/src/index.tsx b/packages/frontend-components/src/index.tsx
index 7f839ced5..fba3973b6 100644
--- a/packages/frontend-components/src/index.tsx
+++ b/packages/frontend-components/src/index.tsx
@@ -26,6 +26,15 @@ function classNames(...values: Array<string | false | null | undefined>) {
return values.filter(Boolean).join(' ')
}
+export type DataViewHeaderProps = {
+ actions?: ReactNode
+ className?: string
+ description?: ReactNode
+ icon?: ReactNode
+ tabs?: ReactNode
+ title: ReactNode
+}
+
export function DataViewHeader({
actions,
className,
@@ -33,14 +42,7 @@ export function DataViewHeader({
icon,
tabs,
title,
-}: {
- actions?: ReactNode
- className?: string
- description?: ReactNode
- icon?: ReactNode
- tabs?: ReactNode
- title: ReactNode
-}) {
+}: DataViewHeaderProps) {
return (
<header className={classNames('eft-data-view-header', className)}>
<div className="eft-data-view-header__main">
@@ -162,6 +164,15 @@ export function TableCell({
return <td {...props} className={classNames(`eft-table__cell--${kind}`, className)} />
}
+export type TableHeaderCellProps = Omit<ThHTMLAttributes<HTMLTableCellElement>, 'children'> & {
+ activeDirection?: SortDirection | null
+ defaultDirection?: SortDirection
+ kind?: CellKind
+ label: ReactNode
+ onSort?: () => void
+ sortLabel?: ReactNode
+}
+
export function TableHeaderCell({
activeDirection,
className,
@@ -171,14 +182,7 @@ export function TableHeaderCell({
onSort,
sortLabel,
...props
-}: Omit<ThHTMLAttributes<HTMLTableCellElement>, 'children'> & {
- activeDirection?: SortDirection | null
- defaultDirection?: SortDirection
- kind?: CellKind
- label: ReactNode
- onSort?: () => void
- sortLabel?: ReactNode
-}) {
+}: TableHeaderCellProps) {
const ariaSort = activeDirection
? activeDirection === 'asc'
? 'ascending'
@@ -234,17 +238,19 @@ export function TableHeaderCell({
)
}
+export type TableStateRowProps = {
+ action?: ReactNode
+ colSpan: number
+ kind?: 'loading' | 'empty' | 'error'
+ message?: ReactNode
+}
+
export function TableStateRow({
action,
colSpan,
kind = 'empty',
message = 'No data',
-}: {
- action?: ReactNode
- colSpan: number
- kind?: 'loading' | 'empty' | 'error'
- message?: ReactNode
-}) {
+}: TableStateRowProps) {
return (
<tr>
<td className={classNames('eft-table__state', `eft-table__state--${kind}`)} colSpan={colSpan}>