@yext/visual-editor 1.4.14 → 2.0.0-beta.10
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/dist/SectionLibraryVisualEditorProvider-DN65KSX7.js +119824 -0
- package/dist/SectionLibraryVisualEditorProvider.css +1 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/Address.tsx +251 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/HeadingText.tsx +147 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/HoursStatus.tsx +157 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/HoursTable.tsx +164 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/MapboxStaticMap.tsx +205 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/Phone.tsx +155 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/image/EmptyImageState.tsx +168 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/image/Image.tsx +275 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/image/styling.ts +66 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/index.ts +13 -0
- package/dist/cli/assets/directory-locator-source/components/sections/Breadcrumbs.tsx +298 -0
- package/dist/cli/assets/directory-locator-source/components/sections/directory/Directory.test.tsx +872 -0
- package/dist/cli/assets/directory-locator-source/components/sections/directory/Directory.tsx +298 -0
- package/dist/cli/assets/directory-locator-source/components/sections/directory/DirectoryCard.tsx +507 -0
- package/dist/cli/assets/directory-locator-source/components/sections/directory/DirectoryWrapper.tsx +499 -0
- package/dist/cli/assets/directory-locator-source/components/sections/directory/directoryChildReference.test.tsx +226 -0
- package/dist/cli/assets/directory-locator-source/components/sections/directory/directoryChildReference.tsx +98 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/Filters.test.tsx +147 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/Filters.tsx +691 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/Locator.test.tsx +1551 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/Locator.tsx +541 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/LocatorFields.test.ts +43 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/LocatorResultCard.tsx +1594 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/LocatorWrapper.tsx +1157 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/Map.tsx +304 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/MapPinIcon.tsx +160 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/Results.tsx +267 -0
- package/dist/cli/assets/directory-locator-source/sectionLibrarySupport.ts +277 -0
- package/dist/cli/yextve.js +16992 -0
- package/dist/createYextFieldTransforms-CrIkiJ_X.d.ts +2157 -0
- package/dist/index.d.ts +534 -6352
- package/dist/locales/page/cs/visual-editor.json +85 -0
- package/dist/locales/page/da/visual-editor.json +73 -0
- package/dist/locales/page/de/visual-editor.json +73 -0
- package/dist/locales/page/en/visual-editor.json +73 -0
- package/dist/locales/page/en-GB/visual-editor.json +73 -0
- package/dist/locales/page/es/visual-editor.json +79 -0
- package/dist/locales/page/et/visual-editor.json +73 -0
- package/dist/locales/page/fi/visual-editor.json +73 -0
- package/dist/locales/page/fr/visual-editor.json +79 -0
- package/dist/locales/page/hr/visual-editor.json +79 -0
- package/dist/locales/page/hu/visual-editor.json +73 -0
- package/dist/locales/page/it/visual-editor.json +79 -0
- package/dist/locales/page/ja/visual-editor.json +73 -0
- package/dist/locales/page/lt/visual-editor.json +85 -0
- package/dist/locales/page/lv/visual-editor.json +77 -0
- package/dist/locales/page/nb/visual-editor.json +73 -0
- package/dist/locales/page/nl/visual-editor.json +73 -0
- package/dist/locales/page/pl/visual-editor.json +85 -0
- package/dist/locales/page/pt/visual-editor.json +79 -0
- package/dist/locales/page/ro/visual-editor.json +79 -0
- package/dist/locales/page/sk/visual-editor.json +85 -0
- package/dist/locales/page/sv/visual-editor.json +73 -0
- package/dist/locales/page/tr/visual-editor.json +73 -0
- package/dist/locales/page/zh/visual-editor.json +73 -0
- package/dist/locales/page/zh-TW/visual-editor.json +73 -0
- package/dist/locales/platform/cs/visual-editor.json +651 -0
- package/dist/locales/platform/da/visual-editor.json +625 -0
- package/dist/locales/platform/de/visual-editor.json +625 -0
- package/dist/locales/platform/en/visual-editor.json +625 -0
- package/dist/locales/platform/en-GB/visual-editor.json +625 -0
- package/dist/locales/platform/es/visual-editor.json +638 -0
- package/dist/locales/platform/et/visual-editor.json +625 -0
- package/dist/locales/platform/fi/visual-editor.json +625 -0
- package/dist/locales/platform/fr/visual-editor.json +638 -0
- package/dist/locales/platform/hr/visual-editor.json +638 -0
- package/dist/locales/platform/hu/visual-editor.json +625 -0
- package/dist/locales/platform/it/visual-editor.json +638 -0
- package/dist/locales/platform/ja/visual-editor.json +625 -0
- package/dist/locales/platform/lt/visual-editor.json +651 -0
- package/dist/locales/platform/lv/visual-editor.json +633 -0
- package/dist/locales/platform/nb/visual-editor.json +625 -0
- package/dist/locales/platform/nl/visual-editor.json +625 -0
- package/dist/locales/platform/pl/visual-editor.json +651 -0
- package/dist/locales/platform/pt/visual-editor.json +638 -0
- package/dist/locales/platform/ro/visual-editor.json +638 -0
- package/dist/locales/platform/sk/visual-editor.json +651 -0
- package/dist/locales/platform/sv/visual-editor.json +625 -0
- package/dist/locales/platform/tr/visual-editor.json +625 -0
- package/dist/locales/platform/zh/visual-editor.json +625 -0
- package/dist/locales/platform/zh-TW/visual-editor.json +625 -0
- package/dist/plugin/internal/layoutGeneration/limits.d.ts +28 -0
- package/dist/plugin/internal/sectionLibraryValidation/builtInTranslationResources.d.ts +3 -0
- package/dist/plugin/internal/sectionLibraryValidation/stages/api/api.d.ts +7 -0
- package/dist/plugin/internal/sectionLibraryValidation/stages/api/libraryMetadata.d.ts +7 -0
- package/dist/plugin/internal/sectionLibraryValidation/stages/code/importRules.d.ts +13 -0
- package/dist/plugin/internal/sectionLibraryValidation/stages/code/validateCode.d.ts +10 -0
- package/dist/plugin/internal/sectionLibraryValidation/stages/code/xssRules.d.ts +7 -0
- package/dist/plugin/internal/sectionLibraryValidation/stages/structure/structure.d.ts +7 -0
- package/dist/plugin/internal/sectionLibraryValidation/types.d.ts +48 -0
- package/dist/plugin/internal/sectionLibraryValidation/validateSectionLibrary.d.ts +8 -0
- package/dist/plugin/internal/sectionLibraryValidation/validationError.d.ts +6 -0
- package/dist/plugin/plugin.js +7013 -5873
- package/dist/plugin/types/entityFields.d.ts +21 -0
- package/dist/plugin/types/generationPrompts.d.ts +19 -0
- package/dist/plugin/types/generationSettings.d.ts +12 -0
- package/dist/plugin/types/images.d.ts +62 -0
- package/dist/plugin/types/sectionLibrary.d.ts +101 -0
- package/dist/plugin/types/types.d.ts +204 -0
- package/dist/plugin/types/videos.d.ts +24 -0
- package/dist/plugin/utils/i18n/locales.d.ts +5 -0
- package/dist/plugin/utils/i18n/translationResources.d.ts +41 -0
- package/dist/plugin/utils/normalizeLocale.d.ts +8 -0
- package/dist/plugin/utils/plainText.d.ts +6 -0
- package/dist/plugin/vite-plugin/index.d.ts +2 -0
- package/dist/plugin/vite-plugin/layout-generation/generationLogger.d.ts +5 -0
- package/dist/plugin/vite-plugin/layout-generation/generationReports.d.ts +13 -0
- package/dist/plugin/vite-plugin/layout-generation/middleware.d.ts +14 -0
- package/dist/plugin/vite-plugin/layout-generation/modelProxy.d.ts +9 -0
- package/dist/plugin/vite-plugin/layout-generation/prompts.d.ts +17 -0
- package/dist/plugin/vite-plugin/layout-generation/settings.d.ts +3 -0
- package/dist/plugin/vite-plugin/local-editor/artifacts.d.ts +20 -0
- package/dist/plugin/vite-plugin/local-editor/config.d.ts +11 -0
- package/dist/plugin/vite-plugin/local-editor/data.d.ts +12 -0
- package/dist/plugin/vite-plugin/local-editor/entityFields.d.ts +13 -0
- package/dist/plugin/vite-plugin/local-editor/fixtureData.d.ts +12 -0
- package/dist/plugin/vite-plugin/local-editor/generatedFiles.d.ts +33 -0
- package/dist/plugin/vite-plugin/local-editor/server.d.ts +34 -0
- package/dist/plugin/vite-plugin/local-editor/types.d.ts +125 -0
- package/dist/plugin/vite-plugin/local-editor/utils.d.ts +16 -0
- package/dist/plugin/vite-plugin/plugin.d.ts +8 -0
- package/dist/plugin/vite-plugin/section-library/migrationRegistry.d.ts +6 -0
- package/dist/plugin/vite-plugin/section-library/sectionFrontmatter.d.ts +3 -0
- package/dist/plugin/vite-plugin/section-library/sectionLibraryGenerator.d.ts +21 -0
- package/dist/plugin/vite-plugin/section-library/sharedComponentRegistry.d.ts +16 -0
- package/dist/section-library-support.js +178 -0
- package/dist/sectionLibrarySupport.d.ts +703 -0
- package/dist/style.css +1 -1
- package/dist/visual-editor-6mKs9VUe.js +842 -0
- package/dist/visual-editor-BK6fTU7k.js +804 -0
- package/dist/visual-editor-BXYlpe7B.js +145 -0
- package/dist/visual-editor-BruRrJYN.js +804 -0
- package/dist/visual-editor-Bs3wAslG.js +804 -0
- package/dist/visual-editor-Bxy81Ezy.js +145 -0
- package/dist/visual-editor-C0vq2BRM.js +145 -0
- package/dist/visual-editor-C9TLeAzP.js +804 -0
- package/dist/visual-editor-CCgmYV5S.js +169 -0
- package/dist/visual-editor-CERViyTJ.js +145 -0
- package/dist/visual-editor-CHWtMtlu.js +823 -0
- package/dist/visual-editor-CcfUKpnd.js +804 -0
- package/dist/visual-editor-CjORnP1D.js +169 -0
- package/dist/visual-editor-ClC6hoz3.js +804 -0
- package/dist/visual-editor-CmomGJB8.js +157 -0
- package/dist/visual-editor-CtQwadxQ.js +842 -0
- package/dist/visual-editor-Cymg8ID2.js +169 -0
- package/dist/visual-editor-D2Hk1nhM.js +145 -0
- package/dist/visual-editor-D7VeTRK_.js +816 -0
- package/dist/visual-editor-D8MRFn5x.js +157 -0
- package/dist/visual-editor-DOXtCqRv.js +145 -0
- package/dist/visual-editor-DQEd3xwY.js +145 -0
- package/dist/visual-editor-DTE5kxrA.js +804 -0
- package/dist/visual-editor-DUngIOnE.js +157 -0
- package/dist/visual-editor-DeZVZYfd.js +169 -0
- package/dist/visual-editor-DfJMZpiP.js +145 -0
- package/dist/visual-editor-DgAsQK9D.js +145 -0
- package/dist/visual-editor-Dhi__-7_.js +145 -0
- package/dist/visual-editor-DjTEbi-1.js +842 -0
- package/dist/visual-editor-DjdqpJU-.js +145 -0
- package/dist/visual-editor-DkHhrFsX.js +804 -0
- package/dist/visual-editor-DtL-Zuv_.js +804 -0
- package/dist/visual-editor-Duishbsa.js +842 -0
- package/dist/visual-editor-DvuH3jyL.js +157 -0
- package/dist/visual-editor-LXMNWXry.js +823 -0
- package/dist/visual-editor-QpGupjY5.js +823 -0
- package/dist/visual-editor-TfVDfO5_.js +145 -0
- package/dist/visual-editor-W_ZDmMFn.js +145 -0
- package/dist/visual-editor-_TatCCAS.js +804 -0
- package/dist/visual-editor-b7ALusk8.js +145 -0
- package/dist/visual-editor-erGXf3kS.js +157 -0
- package/dist/visual-editor-gEaWoNRu.js +804 -0
- package/dist/visual-editor-gjpr-NAN.js +804 -0
- package/dist/visual-editor-qJW0uCiQ.js +804 -0
- package/dist/visual-editor-sOPDMkOR.js +823 -0
- package/dist/visual-editor-tPb7n5l8.js +823 -0
- package/dist/visual-editor-vomNdlNO.js +804 -0
- package/dist/visual-editor-xnDHZFuO.js +153 -0
- package/dist/visual-editor-yiWZqIH0.js +157 -0
- package/dist/visual-editor-zKhC7_0C.js +823 -0
- package/dist/visual-editor.css +1 -0
- package/dist/visual-editor.js +18578 -137536
- package/package.json +50 -26
- package/dist/editor.css +0 -1
- package/dist/visual-editor-6pnSx-yp.js +0 -223
- package/dist/visual-editor-9ZW3nq5u.js +0 -247
- package/dist/visual-editor-B1RXDqNi.js +0 -1063
- package/dist/visual-editor-BAahiZ1l.js +0 -223
- package/dist/visual-editor-BC2LjdoF.js +0 -223
- package/dist/visual-editor-BPnfBfk1.js +0 -1051
- package/dist/visual-editor-BQiE5eVW.js +0 -1051
- package/dist/visual-editor-BTv-6Pnk.js +0 -1051
- package/dist/visual-editor-BUWp03gX.js +0 -235
- package/dist/visual-editor-Bb3c6iGV.js +0 -223
- package/dist/visual-editor-BipczqTj.js +0 -1075
- package/dist/visual-editor-BlIUd_n_.js +0 -1051
- package/dist/visual-editor-BoPLXEu2.js +0 -223
- package/dist/visual-editor-Bzmpi_9a.js +0 -1063
- package/dist/visual-editor-C38IiBTR.js +0 -235
- package/dist/visual-editor-C9tacnim.js +0 -247
- package/dist/visual-editor-CVa3iu5h.js +0 -1051
- package/dist/visual-editor-CXTL8Ik0.js +0 -1051
- package/dist/visual-editor-CYeahjFX.js +0 -231
- package/dist/visual-editor-CZ2SM6Jc.js +0 -1063
- package/dist/visual-editor-CZDmQI-A.js +0 -1063
- package/dist/visual-editor-C_cHJ6BN.js +0 -1051
- package/dist/visual-editor-Cf3nFbw3.js +0 -235
- package/dist/visual-editor-CiR0metz.js +0 -1051
- package/dist/visual-editor-CoX_NnS-.js +0 -223
- package/dist/visual-editor-Cu8II23Y.js +0 -223
- package/dist/visual-editor-CvXFxocc.js +0 -1063
- package/dist/visual-editor-Cxu6nkib.js +0 -1051
- package/dist/visual-editor-D-3VVfjR.js +0 -223
- package/dist/visual-editor-D-ktbg7q.js +0 -223
- package/dist/visual-editor-D9G5eAAU.js +0 -1051
- package/dist/visual-editor-D9MrqEya.js +0 -223
- package/dist/visual-editor-DAKXBbjV.js +0 -1075
- package/dist/visual-editor-DBmJk7ZR.js +0 -235
- package/dist/visual-editor-DG-c2LU9.js +0 -1051
- package/dist/visual-editor-DI_Vk989.js +0 -1051
- package/dist/visual-editor-DOOYgnjP.js +0 -235
- package/dist/visual-editor-DRx3Ax_O.js +0 -1075
- package/dist/visual-editor-DZ66sria.js +0 -1051
- package/dist/visual-editor-DZTPhYcr.js +0 -247
- package/dist/visual-editor-DcH7WJVI.js +0 -223
- package/dist/visual-editor-DdYXgEbR.js +0 -1059
- package/dist/visual-editor-DeWzgcue.js +0 -1063
- package/dist/visual-editor-Dm5ZNn8C.js +0 -223
- package/dist/visual-editor-DqLCIWPQ.js +0 -1051
- package/dist/visual-editor-NoU28r5Y.js +0 -223
- package/dist/visual-editor-WjrJ9nPc.js +0 -235
- package/dist/visual-editor-_h-sdbID.js +0 -223
- package/dist/visual-editor-r4gSQqFM.js +0 -1075
- package/dist/visual-editor-ujQ29mao.js +0 -247
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { useTemplateProps } from "../../../hooks/useDocument.tsx";
|
|
2
|
+
import {
|
|
3
|
+
backgroundColors,
|
|
4
|
+
ThemeColor,
|
|
5
|
+
} from "../../../utils/themeConfigOptions.ts";
|
|
6
|
+
import { PageSection } from "../../atoms/pageSection.tsx";
|
|
7
|
+
import { msg } from "../../../utils/i18n/platform.ts";
|
|
8
|
+
import { Background } from "../../atoms/background.tsx";
|
|
9
|
+
import { HeadingTextProps } from "../../contentBlocks/HeadingText.tsx";
|
|
10
|
+
import { BreadcrumbsSectionProps } from "../Breadcrumbs.tsx";
|
|
11
|
+
import { PuckComponent, setDeep, Slot } from "@puckeditor/core";
|
|
12
|
+
import { AnalyticsScopeProvider } from "@yext/pages-components";
|
|
13
|
+
import { DirectoryList } from "./DirectoryWrapper.tsx";
|
|
14
|
+
import { isDirectoryGrid } from "../../../utils/directory/utils.ts";
|
|
15
|
+
import {
|
|
16
|
+
toPuckFields,
|
|
17
|
+
YextComponentConfig,
|
|
18
|
+
YextFields,
|
|
19
|
+
} from "../../../fields/fields.ts";
|
|
20
|
+
|
|
21
|
+
export interface DirectoryStyles {
|
|
22
|
+
/**
|
|
23
|
+
* The background color for the directory page heading area.
|
|
24
|
+
* @defaultValue Background Color 1
|
|
25
|
+
*/
|
|
26
|
+
backgroundColor: ThemeColor;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The background color for the directory list area.
|
|
30
|
+
* @defaultValue Background Color 1
|
|
31
|
+
*/
|
|
32
|
+
listBackgroundColor: ThemeColor;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The color of links in the directory list layout.
|
|
36
|
+
*/
|
|
37
|
+
linkColor?: ThemeColor;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The casing of directory list labels. Default uses the link theme transform,
|
|
41
|
+
* falling back to title case.
|
|
42
|
+
* @defaultValue default
|
|
43
|
+
*/
|
|
44
|
+
textTransform?: "none" | "default" | "lowercase" | "uppercase" | "capitalize";
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface DirectoryProps {
|
|
48
|
+
/**
|
|
49
|
+
* This object contains properties for customizing the component's appearance.
|
|
50
|
+
* @propCategory Style Props
|
|
51
|
+
*/
|
|
52
|
+
styles: DirectoryStyles;
|
|
53
|
+
|
|
54
|
+
/** @internal */
|
|
55
|
+
slots: {
|
|
56
|
+
TitleSlot: Slot;
|
|
57
|
+
SiteNameSlot: Slot;
|
|
58
|
+
BreadcrumbsSlot: Slot;
|
|
59
|
+
DirectoryGrid: Slot;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** @internal */
|
|
63
|
+
analytics: {
|
|
64
|
+
scope?: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const directoryFields: YextFields<DirectoryProps> = {
|
|
69
|
+
styles: {
|
|
70
|
+
type: "object",
|
|
71
|
+
label: msg("fields.styles", "Styles"),
|
|
72
|
+
objectFields: {
|
|
73
|
+
backgroundColor: {
|
|
74
|
+
type: "basicSelector",
|
|
75
|
+
label: msg("fields.headingBackgroundColor", "Heading Background Color"),
|
|
76
|
+
options: "BACKGROUND_COLOR",
|
|
77
|
+
},
|
|
78
|
+
listBackgroundColor: {
|
|
79
|
+
type: "basicSelector",
|
|
80
|
+
label: msg(
|
|
81
|
+
"fields.directoryListBackgroundColor",
|
|
82
|
+
"Directory List Background Color"
|
|
83
|
+
),
|
|
84
|
+
options: "BACKGROUND_COLOR",
|
|
85
|
+
},
|
|
86
|
+
linkColor: {
|
|
87
|
+
type: "basicSelector",
|
|
88
|
+
label: msg("fields.linkColor", "Link Color"),
|
|
89
|
+
options: "SITE_COLOR",
|
|
90
|
+
},
|
|
91
|
+
textTransform: {
|
|
92
|
+
type: "select",
|
|
93
|
+
label: msg("theme.textTransform.textTransform", "Text Transform"),
|
|
94
|
+
options: [
|
|
95
|
+
{ label: msg("fields.options.none", "None"), value: "none" },
|
|
96
|
+
{ label: msg("fields.options.default", "Default"), value: "default" },
|
|
97
|
+
{
|
|
98
|
+
label: msg("theme.textTransform.lowercase", "Lowercase"),
|
|
99
|
+
value: "lowercase",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
label: msg("theme.textTransform.uppercase", "Uppercase"),
|
|
103
|
+
value: "uppercase",
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
label: msg("theme.textTransform.capitalize", "Capitalize"),
|
|
107
|
+
value: "capitalize",
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
slots: {
|
|
114
|
+
type: "object",
|
|
115
|
+
objectFields: {
|
|
116
|
+
TitleSlot: { type: "slot", allow: [] },
|
|
117
|
+
SiteNameSlot: { type: "slot", allow: [] },
|
|
118
|
+
BreadcrumbsSlot: { type: "slot", allow: [] },
|
|
119
|
+
DirectoryGrid: { type: "slot", allow: [] },
|
|
120
|
+
},
|
|
121
|
+
visible: false,
|
|
122
|
+
},
|
|
123
|
+
analytics: {
|
|
124
|
+
type: "object",
|
|
125
|
+
label: msg("fields.analytics", "Analytics"),
|
|
126
|
+
visible: false,
|
|
127
|
+
objectFields: {
|
|
128
|
+
scope: {
|
|
129
|
+
label: msg("fields.scope", "Scope"),
|
|
130
|
+
type: "text",
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const DirectoryComponent: PuckComponent<DirectoryProps> = ({
|
|
137
|
+
styles,
|
|
138
|
+
slots,
|
|
139
|
+
}) => {
|
|
140
|
+
const { document: streamDocument, relativePrefixToRoot } = useTemplateProps();
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<Background background={styles.backgroundColor}>
|
|
144
|
+
<slots.BreadcrumbsSlot style={{ height: "auto" }} />
|
|
145
|
+
<PageSection className="flex flex-col items-center gap-2">
|
|
146
|
+
<slots.SiteNameSlot style={{ height: "auto", width: "100%" }} />
|
|
147
|
+
<slots.TitleSlot style={{ height: "auto", width: "100%" }} />
|
|
148
|
+
</PageSection>
|
|
149
|
+
{streamDocument.dm_directoryChildren &&
|
|
150
|
+
isDirectoryGrid(streamDocument.dm_directoryChildren) && (
|
|
151
|
+
<slots.DirectoryGrid style={{ height: "auto" }} />
|
|
152
|
+
)}
|
|
153
|
+
{streamDocument.dm_directoryChildren &&
|
|
154
|
+
!isDirectoryGrid(streamDocument.dm_directoryChildren) && (
|
|
155
|
+
<DirectoryList
|
|
156
|
+
streamDocument={streamDocument}
|
|
157
|
+
directoryChildren={streamDocument.dm_directoryChildren}
|
|
158
|
+
relativePrefixToRoot={relativePrefixToRoot ?? ""}
|
|
159
|
+
linkColor={styles.linkColor}
|
|
160
|
+
textTransform={styles.textTransform}
|
|
161
|
+
backgroundColor={styles.listBackgroundColor}
|
|
162
|
+
/>
|
|
163
|
+
)}
|
|
164
|
+
</Background>
|
|
165
|
+
);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* The Directory Page component serves as a navigational hub,
|
|
170
|
+
* displaying a list of child entities within a hierarchical structure
|
|
171
|
+
* (e.g., a list of states in a country, or cities in a state).
|
|
172
|
+
* It includes breadcrumbs for easy navigation and renders each child item as a distinct card.
|
|
173
|
+
* Available on Directory templates.
|
|
174
|
+
*/
|
|
175
|
+
export const Directory: YextComponentConfig<DirectoryProps> = {
|
|
176
|
+
label: msg("components.directory", "Directory"),
|
|
177
|
+
fields: directoryFields,
|
|
178
|
+
resolveFields: (data, params) => {
|
|
179
|
+
if (
|
|
180
|
+
params.metadata.streamDocument?.dm_directoryChildren &&
|
|
181
|
+
isDirectoryGrid(params.metadata.streamDocument.dm_directoryChildren)
|
|
182
|
+
) {
|
|
183
|
+
const updatedFields = setDeep(
|
|
184
|
+
directoryFields,
|
|
185
|
+
"styles.objectFields.listBackgroundColor.visible",
|
|
186
|
+
false
|
|
187
|
+
);
|
|
188
|
+
const listFieldsHidden = setDeep(
|
|
189
|
+
updatedFields,
|
|
190
|
+
"styles.objectFields.linkColor.visible",
|
|
191
|
+
false
|
|
192
|
+
);
|
|
193
|
+
return toPuckFields(
|
|
194
|
+
setDeep(
|
|
195
|
+
listFieldsHidden,
|
|
196
|
+
"styles.objectFields.textTransform.visible",
|
|
197
|
+
false
|
|
198
|
+
)
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
return toPuckFields(directoryFields);
|
|
202
|
+
},
|
|
203
|
+
defaultProps: {
|
|
204
|
+
styles: {
|
|
205
|
+
backgroundColor: backgroundColors.background1.value,
|
|
206
|
+
listBackgroundColor: backgroundColors.background1.value,
|
|
207
|
+
textTransform: "default",
|
|
208
|
+
},
|
|
209
|
+
slots: {
|
|
210
|
+
TitleSlot: [
|
|
211
|
+
{
|
|
212
|
+
type: "HeadingTextSlot",
|
|
213
|
+
props: {
|
|
214
|
+
data: {
|
|
215
|
+
text: {
|
|
216
|
+
constantValue: { defaultValue: "" },
|
|
217
|
+
constantValueEnabled: false,
|
|
218
|
+
field: "name",
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
styles: { level: 2, align: "center" },
|
|
222
|
+
} satisfies HeadingTextProps,
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
SiteNameSlot: [
|
|
226
|
+
{
|
|
227
|
+
type: "HeadingTextSlot",
|
|
228
|
+
props: {
|
|
229
|
+
data: {
|
|
230
|
+
text: {
|
|
231
|
+
constantValue: { defaultValue: "" },
|
|
232
|
+
constantValueEnabled: true,
|
|
233
|
+
field: "name",
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
styles: { level: 4, align: "center" },
|
|
237
|
+
} satisfies HeadingTextProps,
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
BreadcrumbsSlot: [
|
|
241
|
+
{
|
|
242
|
+
type: "BreadcrumbsSlot",
|
|
243
|
+
props: {
|
|
244
|
+
data: {
|
|
245
|
+
directoryRoot: { defaultValue: "Directory Root" },
|
|
246
|
+
currentPage: {
|
|
247
|
+
constantValue: { defaultValue: "[[name]]" },
|
|
248
|
+
field: "name",
|
|
249
|
+
constantValueEnabled: false,
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
styles: {
|
|
253
|
+
backgroundColor: backgroundColors.background1.value,
|
|
254
|
+
showCurrentPage: true,
|
|
255
|
+
},
|
|
256
|
+
analytics: {
|
|
257
|
+
scope: "directory",
|
|
258
|
+
},
|
|
259
|
+
liveVisibility: true,
|
|
260
|
+
} satisfies BreadcrumbsSectionProps,
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
DirectoryGrid: [
|
|
264
|
+
{
|
|
265
|
+
type: "DirectoryGrid",
|
|
266
|
+
props: {
|
|
267
|
+
data: {
|
|
268
|
+
field: "dm_directoryChildren",
|
|
269
|
+
constantValueEnabled: false,
|
|
270
|
+
constantValue: [],
|
|
271
|
+
mappings: {
|
|
272
|
+
cardTitle: {
|
|
273
|
+
field: "name",
|
|
274
|
+
constantValueEnabled: false,
|
|
275
|
+
constantValue: undefined,
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
styles: {
|
|
280
|
+
backgroundColor: backgroundColors.background1.value,
|
|
281
|
+
},
|
|
282
|
+
slots: {
|
|
283
|
+
CardSlot: [],
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
],
|
|
288
|
+
},
|
|
289
|
+
analytics: {
|
|
290
|
+
scope: "directory",
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
render: (props) => (
|
|
294
|
+
<AnalyticsScopeProvider name={props?.analytics?.scope ?? "directory"}>
|
|
295
|
+
<DirectoryComponent {...props} />
|
|
296
|
+
</AnalyticsScopeProvider>
|
|
297
|
+
),
|
|
298
|
+
};
|