create-appraise 0.1.0
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/README.md +52 -0
- package/package.json +63 -0
- package/templates/default/.env.example +2 -0
- package/templates/default/README.md +51 -0
- package/templates/default/appraise.config.json +4 -0
- package/templates/default/components.json +24 -0
- package/templates/default/eslint.config.mjs +15 -0
- package/templates/default/next-env.d.ts +6 -0
- package/templates/default/next.config.ts +7 -0
- package/templates/default/package-lock.json +14321 -0
- package/templates/default/package.json +124 -0
- package/templates/default/postcss.config.mjs +8 -0
- package/templates/default/prisma/migrations/20251026202316_migrate_back_to_sqlite/migration.sql +257 -0
- package/templates/default/prisma/migrations/20251104113456_add_type_for_template_step_groups/migration.sql +16 -0
- package/templates/default/prisma/migrations/20251104170946_add_tags_to_test_suite_and_test_case/migration.sql +27 -0
- package/templates/default/prisma/migrations/20251112190024_add_cascade_delete_to_test_run_test_case/migration.sql +17 -0
- package/templates/default/prisma/migrations/20251113181100_add_test_run_log/migration.sql +12 -0
- package/templates/default/prisma/migrations/20251119191838_add_tag_type/migration.sql +28 -0
- package/templates/default/prisma/migrations/20251121164059_add_conflict_resolution/migration.sql +12 -0
- package/templates/default/prisma/migrations/20251130190737_add_trace_path_to_test_run_test_case/migration.sql +2 -0
- package/templates/default/prisma/migrations/20251213074835_add_log_path_to_test_run/migration.sql +2 -0
- package/templates/default/prisma/migrations/20251213183952_add_name_property_for_the_test_run_entities/migration.sql +30 -0
- package/templates/default/prisma/migrations/20251223183400_add_report_model_to_db_schema/migration.sql +10 -0
- package/templates/default/prisma/migrations/20251223183637_add_report_test_case_entity_for_storing_test_results_for_individual_test_cases/migration.sql +10 -0
- package/templates/default/prisma/migrations/20251224083549_add_comprehensive_report_storage/migration.sql +108 -0
- package/templates/default/prisma/migrations/20251229194422_migrate_duration_to_string/migration.sql +55 -0
- package/templates/default/prisma/migrations/20251230124637_add_unique_constraint_to_test_run_name/migration.sql +27 -0
- package/templates/default/prisma/migrations/20260115094436_add_dashboard_metrics/migration.sql +59 -0
- package/templates/default/prisma/migrations/20260127172022_add_cascade_delete_to_step_parameters/migration.sql +34 -0
- package/templates/default/prisma/migrations/migration_lock.toml +3 -0
- package/templates/default/prisma/schema.prisma +554 -0
- package/templates/default/public/favicon.ico +0 -0
- package/templates/default/public/file.svg +1 -0
- package/templates/default/public/globe.svg +1 -0
- package/templates/default/public/next.svg +1 -0
- package/templates/default/public/vercel.svg +1 -0
- package/templates/default/public/window.svg +1 -0
- package/templates/default/scripts/regenerate-features.ts +94 -0
- package/templates/default/scripts/setup-env.ts +19 -0
- package/templates/default/scripts/sync-all.ts +341 -0
- package/templates/default/scripts/sync-environments.ts +323 -0
- package/templates/default/scripts/sync-locator-groups.ts +413 -0
- package/templates/default/scripts/sync-locators.ts +402 -0
- package/templates/default/scripts/sync-modules.ts +349 -0
- package/templates/default/scripts/sync-tags.ts +292 -0
- package/templates/default/scripts/sync-template-step-groups.ts +399 -0
- package/templates/default/scripts/sync-template-steps.ts +806 -0
- package/templates/default/scripts/sync-test-cases.ts +905 -0
- package/templates/default/scripts/sync-test-suites.ts +411 -0
- package/templates/default/src/actions/conflict/conflict.action.ts +33 -0
- package/templates/default/src/actions/dashboard/dashboard-actions.ts +241 -0
- package/templates/default/src/actions/environments/environment-actions.ts +205 -0
- package/templates/default/src/actions/locator/locator-actions.ts +547 -0
- package/templates/default/src/actions/locator-groups/locator-group-actions.ts +344 -0
- package/templates/default/src/actions/modules/module-actions.ts +133 -0
- package/templates/default/src/actions/reports/report-actions.ts +614 -0
- package/templates/default/src/actions/review/review-actions.ts +147 -0
- package/templates/default/src/actions/tags/tag-actions.ts +104 -0
- package/templates/default/src/actions/template-step/template-step-actions.ts +332 -0
- package/templates/default/src/actions/template-step-group/template-step-group-actions.ts +278 -0
- package/templates/default/src/actions/template-test-case/template-test-case-actions.ts +238 -0
- package/templates/default/src/actions/test-case/test-case-actions.ts +419 -0
- package/templates/default/src/actions/test-run/test-run-actions.ts +1185 -0
- package/templates/default/src/actions/test-suite/test-suite-actions.ts +253 -0
- package/templates/default/src/actions/user/user-actions.ts +13 -0
- package/templates/default/src/app/(base)/environments/create/page.tsx +28 -0
- package/templates/default/src/app/(base)/environments/environment-form.tsx +219 -0
- package/templates/default/src/app/(base)/environments/environment-table-columns.tsx +96 -0
- package/templates/default/src/app/(base)/environments/environment-table.tsx +24 -0
- package/templates/default/src/app/(base)/environments/modify/[id]/page.tsx +46 -0
- package/templates/default/src/app/(base)/environments/page.tsx +59 -0
- package/templates/default/src/app/(base)/layout.tsx +10 -0
- package/templates/default/src/app/(base)/locator-groups/create/page.tsx +44 -0
- package/templates/default/src/app/(base)/locator-groups/locator-group-form.tsx +215 -0
- package/templates/default/src/app/(base)/locator-groups/locator-group-table-columns.tsx +77 -0
- package/templates/default/src/app/(base)/locator-groups/locator-group-table.tsx +28 -0
- package/templates/default/src/app/(base)/locator-groups/modify/[id]/page.tsx +46 -0
- package/templates/default/src/app/(base)/locator-groups/page.tsx +61 -0
- package/templates/default/src/app/(base)/locators/create/page.tsx +38 -0
- package/templates/default/src/app/(base)/locators/locator-form.tsx +163 -0
- package/templates/default/src/app/(base)/locators/locator-table-columns.tsx +90 -0
- package/templates/default/src/app/(base)/locators/locator-table.tsx +28 -0
- package/templates/default/src/app/(base)/locators/modify/[id]/page.tsx +45 -0
- package/templates/default/src/app/(base)/locators/page.tsx +65 -0
- package/templates/default/src/app/(base)/locators/sync-locators-button.tsx +66 -0
- package/templates/default/src/app/(base)/modules/create/page.tsx +34 -0
- package/templates/default/src/app/(base)/modules/modify/[id]/page.tsx +46 -0
- package/templates/default/src/app/(base)/modules/module-form.tsx +126 -0
- package/templates/default/src/app/(base)/modules/module-table-columns.tsx +85 -0
- package/templates/default/src/app/(base)/modules/module-table.tsx +24 -0
- package/templates/default/src/app/(base)/modules/page.tsx +59 -0
- package/templates/default/src/app/(base)/reports/[id]/page.tsx +517 -0
- package/templates/default/src/app/(base)/reports/duration-chart.tsx +33 -0
- package/templates/default/src/app/(base)/reports/feature-chart.tsx +78 -0
- package/templates/default/src/app/(base)/reports/overview-chart.tsx +46 -0
- package/templates/default/src/app/(base)/reports/page.tsx +98 -0
- package/templates/default/src/app/(base)/reports/report-metric-card.tsx +16 -0
- package/templates/default/src/app/(base)/reports/report-table-columns.tsx +189 -0
- package/templates/default/src/app/(base)/reports/report-table.tsx +72 -0
- package/templates/default/src/app/(base)/reports/report-view-table-columns.tsx +131 -0
- package/templates/default/src/app/(base)/reports/report-view-table.tsx +82 -0
- package/templates/default/src/app/(base)/reports/test-cases/page.tsx +42 -0
- package/templates/default/src/app/(base)/reports/test-cases/test-cases-metric-table-columns.tsx +115 -0
- package/templates/default/src/app/(base)/reports/test-cases/test-cases-metric-table.tsx +27 -0
- package/templates/default/src/app/(base)/reports/test-suites/page.tsx +42 -0
- package/templates/default/src/app/(base)/reports/test-suites/test-suites-metric-table-columns.tsx +79 -0
- package/templates/default/src/app/(base)/reports/test-suites/test-suites-metric-table.tsx +27 -0
- package/templates/default/src/app/(base)/reports/view-logs-button.tsx +60 -0
- package/templates/default/src/app/(base)/reviews/create/page.tsx +26 -0
- package/templates/default/src/app/(base)/reviews/created-reviews-table.tsx +15 -0
- package/templates/default/src/app/(base)/reviews/modify/[id]/page.tsx +26 -0
- package/templates/default/src/app/(base)/reviews/page.tsx +26 -0
- package/templates/default/src/app/(base)/reviews/review/[id]/page.tsx +26 -0
- package/templates/default/src/app/(base)/reviews/review-form.tsx +11 -0
- package/templates/default/src/app/(base)/reviews/review-table-by-creator-columns.tsx +9 -0
- package/templates/default/src/app/(base)/reviews/review-table-by-reviewer-columns.tsx +9 -0
- package/templates/default/src/app/(base)/reviews/reviewer-reviews-table.tsx +15 -0
- package/templates/default/src/app/(base)/tags/create/page.tsx +39 -0
- package/templates/default/src/app/(base)/tags/modify/[id]/page.tsx +50 -0
- package/templates/default/src/app/(base)/tags/page.tsx +58 -0
- package/templates/default/src/app/(base)/tags/tag-form.tsx +147 -0
- package/templates/default/src/app/(base)/tags/tag-table-columns.tsx +63 -0
- package/templates/default/src/app/(base)/tags/tag-table.tsx +29 -0
- package/templates/default/src/app/(base)/template-step-groups/create/page.tsx +28 -0
- package/templates/default/src/app/(base)/template-step-groups/modify/[id]/page.tsx +45 -0
- package/templates/default/src/app/(base)/template-step-groups/page.tsx +60 -0
- package/templates/default/src/app/(base)/template-step-groups/template-step-group-form.tsx +167 -0
- package/templates/default/src/app/(base)/template-step-groups/template-step-group-table-columns.tsx +89 -0
- package/templates/default/src/app/(base)/template-step-groups/template-step-group-table.tsx +32 -0
- package/templates/default/src/app/(base)/template-steps/create/page.tsx +37 -0
- package/templates/default/src/app/(base)/template-steps/modify/[id]/page.tsx +49 -0
- package/templates/default/src/app/(base)/template-steps/page.tsx +59 -0
- package/templates/default/src/app/(base)/template-steps/paramChip.tsx +213 -0
- package/templates/default/src/app/(base)/template-steps/template-step-form.tsx +384 -0
- package/templates/default/src/app/(base)/template-steps/template-step-table-columns.tsx +158 -0
- package/templates/default/src/app/(base)/template-steps/template-step-table.tsx +24 -0
- package/templates/default/src/app/(base)/template-test-cases/create/page.tsx +56 -0
- package/templates/default/src/app/(base)/template-test-cases/modify/[id]/page.tsx +89 -0
- package/templates/default/src/app/(base)/template-test-cases/page.tsx +58 -0
- package/templates/default/src/app/(base)/template-test-cases/template-test-case-flow.tsx +84 -0
- package/templates/default/src/app/(base)/template-test-cases/template-test-case-form.tsx +262 -0
- package/templates/default/src/app/(base)/template-test-cases/template-test-case-table-columns.tsx +76 -0
- package/templates/default/src/app/(base)/template-test-cases/template-test-case-table.tsx +32 -0
- package/templates/default/src/app/(base)/test-cases/create/page.tsx +76 -0
- package/templates/default/src/app/(base)/test-cases/create-from-template/generate/[id]/page.tsx +96 -0
- package/templates/default/src/app/(base)/test-cases/create-from-template/page.tsx +38 -0
- package/templates/default/src/app/(base)/test-cases/create-from-template/template-selection-form.tsx +73 -0
- package/templates/default/src/app/(base)/test-cases/modify/[id]/page.tsx +106 -0
- package/templates/default/src/app/(base)/test-cases/page.tsx +60 -0
- package/templates/default/src/app/(base)/test-cases/test-case-flow.tsx +82 -0
- package/templates/default/src/app/(base)/test-cases/test-case-form.tsx +395 -0
- package/templates/default/src/app/(base)/test-cases/test-case-table-columns.tsx +90 -0
- package/templates/default/src/app/(base)/test-cases/test-case-table.tsx +35 -0
- package/templates/default/src/app/(base)/test-runs/[id]/page.tsx +56 -0
- package/templates/default/src/app/(base)/test-runs/create/page.tsx +47 -0
- package/templates/default/src/app/(base)/test-runs/page.tsx +60 -0
- package/templates/default/src/app/(base)/test-runs/test-run-form.tsx +512 -0
- package/templates/default/src/app/(base)/test-runs/test-run-table-columns.tsx +229 -0
- package/templates/default/src/app/(base)/test-runs/test-run-table.tsx +127 -0
- package/templates/default/src/app/(base)/test-suites/create/page.tsx +45 -0
- package/templates/default/src/app/(base)/test-suites/modify/[id]/page.tsx +55 -0
- package/templates/default/src/app/(base)/test-suites/page.tsx +82 -0
- package/templates/default/src/app/(base)/test-suites/test-suite-form.tsx +269 -0
- package/templates/default/src/app/(base)/test-suites/test-suite-table-columns.tsx +97 -0
- package/templates/default/src/app/(base)/test-suites/test-suite-table.tsx +29 -0
- package/templates/default/src/app/(dashboard-components)/app-drawer.tsx +187 -0
- package/templates/default/src/app/(dashboard-components)/data-card-grid.tsx +13 -0
- package/templates/default/src/app/(dashboard-components)/data-card.tsx +27 -0
- package/templates/default/src/app/(dashboard-components)/execution-health-panel.tsx +57 -0
- package/templates/default/src/app/(dashboard-components)/ongoing-test-runs-card.tsx +87 -0
- package/templates/default/src/app/(dashboard-components)/quick-actions-drawer.tsx +45 -0
- package/templates/default/src/app/api/test-runs/[runId]/download/route.ts +133 -0
- package/templates/default/src/app/api/test-runs/[runId]/logs/route.ts +420 -0
- package/templates/default/src/app/api/test-runs/[runId]/trace/[testCaseId]/route.ts +146 -0
- package/templates/default/src/app/favicon.ico +0 -0
- package/templates/default/src/app/globals.css +147 -0
- package/templates/default/src/app/layout.tsx +171 -0
- package/templates/default/src/app/page.tsx +64 -0
- package/templates/default/src/assets/icons/empty-tube.tsx +23 -0
- package/templates/default/src/assets/icons/tube-plus.tsx +29 -0
- package/templates/default/src/components/base-node.tsx +21 -0
- package/templates/default/src/components/chart/pie-chart.tsx +73 -0
- package/templates/default/src/components/data-extraction/locator-inspector.tsx +460 -0
- package/templates/default/src/components/data-state/empty-state.tsx +40 -0
- package/templates/default/src/components/data-visualization/info-card.tsx +70 -0
- package/templates/default/src/components/data-visualization/info-grid.tsx +22 -0
- package/templates/default/src/components/devtools/providers.tsx +13 -0
- package/templates/default/src/components/diagram/button-edge.tsx +54 -0
- package/templates/default/src/components/diagram/dynamic-parameters.tsx +438 -0
- package/templates/default/src/components/diagram/edit-header-option.tsx +36 -0
- package/templates/default/src/components/diagram/flow-diagram.tsx +470 -0
- package/templates/default/src/components/diagram/node-form.tsx +262 -0
- package/templates/default/src/components/diagram/options-header-node.tsx +57 -0
- package/templates/default/src/components/diagram/template-step-combobox.tsx +155 -0
- package/templates/default/src/components/form/error-message.tsx +7 -0
- package/templates/default/src/components/kokonutui/smooth-tab.tsx +453 -0
- package/templates/default/src/components/loading-skeleton/data-table/data-table-skeleton.tsx +30 -0
- package/templates/default/src/components/loading-skeleton/form/button-skeleton.tsx +8 -0
- package/templates/default/src/components/loading-skeleton/form/icon-button-skeleton.tsx +8 -0
- package/templates/default/src/components/loading-skeleton/form/text-input-skeleton.tsx +8 -0
- package/templates/default/src/components/loading-skeleton/visualization/table-skeleton.tsx +14 -0
- package/templates/default/src/components/logo.tsx +15 -0
- package/templates/default/src/components/navigation/command-badge.tsx +34 -0
- package/templates/default/src/components/navigation/command-chain-input.tsx +51 -0
- package/templates/default/src/components/navigation/entity-search-command.tsx +116 -0
- package/templates/default/src/components/navigation/nav-card.tsx +31 -0
- package/templates/default/src/components/navigation/nav-command.tsx +508 -0
- package/templates/default/src/components/navigation/nav-link.tsx +60 -0
- package/templates/default/src/components/navigation/nav-menu-card-deck.tsx +112 -0
- package/templates/default/src/components/node-header.tsx +159 -0
- package/templates/default/src/components/reports/test-case-logs-modal.tsx +253 -0
- package/templates/default/src/components/table/table-actions.tsx +172 -0
- package/templates/default/src/components/test-run/download-logs-button.tsx +99 -0
- package/templates/default/src/components/test-run/log-viewer.tsx +445 -0
- package/templates/default/src/components/test-run/test-run-details.tsx +611 -0
- package/templates/default/src/components/test-run/test-run-header.tsx +149 -0
- package/templates/default/src/components/test-run/view-report-button.tsx +102 -0
- package/templates/default/src/components/theme/mode-toggle.tsx +54 -0
- package/templates/default/src/components/theme/theme-provider.tsx +8 -0
- package/templates/default/src/components/typography/page-header-subtitle.tsx +7 -0
- package/templates/default/src/components/typography/page-header.tsx +7 -0
- package/templates/default/src/components/ui/alert-dialog.tsx +106 -0
- package/templates/default/src/components/ui/alert.tsx +43 -0
- package/templates/default/src/components/ui/avatar.tsx +40 -0
- package/templates/default/src/components/ui/badge.tsx +29 -0
- package/templates/default/src/components/ui/button.tsx +47 -0
- package/templates/default/src/components/ui/calendar.tsx +158 -0
- package/templates/default/src/components/ui/card.tsx +43 -0
- package/templates/default/src/components/ui/chart.tsx +369 -0
- package/templates/default/src/components/ui/checkbox.tsx +28 -0
- package/templates/default/src/components/ui/command.tsx +135 -0
- package/templates/default/src/components/ui/data-table-column-header.tsx +61 -0
- package/templates/default/src/components/ui/data-table-pagination.tsx +87 -0
- package/templates/default/src/components/ui/data-table-view-options.tsx +50 -0
- package/templates/default/src/components/ui/data-table.tsx +267 -0
- package/templates/default/src/components/ui/dialog.tsx +97 -0
- package/templates/default/src/components/ui/dropdown-menu.tsx +182 -0
- package/templates/default/src/components/ui/empty.tsx +104 -0
- package/templates/default/src/components/ui/input.tsx +22 -0
- package/templates/default/src/components/ui/kbd.tsx +28 -0
- package/templates/default/src/components/ui/label.tsx +19 -0
- package/templates/default/src/components/ui/loading.tsx +12 -0
- package/templates/default/src/components/ui/multi-select-with-preview.tsx +116 -0
- package/templates/default/src/components/ui/multi-select.tsx +142 -0
- package/templates/default/src/components/ui/navigation-menu.tsx +120 -0
- package/templates/default/src/components/ui/popover.tsx +33 -0
- package/templates/default/src/components/ui/progress.tsx +25 -0
- package/templates/default/src/components/ui/radio-group.tsx +44 -0
- package/templates/default/src/components/ui/scroll-area.tsx +40 -0
- package/templates/default/src/components/ui/select.tsx +144 -0
- package/templates/default/src/components/ui/separator.tsx +22 -0
- package/templates/default/src/components/ui/skeleton.tsx +7 -0
- package/templates/default/src/components/ui/table.tsx +76 -0
- package/templates/default/src/components/ui/tabs.tsx +55 -0
- package/templates/default/src/components/ui/textarea.tsx +21 -0
- package/templates/default/src/components/ui/toast.tsx +113 -0
- package/templates/default/src/components/ui/toaster.tsx +26 -0
- package/templates/default/src/components/ui/tooltip.tsx +32 -0
- package/templates/default/src/components/user-prompt/delete-prompt.tsx +87 -0
- package/templates/default/src/config/db-config.ts +10 -0
- package/templates/default/src/constants/form-opts/diagram/node-form.ts +30 -0
- package/templates/default/src/constants/form-opts/environment-form-opts.ts +24 -0
- package/templates/default/src/constants/form-opts/locator-form-opts.ts +20 -0
- package/templates/default/src/constants/form-opts/locator-group-form-opts.ts +28 -0
- package/templates/default/src/constants/form-opts/module-form-opts.ts +21 -0
- package/templates/default/src/constants/form-opts/review-form-opts.ts +23 -0
- package/templates/default/src/constants/form-opts/tag-form-opts.ts +42 -0
- package/templates/default/src/constants/form-opts/template-selection-form-opts.ts +16 -0
- package/templates/default/src/constants/form-opts/template-step-group-form-opts.ts +24 -0
- package/templates/default/src/constants/form-opts/template-test-case-form-opts.ts +39 -0
- package/templates/default/src/constants/form-opts/template-test-step-form-opts.ts +36 -0
- package/templates/default/src/constants/form-opts/test-case-form-opts.ts +43 -0
- package/templates/default/src/constants/form-opts/test-run-form-opts.ts +31 -0
- package/templates/default/src/constants/form-opts/test-suite-form-opts.ts +24 -0
- package/templates/default/src/hooks/use-toast.ts +187 -0
- package/templates/default/src/lib/bidirectional-sync.ts +432 -0
- package/templates/default/src/lib/database-sync.ts +531 -0
- package/templates/default/src/lib/environment-file-utils.ts +221 -0
- package/templates/default/src/lib/feature-file-generator.ts +411 -0
- package/templates/default/src/lib/gherkin-parser.ts +259 -0
- package/templates/default/src/lib/locator-group-file-utils.ts +370 -0
- package/templates/default/src/lib/metrics/metric-calculator.ts +613 -0
- package/templates/default/src/lib/module-hierarchy-builder.ts +205 -0
- package/templates/default/src/lib/path-helpers/module-path.ts +71 -0
- package/templates/default/src/lib/test-case-utils.ts +6 -0
- package/templates/default/src/lib/test-run/log-formatter.ts +83 -0
- package/templates/default/src/lib/test-run/process-manager.ts +191 -0
- package/templates/default/src/lib/test-run/report-parser.ts +316 -0
- package/templates/default/src/lib/test-run/test-run-executor.ts +144 -0
- package/templates/default/src/lib/test-run/winston-logger.ts +95 -0
- package/templates/default/src/lib/transformers/gherkin-converter.ts +42 -0
- package/templates/default/src/lib/transformers/key-to-icon-transformer.tsx +95 -0
- package/templates/default/src/lib/transformers/template-test-case-converter.ts +160 -0
- package/templates/default/src/lib/utils/node-param-validation.ts +81 -0
- package/templates/default/src/lib/utils/template-step-file-generator.ts +167 -0
- package/templates/default/src/lib/utils/template-step-file-manager-intelligent.ts +723 -0
- package/templates/default/src/lib/utils/template-step-file-manager.ts +166 -0
- package/templates/default/src/lib/utils.ts +31 -0
- package/templates/default/src/tests/config/environments/environments.json +14 -0
- package/templates/default/src/tests/config/executor/world.ts +41 -0
- package/templates/default/src/tests/executor.ts +80 -0
- package/templates/default/src/tests/hooks/hooks.ts +99 -0
- package/templates/default/src/tests/mapping/locator-map.json +1 -0
- package/templates/default/src/tests/steps/actions/click.step.ts +62 -0
- package/templates/default/src/tests/steps/actions/hover.step.ts +31 -0
- package/templates/default/src/tests/steps/actions/input.step.ts +149 -0
- package/templates/default/src/tests/steps/actions/navigation.step.ts +72 -0
- package/templates/default/src/tests/steps/actions/random_data.step.ts +146 -0
- package/templates/default/src/tests/steps/actions/store.step.ts +90 -0
- package/templates/default/src/tests/steps/actions/wait.step.ts +107 -0
- package/templates/default/src/tests/steps/validations/active_state_assertion.step.ts +34 -0
- package/templates/default/src/tests/steps/validations/navigation_assertion.step.ts +23 -0
- package/templates/default/src/tests/steps/validations/text_assertion.step.ts +111 -0
- package/templates/default/src/tests/steps/validations/visibility_assertion.step.ts +30 -0
- package/templates/default/src/tests/support/parameter-types.ts +12 -0
- package/templates/default/src/tests/utils/cache.util.ts +260 -0
- package/templates/default/src/tests/utils/cli.util.ts +177 -0
- package/templates/default/src/tests/utils/environment.util.ts +65 -0
- package/templates/default/src/tests/utils/locator.util.ts +248 -0
- package/templates/default/src/tests/utils/random-data.util.ts +45 -0
- package/templates/default/src/tests/utils/spawner.util.ts +617 -0
- package/templates/default/src/types/diagram/diagram.ts +34 -0
- package/templates/default/src/types/diagram/template-step.ts +11 -0
- package/templates/default/src/types/executor/browser.type.ts +1 -0
- package/templates/default/src/types/form/actionHandler.ts +6 -0
- package/templates/default/src/types/locator/locator.type.ts +11 -0
- package/templates/default/src/types/step/step.type.ts +1 -0
- package/templates/default/src/types/table/data-table.ts +6 -0
- package/templates/default/tailwind.config.ts +62 -0
- package/templates/default/tsconfig.json +28 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react'
|
|
5
|
+
import { DayButton, DayPicker, getDefaultClassNames } from 'react-day-picker'
|
|
6
|
+
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
|
+
import { Button, buttonVariants } from '@/components/ui/button'
|
|
9
|
+
|
|
10
|
+
function Calendar({
|
|
11
|
+
className,
|
|
12
|
+
classNames,
|
|
13
|
+
showOutsideDays = true,
|
|
14
|
+
captionLayout = 'label',
|
|
15
|
+
buttonVariant = 'ghost',
|
|
16
|
+
formatters,
|
|
17
|
+
components,
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<typeof DayPicker> & {
|
|
20
|
+
buttonVariant?: React.ComponentProps<typeof Button>['variant']
|
|
21
|
+
}) {
|
|
22
|
+
const defaultClassNames = getDefaultClassNames()
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<DayPicker
|
|
26
|
+
showOutsideDays={showOutsideDays}
|
|
27
|
+
className={cn(
|
|
28
|
+
'group/calendar bg-background p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent',
|
|
29
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
30
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
31
|
+
className,
|
|
32
|
+
)}
|
|
33
|
+
captionLayout={captionLayout}
|
|
34
|
+
formatters={{
|
|
35
|
+
formatMonthDropdown: date => date.toLocaleString('default', { month: 'short' }),
|
|
36
|
+
...formatters,
|
|
37
|
+
}}
|
|
38
|
+
classNames={{
|
|
39
|
+
root: cn('w-fit', defaultClassNames.root),
|
|
40
|
+
months: cn('relative flex flex-col gap-4 md:flex-row', defaultClassNames.months),
|
|
41
|
+
month: cn('flex w-full flex-col gap-4', defaultClassNames.month),
|
|
42
|
+
nav: cn('absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1', defaultClassNames.nav),
|
|
43
|
+
button_previous: cn(
|
|
44
|
+
buttonVariants({ variant: buttonVariant }),
|
|
45
|
+
'h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50',
|
|
46
|
+
defaultClassNames.button_previous,
|
|
47
|
+
),
|
|
48
|
+
button_next: cn(
|
|
49
|
+
buttonVariants({ variant: buttonVariant }),
|
|
50
|
+
'h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50',
|
|
51
|
+
defaultClassNames.button_next,
|
|
52
|
+
),
|
|
53
|
+
month_caption: cn(
|
|
54
|
+
'flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]',
|
|
55
|
+
defaultClassNames.month_caption,
|
|
56
|
+
),
|
|
57
|
+
dropdowns: cn(
|
|
58
|
+
'flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium',
|
|
59
|
+
defaultClassNames.dropdowns,
|
|
60
|
+
),
|
|
61
|
+
dropdown_root: cn(
|
|
62
|
+
'has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border',
|
|
63
|
+
defaultClassNames.dropdown_root,
|
|
64
|
+
),
|
|
65
|
+
dropdown: cn('absolute inset-0 opacity-0', defaultClassNames.dropdown),
|
|
66
|
+
caption_label: cn(
|
|
67
|
+
'select-none font-medium',
|
|
68
|
+
captionLayout === 'label'
|
|
69
|
+
? 'text-sm'
|
|
70
|
+
: '[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5',
|
|
71
|
+
defaultClassNames.caption_label,
|
|
72
|
+
),
|
|
73
|
+
table: 'w-full border-collapse',
|
|
74
|
+
weekdays: cn('flex', defaultClassNames.weekdays),
|
|
75
|
+
weekday: cn(
|
|
76
|
+
'text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal',
|
|
77
|
+
defaultClassNames.weekday,
|
|
78
|
+
),
|
|
79
|
+
week: cn('mt-2 flex w-full', defaultClassNames.week),
|
|
80
|
+
week_number_header: cn('w-[--cell-size] select-none', defaultClassNames.week_number_header),
|
|
81
|
+
week_number: cn('text-muted-foreground select-none text-[0.8rem]', defaultClassNames.week_number),
|
|
82
|
+
day: cn(
|
|
83
|
+
'group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md',
|
|
84
|
+
defaultClassNames.day,
|
|
85
|
+
),
|
|
86
|
+
range_start: cn('bg-accent rounded-l-md', defaultClassNames.range_start),
|
|
87
|
+
range_middle: cn('rounded-none', defaultClassNames.range_middle),
|
|
88
|
+
range_end: cn('bg-accent rounded-r-md', defaultClassNames.range_end),
|
|
89
|
+
today: cn(
|
|
90
|
+
'bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none',
|
|
91
|
+
defaultClassNames.today,
|
|
92
|
+
),
|
|
93
|
+
outside: cn('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside),
|
|
94
|
+
disabled: cn('text-muted-foreground opacity-50', defaultClassNames.disabled),
|
|
95
|
+
hidden: cn('invisible', defaultClassNames.hidden),
|
|
96
|
+
...classNames,
|
|
97
|
+
}}
|
|
98
|
+
components={{
|
|
99
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
100
|
+
return <div data-slot="calendar" ref={rootRef} className={cn(className)} {...props} />
|
|
101
|
+
},
|
|
102
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
103
|
+
if (orientation === 'left') {
|
|
104
|
+
return <ChevronLeftIcon className={cn('size-4', className)} {...props} />
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (orientation === 'right') {
|
|
108
|
+
return <ChevronRightIcon className={cn('size-4', className)} {...props} />
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return <ChevronDownIcon className={cn('size-4', className)} {...props} />
|
|
112
|
+
},
|
|
113
|
+
DayButton: CalendarDayButton,
|
|
114
|
+
WeekNumber: ({ children, ...props }) => {
|
|
115
|
+
return (
|
|
116
|
+
<td {...props}>
|
|
117
|
+
<div className="flex size-[--cell-size] items-center justify-center text-center">{children}</div>
|
|
118
|
+
</td>
|
|
119
|
+
)
|
|
120
|
+
},
|
|
121
|
+
...components,
|
|
122
|
+
}}
|
|
123
|
+
{...props}
|
|
124
|
+
/>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function CalendarDayButton({ className, day, modifiers, ...props }: React.ComponentProps<typeof DayButton>) {
|
|
129
|
+
const defaultClassNames = getDefaultClassNames()
|
|
130
|
+
|
|
131
|
+
const ref = React.useRef<HTMLButtonElement>(null)
|
|
132
|
+
React.useEffect(() => {
|
|
133
|
+
if (modifiers.focused) ref.current?.focus()
|
|
134
|
+
}, [modifiers.focused])
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<Button
|
|
138
|
+
ref={ref}
|
|
139
|
+
variant="ghost"
|
|
140
|
+
size="icon"
|
|
141
|
+
data-day={day.date.toLocaleDateString()}
|
|
142
|
+
data-selected-single={
|
|
143
|
+
modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle
|
|
144
|
+
}
|
|
145
|
+
data-range-start={modifiers.range_start}
|
|
146
|
+
data-range-end={modifiers.range_end}
|
|
147
|
+
data-range-middle={modifiers.range_middle}
|
|
148
|
+
className={cn(
|
|
149
|
+
'flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-end=true]:bg-primary data-[range-middle=true]:bg-accent data-[range-start=true]:bg-primary data-[selected-single=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:text-accent-foreground data-[range-start=true]:text-primary-foreground data-[selected-single=true]:text-primary-foreground group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 [&>span]:text-xs [&>span]:opacity-70',
|
|
150
|
+
defaultClassNames.day,
|
|
151
|
+
className,
|
|
152
|
+
)}
|
|
153
|
+
{...props}
|
|
154
|
+
/>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export { Calendar, CalendarDayButton }
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (
|
|
6
|
+
<div ref={ref} className={cn('rounded-xl border bg-card text-card-foreground shadow', className)} {...props} />
|
|
7
|
+
))
|
|
8
|
+
Card.displayName = 'Card'
|
|
9
|
+
|
|
10
|
+
const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
11
|
+
({ className, ...props }, ref) => (
|
|
12
|
+
<div ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />
|
|
13
|
+
),
|
|
14
|
+
)
|
|
15
|
+
CardHeader.displayName = 'CardHeader'
|
|
16
|
+
|
|
17
|
+
const CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
18
|
+
({ className, ...props }, ref) => (
|
|
19
|
+
<div ref={ref} className={cn('font-semibold leading-none tracking-tight', className)} {...props} />
|
|
20
|
+
),
|
|
21
|
+
)
|
|
22
|
+
CardTitle.displayName = 'CardTitle'
|
|
23
|
+
|
|
24
|
+
const CardDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
25
|
+
({ className, ...props }, ref) => (
|
|
26
|
+
<div ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
|
|
27
|
+
),
|
|
28
|
+
)
|
|
29
|
+
CardDescription.displayName = 'CardDescription'
|
|
30
|
+
|
|
31
|
+
const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
32
|
+
({ className, ...props }, ref) => <div ref={ref} className={cn('p-6 pt-0', className)} {...props} />,
|
|
33
|
+
)
|
|
34
|
+
CardContent.displayName = 'CardContent'
|
|
35
|
+
|
|
36
|
+
const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
37
|
+
({ className, ...props }, ref) => (
|
|
38
|
+
<div ref={ref} className={cn('flex items-center p-6 pt-0', className)} {...props} />
|
|
39
|
+
),
|
|
40
|
+
)
|
|
41
|
+
CardFooter.displayName = 'CardFooter'
|
|
42
|
+
|
|
43
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as RechartsPrimitive from "recharts"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
|
|
8
|
+
// Format: { THEME_NAME: CSS_SELECTOR }
|
|
9
|
+
const THEMES = { light: "", dark: ".dark" } as const
|
|
10
|
+
|
|
11
|
+
export type ChartConfig = {
|
|
12
|
+
[k in string]: {
|
|
13
|
+
label?: React.ReactNode
|
|
14
|
+
icon?: React.ComponentType
|
|
15
|
+
} & (
|
|
16
|
+
| { color?: string; theme?: never }
|
|
17
|
+
| { color?: never; theme: Record<keyof typeof THEMES, string> }
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type ChartContextProps = {
|
|
22
|
+
config: ChartConfig
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const ChartContext = React.createContext<ChartContextProps | null>(null)
|
|
26
|
+
|
|
27
|
+
function useChart() {
|
|
28
|
+
const context = React.useContext(ChartContext)
|
|
29
|
+
|
|
30
|
+
if (!context) {
|
|
31
|
+
throw new Error("useChart must be used within a <ChartContainer />")
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return context
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const ChartContainer = React.forwardRef<
|
|
38
|
+
HTMLDivElement,
|
|
39
|
+
React.ComponentProps<"div"> & {
|
|
40
|
+
config: ChartConfig
|
|
41
|
+
children: React.ComponentProps<
|
|
42
|
+
typeof RechartsPrimitive.ResponsiveContainer
|
|
43
|
+
>["children"]
|
|
44
|
+
}
|
|
45
|
+
>(({ id, className, children, config, ...props }, ref) => {
|
|
46
|
+
const uniqueId = React.useId()
|
|
47
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<ChartContext.Provider value={{ config }}>
|
|
51
|
+
<div
|
|
52
|
+
data-chart={chartId}
|
|
53
|
+
ref={ref}
|
|
54
|
+
className={cn(
|
|
55
|
+
"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
|
|
56
|
+
className
|
|
57
|
+
)}
|
|
58
|
+
{...props}
|
|
59
|
+
>
|
|
60
|
+
<ChartStyle id={chartId} config={config} />
|
|
61
|
+
<RechartsPrimitive.ResponsiveContainer>
|
|
62
|
+
{children}
|
|
63
|
+
</RechartsPrimitive.ResponsiveContainer>
|
|
64
|
+
</div>
|
|
65
|
+
</ChartContext.Provider>
|
|
66
|
+
)
|
|
67
|
+
})
|
|
68
|
+
ChartContainer.displayName = "Chart"
|
|
69
|
+
|
|
70
|
+
const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
|
|
71
|
+
const colorConfig = Object.entries(config).filter(
|
|
72
|
+
([, config]) => config.theme || config.color
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
if (!colorConfig.length) {
|
|
76
|
+
return null
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<style
|
|
81
|
+
dangerouslySetInnerHTML={{
|
|
82
|
+
__html: Object.entries(THEMES)
|
|
83
|
+
.map(
|
|
84
|
+
([theme, prefix]) => `
|
|
85
|
+
${prefix} [data-chart=${id}] {
|
|
86
|
+
${colorConfig
|
|
87
|
+
.map(([key, itemConfig]) => {
|
|
88
|
+
const color =
|
|
89
|
+
itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
|
|
90
|
+
itemConfig.color
|
|
91
|
+
return color ? ` --color-${key}: ${color};` : null
|
|
92
|
+
})
|
|
93
|
+
.join("\n")}
|
|
94
|
+
}
|
|
95
|
+
`
|
|
96
|
+
)
|
|
97
|
+
.join("\n"),
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const ChartTooltip = RechartsPrimitive.Tooltip
|
|
104
|
+
|
|
105
|
+
const ChartTooltipContent = React.forwardRef<
|
|
106
|
+
HTMLDivElement,
|
|
107
|
+
React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
|
|
108
|
+
React.ComponentProps<"div"> & {
|
|
109
|
+
hideLabel?: boolean
|
|
110
|
+
hideIndicator?: boolean
|
|
111
|
+
indicator?: "line" | "dot" | "dashed"
|
|
112
|
+
nameKey?: string
|
|
113
|
+
labelKey?: string
|
|
114
|
+
}
|
|
115
|
+
>(
|
|
116
|
+
(
|
|
117
|
+
{
|
|
118
|
+
active,
|
|
119
|
+
payload,
|
|
120
|
+
className,
|
|
121
|
+
indicator = "dot",
|
|
122
|
+
hideLabel = false,
|
|
123
|
+
hideIndicator = false,
|
|
124
|
+
label,
|
|
125
|
+
labelFormatter,
|
|
126
|
+
labelClassName,
|
|
127
|
+
formatter,
|
|
128
|
+
color,
|
|
129
|
+
nameKey,
|
|
130
|
+
labelKey,
|
|
131
|
+
},
|
|
132
|
+
ref
|
|
133
|
+
) => {
|
|
134
|
+
const { config } = useChart()
|
|
135
|
+
|
|
136
|
+
const tooltipLabel = React.useMemo(() => {
|
|
137
|
+
if (hideLabel || !payload?.length) {
|
|
138
|
+
return null
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const [item] = payload
|
|
142
|
+
const key = `${labelKey || item?.dataKey || item?.name || "value"}`
|
|
143
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
144
|
+
const value =
|
|
145
|
+
!labelKey && typeof label === "string"
|
|
146
|
+
? config[label as keyof typeof config]?.label || label
|
|
147
|
+
: itemConfig?.label
|
|
148
|
+
|
|
149
|
+
if (labelFormatter) {
|
|
150
|
+
return (
|
|
151
|
+
<div className={cn("font-medium", labelClassName)}>
|
|
152
|
+
{labelFormatter(value, payload)}
|
|
153
|
+
</div>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (!value) {
|
|
158
|
+
return null
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return <div className={cn("font-medium", labelClassName)}>{value}</div>
|
|
162
|
+
}, [
|
|
163
|
+
label,
|
|
164
|
+
labelFormatter,
|
|
165
|
+
payload,
|
|
166
|
+
hideLabel,
|
|
167
|
+
labelClassName,
|
|
168
|
+
config,
|
|
169
|
+
labelKey,
|
|
170
|
+
])
|
|
171
|
+
|
|
172
|
+
if (!active || !payload?.length) {
|
|
173
|
+
return null
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const nestLabel = payload.length === 1 && indicator !== "dot"
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<div
|
|
180
|
+
ref={ref}
|
|
181
|
+
className={cn(
|
|
182
|
+
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
|
|
183
|
+
className
|
|
184
|
+
)}
|
|
185
|
+
>
|
|
186
|
+
{!nestLabel ? tooltipLabel : null}
|
|
187
|
+
<div className="grid gap-1.5">
|
|
188
|
+
{payload
|
|
189
|
+
.filter((item) => item.type !== "none")
|
|
190
|
+
.map((item, index) => {
|
|
191
|
+
const key = `${nameKey || item.name || item.dataKey || "value"}`
|
|
192
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
193
|
+
const indicatorColor = color || item.payload.fill || item.color
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<div
|
|
197
|
+
key={item.dataKey}
|
|
198
|
+
className={cn(
|
|
199
|
+
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
|
|
200
|
+
indicator === "dot" && "items-center"
|
|
201
|
+
)}
|
|
202
|
+
>
|
|
203
|
+
{formatter && item?.value !== undefined && item.name ? (
|
|
204
|
+
formatter(item.value, item.name, item, index, item.payload)
|
|
205
|
+
) : (
|
|
206
|
+
<>
|
|
207
|
+
{itemConfig?.icon ? (
|
|
208
|
+
<itemConfig.icon />
|
|
209
|
+
) : (
|
|
210
|
+
!hideIndicator && (
|
|
211
|
+
<div
|
|
212
|
+
className={cn(
|
|
213
|
+
"shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",
|
|
214
|
+
{
|
|
215
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
216
|
+
"w-1": indicator === "line",
|
|
217
|
+
"w-0 border-[1.5px] border-dashed bg-transparent":
|
|
218
|
+
indicator === "dashed",
|
|
219
|
+
"my-0.5": nestLabel && indicator === "dashed",
|
|
220
|
+
}
|
|
221
|
+
)}
|
|
222
|
+
style={
|
|
223
|
+
{
|
|
224
|
+
"--color-bg": indicatorColor,
|
|
225
|
+
"--color-border": indicatorColor,
|
|
226
|
+
} as React.CSSProperties
|
|
227
|
+
}
|
|
228
|
+
/>
|
|
229
|
+
)
|
|
230
|
+
)}
|
|
231
|
+
<div
|
|
232
|
+
className={cn(
|
|
233
|
+
"flex flex-1 justify-between leading-none",
|
|
234
|
+
nestLabel ? "items-end" : "items-center"
|
|
235
|
+
)}
|
|
236
|
+
>
|
|
237
|
+
<div className="grid gap-1.5">
|
|
238
|
+
{nestLabel ? tooltipLabel : null}
|
|
239
|
+
<span className="text-muted-foreground">
|
|
240
|
+
{itemConfig?.label || item.name}
|
|
241
|
+
</span>
|
|
242
|
+
</div>
|
|
243
|
+
{item.value && (
|
|
244
|
+
<span className="font-mono font-medium tabular-nums text-foreground">
|
|
245
|
+
{item.value.toLocaleString()}
|
|
246
|
+
</span>
|
|
247
|
+
)}
|
|
248
|
+
</div>
|
|
249
|
+
</>
|
|
250
|
+
)}
|
|
251
|
+
</div>
|
|
252
|
+
)
|
|
253
|
+
})}
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
)
|
|
257
|
+
}
|
|
258
|
+
)
|
|
259
|
+
ChartTooltipContent.displayName = "ChartTooltip"
|
|
260
|
+
|
|
261
|
+
const ChartLegend = RechartsPrimitive.Legend
|
|
262
|
+
|
|
263
|
+
const ChartLegendContent = React.forwardRef<
|
|
264
|
+
HTMLDivElement,
|
|
265
|
+
React.ComponentProps<"div"> &
|
|
266
|
+
Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
|
267
|
+
hideIcon?: boolean
|
|
268
|
+
nameKey?: string
|
|
269
|
+
}
|
|
270
|
+
>(
|
|
271
|
+
(
|
|
272
|
+
{ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey },
|
|
273
|
+
ref
|
|
274
|
+
) => {
|
|
275
|
+
const { config } = useChart()
|
|
276
|
+
|
|
277
|
+
if (!payload?.length) {
|
|
278
|
+
return null
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return (
|
|
282
|
+
<div
|
|
283
|
+
ref={ref}
|
|
284
|
+
className={cn(
|
|
285
|
+
"flex items-center justify-center gap-4",
|
|
286
|
+
verticalAlign === "top" ? "pb-3" : "pt-3",
|
|
287
|
+
className
|
|
288
|
+
)}
|
|
289
|
+
>
|
|
290
|
+
{payload
|
|
291
|
+
.filter((item) => item.type !== "none")
|
|
292
|
+
.map((item) => {
|
|
293
|
+
const key = `${nameKey || item.dataKey || "value"}`
|
|
294
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key)
|
|
295
|
+
|
|
296
|
+
return (
|
|
297
|
+
<div
|
|
298
|
+
key={item.value}
|
|
299
|
+
className={cn(
|
|
300
|
+
"flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
|
|
301
|
+
)}
|
|
302
|
+
>
|
|
303
|
+
{itemConfig?.icon && !hideIcon ? (
|
|
304
|
+
<itemConfig.icon />
|
|
305
|
+
) : (
|
|
306
|
+
<div
|
|
307
|
+
className="h-2 w-2 shrink-0 rounded-[2px]"
|
|
308
|
+
style={{
|
|
309
|
+
backgroundColor: item.color,
|
|
310
|
+
}}
|
|
311
|
+
/>
|
|
312
|
+
)}
|
|
313
|
+
{itemConfig?.label}
|
|
314
|
+
</div>
|
|
315
|
+
)
|
|
316
|
+
})}
|
|
317
|
+
</div>
|
|
318
|
+
)
|
|
319
|
+
}
|
|
320
|
+
)
|
|
321
|
+
ChartLegendContent.displayName = "ChartLegend"
|
|
322
|
+
|
|
323
|
+
// Helper to extract item config from a payload.
|
|
324
|
+
function getPayloadConfigFromPayload(
|
|
325
|
+
config: ChartConfig,
|
|
326
|
+
payload: unknown,
|
|
327
|
+
key: string
|
|
328
|
+
) {
|
|
329
|
+
if (typeof payload !== "object" || payload === null) {
|
|
330
|
+
return undefined
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const payloadPayload =
|
|
334
|
+
"payload" in payload &&
|
|
335
|
+
typeof payload.payload === "object" &&
|
|
336
|
+
payload.payload !== null
|
|
337
|
+
? payload.payload
|
|
338
|
+
: undefined
|
|
339
|
+
|
|
340
|
+
let configLabelKey: string = key
|
|
341
|
+
|
|
342
|
+
if (
|
|
343
|
+
key in payload &&
|
|
344
|
+
typeof payload[key as keyof typeof payload] === "string"
|
|
345
|
+
) {
|
|
346
|
+
configLabelKey = payload[key as keyof typeof payload] as string
|
|
347
|
+
} else if (
|
|
348
|
+
payloadPayload &&
|
|
349
|
+
key in payloadPayload &&
|
|
350
|
+
typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
|
|
351
|
+
) {
|
|
352
|
+
configLabelKey = payloadPayload[
|
|
353
|
+
key as keyof typeof payloadPayload
|
|
354
|
+
] as string
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return configLabelKey in config
|
|
358
|
+
? config[configLabelKey]
|
|
359
|
+
: config[key as keyof typeof config]
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export {
|
|
363
|
+
ChartContainer,
|
|
364
|
+
ChartTooltip,
|
|
365
|
+
ChartTooltipContent,
|
|
366
|
+
ChartLegend,
|
|
367
|
+
ChartLegendContent,
|
|
368
|
+
ChartStyle,
|
|
369
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox'
|
|
5
|
+
import { Check } from 'lucide-react'
|
|
6
|
+
|
|
7
|
+
import { cn } from '@/lib/utils'
|
|
8
|
+
|
|
9
|
+
const Checkbox = React.forwardRef<
|
|
10
|
+
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
|
11
|
+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
|
12
|
+
>(({ className, ...props }, ref) => (
|
|
13
|
+
<CheckboxPrimitive.Root
|
|
14
|
+
ref={ref}
|
|
15
|
+
className={cn(
|
|
16
|
+
'peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground',
|
|
17
|
+
className,
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
>
|
|
21
|
+
<CheckboxPrimitive.Indicator className={cn('flex items-center justify-center text-current')}>
|
|
22
|
+
<Check className="h-4 w-4" />
|
|
23
|
+
</CheckboxPrimitive.Indicator>
|
|
24
|
+
</CheckboxPrimitive.Root>
|
|
25
|
+
))
|
|
26
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName
|
|
27
|
+
|
|
28
|
+
export { Checkbox }
|