@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,239 @@
1
+ import { useState } from '@wordpress/element';
2
+ import { __ } from '@wordpress/i18n';
3
+ import { getAttrKey, checkAttr, getOption, props, fetchFromWpRest } from '@eightshift/frontend-libs-tailwind/scripts';
4
+ import { LoadMoreOptions } from '../../../components/load-more/components/load-more-options';
5
+ import {
6
+ AnimatedVisibility,
7
+ AsyncMultiSelect,
8
+ BaseControl,
9
+ HStack,
10
+ NumberPicker,
11
+ OptionSelect,
12
+ Select,
13
+ Spacer,
14
+ Toggle,
15
+ } from '@eightshift/ui-components';
16
+ import { icons } from '@eightshift/ui-components/icons';
17
+ import manifest from '../manifest.json';
18
+
19
+ export const FeaturedContentOptions = ({ attributes, setAttributes }) => {
20
+ const featuredContentPostType = checkAttr('featuredContentPostType', attributes, manifest);
21
+ const featuredContentTaxonomy = checkAttr('featuredContentTaxonomy', attributes, manifest, true);
22
+ const featuredContentTerms = checkAttr('featuredContentTerms', attributes, manifest) ?? [];
23
+ const featuredContentUseCurrentTerm = checkAttr('featuredContentUseCurrentTerm', attributes, manifest);
24
+ const featuredContentPosts = checkAttr('featuredContentPosts', attributes, manifest) ?? [];
25
+ const featuredContentExcludeCurrentPost = checkAttr('featuredContentExcludeCurrentPost', attributes, manifest);
26
+ const featuredContentRandomOrder = checkAttr('featuredContentRandomOrder', attributes, manifest);
27
+ const featuredContentLayout = checkAttr('featuredContentLayout', attributes, manifest);
28
+ const featuredContentPerPage = checkAttr('featuredContentPerPage', attributes, manifest);
29
+
30
+ const allGenericOption = { label: __('Show all', '%g_textdomain%'), value: '_all', separator: 'below' };
31
+
32
+ const postTypeOptions = getOption('featuredContentPostType', attributes, manifest);
33
+ const taxonomyOptions = [allGenericOption, ...getOption('featuredContentTaxonomy', attributes, manifest)];
34
+
35
+ // Set internal store for specific items.
36
+ const [useSpecificPosts, setUseSpecificPosts] = useState(featuredContentPosts?.length > 0);
37
+ const [useSpecificTerms, setUseSpecificTerms] = useState(featuredContentTerms?.length > 0);
38
+
39
+ return (
40
+ <>
41
+ <OptionSelect
42
+ icon={icons.layoutAlt3}
43
+ label={__('Layout', '%g_textdomain%')}
44
+ value={featuredContentLayout}
45
+ onChange={(value) => setAttributes({ [getAttrKey('featuredContentLayout', attributes, manifest)]: value })}
46
+ options={getOption('featuredContentLayout', attributes, manifest)}
47
+ type='menu'
48
+ inline
49
+ />
50
+
51
+ <NumberPicker
52
+ icon={icons.dummySpacer}
53
+ label={__('Items per page', '%g_textdomain%')}
54
+ value={featuredContentPerPage}
55
+ onChange={(value) => setAttributes({ [getAttrKey('featuredContentPerPage', attributes, manifest)]: value })}
56
+ min={1}
57
+ inline
58
+ />
59
+
60
+ <Spacer />
61
+ <Spacer />
62
+
63
+ <OptionSelect
64
+ icon={icons.multiple}
65
+ label={__('Content type', '%g_textdomain%')}
66
+ value={featuredContentPostType?.value}
67
+ options={postTypeOptions}
68
+ onChange={(rawValue) => {
69
+ setUseSpecificPosts(false);
70
+ setUseSpecificTerms(false);
71
+
72
+ const value = postTypeOptions.find((option) => option.value === rawValue);
73
+
74
+ setAttributes({
75
+ [getAttrKey('featuredContentPostType', attributes, manifest)]: value,
76
+ [getAttrKey('featuredContentTaxonomy', attributes, manifest)]: undefined,
77
+ [getAttrKey('featuredContentTerms', attributes, manifest)]: undefined,
78
+ [getAttrKey('featuredContentUseCurrentTerm', attributes, manifest)]: false,
79
+ [getAttrKey('featuredContentPosts', attributes, manifest)]: undefined,
80
+ });
81
+ }}
82
+ type='menu'
83
+ inline
84
+ />
85
+
86
+ <OptionSelect
87
+ aria-label={__('Select items to show', '%g_textdomain%')}
88
+ value={useSpecificPosts}
89
+ onChange={() => {
90
+ setUseSpecificPosts(!useSpecificPosts);
91
+ setAttributes({
92
+ [getAttrKey('featuredContentPosts', attributes, manifest)]: undefined,
93
+ });
94
+ }}
95
+ options={[
96
+ { label: __('Show all posts', '%g_textdomain%'), value: false },
97
+ {
98
+ label: __('Select posts to show', '%g_textdomain%'),
99
+ value: true,
100
+ disabled: featuredContentExcludeCurrentPost || featuredContentTaxonomy,
101
+ subtitle:(featuredContentExcludeCurrentPost || featuredContentTaxonomy) && __('Unavailable when a taxonomy filter is set', '%g_textdomain%')
102
+ },
103
+ ]}
104
+ type='radiosSegmented'
105
+ vertical
106
+ />
107
+
108
+ <AnimatedVisibility
109
+ noInitial
110
+ visible={!useSpecificPosts}
111
+ >
112
+ <Toggle
113
+ icon={icons.excludeItemAlt}
114
+ label={__('Exclude current', '%g_textdomain%')}
115
+ subtitle={__('Best used with blog posts', '%g_textdomain%')}
116
+ checked={featuredContentExcludeCurrentPost}
117
+ onChange={(value) =>
118
+ setAttributes({ [getAttrKey('featuredContentExcludeCurrentPost', attributes, manifest)]: value })
119
+ }
120
+ />
121
+ </AnimatedVisibility>
122
+
123
+ <AnimatedVisibility
124
+ noInitial
125
+ visible={useSpecificPosts && !featuredContentExcludeCurrentPost}
126
+ >
127
+ <AsyncMultiSelect
128
+ key={featuredContentPostType.value}
129
+ help={__(
130
+ 'Newest 30 items are shown, others can be selected by searching. If blank, all items are shown.',
131
+ '%g_textdomain%',
132
+ )}
133
+ value={featuredContentPosts}
134
+ loadOptions={fetchFromWpRest(featuredContentPostType?.api, {
135
+ processLabel: ({ title: { rendered } }) => rendered,
136
+ noCache: true,
137
+ })}
138
+ onChange={(value) => setAttributes({ [getAttrKey('featuredContentPosts', attributes, manifest)]: value })}
139
+ reFetchOnSearch
140
+ />
141
+ </AnimatedVisibility>
142
+
143
+ <Spacer />
144
+
145
+ <Toggle
146
+ icon={icons.dice}
147
+ label={__('Randomize order', '%g_textdomain%')}
148
+ checked={featuredContentRandomOrder}
149
+ onChange={(value) => setAttributes({ [getAttrKey('featuredContentRandomOrder', attributes, manifest)]: value })}
150
+ />
151
+
152
+ <Spacer />
153
+ <Spacer />
154
+
155
+ <OptionSelect
156
+ icon={icons.filter}
157
+ label={__('Taxonomy', '%g_textdomain%')}
158
+ value={(featuredContentTaxonomy ?? allGenericOption)?.value}
159
+ options={taxonomyOptions}
160
+ onChange={(rawValue) => {
161
+ setUseSpecificPosts(false);
162
+ setUseSpecificTerms(false);
163
+
164
+ const value =
165
+ rawValue === '_all' ? allGenericOption : taxonomyOptions.find((option) => option.value === rawValue);
166
+
167
+ setAttributes({
168
+ [getAttrKey('featuredContentTaxonomy', attributes, manifest)]:
169
+ value === allGenericOption ? undefined : value,
170
+ [getAttrKey('featuredContentTerms', attributes, manifest)]: undefined,
171
+ [getAttrKey('featuredContentUseCurrentTerm', attributes, manifest)]: false,
172
+ [getAttrKey('featuredContentPosts', attributes, manifest)]: undefined,
173
+ });
174
+ }}
175
+ hidden={featuredContentPostType?.taxonomies?.length < 1}
176
+ type='menu'
177
+ inline
178
+ />
179
+
180
+ <OptionSelect
181
+ aria-label={__('Select terms to show', '%g_textdomain%')}
182
+ value={featuredContentUseCurrentTerm ? 'current' : useSpecificTerms ? 'manual' : 'all'}
183
+ onChange={(value) => {
184
+ setUseSpecificTerms(value === 'manual');
185
+ setAttributes({
186
+ [getAttrKey('featuredContentTerms', attributes, manifest)]: undefined,
187
+ [getAttrKey('featuredContentUseCurrentTerm', attributes, manifest)]: value === 'current',
188
+ });
189
+ }}
190
+ options={[
191
+ { label: __('Show all terms', '%g_textdomain%'), value: 'all' },
192
+ {
193
+ label: __('Select terms to show', '%g_textdomain%'),
194
+ value: 'manual',
195
+ },
196
+ {
197
+ label: __('Show same terms as current post', '%g_textdomain%'),
198
+ value: 'current',
199
+ },
200
+ ]}
201
+ type='radiosSegmented'
202
+ vertical
203
+ />
204
+
205
+ <AnimatedVisibility
206
+ noInitial
207
+ visible={useSpecificTerms && !featuredContentUseCurrentTerm}
208
+ >
209
+ <AsyncMultiSelect
210
+ key={featuredContentTaxonomy?.value}
211
+ help={__(
212
+ 'Newest 30 items are shown, others can be selected by searching. If blank, all items are shown.',
213
+ '%g_textdomain%',
214
+ )}
215
+ value={featuredContentTerms}
216
+ loadOptions={fetchFromWpRest(featuredContentTaxonomy?.api, {
217
+ fields: 'id,name',
218
+ processId: ({ id }) => id,
219
+ processLabel: ({ name }) => name,
220
+ noCache: true,
221
+ })}
222
+ onChange={(value) => setAttributes({ [getAttrKey('featuredContentTerms', attributes, manifest)]: value })}
223
+ reFetchOnSearch
224
+ placeholder={__('Select terms to show', '%g_textdomain%')}
225
+ />
226
+ </AnimatedVisibility>
227
+
228
+ <Spacer />
229
+
230
+ <LoadMoreOptions
231
+ {...props('loadMore', attributes, {
232
+ setAttributes,
233
+ })}
234
+ label={__('"Load more" button', '%g_textdomain%')}
235
+ noUseToggle
236
+ />
237
+ </>
238
+ );
239
+ };
@@ -0,0 +1,13 @@
1
+ import { FeaturedContentEditor } from './components/featured-content-editor';
2
+ import { FeaturedContentOptions } from './components/featured-content-options';
3
+ import { GutenbergBlock } from '@eightshift/frontend-libs-tailwind/scripts';
4
+
5
+ export const FeaturedContent = (props) => {
6
+ return (
7
+ <GutenbergBlock
8
+ {...props}
9
+ options={FeaturedContentOptions}
10
+ editor={FeaturedContentEditor}
11
+ />
12
+ );
13
+ };
@@ -0,0 +1,139 @@
1
+ <?php
2
+
3
+ /**
4
+ * Featured content block 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
+ $blockName = $attributes['blockName'] ?? '';
14
+
15
+ $featuredContentPostType = Helpers::checkAttr('featuredContentPostType', $attributes, $manifest);
16
+ $featuredContentTaxonomy = Helpers::checkAttr('featuredContentTaxonomy', $attributes, $manifest);
17
+ $featuredContentTerms = Helpers::checkAttr('featuredContentTerms', $attributes, $manifest);
18
+ $featuredContentPosts = Helpers::checkAttr('featuredContentPosts', $attributes, $manifest);
19
+ $featuredContentExcludeCurrentPost = Helpers::checkAttr('featuredContentExcludeCurrentPost', $attributes, $manifest);
20
+ $featuredContentUseCurrentTerm = Helpers::checkAttr('featuredContentUseCurrentTerm', $attributes, $manifest);
21
+ $featuredContentRandomOrder = Helpers::checkAttr('featuredContentRandomOrder', $attributes, $manifest);
22
+ $featuredContentLoadMoreUse = Helpers::checkAttr('featuredContentLoadMoreUse', $attributes, $manifest);
23
+ $featuredContentPerPage = Helpers::checkAttr('featuredContentPerPage', $attributes, $manifest);
24
+
25
+ $featuredContentServerSideRender = Helpers::checkAttr('featuredContentServerSideRender', $attributes, $manifest);
26
+
27
+ if (!empty($featuredContentPostType)) {
28
+ $featuredContentPostType = $featuredContentPostType['value'];
29
+ }
30
+
31
+ if (!empty($featuredContentTaxonomy)) {
32
+ $featuredContentTaxonomy = $featuredContentTaxonomy['value'];
33
+ }
34
+
35
+ global $post;
36
+
37
+ $args = [
38
+ 'post_type' => $featuredContentPostType,
39
+ 'posts_per_page' => $featuredContentPerPage,
40
+ 'fields' => 'ids',
41
+ 'order' => 'ASC',
42
+ ];
43
+
44
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
45
+ if (isset($_GET['current-page'])) {
46
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
47
+ $skipToPage = sanitize_text_field(wp_unslash($_GET['current-page']));
48
+
49
+ $args['posts_per_page'] = $featuredContentPerPage * $skipToPage;
50
+ }
51
+
52
+ if ($featuredContentTaxonomy) {
53
+ $args['tax_query'][0] = [
54
+ 'taxonomy' => $featuredContentTaxonomy,
55
+ 'field' => 'id',
56
+ ];
57
+
58
+ if ($featuredContentTerms) {
59
+ $args['tax_query'][0]['terms'] = array_map(fn ($item) => $item['value'], (array) $featuredContentTerms);
60
+ } elseif ($featuredContentUseCurrentTerm && $post instanceof WP_Post) {
61
+ $currentTerms = get_the_terms($post->ID, strval($featuredContentTaxonomy));
62
+
63
+ if ($currentTerms) {
64
+ $args['tax_query'][0]['terms'] = wp_list_pluck($currentTerms, 'term_id');
65
+ }
66
+ } else {
67
+ // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query
68
+ $args['tax_query'][0]['operator'] = 'NOT IN';
69
+ }
70
+ }
71
+
72
+ $excludeList = [];
73
+
74
+ if ($featuredContentExcludeCurrentPost && $post instanceof WP_Post) {
75
+ $excludeList[] = $post->ID;
76
+ }
77
+
78
+ if ($excludeList) {
79
+ $args['post__not_in'] = $excludeList;
80
+ }
81
+
82
+ if ($featuredContentPosts) {
83
+ $args['post__in'] = array_map(fn($item) => $item['value'], (array)$featuredContentPosts);
84
+ $args['orderby'] = 'post__in';
85
+ }
86
+
87
+ if ($featuredContentRandomOrder) {
88
+ $args['orderby'] = 'rand';
89
+ }
90
+
91
+ $mainQuery = new WP_Query($args);
92
+
93
+ if (!$mainQuery->have_posts()) {
94
+ return;
95
+ }
96
+
97
+ wp_reset_postdata();
98
+
99
+ $unique = Helpers::getUnique();
100
+ $loadMoreId = "{$blockName}-{$unique}";
101
+
102
+ $args['posts_per_page'] = $featuredContentPerPage;
103
+ ?>
104
+
105
+ <div>
106
+ <div
107
+ id="<?php echo esc_attr($loadMoreId); ?>"
108
+ class="<?php echo esc_attr(Helpers::getTwClasses($attributes, $manifest)); ?>"
109
+ aria-live="polite"
110
+ >
111
+ <?php
112
+ echo Helpers::render(
113
+ 'cards',
114
+ [
115
+ 'items' => $mainQuery->posts,
116
+ ],
117
+ 'blocks',
118
+ false,
119
+ "{$blockName}/partials"
120
+ );
121
+ ?>
122
+ </div>
123
+
124
+ <?php
125
+ // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
126
+ if (!$featuredContentServerSideRender && $mainQuery->max_num_pages > 1) { ?>
127
+ <div class="<?php echo esc_attr(Helpers::getTwPart('loadMoreContainer', $manifest)); ?>">
128
+ <?php
129
+ echo Helpers::render('load-more', Helpers::props('loadMore', $attributes, [
130
+ 'loadMoreInitialItems' => wp_json_encode($mainQuery->posts),
131
+ 'loadMoreQuery' => wp_json_encode($args),
132
+ 'loadMoreId' => $loadMoreId,
133
+ 'loadMoreType' => $blockName,
134
+ 'loadMorePage' => $skipToPage ?? 1,
135
+ ]));
136
+ ?>
137
+ </div>
138
+ <?php } ?>
139
+ </div>
@@ -0,0 +1,131 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/block.json",
3
+ "blockName": "featured-content",
4
+ "title": "Featured content",
5
+ "description": "Display posts with an option for dynamic loading and taxonomy filtering.",
6
+ "category": "eightshift",
7
+ "icon": {
8
+ "src": "es-featured-posts"
9
+ },
10
+ "keywords": [
11
+ "featured",
12
+ "posts",
13
+ "content"
14
+ ],
15
+ "attributes": {
16
+ "featuredContentPostType": {
17
+ "type": "object",
18
+ "default": {
19
+ "label": "Post",
20
+ "value": "post",
21
+ "api": "posts",
22
+ "taxonomies": [
23
+ "category"
24
+ ]
25
+ }
26
+ },
27
+ "featuredContentTaxonomy": {
28
+ "type": "object"
29
+ },
30
+ "featuredContentTerms": {
31
+ "type": "array"
32
+ },
33
+ "featuredContentPosts": {
34
+ "type": "array"
35
+ },
36
+ "featuredContentUseCurrentTerm": {
37
+ "type": "boolean",
38
+ "default": false
39
+ },
40
+ "featuredContentExcludeCurrentPost": {
41
+ "type": "boolean",
42
+ "default": false
43
+ },
44
+ "featuredContentServerSideRender": {
45
+ "type": "boolean",
46
+ "default": false
47
+ },
48
+ "featuredContentRandomOrder": {
49
+ "type": "boolean",
50
+ "default": false
51
+ },
52
+ "featuredContentLayout": {
53
+ "type": "string",
54
+ "default": "threeCols"
55
+ },
56
+ "featuredContentPerPage": {
57
+ "type": "integer",
58
+ "default": 6
59
+ }
60
+ },
61
+ "components": {
62
+ "loadMore": "loadMore"
63
+ },
64
+ "options": {
65
+ "featuredContentPostType": [
66
+ {
67
+ "label": "Post",
68
+ "value": "post",
69
+ "api": "posts",
70
+ "taxonomies": [
71
+ "category"
72
+ ]
73
+ },
74
+ {
75
+ "label": "Page",
76
+ "value": "page",
77
+ "api": "pages"
78
+ }
79
+ ],
80
+ "featuredContentTaxonomy": [
81
+ {
82
+ "label": "Category",
83
+ "value": "category",
84
+ "api": "categories"
85
+ }
86
+ ],
87
+ "featuredContentLayout": [
88
+ {
89
+ "label": "2 columns",
90
+ "value": "twoCols",
91
+ "endIcon": "twoColumns"
92
+ },
93
+ {
94
+ "label": "3 columns",
95
+ "value": "threeCols",
96
+ "endIcon": "columns"
97
+ },
98
+ {
99
+ "label": "4 columns",
100
+ "value": "fourCols",
101
+ "endIcon": "fourColumns",
102
+ "separator": "below"
103
+ },
104
+ {
105
+ "label": "Auto columns",
106
+ "value": "auto",
107
+ "endIcon": "gridAutoCols"
108
+ }
109
+ ]
110
+ },
111
+ "tailwind": {
112
+ "base": {
113
+ "twClasses": "grid gap-6"
114
+ },
115
+ "parts": {
116
+ "loadMoreContainer": {
117
+ "twClasses": "flex justify-center w-full mt-6"
118
+ }
119
+ },
120
+ "options": {
121
+ "featuredContentLayout": {
122
+ "twClasses": {
123
+ "twoCols": "grid-cols-1 sm:grid-cols-2",
124
+ "threeCols": "grid-cols-1 sm:grid-cols-2 md:grid-cols-3",
125
+ "fourCols": "grid-cols-1 sm:grid-cols-2 md:grid-cols-4",
126
+ "auto": "grid-cols-1 sm:grid-cols-[repeat(auto-fill,minmax(20rem,1fr))]"
127
+ }
128
+ }
129
+ }
130
+ }
131
+ }
@@ -0,0 +1,39 @@
1
+ <?php
2
+
3
+ /**
4
+ * Template for the Featured Content view - Card content map from ID.
5
+ *
6
+ * @package %g_namespace%
7
+ */
8
+
9
+ $items = $attributes['items'] ?? [];
10
+ $hasEnterAnimation = $attributes['hasEnterAnimation'] ?? false;
11
+
12
+ $output = [];
13
+
14
+ if (!$items) {
15
+ return $output;
16
+ }
17
+
18
+ foreach ($items as $item) {
19
+ $featuredImage = get_the_post_thumbnail_url($item, 'full');
20
+ ?>
21
+ <a
22
+ href="<?php echo esc_attr(get_the_permalink($item)); ?>"
23
+ class="group rounded-xl relative overflow-hidden w-full aspect-[0.875] bg-gradient-to-b from-gray-100 to-white shadow-md hover:shadow-lg transition duration-500 hover:duration-1000 border border-gray-200 <?php echo $hasEnterAnimation ? 'animate-in zoom-in-110 fade-in' : ''; ?>"
24
+ >
25
+ <?php if (!empty($featuredImage)) { ?>
26
+ <img class="absolute inset-0 !size-full object-cover group-hover:scale-105 origin-bottom transition-transform duration-500 group-hover:duration-1000 pointer-events-none select-none" src="<?php echo esc_url($featuredImage); ?>" alt="">
27
+ <div class=" absolute inset-0 backdrop-blur [mask-image:_linear-gradient(to_bottom,_transparent_5%,_black_50%)]"></div>
28
+ <div class=" absolute inset-0 backdrop-blur-lg [mask-image:_linear-gradient(to_bottom,_transparent_20%,_black_100%)]"></div>
29
+ <div class=" absolute inset-0 backdrop-blur-3xl [mask-image:_linear-gradient(to_bottom,_transparent_85%,_black_100%)]"></div>
30
+ <div class="absolute inset-0 backdrop-saturate-[125%] backdrop-brightness-150"></div>
31
+ <div class="absolute inset-0 bg-black/50 [&+div]:text-white [mask-image:_linear-gradient(to_bottom,_transparent_25%,_black_80%)]"></div>
32
+ <?php } ?>
33
+ <div class="flex flex-col justify-end p-6 absolute inset-0 group-hover:scale-[1.025] origin-bottom-left transition-transform duration-500 group-hover:duration-1000">
34
+ <p class="text-xs opacity-45 uppercase mb-0.5"><?php echo get_the_date('', $item); ?></p>
35
+ <p class="~sm/md:~text-lg/3xl !leading-tight font-display line-clamp-3 text-balance"><?php echo esc_html(get_the_title($item)); ?></p>
36
+ </div>
37
+ </a>
38
+ <?php
39
+ }
@@ -0,0 +1,8 @@
1
+ import { InnerBlocks } from '@wordpress/block-editor';
2
+ import { BlockInserter } from '@eightshift/frontend-libs-tailwind/scripts';
3
+
4
+ export const GroupEditor = ({ clientId }) => {
5
+ return (
6
+ <InnerBlocks renderAppender={() => <BlockInserter clientId={clientId} />} />
7
+ );
8
+ };
@@ -0,0 +1,14 @@
1
+ import { useSelect } from '@wordpress/data';
2
+ import { overrideInnerBlockAttributes } from '@eightshift/frontend-libs-tailwind/scripts/editor';
3
+ import { GroupEditor } from './components/group-editor';
4
+
5
+ export const Group = (props) => {
6
+ useSelect((select) => {
7
+ overrideInnerBlockAttributes(select, props.clientId, {
8
+ wrapperNoWidthControls: true,
9
+ wrapperWidth: 'none',
10
+ });
11
+ });
12
+
13
+ return <GroupEditor {...props} />;
14
+ };
@@ -0,0 +1,10 @@
1
+ <?php
2
+
3
+ /**
4
+ * Template for the Group block.
5
+ *
6
+ * @package %g_namespace%
7
+ */
8
+
9
+ // phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
10
+ echo $renderContent;
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/block.json",
3
+ "blockName": "group",
4
+ "title": "Group",
5
+ "description" : "Group similar content together.",
6
+ "category": "eightshift",
7
+ "icon": {
8
+ "src": "es-group"
9
+ },
10
+ "keywords": [
11
+ "container",
12
+ "section",
13
+ "group"
14
+ ],
15
+ "example": {
16
+ "innerBlocks": [
17
+ {
18
+ "name": "eightshift-boilerplate/heading",
19
+ "attributes": {
20
+ "headingHeadingContent": "Lorem ipsum dolor sit amet"
21
+ }
22
+ },
23
+ {
24
+ "name": "eightshift-boilerplate/paragraph",
25
+ "attributes": {
26
+ "paragraphParagraphContent": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam aliquam est id semper aliquet. Aenean accumsan lacus justo, a lacinia turpis semper condimentum. "
27
+ }
28
+ }
29
+ ]
30
+ },
31
+ "hasInnerBlocks": true
32
+ }
@@ -0,0 +1,15 @@
1
+ import React, { useMemo } from 'react';
2
+ import { getTwClasses, props } from '@eightshift/frontend-libs-tailwind/scripts';
3
+ import { HeadingEditor as EditorComponent } from '../../../components/heading/components/heading-editor';
4
+ import manifest from './../manifest.json';
5
+
6
+ export const HeadingEditor = ({ attributes, setAttributes }) => {
7
+ return (
8
+ <EditorComponent
9
+ {...props('heading', attributes, {
10
+ setAttributes,
11
+ })}
12
+ additionalClass={getTwClasses(attributes, manifest)}
13
+ />
14
+ );
15
+ };
@@ -0,0 +1,38 @@
1
+ import { __ } from '@wordpress/i18n';
2
+ import { checkAttr, getAttrKey, getOption, props } from '@eightshift/frontend-libs-tailwind/scripts';
3
+ import { HeadingOptions as OptionsComponent } from '../../../components/heading/components/heading-options';
4
+ import { ColorPicker, OptionSelect } from '@eightshift/ui-components';
5
+ import { getColorOption } from '../../../assets/scripts/shared';
6
+ import manifest from '../manifest.json';
7
+
8
+ export const HeadingOptions = ({ attributes, setAttributes }) => {
9
+ const headingAlign = checkAttr('headingAlign', attributes, manifest);
10
+ const headingColor = checkAttr('headingColor', attributes, manifest);
11
+
12
+ return (
13
+ <OptionsComponent
14
+ {...props('heading', attributes, {
15
+ setAttributes,
16
+ })}
17
+ additionalControls={
18
+ <>
19
+ <ColorPicker
20
+ colors={getColorOption('headingColor', manifest)}
21
+ onChange={(value) => setAttributes({ [getAttrKey('headingColor', attributes, manifest)]: value })}
22
+ type='textColor'
23
+ value={headingColor}
24
+ aria-label={__('Text color', '%g_textdomain%')}
25
+ />
26
+
27
+ <OptionSelect
28
+ value={headingAlign}
29
+ onChange={(value) => setAttributes({ [getAttrKey('headingAlign', attributes, manifest)]: value })}
30
+ options={getOption('headingAlign', attributes, manifest)}
31
+ aria-label={__('Text alignment', '%g_textdomain%')}
32
+ />
33
+ </>
34
+ }
35
+ controlOnly
36
+ />
37
+ );
38
+ };