@salesforce/templates 66.3.0 → 66.3.2
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/lib/templates/flexipage/RecordPage/_flexipage.flexipage-meta.xml +0 -24
- package/lib/templates/project/reactb2e/.a4drules/{graphql.md → features/feature-graphql-graphql-data-access-rule.md} +186 -125
- package/lib/templates/project/reactb2e/.a4drules/features/feature-react-agentforce-conversation-client-embedded-agent-rule.md +32 -0
- package/lib/templates/project/reactb2e/.a4drules/features/feature-react-chart-analytics-charts-rule.md +27 -0
- package/lib/templates/project/reactb2e/.a4drules/skills/feature-graphql-graphql-data-access/SKILL.md +155 -0
- package/lib/templates/project/{reactb2x/.a4drules/graphql/tools/knowledge/lds-explore-graphql-schema.md → reactb2e/.a4drules/skills/feature-graphql-graphql-data-access/docs/explore-schema.md} +58 -29
- package/lib/templates/project/{reactb2x/.a4drules/graphql/tools/knowledge/lds-generate-graphql-mutationquery.md → reactb2e/.a4drules/skills/feature-graphql-graphql-data-access/docs/generate-mutation-query.md} +52 -42
- package/lib/templates/project/{reactb2x/.a4drules/graphql/tools/knowledge/lds-generate-graphql-readquery.md → reactb2e/.a4drules/skills/feature-graphql-graphql-data-access/docs/generate-read-query.md} +32 -22
- package/lib/templates/project/{reactb2x/.a4drules/graphql/tools/schemas/shared.graphqls → reactb2e/.a4drules/skills/feature-graphql-graphql-data-access/docs/shared-schema.graphqls} +1 -1
- package/lib/templates/project/reactb2e/.a4drules/skills/feature-micro-frontend-micro-frontend/SKILL.md +137 -0
- package/lib/templates/project/reactb2e/.a4drules/skills/feature-react-agentforce-conversation-client-embedded-agent/SKILL.md +108 -0
- package/lib/templates/project/reactb2e/.a4drules/skills/feature-react-agentforce-conversation-client-embedded-agent/docs/embed-examples.md +182 -0
- package/lib/templates/project/reactb2e/.a4drules/skills/feature-react-chart-analytics-charts/SKILL.md +41 -0
- package/lib/templates/project/reactb2e/.a4drules/skills/feature-react-chart-analytics-charts/docs/schema-mapping.md +4 -0
- package/lib/templates/project/reactb2e/.a4drules/webapp-code-quality.md +136 -0
- package/lib/templates/project/reactb2e/.a4drules/{images.md → webapp-images.md} +6 -4
- package/lib/templates/project/reactb2e/.a4drules/webapp-no-node-e.md +3 -2
- package/lib/templates/project/reactb2e/.a4drules/webapp-react.md +149 -0
- package/lib/templates/project/reactb2e/.a4drules/{typescript.md → webapp-typescript.md} +10 -29
- package/lib/templates/project/reactb2e/.a4drules/webapp.md +60 -45
- package/lib/templates/project/reactb2e/AGENT.md +1 -1
- package/lib/templates/project/reactb2e/CHANGELOG.md +377 -0
- package/lib/templates/project/reactb2e/README.md +38 -4
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/CHANGELOG.md +10 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/README.md +35 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/package.json +17 -7
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/appLayout.tsx +76 -10
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/__inherit_AgentforceConversationClient.tsx +3 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/alerts/status-alert.tsx +49 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/layouts/card-layout.tsx +29 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/alert.tsx +76 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/button.tsx +67 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/card.tsx +103 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/dialog.tsx +162 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/field.tsx +237 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/index.ts +84 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/input.tsx +19 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/label.tsx +22 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/pagination.tsx +132 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/select.tsx +193 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/separator.tsx +26 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/skeleton.tsx +14 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/spinner.tsx +16 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/table.tsx +114 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components/ui/tabs.tsx +88 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/components.json +18 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/constants.ts +39 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/api/index.ts +19 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/api/objectDetailService.ts +125 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/api/objectInfoGraphQLService.ts +194 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/api/objectInfoService.ts +199 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/api/recordListGraphQLService.ts +365 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/DetailFields.tsx +55 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/DetailForm.tsx +146 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/DetailHeader.tsx +34 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/DetailLayoutSections.tsx +80 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/Section.tsx +108 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/SectionRow.tsx +20 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/UiApiDetailForm.tsx +140 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/formatted/FieldValueDisplay.tsx +73 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/formatted/FormattedAddress.tsx +29 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/formatted/FormattedEmail.tsx +17 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/formatted/FormattedPhone.tsx +24 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/formatted/FormattedText.tsx +11 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/formatted/FormattedUrl.tsx +29 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/detail/formatted/index.ts +6 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/filters/FilterField.tsx +54 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/filters/FilterInput.tsx +55 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/filters/FilterSelect.tsx +72 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/filters/FiltersPanel.tsx +380 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/forms/filters-form.tsx +114 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/forms/submit-button.tsx +47 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/search/GlobalSearchInput.tsx +114 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/search/ResultCardFields.tsx +71 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/search/SearchHeader.tsx +31 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/search/SearchPagination.tsx +144 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/search/SearchResultCard.tsx +136 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/search/SearchResultsPanel.tsx +197 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/components/shared/LoadingFallback.tsx +61 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/filters/FilterInput.tsx +55 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/filters/FilterSelect.tsx +72 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/hooks/form.tsx +209 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/hooks/index.ts +22 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/hooks/useObjectInfoBatch.ts +65 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/hooks/useObjectSearchData.ts +395 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/hooks/useRecordDetailLayout.ts +156 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/hooks/useRecordListGraphQL.ts +135 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/pages/DetailPage.tsx +109 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/pages/GlobalSearch.tsx +229 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/types/filters/filters.ts +120 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/types/filters/picklist.ts +32 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/types/index.ts +4 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/types/objectInfo/objectInfo.ts +166 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/types/recordDetail/recordDetail.ts +61 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/types/search/searchResults.ts +229 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/apiUtils.ts +125 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/cacheUtils.ts +76 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/debounce.ts +89 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/fieldUtils.ts +354 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/fieldValueExtractor.ts +67 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/filterUtils.ts +32 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/formDataTransformUtils.ts +260 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/formUtils.ts +142 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/graphQLNodeFieldUtils.ts +186 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/graphQLObjectInfoAdapter.ts +319 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/graphQLRecordAdapter.ts +90 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/index.ts +59 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/layoutTransformUtils.ts +236 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/linkUtils.ts +14 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/paginationUtils.ts +49 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/recordUtils.ts +159 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/features/global-search/utils/sanitizationUtils.ts +49 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/lib/utils.ts +6 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/pages/Home.tsx +11 -10
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/pages/TestAccPage.tsx +19 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/routes.tsx +28 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/styles/global.css +122 -0
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/vite.config.ts +2 -1
- package/lib/templates/project/reactb2e/package.json +1 -1
- package/lib/templates/project/reactb2x/.a4drules/{graphql.md → features/feature-graphql-graphql-data-access-rule.md} +186 -125
- package/lib/templates/project/reactb2x/.a4drules/features/feature-react-agentforce-conversation-client-embedded-agent-rule.md +32 -0
- package/lib/templates/project/reactb2x/.a4drules/features/feature-react-chart-analytics-charts-rule.md +27 -0
- package/lib/templates/project/reactb2x/.a4drules/skills/feature-graphql-graphql-data-access/SKILL.md +155 -0
- package/lib/templates/project/{reactb2e/.a4drules/graphql/tools/knowledge/lds-explore-graphql-schema.md → reactb2x/.a4drules/skills/feature-graphql-graphql-data-access/docs/explore-schema.md} +58 -29
- package/lib/templates/project/{reactb2e/.a4drules/graphql/tools/knowledge/lds-generate-graphql-mutationquery.md → reactb2x/.a4drules/skills/feature-graphql-graphql-data-access/docs/generate-mutation-query.md} +52 -42
- package/lib/templates/project/{reactb2e/.a4drules/graphql/tools/knowledge/lds-generate-graphql-readquery.md → reactb2x/.a4drules/skills/feature-graphql-graphql-data-access/docs/generate-read-query.md} +32 -22
- package/lib/templates/project/{reactb2e/.a4drules/graphql/tools/schemas/shared.graphqls → reactb2x/.a4drules/skills/feature-graphql-graphql-data-access/docs/shared-schema.graphqls} +1 -1
- package/lib/templates/project/reactb2x/.a4drules/skills/feature-micro-frontend-micro-frontend/SKILL.md +137 -0
- package/lib/templates/project/reactb2x/.a4drules/skills/feature-react-agentforce-conversation-client-embedded-agent/SKILL.md +108 -0
- package/lib/templates/project/reactb2x/.a4drules/skills/feature-react-agentforce-conversation-client-embedded-agent/docs/embed-examples.md +182 -0
- package/lib/templates/project/reactb2x/.a4drules/skills/feature-react-chart-analytics-charts/SKILL.md +41 -0
- package/lib/templates/project/reactb2x/.a4drules/skills/feature-react-chart-analytics-charts/docs/schema-mapping.md +4 -0
- package/lib/templates/project/reactb2x/.a4drules/webapp-code-quality.md +136 -0
- package/lib/templates/project/reactb2x/.a4drules/{images.md → webapp-images.md} +6 -4
- package/lib/templates/project/reactb2x/.a4drules/webapp-no-node-e.md +3 -2
- package/lib/templates/project/reactb2x/.a4drules/webapp-react.md +149 -0
- package/lib/templates/project/reactb2x/.a4drules/{typescript.md → webapp-typescript.md} +10 -29
- package/lib/templates/project/reactb2x/.a4drules/webapp.md +60 -45
- package/lib/templates/project/reactb2x/AGENT.md +1 -1
- package/lib/templates/project/reactb2x/CHANGELOG.md +377 -0
- package/lib/templates/project/reactb2x/README.md +58 -4
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/CHANGELOG.md +10 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/README.md +35 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/package.json +8 -7
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/appLayout.tsx +75 -3
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/alerts/status-alert.tsx +36 -32
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/layouts/card-layout.tsx +29 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/alert.tsx +61 -54
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/button.tsx +57 -57
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/card.tsx +86 -75
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/dialog.tsx +129 -110
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/field.tsx +208 -193
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/index.ts +65 -53
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/input.tsx +14 -14
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/label.tsx +17 -14
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/pagination.tsx +108 -88
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/select.tsx +156 -146
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/separator.tsx +19 -19
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/skeleton.tsx +10 -10
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/spinner.tsx +12 -11
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/table.tsx +96 -69
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/ui/tabs.tsx +71 -61
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components.json +1 -1
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/constants.ts +39 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{context → features/authentication/context}/AuthContext.tsx +1 -1
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{components → features/authentication}/footers/footer-link.tsx +1 -1
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{components → features/authentication}/forms/auth-form.tsx +4 -4
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{components → features/authentication}/forms/submit-button.tsx +4 -4
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{hooks → features/authentication/hooks}/form.tsx +13 -9
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{components → features/authentication}/layout/card-skeleton.tsx +2 -2
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{components → features/authentication}/layout/centered-page-layout.tsx +2 -3
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{layouts → features/authentication/layouts}/AuthAppLayout.tsx +2 -2
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{components/auth → features/authentication/layouts}/authenticationRouteLayout.tsx +2 -2
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{components/auth → features/authentication/layouts}/privateRouteLayout.tsx +2 -2
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{pages → features/authentication/pages}/ChangePassword.tsx +6 -6
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{pages → features/authentication/pages}/ForgotPassword.tsx +5 -5
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{pages → features/authentication/pages}/Login.tsx +6 -6
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{pages → features/authentication/pages}/Profile.tsx +22 -13
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{pages → features/authentication/pages}/Register.tsx +6 -11
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{pages → features/authentication/pages}/ResetPassword.tsx +8 -8
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{components/auth → features/authentication}/sessionTimeout/SessionTimeoutValidator.tsx +6 -6
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/api/index.ts +19 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/api/objectDetailService.ts +125 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/api/objectInfoGraphQLService.ts +194 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/api/objectInfoService.ts +199 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/api/recordListGraphQLService.ts +365 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/detail/DetailFields.tsx +55 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/detail/DetailForm.tsx +146 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/detail/DetailHeader.tsx +34 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/detail/DetailLayoutSections.tsx +80 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/detail/Section.tsx +108 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/detail/SectionRow.tsx +20 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/detail/UiApiDetailForm.tsx +140 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/detail/formatted/FieldValueDisplay.tsx +73 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/detail/formatted/FormattedAddress.tsx +29 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/detail/formatted/FormattedEmail.tsx +17 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/detail/formatted/FormattedPhone.tsx +24 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/detail/formatted/FormattedText.tsx +11 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/detail/formatted/FormattedUrl.tsx +29 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/detail/formatted/index.ts +6 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/filters/FilterField.tsx +54 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/filters/FilterInput.tsx +55 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/filters/FilterSelect.tsx +72 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/filters/FiltersPanel.tsx +380 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/forms/filters-form.tsx +114 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/forms/submit-button.tsx +47 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/search/GlobalSearchInput.tsx +114 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/search/ResultCardFields.tsx +71 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/search/SearchHeader.tsx +31 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/search/SearchPagination.tsx +144 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/search/SearchResultCard.tsx +136 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/search/SearchResultsPanel.tsx +197 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/components/shared/LoadingFallback.tsx +61 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/filters/FilterInput.tsx +55 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/filters/FilterSelect.tsx +72 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/hooks/form.tsx +209 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/hooks/index.ts +22 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/hooks/useObjectInfoBatch.ts +65 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/hooks/useObjectSearchData.ts +395 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/hooks/useRecordDetailLayout.ts +156 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/hooks/useRecordListGraphQL.ts +135 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/pages/DetailPage.tsx +109 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/pages/GlobalSearch.tsx +229 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/types/filters/filters.ts +120 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/types/filters/picklist.ts +32 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/types/index.ts +4 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/types/objectInfo/objectInfo.ts +166 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/types/recordDetail/recordDetail.ts +61 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/types/search/searchResults.ts +229 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/apiUtils.ts +125 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/cacheUtils.ts +76 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/debounce.ts +89 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/fieldUtils.ts +354 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/fieldValueExtractor.ts +67 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/filterUtils.ts +32 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/formDataTransformUtils.ts +260 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/formUtils.ts +142 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/graphQLNodeFieldUtils.ts +186 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/graphQLObjectInfoAdapter.ts +319 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/graphQLRecordAdapter.ts +90 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/index.ts +59 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/layoutTransformUtils.ts +236 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/linkUtils.ts +14 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/paginationUtils.ts +49 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/recordUtils.ts +159 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/features/global-search/utils/sanitizationUtils.ts +49 -0
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/lib/utils.ts +3 -3
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/pages/Home.tsx +11 -10
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/routes.tsx +33 -11
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/styles/global.css +107 -107
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/vite.config.ts +2 -1
- package/lib/templates/project/reactb2x/package.json +1 -1
- package/lib/templates/webapplication/reactbasic/CHANGELOG.md +10 -0
- package/lib/templates/webapplication/reactbasic/README.md +75 -0
- package/lib/templates/webapplication/reactbasic/package.json +13 -5
- package/lib/templates/webapplication/reactbasic/src/appLayout.tsx +75 -3
- package/lib/templates/webapplication/reactbasic/src/components/alerts/status-alert.tsx +49 -0
- package/lib/templates/webapplication/reactbasic/src/components/layouts/card-layout.tsx +29 -0
- package/lib/templates/webapplication/reactbasic/src/components/ui/alert.tsx +76 -0
- package/lib/templates/webapplication/reactbasic/src/components/ui/button.tsx +67 -0
- package/lib/templates/webapplication/reactbasic/src/components/ui/card.tsx +103 -0
- package/lib/templates/webapplication/reactbasic/src/components/ui/dialog.tsx +162 -0
- package/lib/templates/webapplication/reactbasic/src/components/ui/field.tsx +237 -0
- package/lib/templates/webapplication/reactbasic/src/components/ui/index.ts +84 -0
- package/lib/templates/webapplication/reactbasic/src/components/ui/input.tsx +19 -0
- package/lib/templates/webapplication/reactbasic/src/components/ui/label.tsx +22 -0
- package/lib/templates/webapplication/reactbasic/src/components/ui/pagination.tsx +132 -0
- package/lib/templates/webapplication/reactbasic/src/components/ui/select.tsx +193 -0
- package/lib/templates/webapplication/reactbasic/src/components/ui/separator.tsx +26 -0
- package/lib/templates/webapplication/reactbasic/src/components/ui/skeleton.tsx +14 -0
- package/lib/templates/webapplication/reactbasic/src/components/ui/spinner.tsx +16 -0
- package/lib/templates/webapplication/reactbasic/src/components/ui/table.tsx +114 -0
- package/lib/templates/webapplication/reactbasic/src/components/ui/tabs.tsx +88 -0
- package/lib/templates/webapplication/reactbasic/src/components.json +18 -0
- package/lib/templates/webapplication/reactbasic/src/lib/utils.ts +6 -0
- package/lib/templates/webapplication/reactbasic/src/styles/global.css +122 -0
- package/lib/templates/webapplication/reactbasic/vite.config.ts +2 -1
- package/lib/templates/webapplication/webappbasic/README.md +15 -0
- package/lib/utils/webappTemplateUtils.d.ts +10 -0
- package/lib/utils/webappTemplateUtils.js +55 -7
- package/lib/utils/webappTemplateUtils.js.map +1 -1
- package/package.json +5 -5
- package/lib/templates/project/reactb2e/.a4drules/README.md +0 -35
- package/lib/templates/project/reactb2e/.a4drules/a4d-webapp-generate.md +0 -27
- package/lib/templates/project/reactb2e/.a4drules/build-validation.md +0 -78
- package/lib/templates/project/reactb2e/.a4drules/code-quality.md +0 -137
- package/lib/templates/project/reactb2e/.a4drules/graphql/tools/knowledge/lds-guide-graphql.md +0 -205
- package/lib/templates/project/reactb2e/.a4drules/react.md +0 -387
- package/lib/templates/project/reactb2e/.a4drules/react_image_processing.md +0 -45
- package/lib/templates/project/reactb2e/.a4drules/ui-layout.md +0 -23
- package/lib/templates/project/reactb2e/.a4drules/webapp-nav-and-placeholders.md +0 -33
- package/lib/templates/project/reactb2e/.a4drules/webapp-ui-first.md +0 -32
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/build/vite.config.d.ts +0 -2
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/build/vite.config.js +0 -93
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/package-lock.json +0 -14392
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/api/graphql-operations-types.ts +0 -116
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/api/utils/accounts.ts +0 -33
- package/lib/templates/project/reactb2e/force-app/main/default/webapplications/appreacttemplateb2e/src/api/utils/query/highRevenueAccountsQuery.graphql +0 -29
- package/lib/templates/project/reactb2x/.a4drules/README.md +0 -35
- package/lib/templates/project/reactb2x/.a4drules/a4d-webapp-generate.md +0 -27
- package/lib/templates/project/reactb2x/.a4drules/build-validation.md +0 -78
- package/lib/templates/project/reactb2x/.a4drules/code-quality.md +0 -137
- package/lib/templates/project/reactb2x/.a4drules/graphql/tools/knowledge/lds-guide-graphql.md +0 -205
- package/lib/templates/project/reactb2x/.a4drules/react.md +0 -387
- package/lib/templates/project/reactb2x/.a4drules/react_image_processing.md +0 -45
- package/lib/templates/project/reactb2x/.a4drules/ui-layout.md +0 -23
- package/lib/templates/project/reactb2x/.a4drules/webapp-nav-and-placeholders.md +0 -33
- package/lib/templates/project/reactb2x/.a4drules/webapp-ui-first.md +0 -32
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/build/vite.config.d.ts +0 -2
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/build/vite.config.js +0 -93
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/package-lock.json +0 -18408
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/api/graphql-operations-types.ts +0 -116
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/api/utils/accounts.ts +0 -33
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/api/utils/query/highRevenueAccountsQuery.graphql +0 -29
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/components/layout/card-layout.tsx +0 -23
- package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/lib/data-sdk.ts +0 -21
- package/lib/templates/webapplication/reactbasic/build/vite.config.d.ts +0 -2
- package/lib/templates/webapplication/reactbasic/build/vite.config.js +0 -93
- package/lib/templates/webapplication/reactbasic/package-lock.json +0 -14373
- package/lib/templates/webapplication/reactbasic/src/api/graphql-operations-types.ts +0 -116
- package/lib/templates/webapplication/reactbasic/src/api/utils/accounts.ts +0 -33
- package/lib/templates/webapplication/reactbasic/src/api/utils/query/highRevenueAccountsQuery.graphql +0 -29
- /package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{components/auth → features/authentication}/authHelpers.ts +0 -0
- /package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{components/auth → features/authentication}/authenticationConfig.ts +0 -0
- /package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{hooks → features/authentication/hooks}/useCountdownTimer.ts +0 -0
- /package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{hooks → features/authentication/hooks}/useRetryWithBackoff.ts +0 -0
- /package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{components/auth → features/authentication}/sessionTimeout/sessionTimeService.ts +0 -0
- /package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{components/auth → features/authentication}/sessionTimeout/sessionTimeoutConfig.ts +0 -0
- /package/lib/templates/project/reactb2x/force-app/main/default/webapplications/appreacttemplateb2x/src/{utils → features/authentication/utils}/helpers.ts +0 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ResultCardFields Component
|
|
3
|
+
*
|
|
4
|
+
* Displays secondary fields (up to 3) for a search result card.
|
|
5
|
+
* Excludes the primary field and handles nested field values.
|
|
6
|
+
*
|
|
7
|
+
* @param record - The search result record data
|
|
8
|
+
* @param columns - Array of column definitions
|
|
9
|
+
* @param excludeFieldApiName - Field API name to exclude (usually the primary field)
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* - Displays up to 3 secondary fields
|
|
13
|
+
* - Handles nested field paths (e.g., "Owner.Alias")
|
|
14
|
+
* - Skips fields with null/undefined/empty values
|
|
15
|
+
* - Responsive layout (vertical on mobile, horizontal on desktop)
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <ResultCardFields
|
|
20
|
+
* record={searchResult}
|
|
21
|
+
* columns={columns}
|
|
22
|
+
* excludeFieldApiName="Name"
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
import type { Column, SearchResultRecordData } from "../../types/search/searchResults";
|
|
27
|
+
import { getNestedFieldValue } from "../../utils/fieldUtils";
|
|
28
|
+
|
|
29
|
+
interface ResultCardFieldsProps {
|
|
30
|
+
record: SearchResultRecordData;
|
|
31
|
+
columns: Column[];
|
|
32
|
+
excludeFieldApiName?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default function ResultCardFields({
|
|
36
|
+
record,
|
|
37
|
+
columns,
|
|
38
|
+
excludeFieldApiName,
|
|
39
|
+
}: ResultCardFieldsProps) {
|
|
40
|
+
const secondaryFields = columns.filter(
|
|
41
|
+
(col) => col && col.fieldApiName && col.fieldApiName !== excludeFieldApiName,
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<dl className="space-y-2" aria-label="Additional record information">
|
|
46
|
+
{secondaryFields.map((column) => {
|
|
47
|
+
if (!column || !column.fieldApiName) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const displayValue = getNestedFieldValue(record.fields, column.fieldApiName);
|
|
52
|
+
|
|
53
|
+
if (displayValue === null || displayValue === undefined || displayValue === "") {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div
|
|
59
|
+
key={column.fieldApiName}
|
|
60
|
+
className="flex flex-col sm:flex-row sm:items-center gap-1 sm:gap-2"
|
|
61
|
+
>
|
|
62
|
+
<dt className="text-sm font-medium text-muted-foreground min-w-[100px]">
|
|
63
|
+
{column.label || column.fieldApiName}:
|
|
64
|
+
</dt>
|
|
65
|
+
<dd className="text-sm text-foreground">{displayValue}</dd>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
})}
|
|
69
|
+
</dl>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SearchHeader Component
|
|
3
|
+
*
|
|
4
|
+
* Displays the header for search results or browse-all (same UI).
|
|
5
|
+
* labelPlural comes from object metadata (e.g. useObjectInfoBatch) so it is not hard-coded.
|
|
6
|
+
*/
|
|
7
|
+
interface SearchHeaderProps {
|
|
8
|
+
query?: string;
|
|
9
|
+
isBrowseAll?: boolean;
|
|
10
|
+
/** Plural label for the primary object (e.g. "Accounts"). From object metadata. */
|
|
11
|
+
labelPlural?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function SearchHeader({
|
|
15
|
+
query,
|
|
16
|
+
isBrowseAll,
|
|
17
|
+
labelPlural = "records",
|
|
18
|
+
}: SearchHeaderProps) {
|
|
19
|
+
return (
|
|
20
|
+
<header className="mb-6" aria-label="Search results header">
|
|
21
|
+
<h1 className="text-3xl font-bold mb-2">
|
|
22
|
+
{isBrowseAll ? `Browse All ${labelPlural}` : "Search Results"}
|
|
23
|
+
</h1>
|
|
24
|
+
{!isBrowseAll && query && (
|
|
25
|
+
<p className="text-lg" aria-live="polite">
|
|
26
|
+
Results for: <span className="font-semibold">"{query}"</span>
|
|
27
|
+
</p>
|
|
28
|
+
)}
|
|
29
|
+
</header>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SearchPagination Component
|
|
3
|
+
*
|
|
4
|
+
* Displays pagination controls for search results.
|
|
5
|
+
* Previous/Next are disabled using hasPreviousPage/hasNextPage from the API so no request is made when there is no page.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* - Layout: page size selector on the left, prev/page/next controls on the right (corners).
|
|
9
|
+
* - Previous disabled when !hasPreviousPage (cursor stack enables prev when pageIndex > 0).
|
|
10
|
+
* - Next disabled when !hasNextPage or nextPageToken is null.
|
|
11
|
+
*/
|
|
12
|
+
import { Button } from "../../../../components/ui/button";
|
|
13
|
+
import {
|
|
14
|
+
Select,
|
|
15
|
+
SelectContent,
|
|
16
|
+
SelectItem,
|
|
17
|
+
SelectTrigger,
|
|
18
|
+
SelectValue,
|
|
19
|
+
} from "../../../../components/ui/select";
|
|
20
|
+
import { Label } from "../../../../components/ui/label";
|
|
21
|
+
import { PAGE_SIZE_OPTIONS, getValidPageSize, isValidPageSize } from "../../utils/paginationUtils";
|
|
22
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
23
|
+
|
|
24
|
+
interface SearchPaginationProps {
|
|
25
|
+
currentPageToken: string;
|
|
26
|
+
nextPageToken: string | null;
|
|
27
|
+
previousPageToken: string | null;
|
|
28
|
+
hasNextPage?: boolean;
|
|
29
|
+
hasPreviousPage?: boolean;
|
|
30
|
+
pageSize: number;
|
|
31
|
+
/** direction: 'prev' | 'next' | 'first'. When 'first' (e.g. page size change), parent typically resets pagination; token may be '' for prev when going to page 0. */
|
|
32
|
+
onPageChange: (newPageToken: string, direction?: "next" | "prev" | "first") => void;
|
|
33
|
+
onPageSizeChange: (newPageSize: number) => void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default function SearchPagination({
|
|
37
|
+
currentPageToken,
|
|
38
|
+
nextPageToken,
|
|
39
|
+
previousPageToken,
|
|
40
|
+
hasNextPage = false,
|
|
41
|
+
hasPreviousPage = false,
|
|
42
|
+
pageSize,
|
|
43
|
+
onPageChange,
|
|
44
|
+
onPageSizeChange,
|
|
45
|
+
}: SearchPaginationProps) {
|
|
46
|
+
const validPageSize = getValidPageSize(pageSize);
|
|
47
|
+
|
|
48
|
+
const currentPageTokenNum = parseInt(currentPageToken, 10) || 0;
|
|
49
|
+
const currentPage = currentPageTokenNum + 1;
|
|
50
|
+
|
|
51
|
+
const canGoPrevious = Boolean(hasPreviousPage);
|
|
52
|
+
const canGoNext = Boolean(hasNextPage && nextPageToken != null);
|
|
53
|
+
|
|
54
|
+
const handlePrevious = () => {
|
|
55
|
+
if (canGoPrevious) {
|
|
56
|
+
onPageChange(previousPageToken ?? "", "prev");
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const handleNext = () => {
|
|
61
|
+
if (canGoNext && nextPageToken != null) {
|
|
62
|
+
onPageChange(nextPageToken, "next");
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const handlePageSizeChange = (newPageSize: string) => {
|
|
67
|
+
const newSize = parseInt(newPageSize, 10);
|
|
68
|
+
if (!isNaN(newSize) && isValidPageSize(newSize) && newSize !== validPageSize) {
|
|
69
|
+
onPageSizeChange(newSize);
|
|
70
|
+
onPageChange("0", "first");
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<nav
|
|
76
|
+
className="w-full flex flex-row flex-wrap items-center justify-between gap-4 py-2"
|
|
77
|
+
aria-label="Search results pagination"
|
|
78
|
+
>
|
|
79
|
+
<div
|
|
80
|
+
className="flex items-center gap-2 shrink-0"
|
|
81
|
+
role="group"
|
|
82
|
+
aria-label="Page size selector"
|
|
83
|
+
>
|
|
84
|
+
<Label htmlFor="page-size-select" className="text-sm font-normal whitespace-nowrap">
|
|
85
|
+
Results per page:
|
|
86
|
+
</Label>
|
|
87
|
+
<Select value={validPageSize.toString()} onValueChange={handlePageSizeChange}>
|
|
88
|
+
<SelectTrigger
|
|
89
|
+
id="page-size-select"
|
|
90
|
+
className="w-[70px]"
|
|
91
|
+
aria-label="Select number of results per page"
|
|
92
|
+
>
|
|
93
|
+
<SelectValue />
|
|
94
|
+
</SelectTrigger>
|
|
95
|
+
<SelectContent>
|
|
96
|
+
{PAGE_SIZE_OPTIONS.map((option) => (
|
|
97
|
+
<SelectItem key={option.value} value={option.value}>
|
|
98
|
+
{option.label}
|
|
99
|
+
</SelectItem>
|
|
100
|
+
))}
|
|
101
|
+
</SelectContent>
|
|
102
|
+
</Select>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<div className="flex items-center gap-1 shrink-0" role="group" aria-label="Page navigation">
|
|
106
|
+
<Button
|
|
107
|
+
type="button"
|
|
108
|
+
variant="outline"
|
|
109
|
+
size="sm"
|
|
110
|
+
disabled={!canGoPrevious}
|
|
111
|
+
onClick={handlePrevious}
|
|
112
|
+
aria-label={
|
|
113
|
+
canGoPrevious
|
|
114
|
+
? `Go to previous page (Page ${currentPage - 1})`
|
|
115
|
+
: "Previous page (disabled)"
|
|
116
|
+
}
|
|
117
|
+
>
|
|
118
|
+
<ChevronLeft className="size-4" aria-hidden />
|
|
119
|
+
Previous
|
|
120
|
+
</Button>
|
|
121
|
+
<span
|
|
122
|
+
className="min-w-[4rem] text-center text-sm text-muted-foreground px-2"
|
|
123
|
+
aria-label={`Page ${currentPage}, current page`}
|
|
124
|
+
aria-current="page"
|
|
125
|
+
>
|
|
126
|
+
Page {currentPage}
|
|
127
|
+
</span>
|
|
128
|
+
<Button
|
|
129
|
+
type="button"
|
|
130
|
+
variant="outline"
|
|
131
|
+
size="sm"
|
|
132
|
+
disabled={!canGoNext}
|
|
133
|
+
onClick={handleNext}
|
|
134
|
+
aria-label={
|
|
135
|
+
canGoNext ? `Go to next page (Page ${currentPage + 1})` : "Next page (disabled)"
|
|
136
|
+
}
|
|
137
|
+
>
|
|
138
|
+
Next
|
|
139
|
+
<ChevronRight className="size-4" aria-hidden />
|
|
140
|
+
</Button>
|
|
141
|
+
</div>
|
|
142
|
+
</nav>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SearchResultCard Component
|
|
3
|
+
*
|
|
4
|
+
* Displays a single search result as a card with primary and secondary fields.
|
|
5
|
+
* Clicking the card navigates to the detail page for that record.
|
|
6
|
+
*
|
|
7
|
+
* @param record - The search result record data to display
|
|
8
|
+
* @param columns - Array of column definitions for field display
|
|
9
|
+
* @param objectApiName - API name of the object (path param in detail URL: /object/:objectApiName/:recordId)
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* - Automatically identifies the primary field (usually "Name")
|
|
13
|
+
* - Displays up to 3 secondary fields
|
|
14
|
+
* - Supports keyboard navigation (Enter/Space to navigate)
|
|
15
|
+
* - Handles nested field values (e.g., "Owner.Alias")
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <SearchResultCard
|
|
20
|
+
* record={searchResult}
|
|
21
|
+
* columns={columns}
|
|
22
|
+
* objectApiName="Account"
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
import { useNavigate } from "react-router";
|
|
27
|
+
import { useMemo, useCallback } from "react";
|
|
28
|
+
import {
|
|
29
|
+
Card,
|
|
30
|
+
CardContent,
|
|
31
|
+
CardHeader,
|
|
32
|
+
CardTitle,
|
|
33
|
+
} from "../../../../components/ui/card";
|
|
34
|
+
import type { Column, SearchResultRecordData } from "../../types/search/searchResults";
|
|
35
|
+
import { getNestedFieldValue } from "../../utils/fieldUtils";
|
|
36
|
+
import ResultCardFields from "./ResultCardFields";
|
|
37
|
+
import { OBJECT_API_NAMES } from "../../../../constants";
|
|
38
|
+
|
|
39
|
+
interface SearchResultCardProps {
|
|
40
|
+
record: SearchResultRecordData;
|
|
41
|
+
columns: Column[];
|
|
42
|
+
objectApiName?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default function SearchResultCard({
|
|
46
|
+
record,
|
|
47
|
+
columns,
|
|
48
|
+
objectApiName,
|
|
49
|
+
}: SearchResultCardProps) {
|
|
50
|
+
const navigate = useNavigate();
|
|
51
|
+
|
|
52
|
+
if (!record || !record.id) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!columns || !Array.isArray(columns) || columns.length === 0) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!record.fields || typeof record.fields !== "object") {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const detailPath = useMemo(
|
|
65
|
+
() => `/object/${objectApiName?.trim() || OBJECT_API_NAMES[0]}/${record.id}`,
|
|
66
|
+
[record.id, objectApiName],
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const handleClick = useCallback(() => {
|
|
70
|
+
if (record.id) navigate(detailPath);
|
|
71
|
+
}, [record.id, detailPath, navigate]);
|
|
72
|
+
|
|
73
|
+
const handleKeyDown = useCallback(
|
|
74
|
+
(e: React.KeyboardEvent) => {
|
|
75
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
handleClick();
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
[handleClick],
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const primaryField = useMemo(() => {
|
|
84
|
+
return (
|
|
85
|
+
columns.find(
|
|
86
|
+
(col) =>
|
|
87
|
+
col &&
|
|
88
|
+
col.fieldApiName &&
|
|
89
|
+
(col.fieldApiName.toLowerCase() === "name" ||
|
|
90
|
+
col.fieldApiName.toLowerCase().includes("name")),
|
|
91
|
+
) ||
|
|
92
|
+
columns[0] ||
|
|
93
|
+
null
|
|
94
|
+
);
|
|
95
|
+
}, [columns]);
|
|
96
|
+
|
|
97
|
+
const primaryValue = useMemo(() => {
|
|
98
|
+
return primaryField && primaryField.fieldApiName
|
|
99
|
+
? getNestedFieldValue(record.fields, primaryField.fieldApiName) || "Untitled"
|
|
100
|
+
: "Untitled";
|
|
101
|
+
}, [primaryField, record.fields]);
|
|
102
|
+
|
|
103
|
+
const secondaryColumns = useMemo(() => {
|
|
104
|
+
return columns.filter(
|
|
105
|
+
(col) => col && col.fieldApiName && col.fieldApiName !== primaryField?.fieldApiName,
|
|
106
|
+
);
|
|
107
|
+
}, [columns, primaryField]);
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<Card
|
|
111
|
+
className="cursor-pointer hover:shadow-md transition-shadow focus-within:ring-2 focus-within:ring-blue-500 focus-within:ring-offset-2"
|
|
112
|
+
onClick={handleClick}
|
|
113
|
+
onKeyDown={handleKeyDown}
|
|
114
|
+
role="button"
|
|
115
|
+
tabIndex={0}
|
|
116
|
+
aria-label={`View details for ${primaryValue}`}
|
|
117
|
+
aria-describedby={`result-${record.id}-description`}
|
|
118
|
+
>
|
|
119
|
+
<CardHeader>
|
|
120
|
+
<CardTitle className="text-lg" id={`result-${record.id}-title`}>
|
|
121
|
+
{primaryValue}
|
|
122
|
+
</CardTitle>
|
|
123
|
+
</CardHeader>
|
|
124
|
+
<CardContent>
|
|
125
|
+
<div id={`result-${record.id}-description`} className="sr-only">
|
|
126
|
+
Search result: {primaryValue}
|
|
127
|
+
</div>
|
|
128
|
+
<ResultCardFields
|
|
129
|
+
record={record}
|
|
130
|
+
columns={secondaryColumns}
|
|
131
|
+
excludeFieldApiName={primaryField?.fieldApiName}
|
|
132
|
+
/>
|
|
133
|
+
</CardContent>
|
|
134
|
+
</Card>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SearchResultsPanel Component
|
|
3
|
+
*
|
|
4
|
+
* Displays the search results panel with loading, error, and empty states.
|
|
5
|
+
* Renders a list of SearchResultCard components and pagination controls.
|
|
6
|
+
*
|
|
7
|
+
* @param columns - Array of column definitions for displaying result data
|
|
8
|
+
* @param results - Array of search result records to display
|
|
9
|
+
* @param columnsLoading - Whether column metadata is currently loading
|
|
10
|
+
* @param resultsLoading - Whether search results are currently loading
|
|
11
|
+
* @param columnsError - Error message if column fetch failed
|
|
12
|
+
* @param resultsError - Error message if results fetch failed
|
|
13
|
+
* @param currentPageToken - Current pagination token
|
|
14
|
+
* @param pageSize - Number of results per page
|
|
15
|
+
* @param onPageChange - Callback when pagination changes; second arg optional: "next" | "prev" | "first" (cursor-stack pagination)
|
|
16
|
+
* @param onPageSizeChange - Callback when page size changes
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <SearchResultsPanel
|
|
21
|
+
* columns={columns}
|
|
22
|
+
* results={results}
|
|
23
|
+
* columnsLoading={false}
|
|
24
|
+
* resultsLoading={false}
|
|
25
|
+
* columnsError={null}
|
|
26
|
+
* resultsError={null}
|
|
27
|
+
* currentPageToken="0"
|
|
28
|
+
* pageSize={25}
|
|
29
|
+
* onPageChange={(token, direction) => handlePageChange(token, direction)}
|
|
30
|
+
* onPageSizeChange={(size) => setPageSize(size)}
|
|
31
|
+
* />
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
import { useMemo } from "react";
|
|
35
|
+
import { Alert, AlertDescription, AlertTitle } from "../../../../components/ui/alert";
|
|
36
|
+
import { Skeleton } from "../../../../components/ui/skeleton";
|
|
37
|
+
import { AlertCircle } from "lucide-react";
|
|
38
|
+
import {
|
|
39
|
+
Select,
|
|
40
|
+
SelectContent,
|
|
41
|
+
SelectItem,
|
|
42
|
+
SelectTrigger,
|
|
43
|
+
SelectValue,
|
|
44
|
+
} from "../../../../components/ui/select";
|
|
45
|
+
import { Label } from "../../../../components/ui/label";
|
|
46
|
+
import SearchResultCard from "./SearchResultCard";
|
|
47
|
+
import SearchPagination from "./SearchPagination";
|
|
48
|
+
import type { Column, SearchResultRecord } from "../../types/search/searchResults";
|
|
49
|
+
import { getSafeKey } from "../../utils/recordUtils";
|
|
50
|
+
|
|
51
|
+
interface SearchResultsPanelProps {
|
|
52
|
+
/** API name of the object being searched (e.g. for detail page navigation). */
|
|
53
|
+
objectApiName?: string;
|
|
54
|
+
columns: Column[];
|
|
55
|
+
results: SearchResultRecord[];
|
|
56
|
+
columnsLoading: boolean;
|
|
57
|
+
resultsLoading: boolean;
|
|
58
|
+
columnsError: string | null;
|
|
59
|
+
resultsError: string | null;
|
|
60
|
+
currentPageToken: string;
|
|
61
|
+
nextPageToken: string | null;
|
|
62
|
+
previousPageToken: string | null;
|
|
63
|
+
hasNextPage?: boolean;
|
|
64
|
+
hasPreviousPage?: boolean;
|
|
65
|
+
pageSize: number;
|
|
66
|
+
sortBy: string;
|
|
67
|
+
onPageChange: (newPageToken: string, direction?: "next" | "prev" | "first") => void;
|
|
68
|
+
onPageSizeChange: (newPageSize: number) => void;
|
|
69
|
+
onSortByChange: (newSortBy: string) => void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default function SearchResultsPanel({
|
|
73
|
+
objectApiName,
|
|
74
|
+
columns,
|
|
75
|
+
results,
|
|
76
|
+
columnsLoading,
|
|
77
|
+
resultsLoading,
|
|
78
|
+
columnsError,
|
|
79
|
+
resultsError,
|
|
80
|
+
currentPageToken,
|
|
81
|
+
nextPageToken,
|
|
82
|
+
previousPageToken,
|
|
83
|
+
hasNextPage = false,
|
|
84
|
+
hasPreviousPage = false,
|
|
85
|
+
pageSize,
|
|
86
|
+
sortBy,
|
|
87
|
+
onPageChange,
|
|
88
|
+
onPageSizeChange,
|
|
89
|
+
onSortByChange,
|
|
90
|
+
}: SearchResultsPanelProps) {
|
|
91
|
+
const sortableColumns = useMemo(() => columns.filter(({ sortable }) => sortable), [columns]);
|
|
92
|
+
|
|
93
|
+
const validResults = useMemo(
|
|
94
|
+
() => results.filter((record) => record && record.record && record.record.id),
|
|
95
|
+
[results],
|
|
96
|
+
);
|
|
97
|
+
if (columnsError || resultsError) {
|
|
98
|
+
return (
|
|
99
|
+
<Alert variant="destructive" role="alert">
|
|
100
|
+
<AlertCircle className="h-4 w-4" aria-hidden="true" />
|
|
101
|
+
<AlertTitle>Error</AlertTitle>
|
|
102
|
+
<AlertDescription>
|
|
103
|
+
{columnsError || resultsError || "Failed to load search results"}
|
|
104
|
+
</AlertDescription>
|
|
105
|
+
</Alert>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (resultsLoading || columnsLoading) {
|
|
110
|
+
return (
|
|
111
|
+
<div
|
|
112
|
+
className="space-y-4"
|
|
113
|
+
role="status"
|
|
114
|
+
aria-live="polite"
|
|
115
|
+
aria-label="Loading search results"
|
|
116
|
+
>
|
|
117
|
+
<span className="sr-only">Loading search results</span>
|
|
118
|
+
{[1, 2, 3].map((i) => (
|
|
119
|
+
<div key={i} className="border rounded-lg p-6" aria-hidden="true">
|
|
120
|
+
<Skeleton className="h-6 w-3/4 mb-4" />
|
|
121
|
+
<Skeleton className="h-4 w-full mb-2" />
|
|
122
|
+
<Skeleton className="h-4 w-2/3" />
|
|
123
|
+
</div>
|
|
124
|
+
))}
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (results.length === 0) {
|
|
130
|
+
return (
|
|
131
|
+
<div className="text-center py-12" role="status" aria-live="polite">
|
|
132
|
+
<p className="text-lg mb-2">No results found</p>
|
|
133
|
+
<p className="text-sm">Try adjusting your search query or filters</p>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<>
|
|
140
|
+
{sortableColumns.length > 0 && (
|
|
141
|
+
<div
|
|
142
|
+
className="mb-6 flex items-center gap-2 justify-end"
|
|
143
|
+
role="group"
|
|
144
|
+
aria-label="Sort options"
|
|
145
|
+
>
|
|
146
|
+
<Label htmlFor="sort-by-select" className="text-sm font-normal whitespace-nowrap">
|
|
147
|
+
Sort by:
|
|
148
|
+
</Label>
|
|
149
|
+
<Select value={sortBy || ""} onValueChange={onSortByChange}>
|
|
150
|
+
<SelectTrigger
|
|
151
|
+
id="sort-by-select"
|
|
152
|
+
className="w-[200px]"
|
|
153
|
+
aria-label="Sort search results by field"
|
|
154
|
+
>
|
|
155
|
+
<SelectValue placeholder="Select field..." />
|
|
156
|
+
</SelectTrigger>
|
|
157
|
+
<SelectContent>
|
|
158
|
+
<SelectItem value="relevance">Relevance</SelectItem>
|
|
159
|
+
{sortableColumns.map((column) => (
|
|
160
|
+
<SelectItem key={column.fieldApiName} value={column.fieldApiName}>
|
|
161
|
+
{column.label}
|
|
162
|
+
</SelectItem>
|
|
163
|
+
))}
|
|
164
|
+
</SelectContent>
|
|
165
|
+
</Select>
|
|
166
|
+
</div>
|
|
167
|
+
)}
|
|
168
|
+
|
|
169
|
+
<div className="space-y-4 mb-6" role="list" aria-label="Search results list">
|
|
170
|
+
{validResults.map((record, index) => {
|
|
171
|
+
const recordId = record.record.id;
|
|
172
|
+
const safeKey = getSafeKey(recordId, index);
|
|
173
|
+
return (
|
|
174
|
+
<div key={safeKey} role="listitem">
|
|
175
|
+
<SearchResultCard
|
|
176
|
+
record={record.record}
|
|
177
|
+
columns={columns}
|
|
178
|
+
objectApiName={objectApiName}
|
|
179
|
+
/>
|
|
180
|
+
</div>
|
|
181
|
+
);
|
|
182
|
+
})}
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<SearchPagination
|
|
186
|
+
currentPageToken={currentPageToken}
|
|
187
|
+
nextPageToken={nextPageToken}
|
|
188
|
+
previousPageToken={previousPageToken}
|
|
189
|
+
hasNextPage={hasNextPage}
|
|
190
|
+
hasPreviousPage={hasPreviousPage}
|
|
191
|
+
pageSize={pageSize}
|
|
192
|
+
onPageChange={onPageChange}
|
|
193
|
+
onPageSizeChange={onPageSizeChange}
|
|
194
|
+
/>
|
|
195
|
+
</>
|
|
196
|
+
);
|
|
197
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LoadingFallback Component
|
|
3
|
+
*
|
|
4
|
+
* Loading fallback component for Suspense boundaries.
|
|
5
|
+
* Displays a centered spinner while lazy-loaded components are being fetched.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* - Used with React Suspense for code splitting
|
|
9
|
+
* - Simple centered spinner design
|
|
10
|
+
* - Responsive and accessible
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <Suspense fallback={<LoadingFallback />}>
|
|
15
|
+
* <LazyComponent />
|
|
16
|
+
* </Suspense>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
20
|
+
import { Spinner } from "../../../../components/ui/spinner";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Spinner size variants based on content width.
|
|
24
|
+
*/
|
|
25
|
+
const spinnerVariants = cva("", {
|
|
26
|
+
variants: {
|
|
27
|
+
contentMaxWidth: {
|
|
28
|
+
sm: "size-6",
|
|
29
|
+
md: "size-8",
|
|
30
|
+
lg: "size-10",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
defaultVariants: {
|
|
34
|
+
contentMaxWidth: "sm",
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
interface LoadingFallbackProps extends VariantProps<typeof spinnerVariants> {
|
|
39
|
+
/**
|
|
40
|
+
* Maximum width of the content container. Also scales the spinner size.
|
|
41
|
+
* @default "sm"
|
|
42
|
+
*/
|
|
43
|
+
contentMaxWidth?: "sm" | "md" | "lg";
|
|
44
|
+
/**
|
|
45
|
+
* Accessible label for screen readers.
|
|
46
|
+
* @default "Loading…"
|
|
47
|
+
*/
|
|
48
|
+
loadingText?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default function LoadingFallback({
|
|
52
|
+
contentMaxWidth = "sm",
|
|
53
|
+
loadingText = "Loading…",
|
|
54
|
+
}: LoadingFallbackProps) {
|
|
55
|
+
return (
|
|
56
|
+
<div className="flex justify-center" role="status" aria-live="polite">
|
|
57
|
+
<Spinner className={spinnerVariants({ contentMaxWidth })} aria-hidden="true" />
|
|
58
|
+
<span className="sr-only">{loadingText}</span>
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FilterInput Component
|
|
3
|
+
*
|
|
4
|
+
* Renders a text input field for filter values.
|
|
5
|
+
* Used for filters that don't have a picklist (affordance !== 'select').
|
|
6
|
+
*
|
|
7
|
+
* @param filter - Filter definition containing field path, label, and attributes
|
|
8
|
+
* @param value - Current filter input value
|
|
9
|
+
* @param onChange - Callback when input value changes
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* - Displays filter label or field path as the label
|
|
13
|
+
* - Shows placeholder text from filter attributes or generates default
|
|
14
|
+
* - Displays help message if available
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <FilterInput
|
|
19
|
+
* filter={textFilter}
|
|
20
|
+
* value={filterValue}
|
|
21
|
+
* onChange={(value) => setFilterValue(value)}
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
import { Input } from "../../../components/ui/input";
|
|
26
|
+
import { Field, FieldLabel, FieldDescription } from "../../../components/ui/field";
|
|
27
|
+
import type { Filter } from "../types/filters/filters";
|
|
28
|
+
|
|
29
|
+
interface FilterInputProps {
|
|
30
|
+
filter: Filter;
|
|
31
|
+
value: string;
|
|
32
|
+
onChange: (value: string) => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default function FilterInput({ filter, value, onChange }: FilterInputProps) {
|
|
36
|
+
return (
|
|
37
|
+
<Field>
|
|
38
|
+
<FieldLabel htmlFor={filter.targetFieldPath}>
|
|
39
|
+
{filter.label || filter.targetFieldPath}
|
|
40
|
+
</FieldLabel>
|
|
41
|
+
<Input
|
|
42
|
+
id={filter.targetFieldPath}
|
|
43
|
+
type="text"
|
|
44
|
+
value={value}
|
|
45
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => onChange(e.target.value)}
|
|
46
|
+
placeholder={
|
|
47
|
+
filter.attributes?.placeholder ||
|
|
48
|
+
`Enter ${(filter.label || filter.targetFieldPath).toLowerCase()}`
|
|
49
|
+
}
|
|
50
|
+
aria-label={filter.label || filter.targetFieldPath}
|
|
51
|
+
/>
|
|
52
|
+
{filter.helpMessage && <FieldDescription>{filter.helpMessage}</FieldDescription>}
|
|
53
|
+
</Field>
|
|
54
|
+
);
|
|
55
|
+
}
|