@eightshift/frontend-libs-tailwind 1.5.0 → 2.0.1

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 (246) hide show
  1. package/.gitattributes +8 -30
  2. package/.github/workflows/ci.yml +2 -1
  3. package/CHANGELOG.md +29 -1
  4. package/bun.lock +1009 -0
  5. package/package.json +16 -26
  6. package/schemas/globalManifest.json +5 -0
  7. package/scripts/components/picker-placeholder.js +1 -1
  8. package/scripts/editor/colors.js +2 -2
  9. package/scripts/editor/options.js +1 -1
  10. package/scripts/editor/registration.js +4 -7
  11. package/scripts/editor/store.js +19 -0
  12. package/scripts/helpers/cookies.js +24 -16
  13. package/scripts/plugins/yoast-seo.js +71 -45
  14. package/webpack/base.mjs +0 -5
  15. package/webpack/helpers.mjs +1 -5
  16. package/webpack/index.mjs +0 -1
  17. package/webpack/project.mjs +0 -5
  18. package/blocks/init/assets/application-admin.js +0 -10
  19. package/blocks/init/assets/application.js +0 -13
  20. package/blocks/init/assets/fonts/fraunces-italic-latin-extended.woff2 +0 -0
  21. package/blocks/init/assets/fonts/fraunces-italic-latin.woff2 +0 -0
  22. package/blocks/init/assets/fonts/fraunces-latin-extended.woff2 +0 -0
  23. package/blocks/init/assets/fonts/fraunces-latin.woff2 +0 -0
  24. package/blocks/init/assets/fonts/noto-sans-italic-latin-extended.woff2 +0 -0
  25. package/blocks/init/assets/fonts/noto-sans-italic-latin.woff2 +0 -0
  26. package/blocks/init/assets/fonts/noto-sans-latin-extended.woff2 +0 -0
  27. package/blocks/init/assets/fonts/noto-sans-latin.woff2 +0 -0
  28. package/blocks/init/assets/images/index.js +0 -5
  29. package/blocks/init/assets/scripts/application-admin.js +0 -7
  30. package/blocks/init/assets/scripts/application.js +0 -3
  31. package/blocks/init/assets/scripts/theme-colors.js +0 -39
  32. package/blocks/init/assets/styles/application-admin.css +0 -6
  33. package/blocks/init/assets/styles/application.css +0 -3
  34. package/blocks/init/src/Blocks/assets/application-blocks-editor.js +0 -14
  35. package/blocks/init/src/Blocks/assets/application-blocks-frontend.js +0 -13
  36. package/blocks/init/src/Blocks/assets/application-blocks.js +0 -9
  37. package/blocks/init/src/Blocks/assets/scripts/application-blocks-editor.js +0 -65
  38. package/blocks/init/src/Blocks/assets/scripts/application-blocks-frontend.js +0 -24
  39. package/blocks/init/src/Blocks/assets/scripts/link-section-editor.js +0 -262
  40. package/blocks/init/src/Blocks/assets/scripts/shared.js +0 -25
  41. package/blocks/init/src/Blocks/assets/styles/application-blocks-editor.css +0 -15
  42. package/blocks/init/src/Blocks/assets/styles/application-blocks-frontend.css +0 -9
  43. package/blocks/init/src/Blocks/assets/styles/application-blocks.css +0 -1
  44. package/blocks/init/src/Blocks/assets/styles/editor/editor-overrides.css +0 -15
  45. package/blocks/init/src/Blocks/assets/styles/fonts.css +0 -90
  46. package/blocks/init/src/Blocks/assets/styles/tailwind.css +0 -30
  47. package/blocks/init/src/Blocks/components/admin-theme-options/admin-theme-options.php +0 -20
  48. package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/index.js +0 -36
  49. package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/pages/parts.js +0 -56
  50. package/blocks/init/src/Blocks/components/admin-theme-options/manifest.json +0 -5
  51. package/blocks/init/src/Blocks/components/button/assets/index.js +0 -22
  52. package/blocks/init/src/Blocks/components/button/button.php +0 -88
  53. package/blocks/init/src/Blocks/components/button/components/button-editor.js +0 -36
  54. package/blocks/init/src/Blocks/components/button/components/button-options.js +0 -134
  55. package/blocks/init/src/Blocks/components/button/manifest.json +0 -302
  56. package/blocks/init/src/Blocks/components/card/card.php +0 -42
  57. package/blocks/init/src/Blocks/components/card/components/card-editor.js +0 -43
  58. package/blocks/init/src/Blocks/components/card/components/card-options.js +0 -55
  59. package/blocks/init/src/Blocks/components/card/manifest.json +0 -111
  60. package/blocks/init/src/Blocks/components/head/head.php +0 -52
  61. package/blocks/init/src/Blocks/components/head/manifest.json +0 -17
  62. package/blocks/init/src/Blocks/components/heading/components/heading-editor.js +0 -26
  63. package/blocks/init/src/Blocks/components/heading/components/heading-options.js +0 -62
  64. package/blocks/init/src/Blocks/components/heading/heading.php +0 -45
  65. package/blocks/init/src/Blocks/components/heading/manifest.json +0 -76
  66. package/blocks/init/src/Blocks/components/hero/components/hero-editor.js +0 -42
  67. package/blocks/init/src/Blocks/components/hero/components/hero-options.js +0 -100
  68. package/blocks/init/src/Blocks/components/hero/hero.php +0 -45
  69. package/blocks/init/src/Blocks/components/hero/manifest.json +0 -96
  70. package/blocks/init/src/Blocks/components/icon/components/icon-editor.js +0 -23
  71. package/blocks/init/src/Blocks/components/icon/components/icon-options.js +0 -65
  72. package/blocks/init/src/Blocks/components/icon/icon.php +0 -53
  73. package/blocks/init/src/Blocks/components/icon/manifest.json +0 -1238
  74. package/blocks/init/src/Blocks/components/image/components/image-editor.js +0 -64
  75. package/blocks/init/src/Blocks/components/image/components/image-options.js +0 -111
  76. package/blocks/init/src/Blocks/components/image/image.php +0 -68
  77. package/blocks/init/src/Blocks/components/image/manifest.json +0 -125
  78. package/blocks/init/src/Blocks/components/list/components/list-editor.js +0 -30
  79. package/blocks/init/src/Blocks/components/list/components/list-options.js +0 -62
  80. package/blocks/init/src/Blocks/components/list/list.php +0 -32
  81. package/blocks/init/src/Blocks/components/list/manifest.json +0 -127
  82. package/blocks/init/src/Blocks/components/load-more/assets/index.js +0 -19
  83. package/blocks/init/src/Blocks/components/load-more/assets/load-more.js +0 -146
  84. package/blocks/init/src/Blocks/components/load-more/components/load-more-editor.js +0 -14
  85. package/blocks/init/src/Blocks/components/load-more/components/load-more-options.js +0 -19
  86. package/blocks/init/src/Blocks/components/load-more/load-more.php +0 -47
  87. package/blocks/init/src/Blocks/components/load-more/manifest.json +0 -39
  88. package/blocks/init/src/Blocks/components/modal/assets/index.js +0 -27
  89. package/blocks/init/src/Blocks/components/modal/manifest.json +0 -48
  90. package/blocks/init/src/Blocks/components/modal/modal.php +0 -46
  91. package/blocks/init/src/Blocks/components/paragraph/components/paragraph-editor.js +0 -38
  92. package/blocks/init/src/Blocks/components/paragraph/components/paragraph-options.js +0 -48
  93. package/blocks/init/src/Blocks/components/paragraph/manifest.json +0 -81
  94. package/blocks/init/src/Blocks/components/paragraph/paragraph.php +0 -33
  95. package/blocks/init/src/Blocks/components/post-header/manifest.json +0 -5
  96. package/blocks/init/src/Blocks/components/post-header/post-header.php +0 -24
  97. package/blocks/init/src/Blocks/components/quote/components/quote-editor.js +0 -53
  98. package/blocks/init/src/Blocks/components/quote/components/quote-options.js +0 -29
  99. package/blocks/init/src/Blocks/components/quote/manifest.json +0 -47
  100. package/blocks/init/src/Blocks/components/quote/quote.php +0 -49
  101. package/blocks/init/src/Blocks/components/share/assets/index.js +0 -39
  102. package/blocks/init/src/Blocks/components/share/components/share-editor.js +0 -28
  103. package/blocks/init/src/Blocks/components/share/components/share-options.js +0 -112
  104. package/blocks/init/src/Blocks/components/share/manifest.json +0 -72
  105. package/blocks/init/src/Blocks/components/share/share.php +0 -69
  106. package/blocks/init/src/Blocks/components/tracking-before-body-end/manifest.json +0 -5
  107. package/blocks/init/src/Blocks/components/tracking-before-body-end/tracking-before-body-end.php +0 -9
  108. package/blocks/init/src/Blocks/components/tracking-head/manifest.json +0 -5
  109. package/blocks/init/src/Blocks/components/tracking-head/tracking-head.php +0 -9
  110. package/blocks/init/src/Blocks/components/video/components/video-editor.js +0 -74
  111. package/blocks/init/src/Blocks/components/video/components/video-options.js +0 -279
  112. package/blocks/init/src/Blocks/components/video/manifest.json +0 -120
  113. package/blocks/init/src/Blocks/components/video/video.php +0 -70
  114. package/blocks/init/src/Blocks/custom/accordion/accordion-block.js +0 -15
  115. package/blocks/init/src/Blocks/custom/accordion/accordion.php +0 -28
  116. package/blocks/init/src/Blocks/custom/accordion/assets/index.js +0 -37
  117. package/blocks/init/src/Blocks/custom/accordion/components/accordion-editor.js +0 -22
  118. package/blocks/init/src/Blocks/custom/accordion/components/accordion-options.js +0 -18
  119. package/blocks/init/src/Blocks/custom/accordion/manifest.json +0 -32
  120. package/blocks/init/src/Blocks/custom/accordion-item/accordion-item-block.js +0 -19
  121. package/blocks/init/src/Blocks/custom/accordion-item/accordion-item.php +0 -46
  122. package/blocks/init/src/Blocks/custom/accordion-item/components/accordion-item-editor.js +0 -60
  123. package/blocks/init/src/Blocks/custom/accordion-item/manifest.json +0 -69
  124. package/blocks/init/src/Blocks/custom/button/button-block.js +0 -13
  125. package/blocks/init/src/Blocks/custom/button/button.php +0 -11
  126. package/blocks/init/src/Blocks/custom/button/components/button-editor.js +0 -12
  127. package/blocks/init/src/Blocks/custom/button/components/button-options.js +0 -12
  128. package/blocks/init/src/Blocks/custom/button/manifest.json +0 -18
  129. package/blocks/init/src/Blocks/custom/card/card-block.js +0 -13
  130. package/blocks/init/src/Blocks/custom/card/card.php +0 -11
  131. package/blocks/init/src/Blocks/custom/card/components/card-editor.js +0 -12
  132. package/blocks/init/src/Blocks/custom/card/components/card-options.js +0 -15
  133. package/blocks/init/src/Blocks/custom/card/manifest.json +0 -18
  134. package/blocks/init/src/Blocks/custom/carousel/assets/index.js +0 -46
  135. package/blocks/init/src/Blocks/custom/carousel/assets/navigation.js +0 -31
  136. package/blocks/init/src/Blocks/custom/carousel/assets/pagination.js +0 -40
  137. package/blocks/init/src/Blocks/custom/carousel/carousel-block.js +0 -21
  138. package/blocks/init/src/Blocks/custom/carousel/carousel.php +0 -61
  139. package/blocks/init/src/Blocks/custom/carousel/components/carousel-editor.js +0 -25
  140. package/blocks/init/src/Blocks/custom/carousel/components/carousel-options.js +0 -47
  141. package/blocks/init/src/Blocks/custom/carousel/manifest.json +0 -130
  142. package/blocks/init/src/Blocks/custom/column/column-block.js +0 -21
  143. package/blocks/init/src/Blocks/custom/column/column-hooks.js +0 -32
  144. package/blocks/init/src/Blocks/custom/column/column.php +0 -21
  145. package/blocks/init/src/Blocks/custom/column/components/column-editor.js +0 -22
  146. package/blocks/init/src/Blocks/custom/column/components/column-options.js +0 -580
  147. package/blocks/init/src/Blocks/custom/column/manifest.json +0 -625
  148. package/blocks/init/src/Blocks/custom/columns/columns-block.js +0 -20
  149. package/blocks/init/src/Blocks/custom/columns/columns.php +0 -21
  150. package/blocks/init/src/Blocks/custom/columns/components/columns-editor.js +0 -81
  151. package/blocks/init/src/Blocks/custom/columns/components/columns-options.js +0 -104
  152. package/blocks/init/src/Blocks/custom/columns/manifest.json +0 -581
  153. package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-editor.js +0 -28
  154. package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-options.js +0 -248
  155. package/blocks/init/src/Blocks/custom/featured-content/featured-content-block.js +0 -13
  156. package/blocks/init/src/Blocks/custom/featured-content/featured-content.php +0 -139
  157. package/blocks/init/src/Blocks/custom/featured-content/manifest.json +0 -131
  158. package/blocks/init/src/Blocks/custom/featured-content/partials/cards.php +0 -39
  159. package/blocks/init/src/Blocks/custom/group/components/group-editor.js +0 -6
  160. package/blocks/init/src/Blocks/custom/group/group-block.js +0 -14
  161. package/blocks/init/src/Blocks/custom/group/group.php +0 -10
  162. package/blocks/init/src/Blocks/custom/group/manifest.json +0 -32
  163. package/blocks/init/src/Blocks/custom/heading/components/heading-editor.js +0 -15
  164. package/blocks/init/src/Blocks/custom/heading/components/heading-options.js +0 -38
  165. package/blocks/init/src/Blocks/custom/heading/heading-block.js +0 -13
  166. package/blocks/init/src/Blocks/custom/heading/heading-transforms.js +0 -26
  167. package/blocks/init/src/Blocks/custom/heading/heading.php +0 -15
  168. package/blocks/init/src/Blocks/custom/heading/manifest.json +0 -79
  169. package/blocks/init/src/Blocks/custom/hero/components/hero-editor.js +0 -12
  170. package/blocks/init/src/Blocks/custom/hero/components/hero-options.js +0 -14
  171. package/blocks/init/src/Blocks/custom/hero/hero-block.js +0 -13
  172. package/blocks/init/src/Blocks/custom/hero/hero.php +0 -11
  173. package/blocks/init/src/Blocks/custom/hero/manifest.json +0 -17
  174. package/blocks/init/src/Blocks/custom/image/components/image-editor.js +0 -12
  175. package/blocks/init/src/Blocks/custom/image/components/image-options.js +0 -14
  176. package/blocks/init/src/Blocks/custom/image/image-block.js +0 -13
  177. package/blocks/init/src/Blocks/custom/image/image.php +0 -11
  178. package/blocks/init/src/Blocks/custom/image/manifest.json +0 -33
  179. package/blocks/init/src/Blocks/custom/list/components/list-editor.js +0 -14
  180. package/blocks/init/src/Blocks/custom/list/components/list-options.js +0 -39
  181. package/blocks/init/src/Blocks/custom/list/list-block.js +0 -13
  182. package/blocks/init/src/Blocks/custom/list/list.php +0 -15
  183. package/blocks/init/src/Blocks/custom/list/manifest.json +0 -58
  184. package/blocks/init/src/Blocks/custom/map/assets/index.js +0 -20
  185. package/blocks/init/src/Blocks/custom/map/assets/map-controller.js +0 -41
  186. package/blocks/init/src/Blocks/custom/map/assets/utils.js +0 -161
  187. package/blocks/init/src/Blocks/custom/map/components/map-components.js +0 -403
  188. package/blocks/init/src/Blocks/custom/map/components/map-editor.js +0 -56
  189. package/blocks/init/src/Blocks/custom/map/components/map-options.js +0 -550
  190. package/blocks/init/src/Blocks/custom/map/manifest.json +0 -79
  191. package/blocks/init/src/Blocks/custom/map/map-block.js +0 -13
  192. package/blocks/init/src/Blocks/custom/map/map.php +0 -52
  193. package/blocks/init/src/Blocks/custom/map/styles.css +0 -2
  194. package/blocks/init/src/Blocks/custom/modal/components/modal-editor.js +0 -90
  195. package/blocks/init/src/Blocks/custom/modal/manifest.json +0 -51
  196. package/blocks/init/src/Blocks/custom/modal/modal-block.js +0 -14
  197. package/blocks/init/src/Blocks/custom/modal/modal.php +0 -20
  198. package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-editor.js +0 -17
  199. package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-options.js +0 -38
  200. package/blocks/init/src/Blocks/custom/paragraph/manifest.json +0 -82
  201. package/blocks/init/src/Blocks/custom/paragraph/paragraph-block.js +0 -13
  202. package/blocks/init/src/Blocks/custom/paragraph/paragraph-transforms.js +0 -46
  203. package/blocks/init/src/Blocks/custom/paragraph/paragraph.php +0 -15
  204. package/blocks/init/src/Blocks/custom/quote/components/quote-editor.js +0 -12
  205. package/blocks/init/src/Blocks/custom/quote/components/quote-options.js +0 -14
  206. package/blocks/init/src/Blocks/custom/quote/manifest.json +0 -17
  207. package/blocks/init/src/Blocks/custom/quote/quote-block.js +0 -13
  208. package/blocks/init/src/Blocks/custom/quote/quote.php +0 -13
  209. package/blocks/init/src/Blocks/custom/share/components/share-editor.js +0 -6
  210. package/blocks/init/src/Blocks/custom/share/components/share-options.js +0 -12
  211. package/blocks/init/src/Blocks/custom/share/manifest.json +0 -19
  212. package/blocks/init/src/Blocks/custom/share/share-block.js +0 -13
  213. package/blocks/init/src/Blocks/custom/share/share.php +0 -11
  214. package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-editor.js +0 -57
  215. package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-options.js +0 -106
  216. package/blocks/init/src/Blocks/custom/site-footer/manifest.json +0 -73
  217. package/blocks/init/src/Blocks/custom/site-footer/site-footer-block.js +0 -13
  218. package/blocks/init/src/Blocks/custom/site-footer/site-footer.php +0 -74
  219. package/blocks/init/src/Blocks/custom/site-navigation/assets/index.js +0 -9
  220. package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-editor.js +0 -42
  221. package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-options.js +0 -73
  222. package/blocks/init/src/Blocks/custom/site-navigation/manifest.json +0 -77
  223. package/blocks/init/src/Blocks/custom/site-navigation/site-navigation-block.js +0 -13
  224. package/blocks/init/src/Blocks/custom/site-navigation/site-navigation.php +0 -99
  225. package/blocks/init/src/Blocks/custom/table-of-contents/assets/index.js +0 -58
  226. package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-editor.js +0 -38
  227. package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-options.js +0 -32
  228. package/blocks/init/src/Blocks/custom/table-of-contents/manifest.json +0 -48
  229. package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents-block.js +0 -13
  230. package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents.php +0 -31
  231. package/blocks/init/src/Blocks/custom/video/components/video-editor.js +0 -6
  232. package/blocks/init/src/Blocks/custom/video/components/video-options.js +0 -12
  233. package/blocks/init/src/Blocks/custom/video/manifest.json +0 -29
  234. package/blocks/init/src/Blocks/custom/video/video-block.js +0 -13
  235. package/blocks/init/src/Blocks/custom/video/video.php +0 -22
  236. package/blocks/init/src/Blocks/manifest.json +0 -32
  237. package/blocks/init/src/Blocks/variations/card-simple/manifest.json +0 -17
  238. package/blocks/init/src/Blocks/wrapper/components/wrapper-editor.js +0 -12
  239. package/blocks/init/src/Blocks/wrapper/components/wrapper-options.js +0 -364
  240. package/blocks/init/src/Blocks/wrapper/manifest.json +0 -459
  241. package/blocks/init/src/Blocks/wrapper/styles-editor.css +0 -13
  242. package/blocks/init/src/Blocks/wrapper/styles.css +0 -19
  243. package/blocks/init/src/Blocks/wrapper/wrapper.js +0 -27
  244. package/blocks/init/src/Blocks/wrapper/wrapper.php +0 -34
  245. package/bun.lockb +0 -0
  246. package/readme/packages.md +0 -74
@@ -1,22 +0,0 @@
1
- import domReady from '@wordpress/dom-ready';
2
-
3
- domReady(() => {
4
- const elements = document.querySelectorAll('.button[href^="#"]');
5
-
6
- if (!elements.length) {
7
- return;
8
- }
9
-
10
- elements.forEach((element) => {
11
- element.addEventListener('click', (event) => {
12
- event.preventDefault();
13
- const target = document.querySelector(event.currentTarget.getAttribute('href'));
14
-
15
- window.scrollTo({
16
- top: target.offsetTop,
17
- left: 0,
18
- behavior: 'smooth',
19
- });
20
- });
21
- });
22
- });
@@ -1,88 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Button 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
- $buttonUse = Helpers::checkAttr('buttonUse', $attributes, $manifest);
14
-
15
- if (!$buttonUse) {
16
- return;
17
- }
18
-
19
- $additionalClass = $attributes['additionalClass'] ?? '';
20
- $additionalAttributes = $attributes['additionalAttributes'] ?? [];
21
- $buttonId = Helpers::checkAttr('buttonId', $attributes, $manifest);
22
- $buttonType = Helpers::checkAttr('buttonType', $attributes, $manifest);
23
-
24
- $buttonUrl = Helpers::checkAttr('buttonUrl', $attributes, $manifest);
25
- $buttonIsNewTab = Helpers::checkAttr('buttonIsNewTab', $attributes, $manifest);
26
-
27
- $buttonContent = Helpers::checkAttr('buttonContent', $attributes, $manifest);
28
-
29
- $buttonAriaLabel = Helpers::checkAttr('buttonAriaLabel', $attributes, $manifest);
30
-
31
- $buttonIconUse = Helpers::checkAttr('buttonIconUse', $attributes, $manifest);
32
-
33
- $buttonAttrs = [];
34
-
35
- if (!$buttonIconUse && empty($buttonContent)) {
36
- return;
37
- }
38
-
39
- if (!empty($additionalAttributes)) {
40
- $buttonAttrs = $additionalAttributes;
41
- }
42
-
43
- if (!empty($buttonUrl)) {
44
- $buttonAttrs['href'] = $buttonUrl;
45
- }
46
-
47
- if ($buttonIsNewTab) {
48
- $buttonAttrs['target'] = '_blank';
49
- $buttonAttrs['rel'] = 'noopener noreferrer';
50
- }
51
-
52
- if (!empty($buttonId)) {
53
- $buttonAttrs['id'] = $buttonId;
54
- }
55
-
56
- if (!empty($buttonAriaLabel)) {
57
- $buttonAttrs['aria-label'] = $buttonAriaLabel;
58
- }
59
-
60
- $buttonAttrs['class'] = Helpers::tailwindClasses('base', $attributes, $manifest, 'button', $additionalClass);
61
-
62
- $buttonTag = !empty($buttonUrl) ? 'a' : 'button';
63
-
64
- if (empty($buttonUrl) && !empty($buttonType)) {
65
- $buttonAttrs['type'] = $buttonType;
66
- }
67
- ?>
68
-
69
- <<?php echo $buttonTag; // phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped ?>
70
- <?php
71
- foreach ($buttonAttrs as $key => $value) {
72
- if (empty($key) && empty($value)) {
73
- continue;
74
- }
75
-
76
- // phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
77
- echo "{$key}=" . '"' . esc_attr($value) . '"';
78
- }
79
- ?>
80
- >
81
- <?php
82
- echo Helpers::render('icon', Helpers::props('icon', $attributes));
83
- ?>
84
-
85
- <?php if (!empty($buttonContent)) { ?>
86
- <span><?php echo esc_html($buttonContent); ?></span>
87
- <?php } ?>
88
- </<?php echo $buttonTag; // phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped ?>>
@@ -1,36 +0,0 @@
1
- import { __ } from '@wordpress/i18n';
2
- import { RichText } from '@wordpress/block-editor';
3
- import { checkAttr, getAttrKey, tailwindClasses, props } from '@eightshift/frontend-libs-tailwind/scripts';
4
- import { IconEditor } from '../../icon/components/icon-editor';
5
- import manifest from './../manifest.json';
6
-
7
- export const ButtonEditor = (attributes) => {
8
- const { componentClass } = manifest;
9
-
10
- const { setAttributes, additionalClass, placeholder = __('Add content', '%g_textdomain%') } = attributes;
11
-
12
- const buttonContent = checkAttr('buttonContent', attributes, manifest);
13
- const buttonUse = checkAttr('buttonUse', attributes, manifest);
14
-
15
- if (!buttonUse) {
16
- return null;
17
- }
18
-
19
- return (
20
- <div className={tailwindClasses(attributes, manifest, additionalClass)}>
21
- <IconEditor
22
- {...props('icon', attributes, {
23
- blockClass: componentClass,
24
- })}
25
- />
26
-
27
- <RichText
28
- placeholder={placeholder}
29
- value={buttonContent}
30
- onChange={(value) => setAttributes({ [getAttrKey('buttonContent', attributes, manifest)]: value })}
31
- keepPlaceholderOnFocus
32
- allowedFormats={[]}
33
- />
34
- </div>
35
- );
36
- };
@@ -1,134 +0,0 @@
1
- import { __ } from '@wordpress/i18n';
2
- import {
3
- getOption,
4
- checkAttr,
5
- getAttrKey,
6
- props,
7
- getOptions,
8
- wpSearchRoute,
9
- getHiddenOptions,
10
- } from '@eightshift/frontend-libs-tailwind/scripts';
11
- import { IconOptions } from '../../icon/components/icon-options';
12
- import {
13
- ButtonGroup,
14
- ColorPicker,
15
- ComponentToggle,
16
- HStack,
17
- InputField,
18
- LinkInput,
19
- OptionSelect,
20
- Spacer,
21
- Toggle,
22
- } from '@eightshift/ui-components';
23
- import { icons } from '@eightshift/ui-components/icons';
24
- import { upperFirst } from '@eightshift/ui-components/utilities';
25
- import manifest from './../manifest.json';
26
-
27
- export const ButtonOptions = (attributes) => {
28
- const { setAttributes, hideOptions, ...rest } = attributes;
29
-
30
- const hiddenOptions = getHiddenOptions(hideOptions);
31
-
32
- const buttonId = checkAttr('buttonId', attributes, manifest);
33
- const buttonAriaLabel = checkAttr('buttonAriaLabel', attributes, manifest);
34
- const buttonUrl = checkAttr('buttonUrl', attributes, manifest);
35
- const buttonIsAnchor = checkAttr('buttonIsAnchor', attributes, manifest);
36
- const buttonIsNewTab = checkAttr('buttonIsNewTab', attributes, manifest);
37
- const buttonVariant = checkAttr('buttonVariant', attributes, manifest);
38
- const buttonColor = checkAttr('buttonColor', attributes, manifest);
39
- const buttonUse = checkAttr('buttonUse', attributes, manifest);
40
-
41
- return (
42
- <ComponentToggle
43
- label={manifest.title}
44
- icon={icons.buttonOutline}
45
- onChange={(value) => setAttributes({ [getAttrKey('buttonUse', attributes, manifest)]: value })}
46
- useComponent={buttonUse}
47
- {...rest}
48
- >
49
- <HStack hidden={hiddenOptions?.variant && hiddenOptions?.color && hiddenOptions?.icon}>
50
- <ButtonGroup hidden={hiddenOptions?.variant && hiddenOptions?.color}>
51
- <OptionSelect
52
- aria-label={__('Style', '%g_textdomain%')}
53
- value={buttonVariant}
54
- onChange={(value) => setAttributes({ [getAttrKey('buttonVariant', attributes, manifest)]: value })}
55
- options={getOption('buttonVariant', attributes, manifest)}
56
- type='menu'
57
- hidden={hiddenOptions?.variant}
58
- />
59
-
60
- <ColorPicker
61
- aria-label={__('Color', '%g_textdomain%')}
62
- value={buttonColor}
63
- onChange={(value) => setAttributes({ [getAttrKey('buttonColor', attributes, manifest)]: value })}
64
- colors={getOption(`buttonColor${upperFirst(buttonVariant)}`, attributes, manifest, true)}
65
- hidden={hiddenOptions?.color}
66
- />
67
- </ButtonGroup>
68
-
69
- <IconOptions
70
- {...props('icon', attributes, {
71
- options: getOptions(attributes, manifest),
72
- })}
73
- hidden={hiddenOptions?.icon}
74
- hideOptions='size'
75
- design='compactLabel'
76
- />
77
- </HStack>
78
-
79
- <Spacer hidden={hiddenOptions?.link} />
80
-
81
- <LinkInput
82
- icon={buttonIsAnchor ? icons.globeAnchor : icons.globe}
83
- url={buttonUrl}
84
- onChange={({ url, isAnchor }) => {
85
- setAttributes({
86
- [getAttrKey('buttonUrl', attributes, manifest)]: url,
87
- [getAttrKey('buttonIsAnchor', attributes, manifest)]: isAnchor ?? false,
88
- });
89
- }}
90
- fetchSuggestions={wpSearchRoute}
91
- hidden={hiddenOptions?.link}
92
- />
93
-
94
- <Toggle
95
- icon={icons.newTab}
96
- label={__('Open in new tab', '%g_textdomain%')}
97
- checked={buttonIsNewTab}
98
- onChange={(value) => setAttributes({ [getAttrKey('buttonIsNewTab', attributes, manifest)]: value })}
99
- hidden={hiddenOptions?.link || hiddenOptions?.newTab}
100
- />
101
-
102
- <Spacer hidden={hiddenOptions?.ariaLabel} />
103
- <Spacer
104
- icon={icons.a11y}
105
- text={__('Accessibility', '%g_textdomain%')}
106
- border
107
- hidden={hiddenOptions?.ariaLabel}
108
- />
109
- <InputField
110
- icon={icons.ariaLabel}
111
- label={__('ARIA label', '%g_textdomain%')}
112
- value={buttonAriaLabel}
113
- onChange={(value) => setAttributes({ [getAttrKey('buttonAriaLabel', attributes, manifest)]: value })}
114
- help={__('Description of the button.', '%g_textdomain%')}
115
- hidden={hiddenOptions?.ariaLabel}
116
- />
117
-
118
- <Spacer hidden={hiddenOptions?.uniqueId} />
119
- <Spacer
120
- icon={icons.pointerHand}
121
- text={__('Advanced', '%g_textdomain%')}
122
- border
123
- hidden={hiddenOptions?.uniqueId}
124
- />
125
- <InputField
126
- icon={icons.id}
127
- label={__('Unique identifier', '%g_textdomain%')}
128
- value={buttonId}
129
- onChange={(value) => setAttributes({ [getAttrKey('buttonId', attributes, manifest)]: value })}
130
- hidden={hiddenOptions?.uniqueId}
131
- />
132
- </ComponentToggle>
133
- );
134
- };
@@ -1,302 +0,0 @@
1
- {
2
- "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
3
- "componentName": "button",
4
- "title": "Button",
5
- "componentClass": "btn",
6
- "example": {
7
- "attributes": {
8
- "buttonContent": "This is a button",
9
- "buttonUrl": "https://eightshift.com/",
10
- "buttonId": "custom ID"
11
- }
12
- },
13
- "attributes": {
14
- "buttonContent": {
15
- "type": "string"
16
- },
17
- "buttonUrl": {
18
- "type": "string"
19
- },
20
- "buttonId": {
21
- "type": "string"
22
- },
23
- "buttonType": {
24
- "type": "string"
25
- },
26
- "buttonColor": {
27
- "type": "string",
28
- "default": "navy-500"
29
- },
30
- "buttonVariant": {
31
- "type": "string",
32
- "default": "primary"
33
- },
34
- "buttonSize": {
35
- "type": "string",
36
- "default": "base"
37
- },
38
- "buttonIsAnchor": {
39
- "type": "boolean",
40
- "default": false
41
- },
42
- "buttonIsNewTab": {
43
- "type": "boolean",
44
- "default": false
45
- },
46
- "buttonAriaLabel": {
47
- "type": "string"
48
- },
49
- "buttonUse": {
50
- "type": "boolean",
51
- "default": true
52
- },
53
- "buttonIconUse": {
54
- "type": "boolean",
55
- "default": false
56
- }
57
- },
58
- "components": {
59
- "icon": "icon"
60
- },
61
- "options": {
62
- "buttonVariant": [
63
- {
64
- "label": "Primary",
65
- "value": "primary",
66
- "icon": "buttonFilled"
67
- },
68
- {
69
- "label": "Secondary",
70
- "value": "secondary",
71
- "icon": "buttonOutline"
72
- },
73
- {
74
- "label": "Link",
75
- "value": "link",
76
- "icon": "link"
77
- }
78
- ],
79
- "buttonSize": [
80
- {
81
- "label": "Regular",
82
- "value": "base"
83
- },
84
- {
85
- "label": "Small",
86
- "value": "sm"
87
- }
88
- ],
89
- "buttonColorPrimary": [
90
- "navy-100",
91
- "navy-500",
92
- "navy-800",
93
- "red-100",
94
- "red-500",
95
- "red-800",
96
- "gray-100",
97
- "gray-500",
98
- "gray-800"
99
- ],
100
- "buttonColorSecondary": [
101
- "navy-100",
102
- "navy-800",
103
- "red-100",
104
- "red-800",
105
- "gray-100",
106
- "gray-500",
107
- "gray-800"
108
- ],
109
- "buttonColorLink": [
110
- "black",
111
- "white",
112
- "red-500",
113
- "navy-500"
114
- ]
115
- },
116
- "tailwind": {
117
- "base": {
118
- "twClasses": "font-sans transition duration-300 inline-flex items-center focus-visible:ring focus:outline-none text-sm disabled:shadow-none disabled:grayscale disabled:cursor-default disabled:opacity-85"
119
- },
120
- "options": {
121
- "buttonVariant": {
122
- "twClasses": {
123
- "primary": "border shadow hover:shadow-md bg-gradient-to-br [&>svg]:size-6 gap-2",
124
- "secondary": "border [&>svg]:size-6 gap-2",
125
- "link": "leading-tight rounded-sm underline cursor-pointer underline-offset-1 decoration-[1.5px] [&>svg]:size-4 gap-1 hover:ring-4"
126
- }
127
- }
128
- },
129
- "combinations": [
130
- {
131
- "attributes": {
132
- "buttonVariant": [
133
- "primary",
134
- "secondary"
135
- ],
136
- "buttonSize": "base"
137
- },
138
- "twClasses": "~pr-3/4 ~pl-2.5/3.5 ~py-2/3 ~rounded-lg/xl"
139
- },
140
- {
141
- "attributes": {
142
- "buttonVariant": [
143
- "primary",
144
- "secondary"
145
- ],
146
- "buttonSize": "sm"
147
- },
148
- "twClasses": "~pr-1/2 ~pl-1.5/2.5 ~py-1/1.5 ~rounded-md/lg"
149
- },
150
- {
151
- "attributes": {
152
- "buttonVariant": [
153
- "primary",
154
- "secondary"
155
- ],
156
- "buttonSize": "square"
157
- },
158
- "twClasses": "size-14 sm:size-9 rounded-full sm:[&>svg]:size-5 justify-center"
159
- },
160
- {
161
- "attributes": {
162
- "buttonColor": "navy-100",
163
- "buttonVariant": "primary"
164
- },
165
- "twClasses": "from-navy-100 to-navy-200 text-navy-950 border-navy-200 hover:border-navy-200 focus-visible:ring-navy-500/30"
166
- },
167
- {
168
- "attributes": {
169
- "buttonColor": "navy-500",
170
- "buttonVariant": "primary"
171
- },
172
- "twClasses": "from-navy-500 to-navy-600 text-navy-50 border-navy-500 hover:border-navy-600 focus-visible:ring-navy-500/30"
173
- },
174
- {
175
- "attributes": {
176
- "buttonColor": "navy-800",
177
- "buttonVariant": "primary"
178
- },
179
- "twClasses": "from-navy-700 to-navy-800 text-navy-50 border-navy-800 hover:border-navy-900 focus-visible:ring-navy-500/30"
180
- },
181
- {
182
- "attributes": {
183
- "buttonColor": "red-100",
184
- "buttonVariant": "primary"
185
- },
186
- "twClasses": "from-red-100 to-red-200 text-red-950 border-red-200 hover:border-red-300 focus-visible:ring-red-500/30"
187
- },
188
- {
189
- "attributes": {
190
- "buttonColor": "red-500",
191
- "buttonVariant": "primary"
192
- },
193
- "twClasses": "from-red-500 to-red-600 text-red-50 border-red-500 hover:border-red-600 focus-visible:ring-red-500/30"
194
- },
195
- {
196
- "attributes": {
197
- "buttonColor": "red-800",
198
- "buttonVariant": "primary"
199
- },
200
- "twClasses": "from-red-700 to-red-800 text-red-50 border-red-800 hover:border-red-900 focus-visible:ring-red-500/30"
201
- },
202
- {
203
- "attributes": {
204
- "buttonColor": "gray-100",
205
- "buttonVariant": "primary"
206
- },
207
- "twClasses": "from-gray-100 to-gray-200 text-gray-950 border-gray-200 hover:border-gray-300 focus-visible:ring-gray-500/30"
208
- },
209
- {
210
- "attributes": {
211
- "buttonColor": "gray-500",
212
- "buttonVariant": "primary"
213
- },
214
- "twClasses": "from-gray-500 to-gray-600 text-gray-50 border-gray-500 hover:border-gray-600 focus-visible:ring-gray-500/30"
215
- },
216
- {
217
- "attributes": {
218
- "buttonColor": "gray-800",
219
- "buttonVariant": "primary"
220
- },
221
- "twClasses": "from-gray-700 to-gray-800 text-gray-50 border-gray-800 hover:border-gray-900 focus-visible:ring-gray-500/30"
222
- },
223
- {
224
- "attributes": {
225
- "buttonColor": "navy-100",
226
- "buttonVariant": "secondary"
227
- },
228
- "twClasses": "text-navy-100 border-navy-100 focus-visible:ring-navy-500/30 hover:bg-navy-100 hover:text-navy-950"
229
- },
230
- {
231
- "attributes": {
232
- "buttonColor": "navy-800",
233
- "buttonVariant": "secondary"
234
- },
235
- "twClasses": "text-navy-800 border-navy-800 focus-visible:ring-navy-500/30 hover:bg-navy-800 hover:text-navy-50"
236
- },
237
- {
238
- "attributes": {
239
- "buttonColor": "red-100",
240
- "buttonVariant": "secondary"
241
- },
242
- "twClasses": "text-red-100 border-red-100 focus-visible:ring-red-500/30 hover:bg-red-100 hover:text-red-950"
243
- },
244
- {
245
- "attributes": {
246
- "buttonColor": "red-800",
247
- "buttonVariant": "secondary"
248
- },
249
- "twClasses": "text-red-800 border-red-800 focus-visible:ring-red-500/30 hover:bg-red-800 hover:text-red-50"
250
- },
251
- {
252
- "attributes": {
253
- "buttonColor": "gray-100",
254
- "buttonVariant": "secondary"
255
- },
256
- "twClasses": "text-gray-100 border-gray-100 focus-visible:ring-gray-500/30 hover:bg-gray-100 hover:text-gray-950"
257
- },
258
- {
259
- "attributes": {
260
- "buttonColor": "gray-500",
261
- "buttonVariant": "secondary"
262
- },
263
- "twClasses": "text-gray-500 border-gray-500 focus-visible:ring-gray-500/30 hover:bg-gray-500 hover:text-white"
264
- },
265
- {
266
- "attributes": {
267
- "buttonColor": "gray-800",
268
- "buttonVariant": "secondary"
269
- },
270
- "twClasses": "text-gray-800 border-gray-800 focus-visible:ring-gray-500/30 hover:bg-gray-800 hover:text-gray-50"
271
- },
272
- {
273
- "attributes": {
274
- "buttonColor": "black",
275
- "buttonVariant": "link"
276
- },
277
- "twClasses": "text-gray-950 decoration-gray-500 hover:bg-gray-100 focus-visible:ring-gray-500/30 hover:ring-gray-100"
278
- },
279
- {
280
- "attributes": {
281
- "buttonColor": "white",
282
- "buttonVariant": "link"
283
- },
284
- "twClasses": "text-gray-50 decoration-gray-100 hover:bg-gray-100 focus-visible:ring-gray-500/30 hover:ring-gray-100 hover:text-gray-950 hover:decoration-gray-400"
285
- },
286
- {
287
- "attributes": {
288
- "buttonColor": "red-500",
289
- "buttonVariant": "link"
290
- },
291
- "twClasses": "text-current decoration-red-500 hover:bg-red-50 focus-visible:ring-red-500/30 hover:ring-red-50"
292
- },
293
- {
294
- "attributes": {
295
- "buttonColor": "navy-500",
296
- "buttonVariant": "link"
297
- },
298
- "twClasses": "text-current decoration-navy-500 hover:bg-navy-50 focus-visible:ring-navy-500/30 hover:ring-navy-50"
299
- }
300
- ]
301
- }
302
- }
@@ -1,42 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Card 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
-
15
- <div class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass)); ?>" >
16
- <?php
17
- echo Helpers::render('image', Helpers::props('image', $attributes, [
18
- 'additionalClass' => [
19
- 'image' => Helpers::tailwindClasses('image', $attributes, $manifest),
20
- 'picture' => Helpers::tailwindClasses('imagePicture', $attributes, $manifest),
21
- ]
22
- ]));
23
- ?>
24
-
25
- <div class="<?php echo esc_attr(Helpers::tailwindClasses('content-container', $attributes, $manifest)); ?>">
26
- <?php
27
- echo Helpers::render('paragraph', Helpers::props('intro', $attributes, [
28
- 'additionalClass' => Helpers::tailwindClasses('intro', $attributes, $manifest),
29
- ])),
30
-
31
- Helpers::render('heading', Helpers::props('heading', $attributes)),
32
-
33
- Helpers::render('paragraph', Helpers::props('paragraph', $attributes, [
34
- 'additionalClass' => Helpers::tailwindClasses('text', $attributes, $manifest),
35
- ])),
36
-
37
- Helpers::render('button', Helpers::props('button', $attributes, [
38
- 'additionalClass' => Helpers::tailwindClasses('button', $attributes, $manifest),
39
- ]));
40
- ?>
41
- </div>
42
- </div>
@@ -1,43 +0,0 @@
1
- import { props, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
2
- import { ImageEditor } from '../../image/components/image-editor';
3
- import { HeadingEditor } from '../../heading/components/heading-editor';
4
- import { ParagraphEditor } from '../../paragraph/components/paragraph-editor';
5
- import { ButtonEditor } from '../../button/components/button-editor';
6
- import manifest from './../manifest.json';
7
-
8
- export const CardEditor = (attributes) => {
9
- const { additionalClass } = attributes;
10
-
11
- return (
12
- <div className={tailwindClasses(attributes, manifest, additionalClass)}>
13
- <ImageEditor
14
- {...props('image', attributes, {
15
- additionalClass: {
16
- image: tailwindClasses('image', attributes, manifest),
17
- picture: tailwindClasses('imagePicture', attributes, manifest),
18
- imagePlaceholder:
19
- '!border-x-0 !border-t-0 !border-solid !w-full !h-auto aspect-3/2 [&_svg]:!size-12 border-b !rounded-none bg-gray-100 !border-b-gray-200',
20
- },
21
- })}
22
- />
23
-
24
- <div className={tailwindClasses('content-container', attributes, manifest)}>
25
- <ParagraphEditor
26
- {...props('intro', attributes, {
27
- additionalClass: tailwindClasses('intro', attributes, manifest),
28
- })}
29
- />
30
-
31
- <HeadingEditor {...props('heading', attributes)} />
32
-
33
- <ParagraphEditor
34
- {...props('paragraph', attributes, { additionalClass: tailwindClasses('text', attributes, manifest) })}
35
- />
36
-
37
- <ButtonEditor
38
- {...props('button', attributes, { additionalClass: tailwindClasses('button', attributes, manifest) })}
39
- />
40
- </div>
41
- </div>
42
- );
43
- };