@eightshift/frontend-libs-tailwind 1.4.8 → 2.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 (235) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/bun.lockb +0 -0
  3. package/package.json +28 -35
  4. package/scripts/components/block-inserter.js +1 -1
  5. package/scripts/components/file-picker.js +17 -3
  6. package/scripts/components/picker-placeholder.js +5 -7
  7. package/scripts/components/server-side-render.js +1 -1
  8. package/scripts/components/settings/settings.js +21 -20
  9. package/blocks/init/assets/application-admin.js +0 -10
  10. package/blocks/init/assets/application.js +0 -13
  11. package/blocks/init/assets/fonts/fraunces-italic-latin-extended.woff2 +0 -0
  12. package/blocks/init/assets/fonts/fraunces-italic-latin.woff2 +0 -0
  13. package/blocks/init/assets/fonts/fraunces-latin-extended.woff2 +0 -0
  14. package/blocks/init/assets/fonts/fraunces-latin.woff2 +0 -0
  15. package/blocks/init/assets/fonts/noto-sans-italic-latin-extended.woff2 +0 -0
  16. package/blocks/init/assets/fonts/noto-sans-italic-latin.woff2 +0 -0
  17. package/blocks/init/assets/fonts/noto-sans-latin-extended.woff2 +0 -0
  18. package/blocks/init/assets/fonts/noto-sans-latin.woff2 +0 -0
  19. package/blocks/init/assets/images/index.js +0 -5
  20. package/blocks/init/assets/scripts/application-admin.js +0 -7
  21. package/blocks/init/assets/scripts/application.js +0 -3
  22. package/blocks/init/assets/scripts/theme-colors.js +0 -39
  23. package/blocks/init/assets/styles/application-admin.css +0 -6
  24. package/blocks/init/assets/styles/application.css +0 -3
  25. package/blocks/init/src/Blocks/assets/application-blocks-editor.js +0 -14
  26. package/blocks/init/src/Blocks/assets/application-blocks-frontend.js +0 -13
  27. package/blocks/init/src/Blocks/assets/application-blocks.js +0 -9
  28. package/blocks/init/src/Blocks/assets/scripts/application-blocks-editor.js +0 -65
  29. package/blocks/init/src/Blocks/assets/scripts/application-blocks-frontend.js +0 -24
  30. package/blocks/init/src/Blocks/assets/scripts/link-section-editor.js +0 -262
  31. package/blocks/init/src/Blocks/assets/scripts/shared.js +0 -25
  32. package/blocks/init/src/Blocks/assets/styles/application-blocks-editor.css +0 -15
  33. package/blocks/init/src/Blocks/assets/styles/application-blocks-frontend.css +0 -9
  34. package/blocks/init/src/Blocks/assets/styles/application-blocks.css +0 -1
  35. package/blocks/init/src/Blocks/assets/styles/editor/editor-overrides.css +0 -15
  36. package/blocks/init/src/Blocks/assets/styles/fonts.css +0 -90
  37. package/blocks/init/src/Blocks/assets/styles/tailwind.css +0 -30
  38. package/blocks/init/src/Blocks/components/admin-theme-options/admin-theme-options.php +0 -20
  39. package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/index.js +0 -36
  40. package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/pages/parts.js +0 -56
  41. package/blocks/init/src/Blocks/components/admin-theme-options/manifest.json +0 -5
  42. package/blocks/init/src/Blocks/components/button/assets/index.js +0 -22
  43. package/blocks/init/src/Blocks/components/button/button.php +0 -88
  44. package/blocks/init/src/Blocks/components/button/components/button-editor.js +0 -36
  45. package/blocks/init/src/Blocks/components/button/components/button-options.js +0 -134
  46. package/blocks/init/src/Blocks/components/button/manifest.json +0 -302
  47. package/blocks/init/src/Blocks/components/card/card.php +0 -42
  48. package/blocks/init/src/Blocks/components/card/components/card-editor.js +0 -43
  49. package/blocks/init/src/Blocks/components/card/components/card-options.js +0 -55
  50. package/blocks/init/src/Blocks/components/card/manifest.json +0 -111
  51. package/blocks/init/src/Blocks/components/head/head.php +0 -52
  52. package/blocks/init/src/Blocks/components/head/manifest.json +0 -17
  53. package/blocks/init/src/Blocks/components/heading/components/heading-editor.js +0 -26
  54. package/blocks/init/src/Blocks/components/heading/components/heading-options.js +0 -62
  55. package/blocks/init/src/Blocks/components/heading/heading.php +0 -45
  56. package/blocks/init/src/Blocks/components/heading/manifest.json +0 -76
  57. package/blocks/init/src/Blocks/components/hero/components/hero-editor.js +0 -42
  58. package/blocks/init/src/Blocks/components/hero/components/hero-options.js +0 -100
  59. package/blocks/init/src/Blocks/components/hero/hero.php +0 -45
  60. package/blocks/init/src/Blocks/components/hero/manifest.json +0 -96
  61. package/blocks/init/src/Blocks/components/icon/components/icon-editor.js +0 -23
  62. package/blocks/init/src/Blocks/components/icon/components/icon-options.js +0 -65
  63. package/blocks/init/src/Blocks/components/icon/icon.php +0 -53
  64. package/blocks/init/src/Blocks/components/icon/manifest.json +0 -1238
  65. package/blocks/init/src/Blocks/components/image/components/image-editor.js +0 -64
  66. package/blocks/init/src/Blocks/components/image/components/image-options.js +0 -111
  67. package/blocks/init/src/Blocks/components/image/image.php +0 -68
  68. package/blocks/init/src/Blocks/components/image/manifest.json +0 -125
  69. package/blocks/init/src/Blocks/components/list/components/list-editor.js +0 -30
  70. package/blocks/init/src/Blocks/components/list/components/list-options.js +0 -62
  71. package/blocks/init/src/Blocks/components/list/list.php +0 -32
  72. package/blocks/init/src/Blocks/components/list/manifest.json +0 -127
  73. package/blocks/init/src/Blocks/components/load-more/assets/index.js +0 -19
  74. package/blocks/init/src/Blocks/components/load-more/assets/load-more.js +0 -146
  75. package/blocks/init/src/Blocks/components/load-more/components/load-more-editor.js +0 -14
  76. package/blocks/init/src/Blocks/components/load-more/components/load-more-options.js +0 -19
  77. package/blocks/init/src/Blocks/components/load-more/load-more.php +0 -47
  78. package/blocks/init/src/Blocks/components/load-more/manifest.json +0 -39
  79. package/blocks/init/src/Blocks/components/modal/assets/index.js +0 -27
  80. package/blocks/init/src/Blocks/components/modal/manifest.json +0 -48
  81. package/blocks/init/src/Blocks/components/modal/modal.php +0 -46
  82. package/blocks/init/src/Blocks/components/paragraph/components/paragraph-editor.js +0 -38
  83. package/blocks/init/src/Blocks/components/paragraph/components/paragraph-options.js +0 -48
  84. package/blocks/init/src/Blocks/components/paragraph/manifest.json +0 -81
  85. package/blocks/init/src/Blocks/components/paragraph/paragraph.php +0 -33
  86. package/blocks/init/src/Blocks/components/post-header/manifest.json +0 -5
  87. package/blocks/init/src/Blocks/components/post-header/post-header.php +0 -24
  88. package/blocks/init/src/Blocks/components/quote/components/quote-editor.js +0 -53
  89. package/blocks/init/src/Blocks/components/quote/components/quote-options.js +0 -29
  90. package/blocks/init/src/Blocks/components/quote/manifest.json +0 -47
  91. package/blocks/init/src/Blocks/components/quote/quote.php +0 -49
  92. package/blocks/init/src/Blocks/components/share/assets/index.js +0 -39
  93. package/blocks/init/src/Blocks/components/share/components/share-editor.js +0 -28
  94. package/blocks/init/src/Blocks/components/share/components/share-options.js +0 -112
  95. package/blocks/init/src/Blocks/components/share/manifest.json +0 -72
  96. package/blocks/init/src/Blocks/components/share/share.php +0 -69
  97. package/blocks/init/src/Blocks/components/tracking-before-body-end/manifest.json +0 -5
  98. package/blocks/init/src/Blocks/components/tracking-before-body-end/tracking-before-body-end.php +0 -9
  99. package/blocks/init/src/Blocks/components/tracking-head/manifest.json +0 -5
  100. package/blocks/init/src/Blocks/components/tracking-head/tracking-head.php +0 -9
  101. package/blocks/init/src/Blocks/components/video/components/video-editor.js +0 -74
  102. package/blocks/init/src/Blocks/components/video/components/video-options.js +0 -279
  103. package/blocks/init/src/Blocks/components/video/manifest.json +0 -120
  104. package/blocks/init/src/Blocks/components/video/video.php +0 -70
  105. package/blocks/init/src/Blocks/custom/accordion/accordion-block.js +0 -15
  106. package/blocks/init/src/Blocks/custom/accordion/accordion.php +0 -28
  107. package/blocks/init/src/Blocks/custom/accordion/assets/index.js +0 -37
  108. package/blocks/init/src/Blocks/custom/accordion/components/accordion-editor.js +0 -22
  109. package/blocks/init/src/Blocks/custom/accordion/components/accordion-options.js +0 -18
  110. package/blocks/init/src/Blocks/custom/accordion/manifest.json +0 -32
  111. package/blocks/init/src/Blocks/custom/accordion-item/accordion-item-block.js +0 -19
  112. package/blocks/init/src/Blocks/custom/accordion-item/accordion-item.php +0 -46
  113. package/blocks/init/src/Blocks/custom/accordion-item/components/accordion-item-editor.js +0 -60
  114. package/blocks/init/src/Blocks/custom/accordion-item/manifest.json +0 -69
  115. package/blocks/init/src/Blocks/custom/button/button-block.js +0 -13
  116. package/blocks/init/src/Blocks/custom/button/button.php +0 -11
  117. package/blocks/init/src/Blocks/custom/button/components/button-editor.js +0 -12
  118. package/blocks/init/src/Blocks/custom/button/components/button-options.js +0 -12
  119. package/blocks/init/src/Blocks/custom/button/manifest.json +0 -18
  120. package/blocks/init/src/Blocks/custom/card/card-block.js +0 -13
  121. package/blocks/init/src/Blocks/custom/card/card.php +0 -11
  122. package/blocks/init/src/Blocks/custom/card/components/card-editor.js +0 -12
  123. package/blocks/init/src/Blocks/custom/card/components/card-options.js +0 -15
  124. package/blocks/init/src/Blocks/custom/card/manifest.json +0 -18
  125. package/blocks/init/src/Blocks/custom/carousel/assets/index.js +0 -46
  126. package/blocks/init/src/Blocks/custom/carousel/assets/navigation.js +0 -31
  127. package/blocks/init/src/Blocks/custom/carousel/assets/pagination.js +0 -40
  128. package/blocks/init/src/Blocks/custom/carousel/carousel-block.js +0 -21
  129. package/blocks/init/src/Blocks/custom/carousel/carousel.php +0 -61
  130. package/blocks/init/src/Blocks/custom/carousel/components/carousel-editor.js +0 -25
  131. package/blocks/init/src/Blocks/custom/carousel/components/carousel-options.js +0 -47
  132. package/blocks/init/src/Blocks/custom/carousel/manifest.json +0 -130
  133. package/blocks/init/src/Blocks/custom/column/column-block.js +0 -21
  134. package/blocks/init/src/Blocks/custom/column/column-hooks.js +0 -32
  135. package/blocks/init/src/Blocks/custom/column/column.php +0 -21
  136. package/blocks/init/src/Blocks/custom/column/components/column-editor.js +0 -22
  137. package/blocks/init/src/Blocks/custom/column/components/column-options.js +0 -580
  138. package/blocks/init/src/Blocks/custom/column/manifest.json +0 -625
  139. package/blocks/init/src/Blocks/custom/columns/columns-block.js +0 -20
  140. package/blocks/init/src/Blocks/custom/columns/columns.php +0 -21
  141. package/blocks/init/src/Blocks/custom/columns/components/columns-editor.js +0 -81
  142. package/blocks/init/src/Blocks/custom/columns/components/columns-options.js +0 -104
  143. package/blocks/init/src/Blocks/custom/columns/manifest.json +0 -581
  144. package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-editor.js +0 -28
  145. package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-options.js +0 -248
  146. package/blocks/init/src/Blocks/custom/featured-content/featured-content-block.js +0 -13
  147. package/blocks/init/src/Blocks/custom/featured-content/featured-content.php +0 -139
  148. package/blocks/init/src/Blocks/custom/featured-content/manifest.json +0 -131
  149. package/blocks/init/src/Blocks/custom/featured-content/partials/cards.php +0 -39
  150. package/blocks/init/src/Blocks/custom/group/components/group-editor.js +0 -6
  151. package/blocks/init/src/Blocks/custom/group/group-block.js +0 -14
  152. package/blocks/init/src/Blocks/custom/group/group.php +0 -10
  153. package/blocks/init/src/Blocks/custom/group/manifest.json +0 -32
  154. package/blocks/init/src/Blocks/custom/heading/components/heading-editor.js +0 -15
  155. package/blocks/init/src/Blocks/custom/heading/components/heading-options.js +0 -38
  156. package/blocks/init/src/Blocks/custom/heading/heading-block.js +0 -13
  157. package/blocks/init/src/Blocks/custom/heading/heading-transforms.js +0 -26
  158. package/blocks/init/src/Blocks/custom/heading/heading.php +0 -15
  159. package/blocks/init/src/Blocks/custom/heading/manifest.json +0 -79
  160. package/blocks/init/src/Blocks/custom/hero/components/hero-editor.js +0 -12
  161. package/blocks/init/src/Blocks/custom/hero/components/hero-options.js +0 -14
  162. package/blocks/init/src/Blocks/custom/hero/hero-block.js +0 -13
  163. package/blocks/init/src/Blocks/custom/hero/hero.php +0 -11
  164. package/blocks/init/src/Blocks/custom/hero/manifest.json +0 -17
  165. package/blocks/init/src/Blocks/custom/image/components/image-editor.js +0 -12
  166. package/blocks/init/src/Blocks/custom/image/components/image-options.js +0 -14
  167. package/blocks/init/src/Blocks/custom/image/image-block.js +0 -13
  168. package/blocks/init/src/Blocks/custom/image/image.php +0 -11
  169. package/blocks/init/src/Blocks/custom/image/manifest.json +0 -33
  170. package/blocks/init/src/Blocks/custom/list/components/list-editor.js +0 -14
  171. package/blocks/init/src/Blocks/custom/list/components/list-options.js +0 -39
  172. package/blocks/init/src/Blocks/custom/list/list-block.js +0 -13
  173. package/blocks/init/src/Blocks/custom/list/list.php +0 -15
  174. package/blocks/init/src/Blocks/custom/list/manifest.json +0 -58
  175. package/blocks/init/src/Blocks/custom/map/assets/index.js +0 -20
  176. package/blocks/init/src/Blocks/custom/map/assets/map-controller.js +0 -41
  177. package/blocks/init/src/Blocks/custom/map/assets/utils.js +0 -161
  178. package/blocks/init/src/Blocks/custom/map/components/map-components.js +0 -403
  179. package/blocks/init/src/Blocks/custom/map/components/map-editor.js +0 -56
  180. package/blocks/init/src/Blocks/custom/map/components/map-options.js +0 -550
  181. package/blocks/init/src/Blocks/custom/map/manifest.json +0 -79
  182. package/blocks/init/src/Blocks/custom/map/map-block.js +0 -13
  183. package/blocks/init/src/Blocks/custom/map/map.php +0 -52
  184. package/blocks/init/src/Blocks/custom/map/styles.css +0 -2
  185. package/blocks/init/src/Blocks/custom/modal/components/modal-editor.js +0 -90
  186. package/blocks/init/src/Blocks/custom/modal/manifest.json +0 -51
  187. package/blocks/init/src/Blocks/custom/modal/modal-block.js +0 -14
  188. package/blocks/init/src/Blocks/custom/modal/modal.php +0 -20
  189. package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-editor.js +0 -17
  190. package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-options.js +0 -38
  191. package/blocks/init/src/Blocks/custom/paragraph/manifest.json +0 -82
  192. package/blocks/init/src/Blocks/custom/paragraph/paragraph-block.js +0 -13
  193. package/blocks/init/src/Blocks/custom/paragraph/paragraph-transforms.js +0 -46
  194. package/blocks/init/src/Blocks/custom/paragraph/paragraph.php +0 -15
  195. package/blocks/init/src/Blocks/custom/quote/components/quote-editor.js +0 -12
  196. package/blocks/init/src/Blocks/custom/quote/components/quote-options.js +0 -14
  197. package/blocks/init/src/Blocks/custom/quote/manifest.json +0 -17
  198. package/blocks/init/src/Blocks/custom/quote/quote-block.js +0 -13
  199. package/blocks/init/src/Blocks/custom/quote/quote.php +0 -13
  200. package/blocks/init/src/Blocks/custom/share/components/share-editor.js +0 -6
  201. package/blocks/init/src/Blocks/custom/share/components/share-options.js +0 -12
  202. package/blocks/init/src/Blocks/custom/share/manifest.json +0 -19
  203. package/blocks/init/src/Blocks/custom/share/share-block.js +0 -13
  204. package/blocks/init/src/Blocks/custom/share/share.php +0 -11
  205. package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-editor.js +0 -57
  206. package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-options.js +0 -106
  207. package/blocks/init/src/Blocks/custom/site-footer/manifest.json +0 -73
  208. package/blocks/init/src/Blocks/custom/site-footer/site-footer-block.js +0 -13
  209. package/blocks/init/src/Blocks/custom/site-footer/site-footer.php +0 -74
  210. package/blocks/init/src/Blocks/custom/site-navigation/assets/index.js +0 -9
  211. package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-editor.js +0 -42
  212. package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-options.js +0 -73
  213. package/blocks/init/src/Blocks/custom/site-navigation/manifest.json +0 -77
  214. package/blocks/init/src/Blocks/custom/site-navigation/site-navigation-block.js +0 -13
  215. package/blocks/init/src/Blocks/custom/site-navigation/site-navigation.php +0 -99
  216. package/blocks/init/src/Blocks/custom/table-of-contents/assets/index.js +0 -58
  217. package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-editor.js +0 -38
  218. package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-options.js +0 -32
  219. package/blocks/init/src/Blocks/custom/table-of-contents/manifest.json +0 -48
  220. package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents-block.js +0 -13
  221. package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents.php +0 -31
  222. package/blocks/init/src/Blocks/custom/video/components/video-editor.js +0 -6
  223. package/blocks/init/src/Blocks/custom/video/components/video-options.js +0 -12
  224. package/blocks/init/src/Blocks/custom/video/manifest.json +0 -29
  225. package/blocks/init/src/Blocks/custom/video/video-block.js +0 -13
  226. package/blocks/init/src/Blocks/custom/video/video.php +0 -22
  227. package/blocks/init/src/Blocks/manifest.json +0 -32
  228. package/blocks/init/src/Blocks/variations/card-simple/manifest.json +0 -17
  229. package/blocks/init/src/Blocks/wrapper/components/wrapper-editor.js +0 -12
  230. package/blocks/init/src/Blocks/wrapper/components/wrapper-options.js +0 -364
  231. package/blocks/init/src/Blocks/wrapper/manifest.json +0 -459
  232. package/blocks/init/src/Blocks/wrapper/styles-editor.css +0 -13
  233. package/blocks/init/src/Blocks/wrapper/styles.css +0 -19
  234. package/blocks/init/src/Blocks/wrapper/wrapper.js +0 -27
  235. package/blocks/init/src/Blocks/wrapper/wrapper.php +0 -34
@@ -1,248 +0,0 @@
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
- NumberPicker,
9
- OptionSelect,
10
- Spacer,
11
- Toggle,
12
- } from '@eightshift/ui-components';
13
- import { icons } from '@eightshift/ui-components/icons';
14
- import manifest from '../manifest.json';
15
-
16
- export const FeaturedContentOptions = ({ attributes, setAttributes }) => {
17
- const featuredContentPostType = checkAttr('featuredContentPostType', attributes, manifest);
18
- const featuredContentTaxonomy = checkAttr('featuredContentTaxonomy', attributes, manifest, true);
19
- const featuredContentTerms = checkAttr('featuredContentTerms', attributes, manifest) ?? [];
20
- const featuredContentUseCurrentTerm = checkAttr('featuredContentUseCurrentTerm', attributes, manifest);
21
- const featuredContentPosts = checkAttr('featuredContentPosts', attributes, manifest) ?? [];
22
- const featuredContentExcludeCurrentPost = checkAttr('featuredContentExcludeCurrentPost', attributes, manifest);
23
- const featuredContentRandomOrder = checkAttr('featuredContentRandomOrder', attributes, manifest);
24
- const featuredContentLayout = checkAttr('featuredContentLayout', attributes, manifest);
25
- const featuredContentPerPage = checkAttr('featuredContentPerPage', attributes, manifest);
26
-
27
- const allGenericOption = { label: __('Show all', '%g_textdomain%'), value: '_all', separator: 'below' };
28
-
29
- const postTypeOptions = getOption('featuredContentPostType', attributes, manifest);
30
- const taxonomyOptions = [allGenericOption, ...getOption('featuredContentTaxonomy', attributes, manifest)];
31
-
32
- // Set internal store for specific items.
33
- const [useSpecificPosts, setUseSpecificPosts] = useState(featuredContentPosts?.length > 0);
34
- const [useSpecificTerms, setUseSpecificTerms] = useState(featuredContentTerms?.length > 0);
35
-
36
- let termsToShow = '';
37
-
38
- if (featuredContentUseCurrentTerm) {
39
- termsToShow = 'current';
40
- } else {
41
- termsToShow = useSpecificTerms ? 'manual' : 'all';
42
- }
43
-
44
- return (
45
- <>
46
- <OptionSelect
47
- icon={icons.layoutAlt3}
48
- label={__('Layout', '%g_textdomain%')}
49
- value={featuredContentLayout}
50
- onChange={(value) => setAttributes({ [getAttrKey('featuredContentLayout', attributes, manifest)]: value })}
51
- options={getOption('featuredContentLayout', attributes, manifest)}
52
- type='menu'
53
- inline
54
- />
55
-
56
- <NumberPicker
57
- icon={icons.dummySpacer}
58
- label={__('Items per page', '%g_textdomain%')}
59
- value={featuredContentPerPage}
60
- onChange={(value) => setAttributes({ [getAttrKey('featuredContentPerPage', attributes, manifest)]: value })}
61
- min={1}
62
- inline
63
- />
64
-
65
- <Spacer />
66
- <Spacer />
67
-
68
- <OptionSelect
69
- icon={icons.multiple}
70
- label={__('Content type', '%g_textdomain%')}
71
- value={featuredContentPostType?.value}
72
- options={postTypeOptions}
73
- onChange={(rawValue) => {
74
- setUseSpecificPosts(false);
75
- setUseSpecificTerms(false);
76
-
77
- const value = postTypeOptions.find((option) => option.value === rawValue);
78
-
79
- setAttributes({
80
- [getAttrKey('featuredContentPostType', attributes, manifest)]: value,
81
- [getAttrKey('featuredContentTaxonomy', attributes, manifest)]: undefined,
82
- [getAttrKey('featuredContentTerms', attributes, manifest)]: undefined,
83
- [getAttrKey('featuredContentUseCurrentTerm', attributes, manifest)]: false,
84
- [getAttrKey('featuredContentPosts', attributes, manifest)]: undefined,
85
- });
86
- }}
87
- type='menu'
88
- inline
89
- />
90
-
91
- <OptionSelect
92
- aria-label={__('Select items to show', '%g_textdomain%')}
93
- value={useSpecificPosts}
94
- onChange={() => {
95
- setUseSpecificPosts(!useSpecificPosts);
96
- setAttributes({
97
- [getAttrKey('featuredContentPosts', attributes, manifest)]: undefined,
98
- });
99
- }}
100
- options={[
101
- { label: __('Show all posts', '%g_textdomain%'), value: false },
102
- {
103
- label: __('Select posts to show', '%g_textdomain%'),
104
- value: true,
105
- disabled: featuredContentExcludeCurrentPost || featuredContentTaxonomy,
106
- subtitle:
107
- (featuredContentExcludeCurrentPost || featuredContentTaxonomy) &&
108
- __('Unavailable when a taxonomy filter is set', '%g_textdomain%'),
109
- },
110
- ]}
111
- type='radiosSegmented'
112
- vertical
113
- />
114
-
115
- <AnimatedVisibility
116
- noInitial
117
- visible={!useSpecificPosts}
118
- >
119
- <Toggle
120
- icon={icons.excludeItemAlt}
121
- label={__('Exclude current', '%g_textdomain%')}
122
- subtitle={__('Best used with blog posts', '%g_textdomain%')}
123
- checked={featuredContentExcludeCurrentPost}
124
- onChange={(value) =>
125
- setAttributes({ [getAttrKey('featuredContentExcludeCurrentPost', attributes, manifest)]: value })
126
- }
127
- />
128
- </AnimatedVisibility>
129
-
130
- <AnimatedVisibility
131
- noInitial
132
- visible={useSpecificPosts && !featuredContentExcludeCurrentPost}
133
- >
134
- <AsyncMultiSelect
135
- key={featuredContentPostType.value}
136
- help={__(
137
- 'Newest 30 items are shown, others can be selected by searching. If blank, all items are shown.',
138
- '%g_textdomain%',
139
- )}
140
- value={featuredContentPosts}
141
- loadOptions={fetchFromWpRest(featuredContentPostType?.api, {
142
- processLabel: ({ title: { rendered } }) => rendered,
143
- })}
144
- onChange={(value) => setAttributes({ [getAttrKey('featuredContentPosts', attributes, manifest)]: value })}
145
- reFetchOnSearch
146
- />
147
- </AnimatedVisibility>
148
-
149
- <Spacer />
150
-
151
- <Toggle
152
- icon={icons.dice}
153
- label={__('Randomize order', '%g_textdomain%')}
154
- checked={featuredContentRandomOrder}
155
- onChange={(value) => setAttributes({ [getAttrKey('featuredContentRandomOrder', attributes, manifest)]: value })}
156
- />
157
-
158
- <Spacer />
159
- <Spacer />
160
-
161
- <OptionSelect
162
- icon={icons.filter}
163
- label={__('Taxonomy', '%g_textdomain%')}
164
- value={(featuredContentTaxonomy ?? allGenericOption)?.value}
165
- options={taxonomyOptions}
166
- onChange={(rawValue) => {
167
- setUseSpecificPosts(false);
168
- setUseSpecificTerms(false);
169
-
170
- const value =
171
- rawValue === '_all' ? allGenericOption : taxonomyOptions.find((option) => option.value === rawValue);
172
-
173
- setAttributes({
174
- [getAttrKey('featuredContentTaxonomy', attributes, manifest)]:
175
- value === allGenericOption ? undefined : value,
176
- [getAttrKey('featuredContentTerms', attributes, manifest)]: undefined,
177
- [getAttrKey('featuredContentUseCurrentTerm', attributes, manifest)]: false,
178
- [getAttrKey('featuredContentPosts', attributes, manifest)]: undefined,
179
- });
180
- }}
181
- hidden={featuredContentPostType?.taxonomies?.length < 1}
182
- type='menu'
183
- inline
184
- />
185
-
186
- <OptionSelect
187
- aria-label={__('Select terms to show', '%g_textdomain%')}
188
- value={termsToShow}
189
- onChange={(value) => {
190
- setUseSpecificTerms(value === 'manual');
191
- setAttributes({
192
- [getAttrKey('featuredContentTerms', attributes, manifest)]: undefined,
193
- [getAttrKey('featuredContentUseCurrentTerm', attributes, manifest)]: value === 'current',
194
- });
195
- }}
196
- options={[
197
- { label: __('Show all terms', '%g_textdomain%'), value: 'all' },
198
- {
199
- label: __('Select terms to show', '%g_textdomain%'),
200
- value: 'manual',
201
- disabled: (featuredContentTaxonomy ?? allGenericOption)?.value === '_all',
202
- subtitle:
203
- (featuredContentTaxonomy ?? allGenericOption)?.value === '_all' &&
204
- __('Select a taxonomy to enable', '%g_textdomain%'),
205
- },
206
- {
207
- label: __('Show same terms as current post', '%g_textdomain%'),
208
- value: 'current',
209
- },
210
- ]}
211
- type='radiosSegmented'
212
- vertical
213
- />
214
-
215
- <AnimatedVisibility
216
- noInitial
217
- visible={useSpecificTerms && !featuredContentUseCurrentTerm}
218
- >
219
- <AsyncMultiSelect
220
- key={featuredContentTaxonomy?.value}
221
- help={__(
222
- 'Newest 30 items are shown, others can be selected by searching. If blank, all items are shown.',
223
- '%g_textdomain%',
224
- )}
225
- value={featuredContentTerms}
226
- loadOptions={fetchFromWpRest(featuredContentTaxonomy?.api, {
227
- fields: 'id,name',
228
- processId: ({ id }) => id,
229
- processLabel: ({ name }) => name,
230
- })}
231
- onChange={(value) => setAttributes({ [getAttrKey('featuredContentTerms', attributes, manifest)]: value })}
232
- reFetchOnSearch
233
- placeholder={__('Select terms to show', '%g_textdomain%')}
234
- />
235
- </AnimatedVisibility>
236
-
237
- <Spacer />
238
-
239
- <LoadMoreOptions
240
- {...props('loadMore', attributes, {
241
- setAttributes,
242
- })}
243
- label={__('"Load more" button', '%g_textdomain%')}
244
- noUseToggle
245
- />
246
- </>
247
- );
248
- };
@@ -1,13 +0,0 @@
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
- };
@@ -1,139 +0,0 @@
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::tailwindClasses('base', $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::tailwindClasses('loadMoreContainer', $attributes, $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>
@@ -1,131 +0,0 @@
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
- }
@@ -1,39 +0,0 @@
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="" loading="lazy">
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-105"></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
- }
@@ -1,6 +0,0 @@
1
- import { InnerBlocks } from '@wordpress/block-editor';
2
- import { BlockInserter } from '@eightshift/frontend-libs-tailwind/scripts';
3
-
4
- export const GroupEditor = ({ clientId }) => {
5
- return <InnerBlocks renderAppender={() => <BlockInserter clientId={clientId} />} />;
6
- };
@@ -1,14 +0,0 @@
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
- };
@@ -1,10 +0,0 @@
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;
@@ -1,32 +0,0 @@
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
- }
@@ -1,15 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import { tailwindClasses, 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={tailwindClasses(attributes, manifest)}
13
- />
14
- );
15
- };