@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 @@
|
|
|
1
|
+
.rtf-theme{p,li{font-family:var(--fontFamily-body-fontFamily)!important;font-size:var(--fontSize-body-fontSize)!important;line-height:1.5!important;font-weight:var(--fontWeight-body-fontWeight)!important;font-style:var(--fontStyle-body-fontStyle)!important;text-transform:var(--textTransform-body-textTransform)!important}h1{font-family:var(--fontFamily-h2-fontFamily)!important;font-size:var(--fontSize-h2-fontSize)!important;line-height:1.2!important;font-weight:var(--fontWeight-h2-fontWeight)!important;font-style:var(--fontStyle-h2-fontStyle)!important;text-transform:var(--textTransform-h1-textTransform)!important;@media(min-width:640px){font-family:var(--fontFamily-h1-fontFamily)!important;font-size:var(--fontSize-h1-fontSize)!important;font-weight:var(--fontWeight-h1-fontWeight)!important;font-style:var(--fontStyle-h1-fontStyle)!important}}h2{font-family:var(--fontFamily-h3-fontFamily)!important;font-size:var(--fontSize-h3-fontSize)!important;line-height:1.2!important;font-weight:var(--fontWeight-h3-fontWeight)!important;font-style:var(--fontStyle-h3-fontStyle)!important;text-transform:var(--textTransform-h2-textTransform)!important;@media(min-width:640px){font-family:var(--fontFamily-h2-fontFamily)!important;font-size:var(--fontSize-h2-fontSize)!important;font-weight:var(--fontWeight-h2-fontWeight)!important;font-style:var(--fontStyle-h2-fontStyle)!important}}h3{font-family:var(--fontFamily-h4-fontFamily)!important;font-size:var(--fontSize-h4-fontSize)!important;line-height:1.2!important;font-weight:var(--fontWeight-h4-fontWeight)!important;font-style:var(--fontStyle-h4-fontStyle)!important;text-transform:var(--textTransform-h3-textTransform)!important;@media(min-width:640px){font-family:var(--fontFamily-h3-fontFamily)!important;font-size:var(--fontSize-h3-fontSize)!important;font-weight:var(--fontWeight-h3-fontWeight)!important;font-style:var(--fontStyle-h3-fontStyle)!important}}h4{font-family:var(--fontFamily-h5-fontFamily)!important;font-size:var(--fontSize-h5-fontSize)!important;line-height:1.2!important;font-weight:var(--fontWeight-h5-fontWeight)!important;font-style:var(--fontStyle-h5-fontStyle)!important;text-transform:var(--textTransform-h4-textTransform)!important;@media(min-width:640px){font-family:var(--fontFamily-h4-fontFamily)!important;font-size:var(--fontSize-h4-fontSize)!important;font-weight:var(--fontWeight-h4-fontWeight)!important;font-style:var(--fontStyle-h4-fontStyle)!important}}h5{font-family:var(--fontFamily-h6-fontFamily)!important;font-size:var(--fontSize-h6-fontSize)!important;line-height:1.2!important;font-weight:var(--fontWeight-h6-fontWeight)!important;font-style:var(--fontStyle-h6-fontStyle)!important;text-transform:var(--textTransform-h5-textTransform)!important;@media(min-width:640px){font-family:var(--fontFamily-h5-fontFamily)!important;font-size:var(--fontSize-h5-fontSize)!important;font-weight:var(--fontWeight-h5-fontWeight)!important;font-style:var(--fontStyle-h5-fontStyle)!important}}h6{font-family:var(--fontFamily-h6-fontFamily)!important;font-size:var(--fontSize-h6-fontSize)!important;line-height:1.2!important;font-weight:var(--fontWeight-h6-fontWeight)!important;font-style:var(--fontStyle-h6-fontStyle)!important;text-transform:var(--textTransform-h6-textTransform)!important}a{font-family:var(--fontFamily-link-fontFamily)!important;font-size:var(--fontSize-link-fontSize)!important;font-weight:var(--fontWeight-link-fontWeight)!important;font-style:var(--fontStyle-link-fontStyle)!important;line-height:1.5!important;text-decoration:underline!important;text-transform:var(--textTransform-link-textTransform)!important;letter-spacing:var(--letterSpacing-link-letterSpacing)!important;color:hsl(from var(--colors-palette-primary) h s 20)!important;.text-white &{color:#fff!important}}&[style*="color:"]{a{color:inherit!important}}a:hover{text-decoration:none!important}strong{font-weight:inherit!important}}.rtf-body-xs p,.rtf-body-xs li{font-size:calc(var(--fontSize-body-fontSize) - 4px)!important}.rtf-body-sm p,.rtf-body-sm li{font-size:calc(var(--fontSize-body-fontSize) - 2px)!important}.rtf-body-lg p,.rtf-body-lg li{font-size:calc(var(--fontSize-body-fontSize) + 2px)!important}.rtf-wrapper *{color:inherit!important}.puck-header{grid-area:header;display:flex;align-items:center;padding:var(--puck-space-4);width:100%;border-bottom:1px solid var(--puck-color-grey-09);.header-left{flex:1;display:flex;justify-content:flex-start}.header-center{gap:16px;flex:1;text-align:center;display:flex;justify-content:center;flex-direction:row}.actions{flex:1;display:flex;gap:16px;justify-content:flex-end}}.ve-loading-wrapper{width:100vw;height:100vh;justify-content:center;.ve-loading-progress{width:30%}}.sm-icon{height:1rem;width:1rem}.theme-field{color:var(--puck-color-grey-04);font-size:var(--puck-font-size-xxs);font-weight:600;padding:12px 0 12px 4px;border-bottom:1px solid #e5e5f0}.theme-field>:first-child{padding:0 16px}.theme-field>div{padding:12px 16px}.theme-field>fieldset{padding:16px 15px}.theme-field fieldset>div,.theme-field fieldset>label{padding:0;border:none!important}.font-select{text-align:left;width:100%;padding:12px 15px;font-size:14px;cursor:pointer;background-color:var(--puck-color-white);border:1px solid var(--puck-color-grey-09);border-radius:4px;transition:border-color 50ms ease-in;background:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23c3c3c3'><polygon points='0,0 100,0 50,50'/></svg>") no-repeat;background-size:12px;background-position:calc(100% - 12px) calc(50% + 3px);background-repeat:no-repeat}.font-select:hover,.font-select:focus{background-color:var(--puck-color-azure-12);border-color:var(--puck-color-grey-05);transition:none}.font-select-dropdown{position:absolute;z-index:1;background-color:var(--puck-color-white);border:1px solid var(--puck-color-grey-09);border-radius:4px;box-shadow:0 4px 8px #0000001a;max-height:200px;overflow-y:auto;width:100%}.font-select-option{text-align:left;width:100%;padding:12px 15px;background-color:transparent;border:none;cursor:pointer;font-size:14px}.font-select-option:hover,.font-select-option:active{background-color:var(--puck-color-grey-09)}.font-select-search{display:flex;gap:16px;background-color:#fff;padding:12px 15px;align-items:center;position:sticky;top:0;z-index:2}.font-search-input{font-family:var(--puck-font-family)}.font-search-input:focus{outline:none}.date-time-picker{border:1px solid var(--puck-color-grey-09);border-radius:4px;padding:12px 15px;font-size:14px;font-family:inherit;width:100%}.react-international-phone-input{border:1px solid var(--puck-color-grey-09);border-radius:4px;font-size:14px;font-family:inherit;transition:border-color 50ms ease-in;display:flex;align-items:center;padding:12px 15px;height:100%;flex:1;min-width:0}.puck-select{background:var(--puck-color-white);border-width:1px;border-style:solid;border-color:var(--puck-color-grey-09);border-radius:4px;box-sizing:border-box;font-family:inherit;font-size:14px;padding:12px 15px;transition:border-color 50ms ease-in;width:100%;max-width:100%;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23c3c3c3'><polygon points='0,0 100,0 50,50'/></svg>") no-repeat;background-size:12px;background-position:calc(100% - 12px) calc(50% + 3px);background-repeat:no-repeat;background-color:var(--puck-color-white);cursor:pointer}select.puck-select:dir(rtl){background-position:12px calc(50% + 3px)}.puck-select:hover{background-color:var(--puck-color-azure-12);background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%235a5a5a'><polygon points='0,0 100,0 50,50'/></svg>");border-color:var(--puck-color-grey-05);transition:none}.puck-select:focus-visible{border-color:var(--puck-color-grey-05);outline:2px solid var(--puck-color-azure-05);transition:none}div[class*=_SidebarSection-breadcrumb]{overflow:hidden!important;white-space:nowrap!important}div[class*=_SidebarSection-breadcrumbs] *{font-size:12px!important}div[class*=_SidebarSection-breadcrumb] button{white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;max-width:100%!important;flex:1!important;min-width:0!important}.react-international-phone-country-selector{position:relative}.react-international-phone-country-selector-button{display:flex;height:var(--react-international-phone-height, 36px);box-sizing:border-box;align-items:center;justify-content:center;padding:0;border:1px solid var(--react-international-phone-country-selector-border-color, var(--react-international-phone-border-color, gainsboro));margin:0;-moz-appearance:button;appearance:button;-webkit-appearance:button;background-color:var(--react-international-phone-country-selector-background-color, var(--react-international-phone-background-color, white));cursor:pointer;text-transform:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-international-phone-country-selector-button:hover{background-color:var(--react-international-phone-country-selector-background-color-hover, whitesmoke)}.react-international-phone-country-selector-button--hide-dropdown{cursor:auto}.react-international-phone-country-selector-button--hide-dropdown:hover{background-color:transparent}.react-international-phone-country-selector-button__button-content{display:flex;align-items:center;justify-content:center}.react-international-phone-country-selector-button__flag-emoji{margin:0 4px}.react-international-phone-country-selector-button__flag-emoji--disabled{opacity:.75}.react-international-phone-country-selector-button__dropdown-arrow{border-top:var(--react-international-phone-country-selector-arrow-size, 4px) solid var(--react-international-phone-country-selector-arrow-color, #777);border-right:var(--react-international-phone-country-selector-arrow-size, 4px) solid transparent;border-left:var(--react-international-phone-country-selector-arrow-size, 4px) solid transparent;margin-right:4px;transition:all .1s ease-out}.react-international-phone-country-selector-button__dropdown-arrow--active{transform:rotateX(180deg)}.react-international-phone-country-selector-button__dropdown-arrow--disabled{border-top-color:var(--react-international-phone-disabled-country-selector-arrow-color, #999)}.react-international-phone-country-selector-button--disabled,.react-international-phone-country-selector-button--disabled:hover{background-color:var(--react-international-phone-disabled-country-selector-background-color, var(--react-international-phone-disabled-background-color, whitesmoke))}.react-international-phone-country-selector-button--disabled{cursor:auto}.react-international-phone-flag-emoji{width:var(--react-international-phone-flag-width, 24px);height:var(--react-international-phone-flag-height, 24px);box-sizing:border-box}.react-international-phone-country-selector-dropdown{position:absolute;z-index:1;top:var(--react-international-phone-dropdown-top, 44px);left:var(--react-international-phone-dropdown-left, 0);display:flex;width:300px;max-height:200px;flex-direction:column;padding:4px 0;margin:0;background-color:var(--react-international-phone-dropdown-item-background-color, var(--react-international-phone-background-color, white));box-shadow:var(--react-international-phone-dropdown-shadow, 2px 2px 16px rgba(0, 0, 0, .25));color:var(--react-international-phone-dropdown-item-text-color, var(--react-international-phone-text-color, #222));list-style:none;overflow-y:scroll}.react-international-phone-country-selector-dropdown__preferred-list-divider{height:1px;border:none;margin:var(--react-international-phone-dropdown-preferred-list-divider-margin, 0);background:var(--react-international-phone-dropdown-preferred-list-divider-color, var(--react-international-phone-border-color, gainsboro))}.react-international-phone-country-selector-dropdown__list-item{display:flex;min-height:var(--react-international-phone-dropdown-item-height, 28px);box-sizing:border-box;align-items:center;padding:2px 8px}.react-international-phone-country-selector-dropdown__list-item-flag-emoji{margin-right:8px}.react-international-phone-country-selector-dropdown__list-item-country-name{overflow:hidden;margin-right:8px;font-size:var(--react-international-phone-dropdown-item-font-size, 14px);text-overflow:ellipsis;white-space:nowrap}.react-international-phone-country-selector-dropdown__list-item-dial-code{color:var(--react-international-phone-dropdown-item-dial-code-color, gray);font-size:var(--react-international-phone-dropdown-item-font-size, 14px)}.react-international-phone-country-selector-dropdown__list-item:hover{background-color:var(--react-international-phone-selected-dropdown-item-background-color, var(--react-international-phone-selected-dropdown-item-background-color, whitesmoke));cursor:pointer}.react-international-phone-country-selector-dropdown__list-item--selected,.react-international-phone-country-selector-dropdown__list-item--focused{background-color:var(--react-international-phone-selected-dropdown-item-background-color, whitesmoke);color:var(--react-international-phone-selected-dropdown-item-text-color, var(--react-international-phone-text-color, #222))}.react-international-phone-country-selector-dropdown__list-item--selected .react-international-phone-country-selector-dropdown__list-item-dial-code,.react-international-phone-country-selector-dropdown__list-item--focused .react-international-phone-country-selector-dropdown__list-item-dial-code{color:var(--react-international-phone-selected-dropdown-item-dial-code-color, var(--react-international-phone-dropdown-item-dial-code-color, gray))}.react-international-phone-country-selector-dropdown__list-item--focused{background-color:var(--react-international-phone-selected-dropdown-item-background-color, var(--react-international-phone-selected-dropdown-item-background-color, whitesmoke))}.react-international-phone-dial-code-preview{display:flex;align-items:center;justify-content:center;padding:0 8px;border:1px solid var(--react-international-phone-dial-code-preview-border-color, var(--react-international-phone-border-color, gainsboro));margin-right:-1px;background-color:var(--react-international-phone-dial-code-preview-background-color, var(--react-international-phone-background-color, white));color:var(--react-international-phone-dial-code-preview-text-color, var(--react-international-phone-text-color, #222));font-size:var(--react-international-phone-dial-code-preview-font-size, var(--react-international-phone-font-size, 13px))}.react-international-phone-dial-code-preview--disabled{background-color:var(--react-international-phone-dial-code-preview-disabled-background-color, var(--react-international-phone-disabled-background-color, whitesmoke));color:var(--react-international-phone-dial-code-preview-disabled-text-color, var(--react-international-phone-disabled-text-color, #666))}.react-international-phone-input-container{display:flex}.react-international-phone-input-container .react-international-phone-country-selector-button{border-radius:var(--react-international-phone-border-radius, 4px);margin-right:-1px;border-bottom-right-radius:0;border-top-right-radius:0}.react-international-phone-input-container .react-international-phone-input{overflow:visible;height:var(--react-international-phone-height, 36px);box-sizing:border-box;padding:0 8px;border:1px solid var(--react-international-phone-border-color, gainsboro);border-radius:var(--react-international-phone-border-radius, 4px);margin:0;background-color:var(--react-international-phone-background-color, white);border-bottom-left-radius:0;border-top-left-radius:0;color:var(--react-international-phone-text-color, #222);font-family:inherit;font-size:var(--react-international-phone-font-size, 13px)}.react-international-phone-input-container .react-international-phone-input:focus{outline:none}.react-international-phone-input-container .react-international-phone-input--disabled{background-color:var(--react-international-phone-disabled-background-color, whitesmoke);color:var(--react-international-phone-disabled-text-color, #666)}.is-today{font-weight:700}.HoursTable-row{display:flex;justify-content:space-between;width:18rem}.components .HoursTable-intervals{display:flex;flex-direction:column;flex:0 0 auto}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { useTranslation } from "react-i18next";
|
|
2
|
+
import {
|
|
3
|
+
ComponentData,
|
|
4
|
+
DefaultComponentProps,
|
|
5
|
+
PuckComponent,
|
|
6
|
+
setDeep,
|
|
7
|
+
} from "@puckeditor/core";
|
|
8
|
+
import {
|
|
9
|
+
AddressType,
|
|
10
|
+
getDirections,
|
|
11
|
+
Address as RenderAddress,
|
|
12
|
+
} from "@yext/pages-components";
|
|
13
|
+
import { useDocument } from "../../hooks/useDocument.tsx";
|
|
14
|
+
import { EntityField } from "../../editor/EntityField.tsx";
|
|
15
|
+
import { YextEntityField } from "../../editor/YextEntityFieldSelector.tsx";
|
|
16
|
+
import { CTA, CTAVariant, isCtaVariantWithColor } from "../atoms/cta.tsx";
|
|
17
|
+
import { pt, msg } from "../../utils/i18n/platform.ts";
|
|
18
|
+
import { resolveComponentData } from "../../utils/resolveComponentData.tsx";
|
|
19
|
+
import {
|
|
20
|
+
ThemeColor,
|
|
21
|
+
ThemeOptions,
|
|
22
|
+
backgroundColors,
|
|
23
|
+
} from "../../utils/themeConfigOptions.ts";
|
|
24
|
+
import { resolveDataFromParent } from "../../editor/ParentData.tsx";
|
|
25
|
+
import { YextComponentConfig, YextFields } from "../../fields/fields.ts";
|
|
26
|
+
|
|
27
|
+
/** Props for the Address component */
|
|
28
|
+
export interface AddressProps {
|
|
29
|
+
data: {
|
|
30
|
+
/** The address data to display. */
|
|
31
|
+
address: YextEntityField<AddressType>;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
styles: {
|
|
35
|
+
/**
|
|
36
|
+
* Whether to include the region in the Address
|
|
37
|
+
* @defaultValue true
|
|
38
|
+
*/
|
|
39
|
+
showRegion?: boolean;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Whether to include the country in the Address
|
|
43
|
+
* @defaultValue false
|
|
44
|
+
*/
|
|
45
|
+
showCountry?: boolean;
|
|
46
|
+
|
|
47
|
+
/** Whether to include a "Get Directions" CTA to Google Maps */
|
|
48
|
+
showGetDirectionsLink: boolean;
|
|
49
|
+
|
|
50
|
+
/** The variant of the get directions button */
|
|
51
|
+
ctaVariant: CTAVariant;
|
|
52
|
+
|
|
53
|
+
color?: ThemeColor;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** @internal */
|
|
57
|
+
parentData?: {
|
|
58
|
+
field: string;
|
|
59
|
+
address?: AddressType;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Address field definition used in Address and CoreInfoSection
|
|
64
|
+
export const AddressDataField: YextFields<AddressProps["data"]> = {
|
|
65
|
+
address: {
|
|
66
|
+
type: "entityField",
|
|
67
|
+
label: msg("fields.address", "Address"),
|
|
68
|
+
filter: { types: ["type.address"] },
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Address style fields used in Address and CoreInfoSection
|
|
73
|
+
export const AddressStyleFields: YextFields<AddressProps["styles"]> = {
|
|
74
|
+
showRegion: {
|
|
75
|
+
label: msg("fields.showRegion", "Show Region"),
|
|
76
|
+
type: "radio",
|
|
77
|
+
options: [
|
|
78
|
+
{ label: msg("fields.options.yes", "Yes"), value: true },
|
|
79
|
+
{ label: msg("fields.options.no", "No"), value: false },
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
showCountry: {
|
|
83
|
+
label: msg("fields.showCountry", "Show Country"),
|
|
84
|
+
type: "radio",
|
|
85
|
+
options: [
|
|
86
|
+
{ label: msg("fields.options.yes", "Yes"), value: true },
|
|
87
|
+
{ label: msg("fields.options.no", "No"), value: false },
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
showGetDirectionsLink: {
|
|
91
|
+
label: msg("fields.showGetDirectionsLink", "Show Get Directions Link"),
|
|
92
|
+
type: "radio",
|
|
93
|
+
options: [
|
|
94
|
+
{ label: msg("fields.options.yes", "Yes"), value: true },
|
|
95
|
+
{ label: msg("fields.options.no", "No"), value: false },
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
ctaVariant: {
|
|
99
|
+
label: msg("fields.ctaVariant", "CTA Variant"),
|
|
100
|
+
type: "radio",
|
|
101
|
+
options: ThemeOptions.CTA_VARIANT,
|
|
102
|
+
},
|
|
103
|
+
color: {
|
|
104
|
+
type: "basicSelector",
|
|
105
|
+
label: msg("fields.linkColor", "Link Color"),
|
|
106
|
+
options: "SITE_COLOR",
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export const addressFields: YextFields<AddressProps> = {
|
|
111
|
+
data: {
|
|
112
|
+
type: "object",
|
|
113
|
+
label: msg("fields.data", "Data"),
|
|
114
|
+
objectFields: AddressDataField,
|
|
115
|
+
},
|
|
116
|
+
styles: {
|
|
117
|
+
type: "object",
|
|
118
|
+
label: msg("fields.styles", "Styles"),
|
|
119
|
+
objectFields: AddressStyleFields,
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const AddressComponent: PuckComponent<AddressProps> = (props) => {
|
|
124
|
+
const { data, styles, puck, parentData } = props;
|
|
125
|
+
const { t, i18n } = useTranslation();
|
|
126
|
+
const streamDocument = useDocument();
|
|
127
|
+
|
|
128
|
+
const resolvedColor = styles.color;
|
|
129
|
+
const address =
|
|
130
|
+
parentData?.address ??
|
|
131
|
+
(resolveComponentData(
|
|
132
|
+
data.address,
|
|
133
|
+
i18n.language,
|
|
134
|
+
streamDocument
|
|
135
|
+
) as unknown as AddressType | undefined);
|
|
136
|
+
|
|
137
|
+
const listings = streamDocument.ref_listings ?? [];
|
|
138
|
+
const listingsLink = getDirections(
|
|
139
|
+
undefined,
|
|
140
|
+
listings,
|
|
141
|
+
undefined,
|
|
142
|
+
{ provider: "google" },
|
|
143
|
+
undefined
|
|
144
|
+
);
|
|
145
|
+
const addressLink = getDirections(
|
|
146
|
+
address as AddressType,
|
|
147
|
+
undefined,
|
|
148
|
+
undefined,
|
|
149
|
+
{ provider: "google" }
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
// If ref_listings doesn't exist or the address field selected isn't just address, use the address link.
|
|
153
|
+
const useAddressLink: boolean =
|
|
154
|
+
data.address.field !== "address" || !streamDocument.ref_listings?.length;
|
|
155
|
+
|
|
156
|
+
// Only show the address component if there's at least one line of the address
|
|
157
|
+
const showAddress = !!(
|
|
158
|
+
address?.line1 ||
|
|
159
|
+
address?.line2 ||
|
|
160
|
+
address?.city ||
|
|
161
|
+
address?.region ||
|
|
162
|
+
address?.postalCode
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
return showAddress ? (
|
|
166
|
+
<div className="flex flex-col gap-2 text-body-fontSize font-body-fontWeight font-body-fontFamily">
|
|
167
|
+
<EntityField
|
|
168
|
+
displayName={parentData ? parentData.field : pt("address", "Address")}
|
|
169
|
+
fieldId={data.address.field}
|
|
170
|
+
constantValueEnabled={!parentData && data.address.constantValueEnabled}
|
|
171
|
+
>
|
|
172
|
+
<RenderAddress
|
|
173
|
+
address={address}
|
|
174
|
+
showRegion={styles.showRegion}
|
|
175
|
+
showCountry={styles.showCountry}
|
|
176
|
+
/>
|
|
177
|
+
</EntityField>
|
|
178
|
+
{(useAddressLink ? !!addressLink : !!listingsLink) &&
|
|
179
|
+
styles.showGetDirectionsLink && (
|
|
180
|
+
<CTA
|
|
181
|
+
setPadding={true}
|
|
182
|
+
ctaType="getDirections"
|
|
183
|
+
eventName={`getDirections`}
|
|
184
|
+
link={useAddressLink ? addressLink : listingsLink}
|
|
185
|
+
label={t("getDirections", "Get Directions")}
|
|
186
|
+
linkType="DRIVING_DIRECTIONS"
|
|
187
|
+
normalizeLink={false}
|
|
188
|
+
target="_blank"
|
|
189
|
+
variant={styles.ctaVariant}
|
|
190
|
+
color={resolvedColor}
|
|
191
|
+
/>
|
|
192
|
+
)}
|
|
193
|
+
</div>
|
|
194
|
+
) : puck.isEditing ? (
|
|
195
|
+
<div className="min-h-[40px]"></div>
|
|
196
|
+
) : (
|
|
197
|
+
<></>
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export const resolveAddressFields = (
|
|
202
|
+
data: Omit<
|
|
203
|
+
ComponentData<AddressProps, string, Record<string, DefaultComponentProps>>,
|
|
204
|
+
"type"
|
|
205
|
+
>
|
|
206
|
+
) => {
|
|
207
|
+
let updatedFields = resolveDataFromParent(addressFields, data);
|
|
208
|
+
const showGetDirectionsLink = data.props.styles.showGetDirectionsLink;
|
|
209
|
+
updatedFields = setDeep(
|
|
210
|
+
updatedFields,
|
|
211
|
+
"styles.objectFields.ctaVariant.visible",
|
|
212
|
+
showGetDirectionsLink
|
|
213
|
+
);
|
|
214
|
+
const ctaVariant = data.props.styles.ctaVariant;
|
|
215
|
+
const showColor = isCtaVariantWithColor(ctaVariant);
|
|
216
|
+
updatedFields = setDeep(
|
|
217
|
+
updatedFields,
|
|
218
|
+
"styles.objectFields.color.visible",
|
|
219
|
+
showGetDirectionsLink && showColor
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
return updatedFields;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
export const Address: YextComponentConfig<AddressProps> = {
|
|
226
|
+
label: msg("components.address", "Address"),
|
|
227
|
+
fields: addressFields,
|
|
228
|
+
defaultProps: {
|
|
229
|
+
data: {
|
|
230
|
+
address: {
|
|
231
|
+
field: "address",
|
|
232
|
+
constantValue: {
|
|
233
|
+
line1: "",
|
|
234
|
+
city: "",
|
|
235
|
+
region: "",
|
|
236
|
+
postalCode: "",
|
|
237
|
+
countryCode: "",
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
styles: {
|
|
242
|
+
showRegion: true,
|
|
243
|
+
showCountry: false,
|
|
244
|
+
showGetDirectionsLink: true,
|
|
245
|
+
ctaVariant: "link",
|
|
246
|
+
color: backgroundColors.color1.value,
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
resolveFields: resolveAddressFields,
|
|
250
|
+
render: (props) => <AddressComponent {...props} />,
|
|
251
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PuckComponent } from "@puckeditor/core";
|
|
3
|
+
import { useDocument } from "../../hooks/useDocument.tsx";
|
|
4
|
+
import { EntityField } from "../../editor/EntityField.tsx";
|
|
5
|
+
import { YextEntityField } from "../../editor/YextEntityFieldSelector.tsx";
|
|
6
|
+
import { Heading, HeadingProps } from "../atoms/heading.tsx";
|
|
7
|
+
import { TranslatableString } from "../../types/types.ts";
|
|
8
|
+
import { resolveComponentData } from "../../utils/resolveComponentData.tsx";
|
|
9
|
+
import { pt, msg } from "../../utils/i18n/platform.ts";
|
|
10
|
+
import {
|
|
11
|
+
ThemeOptions,
|
|
12
|
+
HeadingLevel,
|
|
13
|
+
ThemeColor,
|
|
14
|
+
} from "../../utils/themeConfigOptions.ts";
|
|
15
|
+
import { resolveDataFromParent } from "../../editor/ParentData.tsx";
|
|
16
|
+
import { useTranslation } from "react-i18next";
|
|
17
|
+
import { YextComponentConfig, YextFields } from "../../fields/fields.ts";
|
|
18
|
+
|
|
19
|
+
export type HeadingTextProps = {
|
|
20
|
+
/** The heading text value */
|
|
21
|
+
data: {
|
|
22
|
+
text: YextEntityField<TranslatableString>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** Styling for the heading. */
|
|
26
|
+
styles: {
|
|
27
|
+
/** The h tag level of the section heading */
|
|
28
|
+
level: HeadingProps["level"];
|
|
29
|
+
/** Alignment of the event section heading */
|
|
30
|
+
align: "left" | "center" | "right";
|
|
31
|
+
/** Optional override to render a different HTML tag instead of the one based on the level */
|
|
32
|
+
semanticLevelOverride?: HeadingLevel | "span";
|
|
33
|
+
color?: ThemeColor;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** @internal Controlled data from the parent section */
|
|
37
|
+
parentData?: {
|
|
38
|
+
field: string;
|
|
39
|
+
text?: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const HeadingTextWrapper: PuckComponent<HeadingTextProps> = (props) => {
|
|
44
|
+
const { data, styles, puck, parentData } = props;
|
|
45
|
+
const streamDocument = useDocument();
|
|
46
|
+
const { i18n } = useTranslation();
|
|
47
|
+
|
|
48
|
+
const justifyClass = styles?.align
|
|
49
|
+
? {
|
|
50
|
+
left: "justify-start",
|
|
51
|
+
center: "justify-center",
|
|
52
|
+
right: "justify-end",
|
|
53
|
+
}[styles.align]
|
|
54
|
+
: "justify-start";
|
|
55
|
+
|
|
56
|
+
const alignClass = styles?.align
|
|
57
|
+
? {
|
|
58
|
+
left: "text-left",
|
|
59
|
+
center: "text-center",
|
|
60
|
+
right: "text-right",
|
|
61
|
+
}[styles.align]
|
|
62
|
+
: "text-left";
|
|
63
|
+
|
|
64
|
+
const resolvedHeadingText =
|
|
65
|
+
parentData?.text ??
|
|
66
|
+
resolveComponentData(data.text, i18n.language, streamDocument);
|
|
67
|
+
|
|
68
|
+
return resolvedHeadingText ? (
|
|
69
|
+
<div className={`flex w-full ${justifyClass}`}>
|
|
70
|
+
<EntityField
|
|
71
|
+
displayName={pt("heading", "Heading") + " " + styles.level}
|
|
72
|
+
fieldId={parentData ? parentData.field : data.text.field}
|
|
73
|
+
constantValueEnabled={!parentData && data.text.constantValueEnabled}
|
|
74
|
+
>
|
|
75
|
+
<Heading
|
|
76
|
+
level={styles.level}
|
|
77
|
+
className={alignClass}
|
|
78
|
+
semanticLevelOverride={styles.semanticLevelOverride}
|
|
79
|
+
color={styles.color}
|
|
80
|
+
>
|
|
81
|
+
{resolvedHeadingText}
|
|
82
|
+
</Heading>
|
|
83
|
+
</EntityField>
|
|
84
|
+
</div>
|
|
85
|
+
) : puck.isEditing ? (
|
|
86
|
+
<div className="h-[30px]" />
|
|
87
|
+
) : (
|
|
88
|
+
<></>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const headingTextFields: YextFields<HeadingTextProps> = {
|
|
93
|
+
data: {
|
|
94
|
+
label: msg("fields.data", "Data"),
|
|
95
|
+
type: "object",
|
|
96
|
+
objectFields: {
|
|
97
|
+
text: {
|
|
98
|
+
type: "entityField",
|
|
99
|
+
label: msg("fields.text", "Text"),
|
|
100
|
+
filter: {
|
|
101
|
+
types: ["type.string"],
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
styles: {
|
|
107
|
+
label: msg("fields.styles", "Styles"),
|
|
108
|
+
type: "object",
|
|
109
|
+
objectFields: {
|
|
110
|
+
level: {
|
|
111
|
+
type: "basicSelector",
|
|
112
|
+
label: msg("fields.headingLevel", "Heading Level"),
|
|
113
|
+
options: "HEADING_LEVEL",
|
|
114
|
+
},
|
|
115
|
+
align: {
|
|
116
|
+
label: msg("fields.headingAlign", "Heading Align"),
|
|
117
|
+
type: "radio",
|
|
118
|
+
options: ThemeOptions.ALIGNMENT,
|
|
119
|
+
},
|
|
120
|
+
color: {
|
|
121
|
+
type: "basicSelector",
|
|
122
|
+
label: msg("fields.color", "Color"),
|
|
123
|
+
options: "SITE_COLOR",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const HeadingText: YextComponentConfig<HeadingTextProps> = {
|
|
130
|
+
label: msg("components.headingText", "Heading Text"),
|
|
131
|
+
fields: headingTextFields,
|
|
132
|
+
resolveFields: (data) => resolveDataFromParent(headingTextFields, data),
|
|
133
|
+
defaultProps: {
|
|
134
|
+
data: {
|
|
135
|
+
text: {
|
|
136
|
+
field: "",
|
|
137
|
+
constantValue: { defaultValue: "Text" },
|
|
138
|
+
constantValueEnabled: true,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
styles: {
|
|
142
|
+
level: 2,
|
|
143
|
+
align: "left",
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
render: (props) => <HeadingTextWrapper {...props} />,
|
|
147
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { useTranslation } from "react-i18next";
|
|
2
|
+
import { PuckComponent } from "@puckeditor/core";
|
|
3
|
+
import { HoursType } from "@yext/pages-components";
|
|
4
|
+
import { useDocument } from "../../hooks/useDocument.tsx";
|
|
5
|
+
import { resolveComponentData } from "../../utils/resolveComponentData.tsx";
|
|
6
|
+
import { EntityField } from "../../editor/EntityField.tsx";
|
|
7
|
+
import { YextEntityField } from "../../editor/YextEntityFieldSelector.tsx";
|
|
8
|
+
import { msg, pt } from "../../utils/i18n/platform.ts";
|
|
9
|
+
import { HoursStatusAtom } from "../atoms/hoursStatus.tsx";
|
|
10
|
+
import { resolveDataFromParent } from "../../editor/ParentData.tsx";
|
|
11
|
+
import { YextComponentConfig, YextFields } from "../../fields/fields.ts";
|
|
12
|
+
|
|
13
|
+
export interface HoursStatusProps {
|
|
14
|
+
data: {
|
|
15
|
+
/** The hours field to display the status for */
|
|
16
|
+
hours: YextEntityField<HoursType>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
styles: {
|
|
20
|
+
/** Whether to show the open status ("Open Now" or "Closed") */
|
|
21
|
+
showCurrentStatus?: boolean;
|
|
22
|
+
/** The time format to use */
|
|
23
|
+
timeFormat?: "12h" | "24h";
|
|
24
|
+
/** The day of week format ("Mon" vs. "Monday") */
|
|
25
|
+
dayOfWeekFormat?: "short" | "long";
|
|
26
|
+
/** Whether to show day names ("Monday", "Tuesday") */
|
|
27
|
+
showDayNames?: boolean;
|
|
28
|
+
/** Additional class names to apply to the underlying component */
|
|
29
|
+
className?: string;
|
|
30
|
+
/** The body size variant */
|
|
31
|
+
bodyVariant?: "lg" | "base" | "sm";
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
parentData?: {
|
|
36
|
+
field: string;
|
|
37
|
+
hours?: HoursType;
|
|
38
|
+
comingSoon?: boolean;
|
|
39
|
+
timezone?: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const hoursStatusWrapperFields: YextFields<HoursStatusProps> = {
|
|
44
|
+
data: {
|
|
45
|
+
type: "object",
|
|
46
|
+
label: msg("fields.data", "Data"),
|
|
47
|
+
objectFields: {
|
|
48
|
+
hours: {
|
|
49
|
+
type: "entityField",
|
|
50
|
+
label: msg("fields.hours", "Hours"),
|
|
51
|
+
filter: {
|
|
52
|
+
types: ["type.hours"],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
styles: {
|
|
58
|
+
type: "object",
|
|
59
|
+
label: msg("fields.styles", "Styles"),
|
|
60
|
+
objectFields: {
|
|
61
|
+
showCurrentStatus: {
|
|
62
|
+
label: msg("fields.showCurrentStatus", "Show Current Status"),
|
|
63
|
+
type: "radio",
|
|
64
|
+
options: [
|
|
65
|
+
{ label: msg("fields.options.yes", "Yes"), value: true },
|
|
66
|
+
{ label: msg("fields.options.no", "No"), value: false },
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
timeFormat: {
|
|
70
|
+
label: msg("fields.timeFormat", "Time Format"),
|
|
71
|
+
type: "radio",
|
|
72
|
+
options: [
|
|
73
|
+
{ label: msg("fields.options.hour12", "12-hour"), value: "12h" },
|
|
74
|
+
{ label: msg("fields.options.hour24", "24-hour"), value: "24h" },
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
showDayNames: {
|
|
78
|
+
label: msg("fields.showDayNames", "Show Day Names"),
|
|
79
|
+
type: "radio",
|
|
80
|
+
options: [
|
|
81
|
+
{ label: msg("fields.options.yes", "Yes"), value: true },
|
|
82
|
+
{ label: msg("fields.options.no", "No"), value: false },
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
dayOfWeekFormat: {
|
|
86
|
+
label: msg("fields.dayOfWeekFormat", "Day of Week Format"),
|
|
87
|
+
type: "radio",
|
|
88
|
+
options: [
|
|
89
|
+
{ label: msg("fields.options.short", "Short"), value: "short" },
|
|
90
|
+
{ label: msg("fields.options.long", "Long"), value: "long" },
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const HoursStatusWrapper: PuckComponent<HoursStatusProps> = ({
|
|
98
|
+
data,
|
|
99
|
+
styles,
|
|
100
|
+
puck,
|
|
101
|
+
parentData,
|
|
102
|
+
}) => {
|
|
103
|
+
const streamDocument = useDocument();
|
|
104
|
+
const { i18n } = useTranslation();
|
|
105
|
+
const comingSoon = parentData?.comingSoon ?? !!streamDocument.comingSoon;
|
|
106
|
+
const hours =
|
|
107
|
+
parentData?.hours ??
|
|
108
|
+
resolveComponentData(data.hours, i18n.language, streamDocument);
|
|
109
|
+
const timezone = parentData?.timezone ?? streamDocument.timezone;
|
|
110
|
+
|
|
111
|
+
return hours || comingSoon ? (
|
|
112
|
+
<EntityField
|
|
113
|
+
displayName={parentData ? parentData.field : pt("hours", "Hours")}
|
|
114
|
+
fieldId={data.hours.field}
|
|
115
|
+
constantValueEnabled={!parentData && data.hours.constantValueEnabled}
|
|
116
|
+
>
|
|
117
|
+
<HoursStatusAtom
|
|
118
|
+
hours={hours ?? {}}
|
|
119
|
+
comingSoon={comingSoon}
|
|
120
|
+
timezone={timezone}
|
|
121
|
+
className={styles.className}
|
|
122
|
+
showCurrentStatus={styles.showCurrentStatus}
|
|
123
|
+
showDayNames={styles.showDayNames}
|
|
124
|
+
timeFormat={styles.timeFormat}
|
|
125
|
+
dayOfWeekFormat={styles.dayOfWeekFormat}
|
|
126
|
+
bodyVariant={styles.bodyVariant}
|
|
127
|
+
/>
|
|
128
|
+
</EntityField>
|
|
129
|
+
) : puck.isEditing ? (
|
|
130
|
+
<div className="h-10" />
|
|
131
|
+
) : (
|
|
132
|
+
<></>
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const HoursStatus: YextComponentConfig<HoursStatusProps> = {
|
|
137
|
+
label: msg("components.hoursStatus", "Hours Status"),
|
|
138
|
+
fields: hoursStatusWrapperFields,
|
|
139
|
+
defaultProps: {
|
|
140
|
+
data: {
|
|
141
|
+
hours: {
|
|
142
|
+
field: "hours",
|
|
143
|
+
constantValue: {},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
styles: {
|
|
147
|
+
showCurrentStatus: true,
|
|
148
|
+
timeFormat: "12h",
|
|
149
|
+
showDayNames: true,
|
|
150
|
+
dayOfWeekFormat: "long",
|
|
151
|
+
className: "",
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
resolveFields: (data) =>
|
|
155
|
+
resolveDataFromParent(hoursStatusWrapperFields, data),
|
|
156
|
+
render: (props) => <HoursStatusWrapper {...props} />,
|
|
157
|
+
};
|