-
Notifications
You must be signed in to change notification settings - Fork 6
feat: add colorVariant, description, actionUrl/actionType/actionIcon to DashboardWidgetSchema #716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,19 +7,57 @@ import { SnakeCaseIdentifierSchema } from '../shared/identifiers.zod'; | |
| import { I18nLabelSchema, AriaPropsSchema } from './i18n.zod'; | ||
| import { ResponsiveConfigSchema, PerformanceConfigSchema } from './responsive.zod'; | ||
|
|
||
| /** | ||
| * Color variant for dashboard widgets (e.g., KPI cards). | ||
| */ | ||
| export const WidgetColorVariantSchema = z.enum([ | ||
| 'default', | ||
| 'blue', | ||
| 'teal', | ||
| 'orange', | ||
| 'purple', | ||
| 'success', | ||
| 'warning', | ||
| 'danger', | ||
| ]).describe('Widget color variant'); | ||
|
|
||
| /** | ||
| * Action type for widget action buttons. | ||
| */ | ||
| export const WidgetActionTypeSchema = z.enum([ | ||
| 'url', | ||
| 'modal', | ||
| 'flow', | ||
| ]).describe('Widget action type'); | ||
|
|
||
| /** | ||
| * Dashboard Widget Schema | ||
| * A single component on the dashboard grid. | ||
| */ | ||
| export const DashboardWidgetSchema = z.object({ | ||
| /** Widget Title */ | ||
| title: I18nLabelSchema.optional().describe('Widget title'), | ||
|
|
||
| /** Widget Description (displayed below the title) */ | ||
| description: I18nLabelSchema.optional().describe('Widget description text below the header'), | ||
|
|
||
| /** Visualization Type */ | ||
| type: ChartTypeSchema.default('metric').describe('Visualization type'), | ||
|
|
||
| /** Chart Configuration */ | ||
| chartConfig: ChartConfigSchema.optional().describe('Chart visualization configuration'), | ||
|
|
||
| /** Color variant for the widget (e.g., KPI card accent color) */ | ||
| colorVariant: WidgetColorVariantSchema.optional().describe('Widget color variant for theming'), | ||
|
|
||
| /** Action URL for the widget header action button */ | ||
| actionUrl: z.string().optional().describe('URL or target for the widget action button'), | ||
|
|
||
| /** Action type for the widget header action button */ | ||
| actionType: WidgetActionTypeSchema.optional().describe('Type of action for the widget action button'), | ||
|
|
||
|
Comment on lines
+53
to
+58
|
||
| /** Icon for the widget header action button */ | ||
| actionIcon: z.string().optional().describe('Icon identifier for the widget action button'), | ||
|
|
||
| /** Data Source Object */ | ||
| object: z.string().optional().describe('Data source object name'), | ||
|
|
@@ -129,6 +167,8 @@ export const DashboardSchema = z.object({ | |
| export type Dashboard = z.infer<typeof DashboardSchema>; | ||
| export type DashboardInput = z.input<typeof DashboardSchema>; | ||
| export type DashboardWidget = z.infer<typeof DashboardWidgetSchema>; | ||
| export type WidgetColorVariant = z.infer<typeof WidgetColorVariantSchema>; | ||
| export type WidgetActionType = z.infer<typeof WidgetActionTypeSchema>; | ||
|
|
||
| /** | ||
| * Dashboard Factory Helper | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actionUrlis used as a generic action target (URL path, modal id, or flow name) but the current description still reads like it is always a URL. Consider updating the field description to explicitly document the expected format for eachactionType(e.g., url => URL/path, modal => modalId, flow => flowName) to avoid client ambiguity.