@agent-native/core 0.101.14 → 0.102.1
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/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +12 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/cli/templates-meta.ts +13 -0
- package/corpus/core/src/client/agent-page/AgentTabsPage.tsx +1 -1
- package/corpus/core/src/client/org/OrgSwitcher.tsx +2 -0
- package/corpus/templates/analytics/changelog/2026-07-15-fixed-the-agent-discarding-a-successful-dashboard-edit-and-r.md +6 -0
- package/corpus/templates/analytics/server/lib/real-data-actions.ts +30 -1
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +15 -0
- package/corpus/templates/content/actions/_database-source-utils.ts +59 -4
- package/corpus/templates/content/actions/prepare-builder-source-review.ts +9 -0
- package/corpus/templates/content/actions/preview-builder-source-review.ts +6 -4
- package/corpus/templates/content/app/components/editor/DescriptionField.tsx +10 -2
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +4 -0
- package/corpus/templates/content/changelog/2026-07-15-page-and-database-descriptions-now-use-a-clean-single-line-f.md +6 -0
- package/corpus/templates/content/changelog/2026-07-15-selected-builder-reviews-now-load-only-the-chosen-rows-avoid.md +6 -0
- package/corpus/templates/content/shared/api.ts +1 -0
- package/corpus/templates/tasks/.agents/commands/visual-plan.md +9 -0
- package/corpus/templates/tasks/.agents/commands/visual-recap.md +8 -0
- package/corpus/templates/tasks/.agents/skills/actions/SKILL.md +492 -0
- package/corpus/templates/tasks/.agents/skills/adding-a-feature/SKILL.md +189 -0
- package/corpus/templates/tasks/.agents/skills/agent-native-docs/SKILL.md +76 -0
- package/corpus/templates/tasks/.agents/skills/agent-watchdog/README.md +43 -0
- package/corpus/templates/tasks/.agents/skills/agent-watchdog/SKILL.md +110 -0
- package/corpus/templates/tasks/.agents/skills/agent-watchdog/agents/openai.yaml +4 -0
- package/corpus/templates/tasks/.agents/skills/capture-learnings/SKILL.md +89 -0
- package/corpus/templates/tasks/.agents/skills/change-summary/SKILL.md +83 -0
- package/corpus/templates/tasks/.agents/skills/create-skill/SKILL.md +221 -0
- package/corpus/templates/tasks/.agents/skills/delegate-to-agent/SKILL.md +263 -0
- package/corpus/templates/tasks/.agents/skills/efficient-fable/README.md +75 -0
- package/corpus/templates/tasks/.agents/skills/efficient-fable/SKILL.md +95 -0
- package/corpus/templates/tasks/.agents/skills/efficient-frontier/README.md +53 -0
- package/corpus/templates/tasks/.agents/skills/efficient-frontier/SKILL.md +73 -0
- package/corpus/templates/tasks/.agents/skills/frontend-design/SKILL.md +112 -0
- package/corpus/templates/tasks/.agents/skills/plan-arbiter/README.md +41 -0
- package/corpus/templates/tasks/.agents/skills/plan-arbiter/SKILL.md +114 -0
- package/corpus/templates/tasks/.agents/skills/plan-arbiter/agents/openai.yaml +4 -0
- package/corpus/templates/tasks/.agents/skills/plow-ahead/README.md +42 -0
- package/corpus/templates/tasks/.agents/skills/plow-ahead/SKILL.md +104 -0
- package/corpus/templates/tasks/.agents/skills/plow-ahead/agents/openai.yaml +4 -0
- package/corpus/templates/tasks/.agents/skills/quick-recap/README.md +55 -0
- package/corpus/templates/tasks/.agents/skills/quick-recap/SKILL.md +54 -0
- package/corpus/templates/tasks/.agents/skills/read-the-damn-docs/README.md +54 -0
- package/corpus/templates/tasks/.agents/skills/read-the-damn-docs/SKILL.md +126 -0
- package/corpus/templates/tasks/.agents/skills/read-the-damn-docs/agents/openai.yaml +4 -0
- package/corpus/templates/tasks/.agents/skills/real-time-sync/SKILL.md +232 -0
- package/corpus/templates/tasks/.agents/skills/security/SKILL.md +280 -0
- package/corpus/templates/tasks/.agents/skills/self-modifying-code/SKILL.md +106 -0
- package/corpus/templates/tasks/.agents/skills/shadcn-ui/SKILL.md +95 -0
- package/corpus/templates/tasks/.agents/skills/stay-within-limits/README.md +61 -0
- package/corpus/templates/tasks/.agents/skills/stay-within-limits/SKILL.md +83 -0
- package/corpus/templates/tasks/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/tasks/.agents/skills/visual-plan/SKILL.md +547 -0
- package/corpus/templates/tasks/.agents/skills/visual-plan/agent-native-skill.json +12 -0
- package/corpus/templates/tasks/.agents/skills/visual-plan/references/canvas.md +121 -0
- package/corpus/templates/tasks/.agents/skills/visual-plan/references/document-quality.md +178 -0
- package/corpus/templates/tasks/.agents/skills/visual-plan/references/exemplar.md +62 -0
- package/corpus/templates/tasks/.agents/skills/visual-plan/references/wireframe.md +264 -0
- package/corpus/templates/tasks/.agents/skills/visual-recap/SKILL.md +634 -0
- package/corpus/templates/tasks/.agents/skills/visual-recap/agent-native-skill.json +12 -0
- package/corpus/templates/tasks/.agents/skills/visual-recap/references/wireframe.md +264 -0
- package/corpus/templates/tasks/.claude/commands/visual-plan.md +9 -0
- package/corpus/templates/tasks/.claude/commands/visual-recap.md +8 -0
- package/corpus/templates/tasks/.env.example +5 -0
- package/corpus/templates/tasks/.ignore +0 -0
- package/corpus/templates/tasks/.prettierrc +5 -0
- package/corpus/templates/tasks/AGENTS.md +158 -0
- package/corpus/templates/tasks/DEVELOPING.md +185 -0
- package/corpus/templates/tasks/README.md +16 -0
- package/corpus/templates/tasks/actions/bulk-delete-inbox-items.ts +24 -0
- package/corpus/templates/tasks/actions/bulk-delete-tasks.ts +21 -0
- package/corpus/templates/tasks/actions/bulk-mark-inbox-items-ready.ts +27 -0
- package/corpus/templates/tasks/actions/bulk-update-tasks.ts +35 -0
- package/corpus/templates/tasks/actions/create-custom-field.ts +22 -0
- package/corpus/templates/tasks/actions/create-inbox-item.ts +30 -0
- package/corpus/templates/tasks/actions/create-task.ts +33 -0
- package/corpus/templates/tasks/actions/delete-custom-field.ts +19 -0
- package/corpus/templates/tasks/actions/delete-inbox-item.ts +17 -0
- package/corpus/templates/tasks/actions/delete-task.ts +17 -0
- package/corpus/templates/tasks/actions/lib/boolean-query-param.ts +30 -0
- package/corpus/templates/tasks/actions/list-custom-fields.ts +18 -0
- package/corpus/templates/tasks/actions/list-inbox-items.ts +16 -0
- package/corpus/templates/tasks/actions/list-tasks.ts +52 -0
- package/corpus/templates/tasks/actions/list-visible-task-fields.ts +18 -0
- package/corpus/templates/tasks/actions/mark-inbox-item-ready.ts +31 -0
- package/corpus/templates/tasks/actions/navigate.ts +51 -0
- package/corpus/templates/tasks/actions/reorder-custom-fields.ts +27 -0
- package/corpus/templates/tasks/actions/reorder-inbox-items.ts +24 -0
- package/corpus/templates/tasks/actions/reorder-tasks.ts +29 -0
- package/corpus/templates/tasks/actions/run.ts +2 -0
- package/corpus/templates/tasks/actions/update-custom-field.ts +33 -0
- package/corpus/templates/tasks/actions/update-inbox-item.ts +24 -0
- package/corpus/templates/tasks/actions/update-task.ts +68 -0
- package/corpus/templates/tasks/actions/update-visible-task-fields.ts +27 -0
- package/corpus/templates/tasks/actions/view-screen-helpers.ts +68 -0
- package/corpus/templates/tasks/actions/view-screen.ts +207 -0
- package/corpus/templates/tasks/app/components/custom-fields/FieldCreateBar.tsx +121 -0
- package/corpus/templates/tasks/app/components/custom-fields/FieldListRow.tsx +116 -0
- package/corpus/templates/tasks/app/components/custom-fields/FieldsList.tsx +225 -0
- package/corpus/templates/tasks/app/components/custom-fields/FieldsListSkeleton.tsx +18 -0
- package/corpus/templates/tasks/app/components/custom-fields/FieldsPage.tsx +42 -0
- package/corpus/templates/tasks/app/components/custom-fields/editor/FieldEditorSidebar.tsx +69 -0
- package/corpus/templates/tasks/app/components/custom-fields/editor/FieldTitleSection.tsx +32 -0
- package/corpus/templates/tasks/app/components/custom-fields/editor/config/CurrencyConfigControl.tsx +49 -0
- package/corpus/templates/tasks/app/components/custom-fields/editor/config/FieldConfigControl.tsx +56 -0
- package/corpus/templates/tasks/app/components/custom-fields/editor/config/NumberConfigControl.tsx +52 -0
- package/corpus/templates/tasks/app/components/custom-fields/editor/config/PercentConfigControl.tsx +30 -0
- package/corpus/templates/tasks/app/components/custom-fields/editor/config/SelectConfigControl.tsx +135 -0
- package/corpus/templates/tasks/app/components/custom-fields/editor/config/select-colors.ts +23 -0
- package/corpus/templates/tasks/app/components/custom-fields/editor/config/utils.ts +52 -0
- package/corpus/templates/tasks/app/components/custom-fields/editor/types.ts +7 -0
- package/corpus/templates/tasks/app/components/dnd/SortableItem.tsx +72 -0
- package/corpus/templates/tasks/app/components/dnd/SortableList.tsx +136 -0
- package/corpus/templates/tasks/app/components/dnd/reorder-moving-items.ts +160 -0
- package/corpus/templates/tasks/app/components/dnd/sortable-drag-props.ts +60 -0
- package/corpus/templates/tasks/app/components/inbox/InboxList.tsx +222 -0
- package/corpus/templates/tasks/app/components/inbox/InboxListPage.tsx +39 -0
- package/corpus/templates/tasks/app/components/inbox/InboxListRow.tsx +122 -0
- package/corpus/templates/tasks/app/components/layout/Header.tsx +55 -0
- package/corpus/templates/tasks/app/components/layout/HeaderActions.tsx +84 -0
- package/corpus/templates/tasks/app/components/layout/Layout.tsx +134 -0
- package/corpus/templates/tasks/app/components/layout/Sidebar.tsx +211 -0
- package/corpus/templates/tasks/app/components/shared/AddListItemInput.tsx +57 -0
- package/corpus/templates/tasks/app/components/shared/AlertDialog.tsx +53 -0
- package/corpus/templates/tasks/app/components/shared/BulkDeleteDialog.tsx +76 -0
- package/corpus/templates/tasks/app/components/shared/ChipSelect.tsx +240 -0
- package/corpus/templates/tasks/app/components/shared/DeleteItemDialog.tsx +40 -0
- package/corpus/templates/tasks/app/components/shared/InlineEditable.tsx +166 -0
- package/corpus/templates/tasks/app/components/shared/ListEmptyState.tsx +13 -0
- package/corpus/templates/tasks/app/components/shared/ListErrorMessage.tsx +15 -0
- package/corpus/templates/tasks/app/components/shared/ListViewHeader.tsx +75 -0
- package/corpus/templates/tasks/app/components/shared/PageHeader.tsx +25 -0
- package/corpus/templates/tasks/app/components/shared/RowActionsMenu.tsx +42 -0
- package/corpus/templates/tasks/app/components/shared/SidePanel.tsx +99 -0
- package/corpus/templates/tasks/app/components/shared/dnd/ListRowPreview.tsx +37 -0
- package/corpus/templates/tasks/app/components/shared/list/List.tsx +63 -0
- package/corpus/templates/tasks/app/components/shared/list/ListRow.tsx +159 -0
- package/corpus/templates/tasks/app/components/shared/list/ListRowDragHandle.tsx +52 -0
- package/corpus/templates/tasks/app/components/shared/list/ListSkeletonRows.tsx +11 -0
- package/corpus/templates/tasks/app/components/shared/list/SortableListItemShell.tsx +32 -0
- package/corpus/templates/tasks/app/components/shared/list/types.ts +1 -0
- package/corpus/templates/tasks/app/components/shared/selection/ListSelectionBar.tsx +158 -0
- package/corpus/templates/tasks/app/components/shared/selection/ListSelectionHeaderToggle.tsx +28 -0
- package/corpus/templates/tasks/app/components/shared/selection/ListSelectionToolbar.tsx +81 -0
- package/corpus/templates/tasks/app/components/shared/selection/get-list-row-selection-ui.ts +41 -0
- package/corpus/templates/tasks/app/components/shared/selection/use-list-selection.ts +196 -0
- package/corpus/templates/tasks/app/components/tasks/TaskList.tsx +333 -0
- package/corpus/templates/tasks/app/components/tasks/TaskListHeaderRow.tsx +46 -0
- package/corpus/templates/tasks/app/components/tasks/TaskListPage.tsx +115 -0
- package/corpus/templates/tasks/app/components/tasks/TaskListRow.css +49 -0
- package/corpus/templates/tasks/app/components/tasks/TaskListRow.tsx +307 -0
- package/corpus/templates/tasks/app/components/tasks/fields/TaskFieldsSidebar.tsx +102 -0
- package/corpus/templates/tasks/app/components/tasks/fields/TaskTitleSection.tsx +27 -0
- package/corpus/templates/tasks/app/components/tasks/fields/controls/DateValueControl.tsx +21 -0
- package/corpus/templates/tasks/app/components/tasks/fields/controls/FieldValueControl.tsx +76 -0
- package/corpus/templates/tasks/app/components/tasks/fields/controls/MultiSelectValueControl.tsx +52 -0
- package/corpus/templates/tasks/app/components/tasks/fields/controls/NumberValueControl.tsx +56 -0
- package/corpus/templates/tasks/app/components/tasks/fields/controls/RichTextValueControl.tsx +115 -0
- package/corpus/templates/tasks/app/components/tasks/fields/controls/SingleSelectValueControl.tsx +61 -0
- package/corpus/templates/tasks/app/components/tasks/fields/controls/TextValueControl.tsx +20 -0
- package/corpus/templates/tasks/app/components/tasks/use-task-row-completion-animation.ts +181 -0
- package/corpus/templates/tasks/app/components/ui/accordion.tsx +56 -0
- package/corpus/templates/tasks/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/alert.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/aspect-ratio.tsx +5 -0
- package/corpus/templates/tasks/app/components/ui/avatar.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/badge.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/breadcrumb.tsx +115 -0
- package/corpus/templates/tasks/app/components/ui/button.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/calendar.tsx +70 -0
- package/corpus/templates/tasks/app/components/ui/card.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/carousel.tsx +260 -0
- package/corpus/templates/tasks/app/components/ui/chart.tsx +379 -0
- package/corpus/templates/tasks/app/components/ui/checkbox.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/collapsible.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/command.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/context-menu.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/drawer.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/form.tsx +177 -0
- package/corpus/templates/tasks/app/components/ui/hover-card.tsx +27 -0
- package/corpus/templates/tasks/app/components/ui/input-otp.tsx +69 -0
- package/corpus/templates/tasks/app/components/ui/input.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/label.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/menubar.tsx +254 -0
- package/corpus/templates/tasks/app/components/ui/navigation-menu.tsx +128 -0
- package/corpus/templates/tasks/app/components/ui/pagination.tsx +121 -0
- package/corpus/templates/tasks/app/components/ui/popover.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/progress.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/radio-group.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/resizable.tsx +43 -0
- package/corpus/templates/tasks/app/components/ui/scroll-area.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/select.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/separator.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/sidebar.tsx +782 -0
- package/corpus/templates/tasks/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/slider.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/sonner.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/spinner.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/table.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/tabs.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/toast.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/toaster.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/toggle-group.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/toggle.tsx +43 -0
- package/corpus/templates/tasks/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/tasks/app/components/ui/use-toast.ts +3 -0
- package/corpus/templates/tasks/app/entry.client.tsx +19 -0
- package/corpus/templates/tasks/app/entry.server.tsx +10 -0
- package/corpus/templates/tasks/app/global.css +93 -0
- package/corpus/templates/tasks/app/hooks/cache.ts +31 -0
- package/corpus/templates/tasks/app/hooks/use-custom-fields.ts +93 -0
- package/corpus/templates/tasks/app/hooks/use-inbox-items.ts +196 -0
- package/corpus/templates/tasks/app/hooks/use-mobile.tsx +21 -0
- package/corpus/templates/tasks/app/hooks/use-navigation-state.ts +40 -0
- package/corpus/templates/tasks/app/hooks/use-tasks.ts +276 -0
- package/corpus/templates/tasks/app/hooks/use-toast.ts +188 -0
- package/corpus/templates/tasks/app/hooks/use-visible-task-fields.ts +140 -0
- package/corpus/templates/tasks/app/lib/app-config.ts +11 -0
- package/corpus/templates/tasks/app/lib/tab-id.ts +1 -0
- package/corpus/templates/tasks/app/lib/utils.ts +1 -0
- package/corpus/templates/tasks/app/root.tsx +130 -0
- package/corpus/templates/tasks/app/routes/_index.tsx +22 -0
- package/corpus/templates/tasks/app/routes/extensions.$id.$slug.tsx +2 -0
- package/corpus/templates/tasks/app/routes/extensions.$id.tsx +11 -0
- package/corpus/templates/tasks/app/routes/extensions._index.tsx +11 -0
- package/corpus/templates/tasks/app/routes/extensions.tsx +5 -0
- package/corpus/templates/tasks/app/routes/fields.tsx +16 -0
- package/corpus/templates/tasks/app/routes/inbox.tsx +16 -0
- package/corpus/templates/tasks/app/routes/tasks.tsx +17 -0
- package/corpus/templates/tasks/app/routes/team.tsx +17 -0
- package/corpus/templates/tasks/app/routes.ts +4 -0
- package/corpus/templates/tasks/app/vite-env.d.ts +6 -0
- package/corpus/templates/tasks/components.json +20 -0
- package/corpus/templates/tasks/data/sync-config.json +1 -0
- package/corpus/templates/tasks/docs/features/README.md +81 -0
- package/corpus/templates/tasks/docs/features/f1-tasks.mdx +67 -0
- package/corpus/templates/tasks/docs/features/f2-custom-fields.mdx +68 -0
- package/corpus/templates/tasks/docs/features/f3-projects.mdx +33 -0
- package/corpus/templates/tasks/docs/features/f4-inbox.mdx +55 -0
- package/corpus/templates/tasks/docs/features/f5-views.mdx +65 -0
- package/corpus/templates/tasks/docs/features/f6-search.mdx +43 -0
- package/corpus/templates/tasks/docs/features/f7-first-run.mdx +66 -0
- package/corpus/templates/tasks/docs/features/f8-chat.mdx +120 -0
- package/corpus/templates/tasks/e2e/global-setup.ts +42 -0
- package/corpus/templates/tasks/e2e/helpers/inbox.ts +71 -0
- package/corpus/templates/tasks/e2e/helpers/tasks.ts +99 -0
- package/corpus/templates/tasks/learnings.defaults.md +5 -0
- package/corpus/templates/tasks/netlify.toml +10 -0
- package/corpus/templates/tasks/package.json +104 -0
- package/corpus/templates/tasks/playwright.config.ts +34 -0
- package/corpus/templates/tasks/public/agent-native-icon-dark.svg +10 -0
- package/corpus/templates/tasks/public/agent-native-icon-light.svg +10 -0
- package/corpus/templates/tasks/public/agent-native-logo-dark.svg +21 -0
- package/corpus/templates/tasks/public/agent-native-logo-light.svg +21 -0
- package/corpus/templates/tasks/public/favicon.svg +1 -0
- package/corpus/templates/tasks/public/icon-180.svg +1 -0
- package/corpus/templates/tasks/public/icon-192.svg +1 -0
- package/corpus/templates/tasks/public/icon-512.svg +1 -0
- package/corpus/templates/tasks/public/manifest.json +21 -0
- package/corpus/templates/tasks/react-router.config.ts +7 -0
- package/corpus/templates/tasks/server/custom-fields/normalize.ts +163 -0
- package/corpus/templates/tasks/server/custom-fields/parse.ts +146 -0
- package/corpus/templates/tasks/server/custom-fields/schema.ts +147 -0
- package/corpus/templates/tasks/server/custom-fields/store.ts +425 -0
- package/corpus/templates/tasks/server/custom-fields/task-fields.ts +104 -0
- package/corpus/templates/tasks/server/custom-fields/types.ts +98 -0
- package/corpus/templates/tasks/server/custom-fields/validate.ts +210 -0
- package/corpus/templates/tasks/server/custom-fields/values/store.ts +386 -0
- package/corpus/templates/tasks/server/db/bulk-write.ts +30 -0
- package/corpus/templates/tasks/server/db/index.ts +5 -0
- package/corpus/templates/tasks/server/db/record-utils.ts +7 -0
- package/corpus/templates/tasks/server/db/schema.ts +67 -0
- package/corpus/templates/tasks/server/db/test-tasks-table.ts +76 -0
- package/corpus/templates/tasks/server/db/transaction.ts +6 -0
- package/corpus/templates/tasks/server/errors.ts +31 -0
- package/corpus/templates/tasks/server/inbox/store.ts +216 -0
- package/corpus/templates/tasks/server/middleware/auth.ts +15 -0
- package/corpus/templates/tasks/server/plugins/agent-chat.ts +46 -0
- package/corpus/templates/tasks/server/plugins/auth.ts +15 -0
- package/corpus/templates/tasks/server/plugins/db.ts +90 -0
- package/corpus/templates/tasks/server/routes/[...page].get.ts +5 -0
- package/corpus/templates/tasks/server/stored-items/store.ts +548 -0
- package/corpus/templates/tasks/server/tasks/store.ts +306 -0
- package/corpus/templates/tasks/server/user-config/store.ts +138 -0
- package/corpus/templates/tasks/shared/app-state-tabs.ts +15 -0
- package/corpus/templates/tasks/shared/boolean-param.ts +22 -0
- package/corpus/templates/tasks/shared/bulk-limits.ts +7 -0
- package/corpus/templates/tasks/shared/list-screen-snapshot.ts +90 -0
- package/corpus/templates/tasks/shared/navigation.ts +104 -0
- package/corpus/templates/tasks/shared/visible-task-fields.ts +2 -0
- package/corpus/templates/tasks/ssr-entry.ts +15 -0
- package/corpus/templates/tasks/tsconfig.json +24 -0
- package/corpus/templates/tasks/vite.config.ts +19 -0
- package/corpus/templates/tasks/vitest.config.ts +8 -0
- package/dist/cli/templates-meta.d.ts.map +1 -1
- package/dist/cli/templates-meta.js +13 -0
- package/dist/cli/templates-meta.js.map +1 -1
- package/dist/client/agent-page/AgentTabsPage.js +1 -1
- package/dist/client/agent-page/AgentTabsPage.js.map +1 -1
- package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
- package/dist/client/org/OrgSwitcher.js +2 -1
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/notifications/routes.d.ts +2 -2
- package/dist/observability/routes.d.ts +5 -5
- package/dist/resources/handlers.d.ts +3 -3
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { focusAgentChat } from "@agent-native/core/client";
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { toast } from "sonner";
|
|
4
|
+
|
|
5
|
+
import { FieldListRow } from "@/components/custom-fields/FieldListRow";
|
|
6
|
+
import { FieldsListSkeleton } from "@/components/custom-fields/FieldsListSkeleton";
|
|
7
|
+
import { INERT_SORTABLE_PROPS } from "@/components/dnd/SortableItem";
|
|
8
|
+
import { ChipSelect } from "@/components/shared/ChipSelect";
|
|
9
|
+
import { DeleteItemDialog } from "@/components/shared/DeleteItemDialog";
|
|
10
|
+
import { ListRowPreview } from "@/components/shared/dnd/ListRowPreview";
|
|
11
|
+
import { List } from "@/components/shared/list/List";
|
|
12
|
+
import { ListEmptyState } from "@/components/shared/ListEmptyState";
|
|
13
|
+
import { ListErrorMessage } from "@/components/shared/ListErrorMessage";
|
|
14
|
+
import {
|
|
15
|
+
useCreateCustomField,
|
|
16
|
+
useCustomFields,
|
|
17
|
+
useDeleteCustomField,
|
|
18
|
+
useReorderCustomFields,
|
|
19
|
+
type FieldDefinition,
|
|
20
|
+
} from "@/hooks/use-custom-fields";
|
|
21
|
+
import {
|
|
22
|
+
TASK_CARD_FIELD_LIMIT,
|
|
23
|
+
useUpdateVisibleTaskFields,
|
|
24
|
+
useVisibleTaskFieldIds,
|
|
25
|
+
} from "@/hooks/use-visible-task-fields";
|
|
26
|
+
|
|
27
|
+
import { FieldEditorSidebar } from "./editor/FieldEditorSidebar";
|
|
28
|
+
import type { FieldDraft } from "./editor/types";
|
|
29
|
+
import { FieldCreateBar } from "./FieldCreateBar";
|
|
30
|
+
|
|
31
|
+
type FieldListItem = FieldDefinition;
|
|
32
|
+
|
|
33
|
+
export function FieldsList({
|
|
34
|
+
activeFieldId,
|
|
35
|
+
setActiveFieldId,
|
|
36
|
+
}: {
|
|
37
|
+
activeFieldId: string | null;
|
|
38
|
+
setActiveFieldId: (fieldId: string | null) => void;
|
|
39
|
+
}) {
|
|
40
|
+
const { fields, isPending, isError, error } = useCustomFields();
|
|
41
|
+
const { fieldIds: visibleFieldIds } = useVisibleTaskFieldIds();
|
|
42
|
+
const updateVisibleTaskFields = useUpdateVisibleTaskFields();
|
|
43
|
+
const visibleFieldOptions = useMemo(
|
|
44
|
+
() => fields.map((field) => ({ id: field.id, label: field.title })),
|
|
45
|
+
[fields],
|
|
46
|
+
);
|
|
47
|
+
const createField = useCreateCustomField();
|
|
48
|
+
const deleteField = useDeleteCustomField();
|
|
49
|
+
const reorderFields = useReorderCustomFields();
|
|
50
|
+
const listItems = useMemo<FieldListItem[]>(() => fields, [fields]);
|
|
51
|
+
const [orderedFields, setOrderedFields] =
|
|
52
|
+
useState<FieldListItem[]>(listItems);
|
|
53
|
+
const [pendingDelete, setPendingDelete] = useState<FieldDefinition | null>(
|
|
54
|
+
null,
|
|
55
|
+
);
|
|
56
|
+
const busy =
|
|
57
|
+
createField.isPending || deleteField.isPending || reorderFields.isPending;
|
|
58
|
+
const editingField = activeFieldId
|
|
59
|
+
? (fields.find((field) => field.id === activeFieldId) ?? null)
|
|
60
|
+
: null;
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
setOrderedFields(listItems);
|
|
64
|
+
}, [listItems]);
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (!activeFieldId) return;
|
|
68
|
+
if (!fields.some((field) => field.id === activeFieldId)) {
|
|
69
|
+
setActiveFieldId(null);
|
|
70
|
+
}
|
|
71
|
+
}, [activeFieldId, fields, setActiveFieldId]);
|
|
72
|
+
|
|
73
|
+
async function handleCreate(draft: FieldDraft) {
|
|
74
|
+
try {
|
|
75
|
+
const created = await createField.mutateAsync({
|
|
76
|
+
title: draft.title,
|
|
77
|
+
type: draft.type,
|
|
78
|
+
config: draft.config,
|
|
79
|
+
});
|
|
80
|
+
setActiveFieldId(created.id);
|
|
81
|
+
focusAgentChat();
|
|
82
|
+
toast.success("Field created.");
|
|
83
|
+
} catch (caught) {
|
|
84
|
+
toast.error((caught as Error)?.message ?? "Could not create field.");
|
|
85
|
+
throw caught;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function handleDelete() {
|
|
90
|
+
const field = pendingDelete;
|
|
91
|
+
if (!field) return;
|
|
92
|
+
try {
|
|
93
|
+
const result = await deleteField.mutateAsync({ fieldId: field.id });
|
|
94
|
+
setPendingDelete(null);
|
|
95
|
+
if (activeFieldId === field.id) setActiveFieldId(null);
|
|
96
|
+
toast.success(
|
|
97
|
+
`Deleted ${field.title}${result.deletedValues ? ` and ${result.deletedValues} task values` : ""}.`,
|
|
98
|
+
);
|
|
99
|
+
} catch (caught) {
|
|
100
|
+
toast.error((caught as Error)?.message ?? "Could not delete field.");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const openEditor = useCallback(
|
|
105
|
+
(fieldId: string) => {
|
|
106
|
+
focusAgentChat();
|
|
107
|
+
setActiveFieldId(fieldId);
|
|
108
|
+
},
|
|
109
|
+
[setActiveFieldId],
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
function handleReorder(nextFields: FieldListItem[]) {
|
|
113
|
+
setOrderedFields(nextFields);
|
|
114
|
+
reorderFields.mutate(
|
|
115
|
+
{ fieldIds: nextFields.map((field) => field.id) },
|
|
116
|
+
{ onError: () => setOrderedFields(listItems) },
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<>
|
|
122
|
+
<div className="grid shrink-0 gap-3">
|
|
123
|
+
<FieldCreateBar busy={busy} onCreate={handleCreate} />
|
|
124
|
+
<ChipSelect
|
|
125
|
+
label="Task card fields"
|
|
126
|
+
options={visibleFieldOptions}
|
|
127
|
+
selectedIds={visibleFieldIds}
|
|
128
|
+
onSelectedIdsChange={(fieldIds) =>
|
|
129
|
+
updateVisibleTaskFields.mutate({ fieldIds })
|
|
130
|
+
}
|
|
131
|
+
disabled={busy || isPending || updateVisibleTaskFields.isPending}
|
|
132
|
+
limit={TASK_CARD_FIELD_LIMIT}
|
|
133
|
+
addButtonLabel="Add field"
|
|
134
|
+
emptyLabel="No fields selected"
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<div className="flex min-h-0 flex-1 flex-col overflow-hidden">
|
|
139
|
+
{isPending ? (
|
|
140
|
+
<FieldsListSkeleton />
|
|
141
|
+
) : isError ? (
|
|
142
|
+
<div
|
|
143
|
+
aria-label="Fields list"
|
|
144
|
+
className="min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1 outline-none"
|
|
145
|
+
>
|
|
146
|
+
<ListErrorMessage
|
|
147
|
+
error={error}
|
|
148
|
+
fallbackMessage="Failed to load fields."
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
151
|
+
) : orderedFields.length === 0 ? (
|
|
152
|
+
<div
|
|
153
|
+
aria-label="Fields list"
|
|
154
|
+
className="min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1 outline-none"
|
|
155
|
+
>
|
|
156
|
+
<ListEmptyState
|
|
157
|
+
heading="No fields yet"
|
|
158
|
+
description="Create a field above to start adding task structure."
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
) : (
|
|
162
|
+
<div className="min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1 outline-none">
|
|
163
|
+
<List
|
|
164
|
+
items={orderedFields}
|
|
165
|
+
selectionEnabled={false}
|
|
166
|
+
ariaLabel="Fields list"
|
|
167
|
+
onReorder={handleReorder}
|
|
168
|
+
renderItem={({ item, sortable }) => (
|
|
169
|
+
<FieldListRow
|
|
170
|
+
sortable={sortable}
|
|
171
|
+
item={item}
|
|
172
|
+
highlighted={activeFieldId === item.id}
|
|
173
|
+
onOpenDetails={() => openEditor(item.id)}
|
|
174
|
+
onRequestDelete={() => setPendingDelete(item)}
|
|
175
|
+
/>
|
|
176
|
+
)}
|
|
177
|
+
renderOverlay={({ item, blockDragCount }) => (
|
|
178
|
+
<ListRowPreview
|
|
179
|
+
id={item.id}
|
|
180
|
+
overlayDataAttribute="data-dnd-overlay-field-id"
|
|
181
|
+
blockDragCount={blockDragCount}
|
|
182
|
+
>
|
|
183
|
+
<FieldListRow
|
|
184
|
+
sortable={INERT_SORTABLE_PROPS}
|
|
185
|
+
item={item}
|
|
186
|
+
highlighted={activeFieldId === item.id}
|
|
187
|
+
onOpenDetails={() => openEditor(item.id)}
|
|
188
|
+
onRequestDelete={() => setPendingDelete(item)}
|
|
189
|
+
/>
|
|
190
|
+
</ListRowPreview>
|
|
191
|
+
)}
|
|
192
|
+
/>
|
|
193
|
+
</div>
|
|
194
|
+
)}
|
|
195
|
+
|
|
196
|
+
<DeleteItemDialog
|
|
197
|
+
open={pendingDelete !== null}
|
|
198
|
+
onOpenChange={(open) => {
|
|
199
|
+
if (!open) setPendingDelete(null);
|
|
200
|
+
}}
|
|
201
|
+
entityLabel="field"
|
|
202
|
+
itemTitle={pendingDelete?.title ?? null}
|
|
203
|
+
pending={deleteField.isPending}
|
|
204
|
+
description={
|
|
205
|
+
pendingDelete ? (
|
|
206
|
+
<>
|
|
207
|
+
This deletes "{pendingDelete.title}" and removes its
|
|
208
|
+
values from every task.
|
|
209
|
+
</>
|
|
210
|
+
) : (
|
|
211
|
+
"This deletes the field and removes its values from every task."
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
onConfirm={() => void handleDelete()}
|
|
215
|
+
/>
|
|
216
|
+
</div>
|
|
217
|
+
|
|
218
|
+
<FieldEditorSidebar
|
|
219
|
+
field={editingField}
|
|
220
|
+
disabled={deleteField.isPending}
|
|
221
|
+
onClose={() => setActiveFieldId(null)}
|
|
222
|
+
/>
|
|
223
|
+
</>
|
|
224
|
+
);
|
|
225
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Skeleton } from "@/components/ui/skeleton";
|
|
2
|
+
|
|
3
|
+
const SKELETON_ROW_COUNT = 3;
|
|
4
|
+
|
|
5
|
+
export function FieldsListSkeleton() {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
aria-label="Fields list"
|
|
9
|
+
className="min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1 outline-none"
|
|
10
|
+
>
|
|
11
|
+
<div className="grid gap-2">
|
|
12
|
+
{Array.from({ length: SKELETON_ROW_COUNT }).map((_, index) => (
|
|
13
|
+
<Skeleton key={index} className="h-14 rounded-lg" />
|
|
14
|
+
))}
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { useSearchParams } from "react-router";
|
|
3
|
+
|
|
4
|
+
import { FieldsList } from "@/components/custom-fields/FieldsList";
|
|
5
|
+
import { PageHeader } from "@/components/shared/PageHeader";
|
|
6
|
+
|
|
7
|
+
export function FieldsPage() {
|
|
8
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
9
|
+
const activeFieldId = searchParams.get("field");
|
|
10
|
+
|
|
11
|
+
const setActiveFieldId = useCallback(
|
|
12
|
+
(nextFieldId: string | null) => {
|
|
13
|
+
setSearchParams(
|
|
14
|
+
(prev) => {
|
|
15
|
+
const nextParams = new URLSearchParams(prev);
|
|
16
|
+
if (nextFieldId) {
|
|
17
|
+
nextParams.set("field", nextFieldId);
|
|
18
|
+
} else {
|
|
19
|
+
nextParams.delete("field");
|
|
20
|
+
}
|
|
21
|
+
return nextParams;
|
|
22
|
+
},
|
|
23
|
+
{ replace: true },
|
|
24
|
+
);
|
|
25
|
+
},
|
|
26
|
+
[setSearchParams],
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className="mx-auto flex h-full min-h-0 w-full max-w-5xl flex-col gap-6 overflow-hidden p-4 md:p-6">
|
|
31
|
+
<PageHeader
|
|
32
|
+
title="Fields"
|
|
33
|
+
description="Define the reusable fields that every task can fill in."
|
|
34
|
+
/>
|
|
35
|
+
|
|
36
|
+
<FieldsList
|
|
37
|
+
activeFieldId={activeFieldId}
|
|
38
|
+
setActiveFieldId={setActiveFieldId}
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { toast } from "sonner";
|
|
3
|
+
|
|
4
|
+
import { SidePanel } from "@/components/shared/SidePanel";
|
|
5
|
+
import {
|
|
6
|
+
useUpdateCustomField,
|
|
7
|
+
type FieldDefinition,
|
|
8
|
+
} from "@/hooks/use-custom-fields";
|
|
9
|
+
|
|
10
|
+
import { FieldConfigControl } from "./config/FieldConfigControl";
|
|
11
|
+
import { FieldTitleSection } from "./FieldTitleSection";
|
|
12
|
+
|
|
13
|
+
export function FieldEditorSidebar({
|
|
14
|
+
field,
|
|
15
|
+
disabled,
|
|
16
|
+
onClose,
|
|
17
|
+
}: {
|
|
18
|
+
field: FieldDefinition | null;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
onClose: () => void;
|
|
21
|
+
}) {
|
|
22
|
+
if (!field) return null;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<SidePanel title="Field" closeLabel="Close field editor" onClose={onClose}>
|
|
26
|
+
<FieldEditorSidebarPanel field={field} disabled={disabled} />
|
|
27
|
+
</SidePanel>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function FieldEditorSidebarPanel({
|
|
32
|
+
field,
|
|
33
|
+
disabled,
|
|
34
|
+
}: {
|
|
35
|
+
field: FieldDefinition;
|
|
36
|
+
disabled: boolean;
|
|
37
|
+
}) {
|
|
38
|
+
const updateField = useUpdateCustomField();
|
|
39
|
+
|
|
40
|
+
const saveUpdate = useCallback(
|
|
41
|
+
(payload: { title?: string; config?: FieldDefinition["config"] }) => {
|
|
42
|
+
void updateField
|
|
43
|
+
.mutateAsync({ fieldId: field.id, ...payload })
|
|
44
|
+
.catch((caught) => {
|
|
45
|
+
toast.error((caught as Error)?.message ?? "Could not update field.");
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
[field.id, updateField],
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div className="min-h-0 flex-1 overflow-y-auto">
|
|
53
|
+
<FieldTitleSection
|
|
54
|
+
title={field.title}
|
|
55
|
+
disabled={disabled}
|
|
56
|
+
onChange={(title) => saveUpdate({ title })}
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
<section className="grid gap-3 border-b border-border/70 px-3 py-3">
|
|
60
|
+
<FieldConfigControl
|
|
61
|
+
type={field.type}
|
|
62
|
+
config={field.config}
|
|
63
|
+
disabled={disabled}
|
|
64
|
+
onChange={(config) => saveUpdate({ config })}
|
|
65
|
+
/>
|
|
66
|
+
</section>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Input } from "@/components/ui/input";
|
|
2
|
+
import { Label } from "@/components/ui/label";
|
|
3
|
+
|
|
4
|
+
export function FieldTitleSection({
|
|
5
|
+
title,
|
|
6
|
+
disabled,
|
|
7
|
+
onChange,
|
|
8
|
+
}: {
|
|
9
|
+
title: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
onChange: (title: string) => void;
|
|
12
|
+
}) {
|
|
13
|
+
return (
|
|
14
|
+
<section className="grid gap-2 border-b border-border/70 px-3 py-3">
|
|
15
|
+
<div className="flex min-w-0 items-center justify-between gap-2">
|
|
16
|
+
<Label className="min-w-0 truncate text-[13px] font-medium">
|
|
17
|
+
Title
|
|
18
|
+
</Label>
|
|
19
|
+
<span className="shrink-0 text-[11px] text-muted-foreground">
|
|
20
|
+
Required
|
|
21
|
+
</span>
|
|
22
|
+
</div>
|
|
23
|
+
<Input
|
|
24
|
+
value={title}
|
|
25
|
+
disabled={disabled}
|
|
26
|
+
onChange={(event) => onChange(event.currentTarget.value)}
|
|
27
|
+
aria-label="Edit field title"
|
|
28
|
+
className="h-9 text-[13px]"
|
|
29
|
+
/>
|
|
30
|
+
</section>
|
|
31
|
+
);
|
|
32
|
+
}
|
package/corpus/templates/tasks/app/components/custom-fields/editor/config/CurrencyConfigControl.tsx
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Input } from "@/components/ui/input";
|
|
2
|
+
import { Label } from "@/components/ui/label";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type FieldConfigControlProps,
|
|
6
|
+
precisionFromConfig,
|
|
7
|
+
symbolFromConfig,
|
|
8
|
+
} from "./utils";
|
|
9
|
+
|
|
10
|
+
export function CurrencyConfigControl({
|
|
11
|
+
config,
|
|
12
|
+
onChange,
|
|
13
|
+
disabled = false,
|
|
14
|
+
}: FieldConfigControlProps) {
|
|
15
|
+
return (
|
|
16
|
+
<div className="grid gap-3 sm:grid-cols-[96px_1fr]">
|
|
17
|
+
<div className="grid gap-2">
|
|
18
|
+
<Label>Symbol</Label>
|
|
19
|
+
<Input
|
|
20
|
+
maxLength={8}
|
|
21
|
+
disabled={disabled}
|
|
22
|
+
value={symbolFromConfig(config)}
|
|
23
|
+
onChange={(event) =>
|
|
24
|
+
onChange({
|
|
25
|
+
symbol: event.currentTarget.value,
|
|
26
|
+
precision: precisionFromConfig(config) || 2,
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
<div className="grid gap-2">
|
|
32
|
+
<Label>Precision</Label>
|
|
33
|
+
<Input
|
|
34
|
+
type="number"
|
|
35
|
+
min={0}
|
|
36
|
+
max={6}
|
|
37
|
+
disabled={disabled}
|
|
38
|
+
value={precisionFromConfig(config) || 2}
|
|
39
|
+
onChange={(event) =>
|
|
40
|
+
onChange({
|
|
41
|
+
symbol: symbolFromConfig(config),
|
|
42
|
+
precision: Number(event.currentTarget.value || 0),
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
package/corpus/templates/tasks/app/components/custom-fields/editor/config/FieldConfigControl.tsx
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { FieldConfig, FieldType } from "@/hooks/use-custom-fields";
|
|
2
|
+
|
|
3
|
+
import { CurrencyConfigControl } from "./CurrencyConfigControl";
|
|
4
|
+
import { NumberConfigControl } from "./NumberConfigControl";
|
|
5
|
+
import { PercentConfigControl } from "./PercentConfigControl";
|
|
6
|
+
import { SelectConfigControl } from "./SelectConfigControl";
|
|
7
|
+
|
|
8
|
+
export function FieldConfigControl({
|
|
9
|
+
type,
|
|
10
|
+
config,
|
|
11
|
+
onChange,
|
|
12
|
+
disabled = false,
|
|
13
|
+
}: {
|
|
14
|
+
type: FieldType;
|
|
15
|
+
config: FieldConfig;
|
|
16
|
+
onChange: (config: FieldConfig) => void;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
}) {
|
|
19
|
+
switch (type) {
|
|
20
|
+
case "number":
|
|
21
|
+
return (
|
|
22
|
+
<NumberConfigControl
|
|
23
|
+
config={config}
|
|
24
|
+
onChange={onChange}
|
|
25
|
+
disabled={disabled}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
case "percent":
|
|
29
|
+
return (
|
|
30
|
+
<PercentConfigControl
|
|
31
|
+
config={config}
|
|
32
|
+
onChange={onChange}
|
|
33
|
+
disabled={disabled}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
case "currency":
|
|
37
|
+
return (
|
|
38
|
+
<CurrencyConfigControl
|
|
39
|
+
config={config}
|
|
40
|
+
onChange={onChange}
|
|
41
|
+
disabled={disabled}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
case "single_select":
|
|
45
|
+
case "multi_select":
|
|
46
|
+
return (
|
|
47
|
+
<SelectConfigControl
|
|
48
|
+
config={config}
|
|
49
|
+
onChange={onChange}
|
|
50
|
+
disabled={disabled}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
default:
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
package/corpus/templates/tasks/app/components/custom-fields/editor/config/NumberConfigControl.tsx
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Checkbox } from "@/components/ui/checkbox";
|
|
2
|
+
import { Input } from "@/components/ui/input";
|
|
3
|
+
import { Label } from "@/components/ui/label";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type FieldConfigControlProps,
|
|
7
|
+
positiveOnlyFromConfig,
|
|
8
|
+
precisionFromConfig,
|
|
9
|
+
} from "./utils";
|
|
10
|
+
|
|
11
|
+
export function NumberConfigControl({
|
|
12
|
+
config,
|
|
13
|
+
onChange,
|
|
14
|
+
disabled = false,
|
|
15
|
+
}: FieldConfigControlProps) {
|
|
16
|
+
return (
|
|
17
|
+
<div className="grid gap-3">
|
|
18
|
+
<div className="grid gap-2">
|
|
19
|
+
<Label>Precision</Label>
|
|
20
|
+
<Input
|
|
21
|
+
type="number"
|
|
22
|
+
min={0}
|
|
23
|
+
max={6}
|
|
24
|
+
disabled={disabled}
|
|
25
|
+
value={precisionFromConfig(config)}
|
|
26
|
+
onChange={(event) => {
|
|
27
|
+
const precision = Number(event.currentTarget.value || 0);
|
|
28
|
+
onChange({
|
|
29
|
+
...config,
|
|
30
|
+
precision,
|
|
31
|
+
});
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
<div className="grid gap-2">
|
|
36
|
+
<label className="flex items-center gap-2 text-sm">
|
|
37
|
+
<Checkbox
|
|
38
|
+
checked={positiveOnlyFromConfig(config)}
|
|
39
|
+
disabled={disabled}
|
|
40
|
+
onCheckedChange={(checked) =>
|
|
41
|
+
onChange({
|
|
42
|
+
...config,
|
|
43
|
+
positiveOnly: checked === true,
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
/>
|
|
47
|
+
Positive numbers only
|
|
48
|
+
</label>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
}
|
package/corpus/templates/tasks/app/components/custom-fields/editor/config/PercentConfigControl.tsx
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Input } from "@/components/ui/input";
|
|
2
|
+
import { Label } from "@/components/ui/label";
|
|
3
|
+
|
|
4
|
+
import { type FieldConfigControlProps, precisionFromConfig } from "./utils";
|
|
5
|
+
|
|
6
|
+
export function PercentConfigControl({
|
|
7
|
+
config,
|
|
8
|
+
onChange,
|
|
9
|
+
disabled = false,
|
|
10
|
+
}: FieldConfigControlProps) {
|
|
11
|
+
return (
|
|
12
|
+
<div className="grid gap-2">
|
|
13
|
+
<Label>Precision</Label>
|
|
14
|
+
<Input
|
|
15
|
+
type="number"
|
|
16
|
+
min={0}
|
|
17
|
+
max={6}
|
|
18
|
+
disabled={disabled}
|
|
19
|
+
value={precisionFromConfig(config)}
|
|
20
|
+
onChange={(event) => {
|
|
21
|
+
const precision = Number(event.currentTarget.value || 0);
|
|
22
|
+
onChange({
|
|
23
|
+
...config,
|
|
24
|
+
precision,
|
|
25
|
+
});
|
|
26
|
+
}}
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
}
|