@eightshift/frontend-libs-tailwind 1.0.0

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 (275) hide show
  1. package/.gitattributes +37 -0
  2. package/.github/CODEOWNERS +1 -0
  3. package/.github/CONTRIBUTING.md +17 -0
  4. package/.github/ISSUE_TEMPLATE/bug_report.md +10 -0
  5. package/.github/ISSUE_TEMPLATE/feature_request.md +10 -0
  6. package/.github/ISSUE_TEMPLATE/question.md +10 -0
  7. package/.github/PULL_REQUEST_TEMPLATE.md +11 -0
  8. package/.github/workflows/ci.yml +31 -0
  9. package/.husky/pre-commit +1 -0
  10. package/.prettierrc +14 -0
  11. package/.stylelintrc +4 -0
  12. package/CHANGELOG.md +13 -0
  13. package/CODE_OF_CONDUCT.md +76 -0
  14. package/LICENSE +21 -0
  15. package/README.md +24 -0
  16. package/blocks/init/assets/application-admin.js +10 -0
  17. package/blocks/init/assets/application.js +13 -0
  18. package/blocks/init/assets/images/index.js +5 -0
  19. package/blocks/init/assets/scripts/application-admin.js +7 -0
  20. package/blocks/init/assets/scripts/application.js +3 -0
  21. package/blocks/init/assets/scripts/theme-colors.js +39 -0
  22. package/blocks/init/assets/styles/application-admin.css +6 -0
  23. package/blocks/init/assets/styles/application.css +3 -0
  24. package/blocks/init/src/Blocks/assets/application-blocks-editor.js +14 -0
  25. package/blocks/init/src/Blocks/assets/application-blocks-frontend.js +13 -0
  26. package/blocks/init/src/Blocks/assets/application-blocks.js +9 -0
  27. package/blocks/init/src/Blocks/assets/scripts/application-blocks-editor.js +65 -0
  28. package/blocks/init/src/Blocks/assets/scripts/application-blocks-frontend.js +24 -0
  29. package/blocks/init/src/Blocks/assets/scripts/link-section-editor.js +258 -0
  30. package/blocks/init/src/Blocks/assets/scripts/shared.js +25 -0
  31. package/blocks/init/src/Blocks/assets/styles/application-blocks-editor.css +15 -0
  32. package/blocks/init/src/Blocks/assets/styles/application-blocks-frontend.css +12 -0
  33. package/blocks/init/src/Blocks/assets/styles/application-blocks.css +0 -0
  34. package/blocks/init/src/Blocks/assets/styles/editor/editor-overrides.css +15 -0
  35. package/blocks/init/src/Blocks/assets/styles/tailwind.css +34 -0
  36. package/blocks/init/src/Blocks/components/admin-theme-options/admin-theme-options.php +20 -0
  37. package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/index.js +36 -0
  38. package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/pages/parts.js +55 -0
  39. package/blocks/init/src/Blocks/components/admin-theme-options/manifest.json +5 -0
  40. package/blocks/init/src/Blocks/components/button/assets/index.js +22 -0
  41. package/blocks/init/src/Blocks/components/button/button.php +77 -0
  42. package/blocks/init/src/Blocks/components/button/components/button-editor.js +40 -0
  43. package/blocks/init/src/Blocks/components/button/components/button-options.js +135 -0
  44. package/blocks/init/src/Blocks/components/button/manifest.json +299 -0
  45. package/blocks/init/src/Blocks/components/card/card.php +42 -0
  46. package/blocks/init/src/Blocks/components/card/components/card-editor.js +39 -0
  47. package/blocks/init/src/Blocks/components/card/components/card-options.js +56 -0
  48. package/blocks/init/src/Blocks/components/card/manifest.json +111 -0
  49. package/blocks/init/src/Blocks/components/head/head.php +52 -0
  50. package/blocks/init/src/Blocks/components/head/manifest.json +17 -0
  51. package/blocks/init/src/Blocks/components/heading/components/heading-editor.js +30 -0
  52. package/blocks/init/src/Blocks/components/heading/components/heading-options.js +62 -0
  53. package/blocks/init/src/Blocks/components/heading/heading.php +45 -0
  54. package/blocks/init/src/Blocks/components/heading/manifest.json +76 -0
  55. package/blocks/init/src/Blocks/components/hero/components/hero-editor.js +42 -0
  56. package/blocks/init/src/Blocks/components/hero/components/hero-options.js +100 -0
  57. package/blocks/init/src/Blocks/components/hero/hero.php +45 -0
  58. package/blocks/init/src/Blocks/components/hero/manifest.json +96 -0
  59. package/blocks/init/src/Blocks/components/icon/components/icon-editor.js +23 -0
  60. package/blocks/init/src/Blocks/components/icon/components/icon-options.js +65 -0
  61. package/blocks/init/src/Blocks/components/icon/icon.php +34 -0
  62. package/blocks/init/src/Blocks/components/icon/manifest.json +1234 -0
  63. package/blocks/init/src/Blocks/components/image/components/image-editor.js +65 -0
  64. package/blocks/init/src/Blocks/components/image/components/image-options.js +111 -0
  65. package/blocks/init/src/Blocks/components/image/image.php +62 -0
  66. package/blocks/init/src/Blocks/components/image/manifest.json +125 -0
  67. package/blocks/init/src/Blocks/components/list/components/list-editor.js +30 -0
  68. package/blocks/init/src/Blocks/components/list/components/list-options.js +62 -0
  69. package/blocks/init/src/Blocks/components/list/list.php +32 -0
  70. package/blocks/init/src/Blocks/components/list/manifest.json +127 -0
  71. package/blocks/init/src/Blocks/components/load-more/assets/index.js +19 -0
  72. package/blocks/init/src/Blocks/components/load-more/assets/load-more.js +147 -0
  73. package/blocks/init/src/Blocks/components/load-more/components/load-more-editor.js +14 -0
  74. package/blocks/init/src/Blocks/components/load-more/components/load-more-options.js +18 -0
  75. package/blocks/init/src/Blocks/components/load-more/load-more.php +47 -0
  76. package/blocks/init/src/Blocks/components/load-more/manifest.json +39 -0
  77. package/blocks/init/src/Blocks/components/modal/assets/index.js +27 -0
  78. package/blocks/init/src/Blocks/components/modal/manifest.json +48 -0
  79. package/blocks/init/src/Blocks/components/modal/modal.php +46 -0
  80. package/blocks/init/src/Blocks/components/paragraph/components/paragraph-editor.js +40 -0
  81. package/blocks/init/src/Blocks/components/paragraph/components/paragraph-options.js +48 -0
  82. package/blocks/init/src/Blocks/components/paragraph/manifest.json +83 -0
  83. package/blocks/init/src/Blocks/components/paragraph/paragraph.php +33 -0
  84. package/blocks/init/src/Blocks/components/post-header/manifest.json +5 -0
  85. package/blocks/init/src/Blocks/components/post-header/post-header.php +24 -0
  86. package/blocks/init/src/Blocks/components/quote/components/quote-editor.js +53 -0
  87. package/blocks/init/src/Blocks/components/quote/components/quote-options.js +29 -0
  88. package/blocks/init/src/Blocks/components/quote/manifest.json +47 -0
  89. package/blocks/init/src/Blocks/components/quote/quote.php +49 -0
  90. package/blocks/init/src/Blocks/components/share/assets/index.js +39 -0
  91. package/blocks/init/src/Blocks/components/share/components/share-editor.js +25 -0
  92. package/blocks/init/src/Blocks/components/share/components/share-options.js +112 -0
  93. package/blocks/init/src/Blocks/components/share/manifest.json +72 -0
  94. package/blocks/init/src/Blocks/components/share/share.php +66 -0
  95. package/blocks/init/src/Blocks/components/tracking-before-body-end/manifest.json +5 -0
  96. package/blocks/init/src/Blocks/components/tracking-before-body-end/tracking-before-body-end.php +9 -0
  97. package/blocks/init/src/Blocks/components/tracking-head/manifest.json +5 -0
  98. package/blocks/init/src/Blocks/components/tracking-head/tracking-head.php +9 -0
  99. package/blocks/init/src/Blocks/components/video/components/video-editor.js +74 -0
  100. package/blocks/init/src/Blocks/components/video/components/video-options.js +280 -0
  101. package/blocks/init/src/Blocks/components/video/manifest.json +116 -0
  102. package/blocks/init/src/Blocks/components/video/video.php +72 -0
  103. package/blocks/init/src/Blocks/custom/accordion/accordion-block.js +15 -0
  104. package/blocks/init/src/Blocks/custom/accordion/accordion.php +28 -0
  105. package/blocks/init/src/Blocks/custom/accordion/assets/index.js +37 -0
  106. package/blocks/init/src/Blocks/custom/accordion/components/accordion-editor.js +17 -0
  107. package/blocks/init/src/Blocks/custom/accordion/components/accordion-options.js +18 -0
  108. package/blocks/init/src/Blocks/custom/accordion/manifest.json +32 -0
  109. package/blocks/init/src/Blocks/custom/accordion-item/accordion-item-block.js +19 -0
  110. package/blocks/init/src/Blocks/custom/accordion-item/accordion-item.php +46 -0
  111. package/blocks/init/src/Blocks/custom/accordion-item/components/accordion-item-editor.js +60 -0
  112. package/blocks/init/src/Blocks/custom/accordion-item/manifest.json +69 -0
  113. package/blocks/init/src/Blocks/custom/button/button-block.js +13 -0
  114. package/blocks/init/src/Blocks/custom/button/button.php +11 -0
  115. package/blocks/init/src/Blocks/custom/button/components/button-editor.js +12 -0
  116. package/blocks/init/src/Blocks/custom/button/components/button-options.js +12 -0
  117. package/blocks/init/src/Blocks/custom/button/manifest.json +18 -0
  118. package/blocks/init/src/Blocks/custom/card/card-block.js +13 -0
  119. package/blocks/init/src/Blocks/custom/card/card.php +11 -0
  120. package/blocks/init/src/Blocks/custom/card/components/card-editor.js +12 -0
  121. package/blocks/init/src/Blocks/custom/card/components/card-options.js +15 -0
  122. package/blocks/init/src/Blocks/custom/card/manifest.json +18 -0
  123. package/blocks/init/src/Blocks/custom/carousel/assets/index.js +46 -0
  124. package/blocks/init/src/Blocks/custom/carousel/assets/navigation.js +31 -0
  125. package/blocks/init/src/Blocks/custom/carousel/assets/pagination.js +39 -0
  126. package/blocks/init/src/Blocks/custom/carousel/carousel-block.js +21 -0
  127. package/blocks/init/src/Blocks/custom/carousel/carousel.php +61 -0
  128. package/blocks/init/src/Blocks/custom/carousel/components/carousel-editor.js +25 -0
  129. package/blocks/init/src/Blocks/custom/carousel/components/carousel-options.js +47 -0
  130. package/blocks/init/src/Blocks/custom/carousel/manifest.json +130 -0
  131. package/blocks/init/src/Blocks/custom/column/column-block.js +21 -0
  132. package/blocks/init/src/Blocks/custom/column/column-hooks.js +32 -0
  133. package/blocks/init/src/Blocks/custom/column/column.php +21 -0
  134. package/blocks/init/src/Blocks/custom/column/components/column-editor.js +19 -0
  135. package/blocks/init/src/Blocks/custom/column/components/column-options.js +579 -0
  136. package/blocks/init/src/Blocks/custom/column/manifest.json +625 -0
  137. package/blocks/init/src/Blocks/custom/columns/columns-block.js +20 -0
  138. package/blocks/init/src/Blocks/custom/columns/columns.php +21 -0
  139. package/blocks/init/src/Blocks/custom/columns/components/columns-editor.js +81 -0
  140. package/blocks/init/src/Blocks/custom/columns/components/columns-options.js +104 -0
  141. package/blocks/init/src/Blocks/custom/columns/manifest.json +555 -0
  142. package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-editor.js +28 -0
  143. package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-options.js +239 -0
  144. package/blocks/init/src/Blocks/custom/featured-content/featured-content-block.js +13 -0
  145. package/blocks/init/src/Blocks/custom/featured-content/featured-content.php +139 -0
  146. package/blocks/init/src/Blocks/custom/featured-content/manifest.json +131 -0
  147. package/blocks/init/src/Blocks/custom/featured-content/partials/cards.php +39 -0
  148. package/blocks/init/src/Blocks/custom/group/components/group-editor.js +8 -0
  149. package/blocks/init/src/Blocks/custom/group/group-block.js +14 -0
  150. package/blocks/init/src/Blocks/custom/group/group.php +10 -0
  151. package/blocks/init/src/Blocks/custom/group/manifest.json +32 -0
  152. package/blocks/init/src/Blocks/custom/heading/components/heading-editor.js +15 -0
  153. package/blocks/init/src/Blocks/custom/heading/components/heading-options.js +38 -0
  154. package/blocks/init/src/Blocks/custom/heading/heading-block.js +13 -0
  155. package/blocks/init/src/Blocks/custom/heading/heading-transforms.js +25 -0
  156. package/blocks/init/src/Blocks/custom/heading/heading.php +15 -0
  157. package/blocks/init/src/Blocks/custom/heading/manifest.json +79 -0
  158. package/blocks/init/src/Blocks/custom/hero/components/hero-editor.js +12 -0
  159. package/blocks/init/src/Blocks/custom/hero/components/hero-options.js +14 -0
  160. package/blocks/init/src/Blocks/custom/hero/hero-block.js +13 -0
  161. package/blocks/init/src/Blocks/custom/hero/hero.php +11 -0
  162. package/blocks/init/src/Blocks/custom/hero/manifest.json +17 -0
  163. package/blocks/init/src/Blocks/custom/image/components/image-editor.js +12 -0
  164. package/blocks/init/src/Blocks/custom/image/components/image-options.js +14 -0
  165. package/blocks/init/src/Blocks/custom/image/image-block.js +13 -0
  166. package/blocks/init/src/Blocks/custom/image/image.php +11 -0
  167. package/blocks/init/src/Blocks/custom/image/manifest.json +105 -0
  168. package/blocks/init/src/Blocks/custom/list/components/list-editor.js +14 -0
  169. package/blocks/init/src/Blocks/custom/list/components/list-options.js +39 -0
  170. package/blocks/init/src/Blocks/custom/list/list-block.js +13 -0
  171. package/blocks/init/src/Blocks/custom/list/list.php +15 -0
  172. package/blocks/init/src/Blocks/custom/list/manifest.json +58 -0
  173. package/blocks/init/src/Blocks/custom/map/assets/index.js +20 -0
  174. package/blocks/init/src/Blocks/custom/map/assets/map-controller.js +42 -0
  175. package/blocks/init/src/Blocks/custom/map/assets/utils.js +161 -0
  176. package/blocks/init/src/Blocks/custom/map/components/map-components.js +403 -0
  177. package/blocks/init/src/Blocks/custom/map/components/map-editor.js +56 -0
  178. package/blocks/init/src/Blocks/custom/map/components/map-options.js +557 -0
  179. package/blocks/init/src/Blocks/custom/map/manifest.json +79 -0
  180. package/blocks/init/src/Blocks/custom/map/map-block.js +13 -0
  181. package/blocks/init/src/Blocks/custom/map/map.php +52 -0
  182. package/blocks/init/src/Blocks/custom/map/styles.css +2 -0
  183. package/blocks/init/src/Blocks/custom/modal/components/modal-editor.js +90 -0
  184. package/blocks/init/src/Blocks/custom/modal/manifest.json +51 -0
  185. package/blocks/init/src/Blocks/custom/modal/modal-block.js +14 -0
  186. package/blocks/init/src/Blocks/custom/modal/modal.php +20 -0
  187. package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-editor.js +41 -0
  188. package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-options.js +38 -0
  189. package/blocks/init/src/Blocks/custom/paragraph/manifest.json +79 -0
  190. package/blocks/init/src/Blocks/custom/paragraph/paragraph-block.js +13 -0
  191. package/blocks/init/src/Blocks/custom/paragraph/paragraph-transforms.js +45 -0
  192. package/blocks/init/src/Blocks/custom/paragraph/paragraph.php +15 -0
  193. package/blocks/init/src/Blocks/custom/quote/components/quote-editor.js +12 -0
  194. package/blocks/init/src/Blocks/custom/quote/components/quote-options.js +14 -0
  195. package/blocks/init/src/Blocks/custom/quote/manifest.json +17 -0
  196. package/blocks/init/src/Blocks/custom/quote/quote-block.js +13 -0
  197. package/blocks/init/src/Blocks/custom/quote/quote.php +13 -0
  198. package/blocks/init/src/Blocks/custom/share/components/share-editor.js +6 -0
  199. package/blocks/init/src/Blocks/custom/share/components/share-options.js +12 -0
  200. package/blocks/init/src/Blocks/custom/share/manifest.json +19 -0
  201. package/blocks/init/src/Blocks/custom/share/share-block.js +13 -0
  202. package/blocks/init/src/Blocks/custom/share/share.php +11 -0
  203. package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-editor.js +57 -0
  204. package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-options.js +106 -0
  205. package/blocks/init/src/Blocks/custom/site-footer/manifest.json +73 -0
  206. package/blocks/init/src/Blocks/custom/site-footer/site-footer-block.js +13 -0
  207. package/blocks/init/src/Blocks/custom/site-footer/site-footer.php +72 -0
  208. package/blocks/init/src/Blocks/custom/site-navigation/assets/index.js +9 -0
  209. package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-editor.js +42 -0
  210. package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-options.js +73 -0
  211. package/blocks/init/src/Blocks/custom/site-navigation/manifest.json +77 -0
  212. package/blocks/init/src/Blocks/custom/site-navigation/site-navigation-block.js +13 -0
  213. package/blocks/init/src/Blocks/custom/site-navigation/site-navigation.php +99 -0
  214. package/blocks/init/src/Blocks/custom/table-of-contents/assets/index.js +58 -0
  215. package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-editor.js +38 -0
  216. package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-options.js +32 -0
  217. package/blocks/init/src/Blocks/custom/table-of-contents/manifest.json +48 -0
  218. package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents-block.js +13 -0
  219. package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents.php +31 -0
  220. package/blocks/init/src/Blocks/custom/video/components/video-editor.js +6 -0
  221. package/blocks/init/src/Blocks/custom/video/components/video-options.js +12 -0
  222. package/blocks/init/src/Blocks/custom/video/manifest.json +105 -0
  223. package/blocks/init/src/Blocks/custom/video/video-block.js +13 -0
  224. package/blocks/init/src/Blocks/custom/video/video.php +22 -0
  225. package/blocks/init/src/Blocks/manifest.json +14 -0
  226. package/blocks/init/src/Blocks/variations/card-simple/manifest.json +17 -0
  227. package/blocks/init/src/Blocks/wrapper/components/wrapper-editor.js +12 -0
  228. package/blocks/init/src/Blocks/wrapper/components/wrapper-options.js +348 -0
  229. package/blocks/init/src/Blocks/wrapper/manifest.json +450 -0
  230. package/blocks/init/src/Blocks/wrapper/styles-editor.css +13 -0
  231. package/blocks/init/src/Blocks/wrapper/styles.css +19 -0
  232. package/blocks/init/src/Blocks/wrapper/wrapper.js +30 -0
  233. package/blocks/init/src/Blocks/wrapper/wrapper.php +34 -0
  234. package/eslint.config.mjs +3 -0
  235. package/linters/base.config.mjs +81 -0
  236. package/linters/eslint.config.mjs +4 -0
  237. package/linters/ignore-gitignored.mjs +9 -0
  238. package/linters/stylelint.config.js +146 -0
  239. package/package.json +93 -0
  240. package/readme/packages.md +74 -0
  241. package/schemas/block.json +302 -0
  242. package/schemas/component.json +240 -0
  243. package/schemas/globalManifest.json +73 -0
  244. package/schemas/variation.json +83 -0
  245. package/scripts/components/block-inserter.js +70 -0
  246. package/scripts/components/file-picker.js +243 -0
  247. package/scripts/components/index.js +6 -0
  248. package/scripts/components/link-section-editor.js +319 -0
  249. package/scripts/components/media-picker.js +86 -0
  250. package/scripts/components/server-side-render.js +37 -0
  251. package/scripts/components/settings/settings.js +48 -0
  252. package/scripts/components/settings/use-theme-options.js +52 -0
  253. package/scripts/editor/attributes.js +304 -0
  254. package/scripts/editor/colors.js +64 -0
  255. package/scripts/editor/editor.js +139 -0
  256. package/scripts/editor/fetch.js +102 -0
  257. package/scripts/editor/hooks.js +44 -0
  258. package/scripts/editor/index.js +11 -0
  259. package/scripts/editor/options.js +152 -0
  260. package/scripts/editor/registration.js +901 -0
  261. package/scripts/editor/store.js +213 -0
  262. package/scripts/editor/tailwindcss.js +224 -0
  263. package/scripts/editor/utility.js +47 -0
  264. package/scripts/helpers/breakpoints.js +48 -0
  265. package/scripts/helpers/cookies.js +65 -0
  266. package/scripts/helpers/dynamic-import.js +19 -0
  267. package/scripts/helpers/index.js +11 -0
  268. package/scripts/index.js +22 -0
  269. package/scripts/plugins/index.js +3 -0
  270. package/scripts/plugins/yoast-seo.js +70 -0
  271. package/webpack/base.mjs +138 -0
  272. package/webpack/helpers.mjs +67 -0
  273. package/webpack/index.mjs +52 -0
  274. package/webpack/production.mjs +60 -0
  275. package/webpack/project.mjs +55 -0
@@ -0,0 +1,29 @@
1
+ import { __ } from '@wordpress/i18n';
2
+ import { checkAttr, getAttrKey } from '@eightshift/frontend-libs-tailwind/scripts';
3
+ import { ComponentToggle, Toggle } from '@eightshift/ui-components';
4
+ import { icons, JsxSvg } from '@eightshift/ui-components/icons';
5
+ import manifest from './../manifest.json';
6
+
7
+ export const QuoteOptions = (attributes) => {
8
+ const { setAttributes, ...rest } = attributes;
9
+
10
+ const quoteUse = checkAttr('quoteUse', attributes, manifest);
11
+ const quoteShowIcon = checkAttr('quoteShowIcon', attributes, manifest);
12
+
13
+ return (
14
+ <ComponentToggle
15
+ label={manifest.title}
16
+ icon={icons.paragraph}
17
+ onChange={(value) => setAttributes({ [getAttrKey('quoteUse', attributes, manifest)]: value })}
18
+ useComponent={quoteUse}
19
+ {...rest}
20
+ >
21
+ <Toggle
22
+ icon={<JsxSvg svg={manifest.resources.quoteIcon} />}
23
+ label={__('Icon', '%g_textdomain%')}
24
+ checked={quoteShowIcon}
25
+ onChange={(value) => setAttributes({ [getAttrKey('quoteShowIcon', attributes, manifest)]: value })}
26
+ />
27
+ </ComponentToggle>
28
+ );
29
+ };
@@ -0,0 +1,47 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
3
+ "componentName": "quote",
4
+ "title": "Quote",
5
+ "componentClass": "quote",
6
+ "example": {
7
+ "attributes": {
8
+ "quoteUse": true
9
+ }
10
+ },
11
+ "attributes": {
12
+ "quoteUse": {
13
+ "type": "boolean",
14
+ "default": true
15
+ },
16
+ "quoteShowIcon": {
17
+ "type": "boolean",
18
+ "default": "true"
19
+ },
20
+ "quoteText": {
21
+ "type": "string"
22
+ },
23
+ "quoteAuthor": {
24
+ "type": "string"
25
+ }
26
+ },
27
+ "resources": {
28
+ "quoteIcon": "<svg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36' fill='none'><path d='M27.058 17.98c-2.467 0-4.343-.569-5.628-1.705-1.259-1.162-1.888-2.698-1.888-4.61 0-2.117.77-3.834 2.312-5.15C23.396 5.17 25.246 4.5 27.404 4.5c2.493 0 4.549.84 6.168 2.518C35.19 8.696 36 11.188 36 14.493c0 2.944-.527 5.578-1.58 7.902-1.054 2.298-2.519 4.21-4.394 5.733-1.85 1.523-3.983 2.582-6.399 3.176-.925.232-1.657.258-2.197.077-.514-.206-.848-.568-1.002-1.084-.128-.49-.038-.956.27-1.395.334-.439.964-.826 1.889-1.162 1.721-.62 3.135-1.394 4.24-2.324 1.13-.93 1.965-1.91 2.505-2.943.565-1.06.848-2.027.848-2.905 0-.491-.142-.879-.424-1.163-.257-.284-.745-.426-1.465-.426h-1.233Zm-19.58.038c-2.467 0-4.33-.568-5.59-1.704C.63 15.152 0 13.602 0 11.666 0 9.548.758 7.83 2.274 6.514 3.816 5.171 5.666 4.5 7.824 4.5c2.519 0 4.574.84 6.167 2.518 1.62 1.678 2.429 4.17 2.429 7.475 0 2.944-.527 5.578-1.58 7.902-1.054 2.324-2.506 4.248-4.356 5.771-1.85 1.524-3.983 2.57-6.398 3.138-.951.232-1.683.258-2.197.077-.514-.206-.848-.568-1.002-1.084-.129-.465-.039-.917.27-1.356.333-.465.95-.865 1.85-1.2 1.721-.62 3.134-1.395 4.24-2.325 1.13-.93 1.965-1.91 2.505-2.943.565-1.033.848-2.002.848-2.905 0-.491-.142-.866-.424-1.124-.257-.284-.746-.426-1.465-.426H7.478Z' fill='currentColor'/></svg>"
29
+ },
30
+ "tailwind": {
31
+ "parts": {
32
+ "container": {
33
+ "twClasses": "pl-7 py-5 border-l-4 border-l-gray-300"
34
+ },
35
+ "quote-text": {
36
+ "twClasses": "text-gray-900 font-display ~text-4xl/6xl !leading-none italic text-balance max-w-prose tracking-tight"
37
+ },
38
+ "author": {
39
+ "twClasses": "font-sans text-sm text-gray-500 mt-4 font-light",
40
+ "twClassesEditor": "inline-flex gap-1 font-sans text-sm text-gray-500 mt-2 font-light"
41
+ },
42
+ "icon": {
43
+ "twClasses": "ml-1 ~mb-3/4 pointer-events-none text-gray-400 size-6"
44
+ }
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,49 @@
1
+ <?php
2
+
3
+ /**
4
+ * Quote component template.
5
+ *
6
+ * @package %g_namespace%
7
+ */
8
+
9
+ use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
10
+
11
+ $manifest = Helpers::getManifestByDir(__DIR__);
12
+ $additionalClass = $attributes['additionalClass'] ?? '';
13
+
14
+ $quoteUse = Helpers::checkAttr('quoteUse', $attributes, $manifest);
15
+
16
+ if (!$quoteUse) {
17
+ return;
18
+ }
19
+
20
+ $quoteText = Helpers::checkAttr('quoteText', $attributes, $manifest);
21
+ $quoteAuthor = Helpers::checkAttr('quoteAuthor', $attributes, $manifest);
22
+ $quoteShowIcon = Helpers::checkAttr('quoteShowIcon', $attributes, $manifest);
23
+
24
+ $iconClass = Helpers::getTwPart('icon', $manifest);
25
+
26
+ $icon = $manifest['resources']['quoteIcon'];
27
+ $icon = str_replace('<svg', '<svg class="' . $iconClass . '"', $icon);
28
+ $icon = str_replace('<svg', '<svg aria-hidden="true"', $icon);
29
+ ?>
30
+
31
+ <figure class="<?php echo esc_attr(Helpers::getTwPart('container', $manifest, $additionalClass)); ?>">
32
+ <?php
33
+ if ($quoteShowIcon) {
34
+ // phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
35
+ echo $icon;
36
+ }
37
+ ?>
38
+
39
+ <blockquote class="<?php echo esc_attr(Helpers::getTwPart('quote-text', $manifest)); ?>">
40
+ <?php echo wp_kses_post($quoteText); ?>
41
+ </blockquote>
42
+
43
+ <?php if (!empty($quoteAuthor)) { ?>
44
+ <figcaption class="<?php echo esc_attr(Helpers::getTwPart('author', $manifest)); ?>">
45
+ &mdash;
46
+ <?php echo wp_kses_post($quoteAuthor); ?>
47
+ </figcaption>
48
+ <?php } ?>
49
+ </figure>
@@ -0,0 +1,39 @@
1
+ import domReady from '@wordpress/dom-ready';
2
+ import manifest from '../manifest.json';
3
+
4
+ domReady(async () => {
5
+ const shareTargets = document.querySelectorAll(`.${manifest.componentJsClass}`);
6
+
7
+ if (shareTargets.length < 1) {
8
+ return;
9
+ }
10
+
11
+ const openShareDialog = async ({ shareUrl, pageUrl, pageTitle }) => {
12
+ const navigatorShareData = {
13
+ title: pageTitle,
14
+ url: pageUrl,
15
+ };
16
+
17
+ if ('share' in navigator && navigator?.canShare(navigatorShareData)) {
18
+ await navigator?.share(navigatorShareData);
19
+ } else {
20
+ window.open(
21
+ shareUrl,
22
+ 'share-post',
23
+ 'height=600,width=800,left=0,top=0,location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1'
24
+ );
25
+ }
26
+ };
27
+
28
+ shareTargets.forEach((element) => {
29
+ element.querySelectorAll(`.${manifest.componentJsClass}-link`).forEach((link) => {
30
+ link.addEventListener('click', () => {
31
+ openShareDialog({
32
+ shareUrl: link?.dataset?.shareUrl ?? '',
33
+ pageUrl: link?.dataset?.pageUrl ?? '',
34
+ pageTitle: link?.dataset?.pageTitle ?? '',
35
+ });
36
+ });
37
+ });
38
+ });
39
+ });
@@ -0,0 +1,25 @@
1
+ import { checkAttr, classnames, getAttrKey, getTwPart } from '@eightshift/frontend-libs-tailwind/scripts';
2
+ import { JsxSvg } from '@eightshift/ui-components/icons';
3
+ import manifest from '../manifest.json';
4
+
5
+ export const ShareEditor = (attributes) => {
6
+ const {
7
+ additionalClass,
8
+ } = attributes;
9
+
10
+ const shareUse = checkAttr('shareUse', attributes, manifest);
11
+
12
+ if (!shareUse) {
13
+ return null;
14
+ }
15
+
16
+ const shareTargets = checkAttr('shareTargets', attributes, manifest);
17
+
18
+ return (
19
+ <div className={getTwPart('container', manifest, additionalClass)}>
20
+ {shareTargets.map((network) => {
21
+ return <JsxSvg className={getTwPart('icon', manifest)} svg={manifest?.networks?.[network]?.icon} />;
22
+ })}
23
+ </div>
24
+ );
25
+ };
@@ -0,0 +1,112 @@
1
+ import { __ } from '@wordpress/i18n';
2
+ import { checkAttr, getAttrKey, getHiddenOptions } from '@eightshift/frontend-libs-tailwind/scripts';
3
+ import manifest from '../manifest.json';
4
+ import {
5
+ ComponentToggle,
6
+ OptionSelect,
7
+ DraggableList,
8
+ DraggableListItem,
9
+ Spacer,
10
+ Switch,
11
+ } from '@eightshift/ui-components';
12
+ import { icons, JsxSvg } from '@eightshift/ui-components/icons';
13
+
14
+ export const ShareOptions = (attributes) => {
15
+ const { hideOptions, setAttributes, ...rest } = attributes;
16
+
17
+ const hiddenOptions = getHiddenOptions(hideOptions);
18
+
19
+ const shareUse = checkAttr('shareUse', attributes, manifest);
20
+
21
+ const shareTargets = checkAttr('shareTargets', attributes, manifest);
22
+ const shareMode = checkAttr('shareMode', attributes, manifest);
23
+
24
+ const networksToShow = Object.entries(manifest.networks).reduce((current, [name, info]) => {
25
+ if (shareMode === 'share' && !info?.shareUrl) {
26
+ return current;
27
+ }
28
+
29
+ return [...current, { name: name, enabled: shareTargets.includes(name), ...info }];
30
+ }, []);
31
+
32
+ const modeOptions = [
33
+ {
34
+ label: __('Link to social networks', '%g_textdomain%'),
35
+ icon: icons.link,
36
+ value: 'links',
37
+ },
38
+ {
39
+ label: __('Share the current URL', '%g_textdomain%'),
40
+ subtitle: __('Unavailable for some networks', '%g_textdomain%'),
41
+ icon: icons.share,
42
+ value: 'share',
43
+ },
44
+ ];
45
+
46
+ const pickerSectionTitle = shareMode
47
+ ? __('Share targets', '%g_textdomain%')
48
+ : __('Social networks', '%g_textdomain%');
49
+
50
+ return (
51
+ <ComponentToggle
52
+ label={manifest.title}
53
+ icon={icons.share}
54
+ onChange={(value) => setAttributes({ [getAttrKey('shareUse', attributes, manifest)]: value })}
55
+ useComponent={shareUse}
56
+ {...rest}
57
+ >
58
+ <OptionSelect
59
+ aria-label={__('Share mode', '%g_textdomain%')}
60
+ value={shareMode}
61
+ options={modeOptions}
62
+ onChange={(value) =>
63
+ setAttributes({
64
+ [getAttrKey('shareMode', attributes, manifest)]: value,
65
+ })
66
+ }
67
+ type='radiosSegmented'
68
+ hidden={hiddenOptions?.mode}
69
+ vertical
70
+ />
71
+
72
+ <Spacer />
73
+
74
+ <DraggableList
75
+ icon={icons.globe}
76
+ label={pickerSectionTitle}
77
+ items={networksToShow}
78
+ onChange={(value) => {
79
+ const newValue = value.reduce((current, { name, enabled }) => {
80
+ if (!enabled) {
81
+ return current;
82
+ }
83
+
84
+ return [...current, name];
85
+ }, []);
86
+
87
+ setAttributes({ [getAttrKey('shareTargets', attributes, manifest)]: newValue });
88
+ }}
89
+ hidden={hiddenOptions?.networks}
90
+ key={shareMode}
91
+ >
92
+ {(item) => {
93
+ const { enabled, title, icon, updateData } = item;
94
+
95
+ return (
96
+ <DraggableListItem
97
+ icon={<JsxSvg svg={icon} />}
98
+ label={title}
99
+ >
100
+ <Switch
101
+ checked={enabled}
102
+ onChange={(value) => {
103
+ updateData({ enabled: value });
104
+ }}
105
+ />
106
+ </DraggableListItem>
107
+ );
108
+ }}
109
+ </DraggableList>
110
+ </ComponentToggle>
111
+ );
112
+ };
@@ -0,0 +1,72 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
3
+ "componentName": "share",
4
+ "title": "Share",
5
+ "componentClass": "share",
6
+ "componentJsClass": "js-share",
7
+ "example": {
8
+ "attributes": {
9
+ "shareUse": true
10
+ }
11
+ },
12
+ "attributes": {
13
+ "shareTargets": {
14
+ "type": "array",
15
+ "default": [
16
+ "facebook",
17
+ "linkedin",
18
+ "youtube",
19
+ "instagram"
20
+ ]
21
+ },
22
+ "shareMode": {
23
+ "type": "string",
24
+ "default": "links"
25
+ },
26
+ "shareUse": {
27
+ "type": "boolean",
28
+ "default": true
29
+ }
30
+ },
31
+ "networks": {
32
+ "facebook": {
33
+ "url": "https://www.facebook.com/infinumcom",
34
+ "title": "Facebook",
35
+ "icon": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><path d='M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z' fill='currentColor'/></svg>",
36
+ "shareUrl": "https://www.facebook.com/sharer/sharer.php?u=POST_URL"
37
+ },
38
+ "x": {
39
+ "url": "https://x.com/infinum",
40
+ "title": "X (formerly Twitter)",
41
+ "icon": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><path d='M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z' fill='currentColor'/></svg>",
42
+ "shareUrl": "https://x.com/intent/post?url=POST_URL&text=POST_TITLE"
43
+ },
44
+ "linkedin": {
45
+ "url": "https://www.linkedin.com/company/infinum/",
46
+ "title": "LinkedIn",
47
+ "icon": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><path d='M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z' fill='currentColor'/></svg>",
48
+ "shareUrl": "https://www.linkedin.com/sharing/share-offsite/?url=POST_URL"
49
+ },
50
+ "youtube": {
51
+ "url": "https://www.youtube.com/channel/UCQV7qsvmrpe8IbCWZsv3Low",
52
+ "title": "YouTube",
53
+ "icon": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><path d='M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z' fill='currentColor'/></svg>"
54
+ },
55
+ "instagram": {
56
+ "url": "https://www.instagram.com/infinumcom/",
57
+ "title": "Instagram",
58
+ "icon": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'><path d='M7.03.084c-1.277.06-2.149.264-2.91.563a5.874 5.874 0 0 0-2.124 1.388 5.878 5.878 0 0 0-1.38 2.127C.321 4.926.12 5.8.064 7.076.008 8.354-.005 8.764.001 12.023c.007 3.259.021 3.667.083 4.947.061 1.277.264 2.149.563 2.911.308.789.72 1.457 1.388 2.123a5.872 5.872 0 0 0 2.129 1.38c.763.295 1.636.496 2.913.552 1.278.056 1.689.069 4.947.063 3.257-.007 3.668-.021 4.947-.082 1.28-.06 2.147-.265 2.91-.563a5.881 5.881 0 0 0 2.123-1.388 5.881 5.881 0 0 0 1.38-2.129c.295-.763.496-1.636.551-2.912.056-1.28.07-1.69.063-4.948-.006-3.258-.02-3.667-.081-4.947-.06-1.28-.264-2.148-.564-2.911a5.892 5.892 0 0 0-1.387-2.123 5.857 5.857 0 0 0-2.128-1.38c-.764-.294-1.636-.496-2.914-.55C15.647.009 15.236-.006 11.977 0 8.718.008 8.31.021 7.03.084m.14 21.693c-1.17-.05-1.805-.245-2.228-.408a3.736 3.736 0 0 1-1.382-.895 3.695 3.695 0 0 1-.9-1.378c-.165-.423-.363-1.058-.417-2.228-.06-1.264-.072-1.644-.08-4.848-.006-3.204.006-3.583.061-4.848.05-1.169.246-1.805.408-2.228.216-.561.477-.96.895-1.382a3.705 3.705 0 0 1 1.379-.9c.423-.165 1.057-.361 2.227-.417 1.265-.06 1.644-.072 4.848-.08 3.203-.006 3.583.006 4.85.062 1.168.05 1.804.244 2.227.408.56.216.96.475 1.382.895.421.42.681.817.9 1.378.165.422.362 1.056.417 2.227.06 1.265.074 1.645.08 4.848.005 3.203-.006 3.583-.061 4.848-.051 1.17-.245 1.805-.408 2.23-.216.56-.477.96-.896 1.38a3.705 3.705 0 0 1-1.378.9c-.422.165-1.058.362-2.226.418-1.266.06-1.645.072-4.85.079-3.204.007-3.582-.006-4.848-.06m9.783-16.192a1.44 1.44 0 1 0 1.437-1.442 1.44 1.44 0 0 0-1.437 1.442M5.839 12.012a6.161 6.161 0 1 0 12.323-.024 6.162 6.162 0 0 0-12.323.024M8 12.008A4 4 0 1 1 12.008 16 4 4 0 0 1 8 12.008' fill='currentColor'/></svg>"
59
+ }
60
+ },
61
+ "tailwind": {
62
+ "parts": {
63
+ "container": {
64
+ "twClasses": "flex items-center gap-2.5"
65
+ },
66
+ "icon": {
67
+ "twClasses": "text-gray-400 hover:text-gray-900 focus:outline-none focus-visible:text-navy-500 [&>svg]:size-5 transition",
68
+ "twClassesEditor": "text-gray-400 size-5"
69
+ }
70
+ }
71
+ }
72
+ }
@@ -0,0 +1,66 @@
1
+ <?php
2
+
3
+ /**
4
+ * Share component template.
5
+ *
6
+ * @package %g_namespace%
7
+ */
8
+
9
+ use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
10
+
11
+ $manifest = Helpers::getManifestByDir(__DIR__);
12
+
13
+ $shareUse = Helpers::checkAttr('shareUse', $attributes, $manifest);
14
+
15
+ if (!$shareUse) {
16
+ return;
17
+ }
18
+
19
+ $shareTargets = Helpers::checkAttr('shareTargets', $attributes, $manifest);
20
+ $shareMode = Helpers::checkAttr('shareMode', $attributes, $manifest);
21
+
22
+ $additionalClass = $attributes['additionalClass'] ?? '';
23
+
24
+ ?>
25
+ <div class="<?php echo esc_attr(Helpers::getTwPart('container', $manifest, $additionalClass)); ?>">
26
+ <?php
27
+ if ($shareMode) {
28
+ foreach ($shareTargets as $networkName) {
29
+ $shareUrl = $manifest['networks'][$networkName]['shareUrl'] ?? '';
30
+ $shareUrl = str_replace('POST_TITLE', get_the_title(), $shareUrl);
31
+ $shareUrl = str_replace('POST_URL', get_the_permalink(), $shareUrl);
32
+ $shareUrl = str_replace('POST_FEATURED_IMAGE', get_the_post_thumbnail_url(get_the_ID(), 'large'), $shareUrl);
33
+ ?>
34
+ <button
35
+ class="<?php echo esc_attr(Helpers::getTwPart('icon', $manifest)); ?>"
36
+ data-network="<?php echo esc_attr($networkName); ?>"
37
+ data-share-url="<?php echo esc_url($shareUrl); ?>"
38
+ data-page-title="<?php echo esc_attr(get_the_title()); ?>"
39
+ data-page-url="<?php echo esc_url(get_the_permalink()); ?>"
40
+ >
41
+ <?php
42
+ // phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
43
+ echo $manifest['networks'][$networkName]['icon'] ?? '';
44
+ ?>
45
+ </button>
46
+ <?php }
47
+ } else {
48
+ foreach ($shareTargets as $networkName) {
49
+ ?>
50
+ <a
51
+ class="<?php echo esc_attr(Helpers::getTwPart('icon', $manifest)); ?>"
52
+ href="<?php echo esc_url($manifest['networks'][$networkName]['url'] ?? ''); ?>"
53
+ title="<?php echo esc_attr($manifest['networks'][$networkName]['title'] ?? ''); ?>"
54
+ target="_blank"
55
+ rel="noreferrer noopener"
56
+ >
57
+ <?php
58
+ // phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
59
+ echo $manifest['networks'][$networkName]['icon'] ?? '';
60
+ ?>
61
+ </a>
62
+ <?php
63
+ }
64
+ }
65
+ ?>
66
+ </div>
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
3
+ "componentName": "tracking-before-body-end",
4
+ "title": "Tracking: Before body end"
5
+ }
@@ -0,0 +1,9 @@
1
+ <?php
2
+
3
+ /**
4
+ * Code added to the end of the document body.
5
+ *
6
+ * @package %g_namespace%
7
+ */
8
+
9
+ // Add your code here.
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
3
+ "componentName": "tracking-before-head",
4
+ "title": "Tracking: Head"
5
+ }
@@ -0,0 +1,9 @@
1
+ <?php
2
+
3
+ /**
4
+ * Code added to the start of the head. Useful for things like tracking scripts.
5
+ *
6
+ * @package %g_namespace%
7
+ */
8
+
9
+ // Add your code here.
@@ -0,0 +1,74 @@
1
+ import { __ } from '@wordpress/i18n';
2
+ import { ManageFileButton, checkAttr, getAttrKey, getTwPart } from '@eightshift/frontend-libs-tailwind/scripts';
3
+ import { HStack, MediaPlaceholder, VStack } from '@eightshift/ui-components';
4
+ import { icons } from '@eightshift/ui-components/icons';
5
+ import manifest from '../manifest.json';
6
+
7
+ export const VideoEditor = (attributes) => {
8
+ const { setAttributes, additionalClass } = attributes;
9
+
10
+ const videoUse = checkAttr('videoUse', attributes, manifest);
11
+ const videoUrl = checkAttr('videoUrl', attributes, manifest);
12
+
13
+ if (!videoUse) {
14
+ return null;
15
+ }
16
+
17
+ const hasVideo = videoUrl?.length > 0;
18
+
19
+ return (
20
+ <>
21
+ {!hasVideo && (
22
+ <MediaPlaceholder
23
+ style='simple'
24
+ size='video'
25
+ icon={icons.video}
26
+ helpText={
27
+ <VStack className='mt-2 text-center'>
28
+ {__('Add a video', 'eightshift-frontend-libs')}
29
+
30
+ <HStack>
31
+ <ManageFileButton
32
+ type='browse'
33
+ onChange={({ id, url, mime, mime_type }) =>
34
+ setAttributes({
35
+ [getAttrKey('videoId', attributes, manifest)]: id,
36
+ [getAttrKey('videoUrl', attributes, manifest)]: url,
37
+ [getAttrKey('videoMimeType', attributes, manifest)]:
38
+ typeof mime === 'undefined' ? mime_type : mime,
39
+ })
40
+ }
41
+ allowedTypes={['video/mp4', 'video/webm']}
42
+ kind='video'
43
+ />
44
+
45
+ <ManageFileButton
46
+ type='upload'
47
+ onChange={({ id, url, mime, mime_type }) =>
48
+ setAttributes({
49
+ [getAttrKey('videoId', attributes, manifest)]: id,
50
+ [getAttrKey('videoUrl', attributes, manifest)]: url,
51
+ [getAttrKey('videoMimeType', attributes, manifest)]:
52
+ typeof mime === 'undefined' ? mime_type : mime,
53
+ })
54
+ }
55
+ allowedTypes={['video/mp4', 'video/webm']}
56
+ kind='video'
57
+ />
58
+ </HStack>
59
+ </VStack>
60
+ }
61
+ />
62
+ )}
63
+
64
+ {hasVideo && (
65
+ <video
66
+ className={getTwPart('video', manifest, additionalClass)}
67
+ src={videoUrl}
68
+ controls
69
+ muted
70
+ />
71
+ )}
72
+ </>
73
+ );
74
+ };