@yext/visual-editor 1.4.11 → 2.0.0-beta.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.
Files changed (225) hide show
  1. package/dist/SectionLibraryVisualEditorProvider-fUGYIhyC.js +108668 -0
  2. package/dist/SectionLibraryVisualEditorProvider.css +1 -0
  3. package/dist/cli/assets/directory-locator-source/components/contentBlocks/Address.tsx +251 -0
  4. package/dist/cli/assets/directory-locator-source/components/contentBlocks/HeadingText.tsx +147 -0
  5. package/dist/cli/assets/directory-locator-source/components/contentBlocks/HoursStatus.tsx +157 -0
  6. package/dist/cli/assets/directory-locator-source/components/contentBlocks/HoursTable.tsx +164 -0
  7. package/dist/cli/assets/directory-locator-source/components/contentBlocks/MapboxStaticMap.tsx +205 -0
  8. package/dist/cli/assets/directory-locator-source/components/contentBlocks/Phone.tsx +155 -0
  9. package/dist/cli/assets/directory-locator-source/components/contentBlocks/image/EmptyImageState.tsx +168 -0
  10. package/dist/cli/assets/directory-locator-source/components/contentBlocks/image/Image.tsx +275 -0
  11. package/dist/cli/assets/directory-locator-source/components/contentBlocks/image/styling.ts +66 -0
  12. package/dist/cli/assets/directory-locator-source/components/contentBlocks/index.ts +13 -0
  13. package/dist/cli/assets/directory-locator-source/components/sections/Breadcrumbs.tsx +298 -0
  14. package/dist/cli/assets/directory-locator-source/components/sections/directory/Directory.test.tsx +872 -0
  15. package/dist/cli/assets/directory-locator-source/components/sections/directory/Directory.tsx +260 -0
  16. package/dist/cli/assets/directory-locator-source/components/sections/directory/DirectoryCard.tsx +507 -0
  17. package/dist/cli/assets/directory-locator-source/components/sections/directory/DirectoryWrapper.tsx +491 -0
  18. package/dist/cli/assets/directory-locator-source/components/sections/directory/directoryChildReference.test.tsx +226 -0
  19. package/dist/cli/assets/directory-locator-source/components/sections/directory/directoryChildReference.tsx +98 -0
  20. package/dist/cli/assets/directory-locator-source/components/sections/locator/Filters.test.tsx +147 -0
  21. package/dist/cli/assets/directory-locator-source/components/sections/locator/Filters.tsx +691 -0
  22. package/dist/cli/assets/directory-locator-source/components/sections/locator/Locator.test.tsx +1551 -0
  23. package/dist/cli/assets/directory-locator-source/components/sections/locator/Locator.tsx +541 -0
  24. package/dist/cli/assets/directory-locator-source/components/sections/locator/LocatorFields.test.ts +43 -0
  25. package/dist/cli/assets/directory-locator-source/components/sections/locator/LocatorResultCard.tsx +1594 -0
  26. package/dist/cli/assets/directory-locator-source/components/sections/locator/LocatorWrapper.tsx +1157 -0
  27. package/dist/cli/assets/directory-locator-source/components/sections/locator/Map.tsx +304 -0
  28. package/dist/cli/assets/directory-locator-source/components/sections/locator/MapPinIcon.tsx +160 -0
  29. package/dist/cli/assets/directory-locator-source/components/sections/locator/Results.tsx +267 -0
  30. package/dist/cli/assets/directory-locator-source/sectionLibrarySupport.ts +245 -0
  31. package/dist/cli/yextve.js +16895 -0
  32. package/dist/index.d.ts +542 -6311
  33. package/dist/locales/page/cs/visual-editor.json +85 -0
  34. package/dist/locales/page/da/visual-editor.json +73 -0
  35. package/dist/locales/page/de/visual-editor.json +73 -0
  36. package/dist/locales/page/en/visual-editor.json +73 -0
  37. package/dist/locales/page/en-GB/visual-editor.json +73 -0
  38. package/dist/locales/page/es/visual-editor.json +79 -0
  39. package/dist/locales/page/et/visual-editor.json +73 -0
  40. package/dist/locales/page/fi/visual-editor.json +73 -0
  41. package/dist/locales/page/fr/visual-editor.json +79 -0
  42. package/dist/locales/page/hr/visual-editor.json +79 -0
  43. package/dist/locales/page/hu/visual-editor.json +73 -0
  44. package/dist/locales/page/it/visual-editor.json +79 -0
  45. package/dist/locales/page/ja/visual-editor.json +73 -0
  46. package/dist/locales/page/lt/visual-editor.json +85 -0
  47. package/dist/locales/page/lv/visual-editor.json +77 -0
  48. package/dist/locales/page/nb/visual-editor.json +73 -0
  49. package/dist/locales/page/nl/visual-editor.json +73 -0
  50. package/dist/locales/page/pl/visual-editor.json +85 -0
  51. package/dist/locales/page/pt/visual-editor.json +79 -0
  52. package/dist/locales/page/ro/visual-editor.json +79 -0
  53. package/dist/locales/page/sk/visual-editor.json +85 -0
  54. package/dist/locales/page/sv/visual-editor.json +73 -0
  55. package/dist/locales/page/tr/visual-editor.json +73 -0
  56. package/dist/locales/page/zh/visual-editor.json +73 -0
  57. package/dist/locales/page/zh-TW/visual-editor.json +73 -0
  58. package/dist/locales/platform/cs/visual-editor.json +531 -0
  59. package/dist/locales/platform/da/visual-editor.json +519 -0
  60. package/dist/locales/platform/de/visual-editor.json +519 -0
  61. package/dist/locales/platform/en/visual-editor.json +519 -0
  62. package/dist/locales/platform/en-GB/visual-editor.json +519 -0
  63. package/dist/locales/platform/es/visual-editor.json +525 -0
  64. package/dist/locales/platform/et/visual-editor.json +519 -0
  65. package/dist/locales/platform/fi/visual-editor.json +519 -0
  66. package/dist/locales/platform/fr/visual-editor.json +525 -0
  67. package/dist/locales/platform/hr/visual-editor.json +525 -0
  68. package/dist/locales/platform/hu/visual-editor.json +519 -0
  69. package/dist/locales/platform/it/visual-editor.json +525 -0
  70. package/dist/locales/platform/ja/visual-editor.json +519 -0
  71. package/dist/locales/platform/lt/visual-editor.json +531 -0
  72. package/dist/locales/platform/lv/visual-editor.json +523 -0
  73. package/dist/locales/platform/nb/visual-editor.json +519 -0
  74. package/dist/locales/platform/nl/visual-editor.json +519 -0
  75. package/dist/locales/platform/pl/visual-editor.json +531 -0
  76. package/dist/locales/platform/pt/visual-editor.json +525 -0
  77. package/dist/locales/platform/ro/visual-editor.json +525 -0
  78. package/dist/locales/platform/sk/visual-editor.json +531 -0
  79. package/dist/locales/platform/sv/visual-editor.json +519 -0
  80. package/dist/locales/platform/tr/visual-editor.json +519 -0
  81. package/dist/locales/platform/zh/visual-editor.json +519 -0
  82. package/dist/locales/platform/zh-TW/visual-editor.json +519 -0
  83. package/dist/locatorEntityTypes-s4dmT9l5.d.ts +1850 -0
  84. package/dist/plugin/internal/sectionLibraryValidation/builtInTranslationResources.d.ts +3 -0
  85. package/dist/plugin/internal/sectionLibraryValidation/stages/api/api.d.ts +7 -0
  86. package/dist/plugin/internal/sectionLibraryValidation/stages/api/libraryMetadata.d.ts +7 -0
  87. package/dist/plugin/internal/sectionLibraryValidation/stages/code/importRules.d.ts +13 -0
  88. package/dist/plugin/internal/sectionLibraryValidation/stages/code/validateCode.d.ts +10 -0
  89. package/dist/plugin/internal/sectionLibraryValidation/stages/code/xssRules.d.ts +7 -0
  90. package/dist/plugin/internal/sectionLibraryValidation/stages/structure/structure.d.ts +7 -0
  91. package/dist/plugin/internal/sectionLibraryValidation/types.d.ts +48 -0
  92. package/dist/plugin/internal/sectionLibraryValidation/validateSectionLibrary.d.ts +8 -0
  93. package/dist/plugin/internal/sectionLibraryValidation/validationError.d.ts +6 -0
  94. package/dist/plugin/plugin.js +2233 -5786
  95. package/dist/plugin/types/entityFields.d.ts +21 -0
  96. package/dist/plugin/types/images.d.ts +62 -0
  97. package/dist/plugin/types/sectionLibrary.d.ts +94 -0
  98. package/dist/plugin/types/types.d.ts +204 -0
  99. package/dist/plugin/types/videos.d.ts +24 -0
  100. package/dist/plugin/utils/i18n/locales.d.ts +5 -0
  101. package/dist/plugin/utils/i18n/translationResources.d.ts +41 -0
  102. package/dist/plugin/utils/normalizeLocale.d.ts +8 -0
  103. package/dist/plugin/utils/plainText.d.ts +6 -0
  104. package/dist/plugin/vite-plugin/index.d.ts +2 -0
  105. package/dist/plugin/vite-plugin/local-editor/artifacts.d.ts +18 -0
  106. package/dist/plugin/vite-plugin/local-editor/config.d.ts +11 -0
  107. package/dist/plugin/vite-plugin/local-editor/data.d.ts +10 -0
  108. package/dist/plugin/vite-plugin/local-editor/entityFields.d.ts +13 -0
  109. package/dist/plugin/vite-plugin/local-editor/fixtureData.d.ts +12 -0
  110. package/dist/plugin/vite-plugin/local-editor/generatedFiles.d.ts +34 -0
  111. package/dist/plugin/vite-plugin/local-editor/server.d.ts +18 -0
  112. package/dist/plugin/vite-plugin/local-editor/types.d.ts +109 -0
  113. package/dist/plugin/vite-plugin/local-editor/utils.d.ts +16 -0
  114. package/dist/plugin/vite-plugin/plugin.d.ts +8 -0
  115. package/dist/plugin/vite-plugin/section-library/migrationRegistry.d.ts +6 -0
  116. package/dist/plugin/vite-plugin/section-library/sectionFrontmatter.d.ts +3 -0
  117. package/dist/plugin/vite-plugin/section-library/sectionLibraryGenerator.d.ts +21 -0
  118. package/dist/plugin/vite-plugin/section-library/sharedComponentRegistry.d.ts +16 -0
  119. package/dist/section-library-support.js +158 -0
  120. package/dist/sectionLibrarySupport.d.ts +282 -0
  121. package/dist/style.css +1 -1
  122. package/dist/visual-editor-2Y77HmqL.js +718 -0
  123. package/dist/visual-editor-7P4U2T4q.js +694 -0
  124. package/dist/visual-editor-AXgoU7J5.js +694 -0
  125. package/dist/visual-editor-B-8ROr4n.js +694 -0
  126. package/dist/visual-editor-BDozYwKy.js +702 -0
  127. package/dist/visual-editor-BGMk-qTN.js +718 -0
  128. package/dist/visual-editor-BIqNAAcB.js +718 -0
  129. package/dist/visual-editor-BPI_dyYw.js +694 -0
  130. package/dist/visual-editor-BXYlpe7B.js +145 -0
  131. package/dist/visual-editor-Bkgub-3w.js +694 -0
  132. package/dist/visual-editor-Bo-tmHFc.js +694 -0
  133. package/dist/visual-editor-BuYrclmi.js +706 -0
  134. package/dist/visual-editor-Bxy81Ezy.js +145 -0
  135. package/dist/visual-editor-C0vq2BRM.js +145 -0
  136. package/dist/visual-editor-CCLIvOCf.js +694 -0
  137. package/dist/visual-editor-CCgmYV5S.js +169 -0
  138. package/dist/visual-editor-CE2J5pWp.js +694 -0
  139. package/dist/visual-editor-CERViyTJ.js +145 -0
  140. package/dist/visual-editor-CY2YjlX9.js +706 -0
  141. package/dist/visual-editor-CcuA4NSE.js +694 -0
  142. package/dist/visual-editor-Cd8yeRID.js +718 -0
  143. package/dist/visual-editor-CjORnP1D.js +169 -0
  144. package/dist/visual-editor-CmomGJB8.js +157 -0
  145. package/dist/visual-editor-CpCR_bSp.js +706 -0
  146. package/dist/visual-editor-Cymg8ID2.js +169 -0
  147. package/dist/visual-editor-D2Hk1nhM.js +145 -0
  148. package/dist/visual-editor-D8MRFn5x.js +157 -0
  149. package/dist/visual-editor-D96X4hBl.js +706 -0
  150. package/dist/visual-editor-DOXtCqRv.js +145 -0
  151. package/dist/visual-editor-DQEd3xwY.js +145 -0
  152. package/dist/visual-editor-DUngIOnE.js +157 -0
  153. package/dist/visual-editor-Dd-aD1iL.js +694 -0
  154. package/dist/visual-editor-DeZVZYfd.js +169 -0
  155. package/dist/visual-editor-DfJMZpiP.js +145 -0
  156. package/dist/visual-editor-DgAsQK9D.js +145 -0
  157. package/dist/visual-editor-Dhi__-7_.js +145 -0
  158. package/dist/visual-editor-DjN3MVkl.js +694 -0
  159. package/dist/visual-editor-DjdqpJU-.js +145 -0
  160. package/dist/visual-editor-DqddYaYq.js +694 -0
  161. package/dist/visual-editor-DrCmls4W.js +694 -0
  162. package/dist/visual-editor-DvuH3jyL.js +157 -0
  163. package/dist/visual-editor-TfVDfO5_.js +145 -0
  164. package/dist/visual-editor-VcrEkFyd.js +706 -0
  165. package/dist/visual-editor-W_ZDmMFn.js +145 -0
  166. package/dist/visual-editor-b7ALusk8.js +145 -0
  167. package/dist/visual-editor-bauJ9beX.js +694 -0
  168. package/dist/visual-editor-erGXf3kS.js +157 -0
  169. package/dist/visual-editor-hVELayZs.js +706 -0
  170. package/dist/visual-editor-xnDHZFuO.js +153 -0
  171. package/dist/visual-editor-yiWZqIH0.js +157 -0
  172. package/dist/visual-editor.css +1 -0
  173. package/dist/visual-editor.js +15074 -137463
  174. package/package.json +46 -25
  175. package/dist/editor.css +0 -1
  176. package/dist/visual-editor-1QC8zZX_.js +0 -221
  177. package/dist/visual-editor-5C5XV5rL.js +0 -221
  178. package/dist/visual-editor-B8-FoFxc.js +0 -1049
  179. package/dist/visual-editor-BJgCpnYV.js +0 -1073
  180. package/dist/visual-editor-BKLiin5z.js +0 -1049
  181. package/dist/visual-editor-BWbqw_QE.js +0 -233
  182. package/dist/visual-editor-Bb6upvTE.js +0 -221
  183. package/dist/visual-editor-BcZCBLFh.js +0 -1049
  184. package/dist/visual-editor-BecDYKH8.js +0 -1049
  185. package/dist/visual-editor-BllAUu_T.js +0 -1073
  186. package/dist/visual-editor-BmaYFuCe.js +0 -233
  187. package/dist/visual-editor-BnPFkJlo.js +0 -221
  188. package/dist/visual-editor-BoIXa-xl.js +0 -245
  189. package/dist/visual-editor-BtDJICJp.js +0 -1073
  190. package/dist/visual-editor-BwxWyr_L.js +0 -221
  191. package/dist/visual-editor-Bz7BlR_j.js +0 -221
  192. package/dist/visual-editor-CC0RAmib.js +0 -1049
  193. package/dist/visual-editor-CDY9slY9.js +0 -1061
  194. package/dist/visual-editor-CFebs6R8.js +0 -1049
  195. package/dist/visual-editor-CNL0HyVh.js +0 -1049
  196. package/dist/visual-editor-CYnzwNwX.js +0 -229
  197. package/dist/visual-editor-CZH605TK.js +0 -233
  198. package/dist/visual-editor-Cada46ZF.js +0 -1049
  199. package/dist/visual-editor-CheComxC.js +0 -1061
  200. package/dist/visual-editor-CuA8h_Xv.js +0 -221
  201. package/dist/visual-editor-CuRmgs-p.js +0 -245
  202. package/dist/visual-editor-D9_YWQQY.js +0 -1073
  203. package/dist/visual-editor-D9w4wRG8.js +0 -245
  204. package/dist/visual-editor-D9xTiOC0.js +0 -221
  205. package/dist/visual-editor-DA7CixSl.js +0 -1061
  206. package/dist/visual-editor-DAnBQ9H_.js +0 -221
  207. package/dist/visual-editor-DF8RsMvq.js +0 -233
  208. package/dist/visual-editor-DLrKYx7j.js +0 -1061
  209. package/dist/visual-editor-DQJc_Xok.js +0 -233
  210. package/dist/visual-editor-DTZFGKm7.js +0 -221
  211. package/dist/visual-editor-DXebihTA.js +0 -233
  212. package/dist/visual-editor-DZ4U1fk-.js +0 -221
  213. package/dist/visual-editor-Dg7P-vDv.js +0 -1057
  214. package/dist/visual-editor-Dh2cuwWt.js +0 -1049
  215. package/dist/visual-editor-DpetyO9o.js +0 -1049
  216. package/dist/visual-editor-Duav2tXb.js +0 -1061
  217. package/dist/visual-editor-DvYsu_s9.js +0 -221
  218. package/dist/visual-editor-DwlX3nnZ.js +0 -221
  219. package/dist/visual-editor-Dz5s66Og.js +0 -221
  220. package/dist/visual-editor-E57fPJMD.js +0 -1049
  221. package/dist/visual-editor-Fy_uEJju.js +0 -1061
  222. package/dist/visual-editor-G8e2TllW.js +0 -1049
  223. package/dist/visual-editor-HkfpXRw7.js +0 -1049
  224. package/dist/visual-editor-ZKG4e_Ey.js +0 -1049
  225. package/dist/visual-editor-rZRnDwgU.js +0 -245
@@ -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-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
+ };