@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,32 @@
1
+ import { __ } from '@wordpress/i18n';
2
+ import { checkAttr, getAttrKey } from '@eightshift/frontend-libs-tailwind/scripts';
3
+ import { BaseControl, Checkbox } from '@eightshift/ui-components';
4
+ import { icons } from '@eightshift/ui-components/icons';
5
+ import manifest from '../manifest.json';
6
+
7
+ export const TableOfContentsOptions = ({ attributes, setAttributes }) => {
8
+ const tableOfContentsHeadingLevels = checkAttr('tableOfContentsHeadingLevels', attributes, manifest);
9
+
10
+ return (
11
+ <BaseControl
12
+ icon={icons.headingLevelAlt}
13
+ label={__('Include', '%g_textdomain%')}
14
+ >
15
+ {Object.keys(tableOfContentsHeadingLevels).map((level, i, arr) => {
16
+ return (
17
+ <Checkbox
18
+ key={i}
19
+ checked={tableOfContentsHeadingLevels[level]}
20
+ label={level.replace('h', __('Heading', '%g_textdomain%') + ' ')}
21
+ onChange={(value) => {
22
+ const newValue = { ...tableOfContentsHeadingLevels };
23
+ newValue[level] = value;
24
+
25
+ setAttributes({ [getAttrKey('tableOfContentsHeadingLevels', attributes, manifest)]: newValue });
26
+ }}
27
+ />
28
+ );
29
+ })}
30
+ </BaseControl>
31
+ );
32
+ };
@@ -0,0 +1,48 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/block.json",
3
+ "blockName": "table-of-contents",
4
+ "title": "Table of contents",
5
+ "description": "Display the structure of the current post.",
6
+ "category": "eightshift",
7
+ "icon": {
8
+ "src": "es-table-of-contents"
9
+ },
10
+ "keywords": [
11
+ "table",
12
+ "of",
13
+ "contents",
14
+ "toc"
15
+ ],
16
+ "example": {
17
+ "attributes": {
18
+ "tableOfContentsParagraphContent": "Contents"
19
+ }
20
+ },
21
+ "attributes": {
22
+ "tableOfContentsHeadingLevels": {
23
+ "type": "object",
24
+ "default": {
25
+ "h1": false,
26
+ "h2": true,
27
+ "h3": true,
28
+ "h4": true,
29
+ "h5": true,
30
+ "h6": true
31
+ }
32
+ },
33
+ "tableOfContentsDescription": {
34
+ "type": "string",
35
+ "default": "In this article"
36
+ }
37
+ },
38
+ "tailwind": {
39
+ "parts": {
40
+ "container": {
41
+ "twClasses": "pl-2 py-2 border-l border-l-gray-300"
42
+ },
43
+ "description": {
44
+ "twClasses": "font-display ~text-xl/2xl text-gray-500 mb-1"
45
+ }
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,13 @@
1
+ import { TableOfContentsEditor } from './components/table-of-contents-editor';
2
+ import { TableOfContentsOptions } from './components/table-of-contents-options';
3
+ import { GutenbergBlock } from '@eightshift/frontend-libs-tailwind/scripts';
4
+
5
+ export const TableOfContents = (props) => {
6
+ return (
7
+ <GutenbergBlock
8
+ {...props}
9
+ options={TableOfContentsOptions}
10
+ editor={TableOfContentsEditor}
11
+ />
12
+ );
13
+ };
@@ -0,0 +1,31 @@
1
+ <?php
2
+
3
+ /**
4
+ * Table of contents 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
+ $blockClass = $attributes['blockClass'] ?? '';
14
+ $blockJsClass = $attributes['blockJsClass'] ?? '';
15
+
16
+ $tocClass = Helpers::classnames([
17
+ Helpers::getTwPart('container', $manifest),
18
+ $blockJsClass,
19
+ ]);
20
+
21
+ $tableOfContentsHeadingLevels = Helpers::checkAttr('tableOfContentsHeadingLevels', $attributes, $manifest);
22
+ $tableOfContentsDescription = Helpers::checkAttr('tableOfContentsDescription', $attributes, $manifest);
23
+
24
+ $headingLevelsToUse = implode(',', array_keys(array_filter($tableOfContentsHeadingLevels, fn($v) => $v)));
25
+ ?>
26
+
27
+ <div class="<?php echo esc_attr($tocClass); ?>" data-levels="<?php echo esc_attr($headingLevelsToUse); ?>">
28
+ <p class="<?php echo esc_attr(Helpers::getTwPart('description', $manifest)); ?>">
29
+ <?php echo esc_attr($tableOfContentsDescription); ?>
30
+ </p>
31
+ </div>
@@ -0,0 +1,6 @@
1
+ import { props } from '@eightshift/frontend-libs-tailwind/scripts';
2
+ import { VideoEditor as EditorComponent } from '../../../components/video/components/video-editor';
3
+
4
+ export const VideoEditor = ({ attributes, setAttributes }) => {
5
+ return <EditorComponent {...props('video', attributes, { setAttributes })} />;
6
+ };
@@ -0,0 +1,12 @@
1
+ import { __ } from '@wordpress/i18n';
2
+ import { props } from '@eightshift/frontend-libs-tailwind/scripts';
3
+ import { VideoOptions as OptionsComponent } from '../../../components/video/components/video-options';
4
+
5
+ export const VideoOptions = ({ attributes, setAttributes }) => {
6
+ return (
7
+ <OptionsComponent
8
+ {...props('video', attributes, { setAttributes })}
9
+ controlOnly
10
+ />
11
+ );
12
+ };
@@ -0,0 +1,105 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/block.json",
3
+ "blockName": "video",
4
+ "title": "Video",
5
+ "description" : "Showcase a video from the Media library.",
6
+ "category": "eightshift",
7
+ "icon": {
8
+ "src": "es-video"
9
+ },
10
+ "keywords": [
11
+ "video",
12
+ "picture",
13
+ "img"
14
+ ],
15
+ "components": {
16
+ "video": "video"
17
+ },
18
+ "example": {
19
+ "attributes": {
20
+ "videoAlign": "center center"
21
+ }
22
+ },
23
+ "attributes": {
24
+ "videoAlign": {
25
+ "type": "string",
26
+ "default": "center center"
27
+ }
28
+ },
29
+ "variables": {
30
+ "videoAlign": {
31
+ "top left": [
32
+ {
33
+ "variable": {
34
+ "block-video-align-horizontal": "flex-start",
35
+ "block-video-align-vertical": "flex-start"
36
+ }
37
+ }
38
+ ],
39
+ "top center": [
40
+ {
41
+ "variable": {
42
+ "block-video-align-horizontal": "center",
43
+ "block-video-align-vertical": "flex-start"
44
+ }
45
+ }
46
+ ],
47
+ "top right": [
48
+ {
49
+ "variable": {
50
+ "block-video-align-horizontal": "flex-end",
51
+ "block-video-align-vertical": "flex-start"
52
+ }
53
+ }
54
+ ],
55
+ "center left": [
56
+ {
57
+ "variable": {
58
+ "block-video-align-horizontal": "flex-start",
59
+ "block-video-align-vertical": "center"
60
+ }
61
+ }
62
+ ],
63
+ "center center": [
64
+ {
65
+ "variable": {
66
+ "block-video-align-horizontal": "center",
67
+ "block-video-align-vertical": "center"
68
+ }
69
+ }
70
+ ],
71
+ "center right": [
72
+ {
73
+ "variable": {
74
+ "block-video-align-horizontal": "flex-end",
75
+ "block-video-align-vertical": "center"
76
+ }
77
+ }
78
+ ],
79
+ "bottom left": [
80
+ {
81
+ "variable": {
82
+ "block-video-align-horizontal": "flex-start",
83
+ "block-video-align-vertical": "flex-end"
84
+ }
85
+ }
86
+ ],
87
+ "bottom center": [
88
+ {
89
+ "variable": {
90
+ "block-video-align-horizontal": "center",
91
+ "block-video-align-vertical": "flex-end"
92
+ }
93
+ }
94
+ ],
95
+ "bottom right": [
96
+ {
97
+ "variable": {
98
+ "block-video-align-horizontal": "flex-end",
99
+ "block-video-align-vertical": "flex-end"
100
+ }
101
+ }
102
+ ]
103
+ }
104
+ }
105
+ }
@@ -0,0 +1,13 @@
1
+ import { VideoEditor } from './components/video-editor';
2
+ import { VideoOptions } from './components/video-options';
3
+ import { GutenbergBlock } from '@eightshift/frontend-libs-tailwind/scripts';
4
+
5
+ export const Video = (props) => {
6
+ return (
7
+ <GutenbergBlock
8
+ {...props}
9
+ options={VideoOptions}
10
+ editor={VideoEditor}
11
+ />
12
+ );
13
+ };
@@ -0,0 +1,22 @@
1
+ <?php
2
+
3
+ /**
4
+ * Video 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
+ $blockClass = $attributes['blockClass'] ?? '';
14
+
15
+
16
+ ?>
17
+
18
+ <div class="<?php echo esc_attr($blockClass); ?>" >
19
+ <?php
20
+ echo Helpers::render('video', Helpers::props('video', $attributes));
21
+ ?>
22
+ </div>
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/globalManifest.json",
3
+ "namespace": "eightshift-boilerplate",
4
+ "background": "#FFFFFF",
5
+ "foreground": "#0F766E",
6
+ "globalVariables": {
7
+ "breakpoints": {
8
+ "mobile": 27,
9
+ "tablet": 80,
10
+ "desktop": 90,
11
+ "large": 120
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/variation.json",
3
+ "parentName": "card",
4
+ "name": "card-simple",
5
+ "title": "Card: Simple",
6
+ "description" : "A simplified version of the Card.",
7
+ "icon": {
8
+ "src": "es-card-simple"
9
+ },
10
+ "attributes": {
11
+ "cardCardParagraphUse": false,
12
+ "cardCardButtonUse": false
13
+ },
14
+ "scope": [
15
+ "inserter"
16
+ ]
17
+ }
@@ -0,0 +1,12 @@
1
+ import { checkAttr, getTwClasses } from '@eightshift/frontend-libs-tailwind/scripts';
2
+ import manifest from './../manifest.json';
3
+
4
+ export const WrapperEditor = ({ attributes, children }) => {
5
+ const wrapperUse = checkAttr('wrapperUse', attributes, manifest);
6
+
7
+ if (!wrapperUse) {
8
+ return children;
9
+ }
10
+
11
+ return <div className={getTwClasses(attributes, manifest)}>{children}</div>;
12
+ };
@@ -0,0 +1,348 @@
1
+ import { __ } from '@wordpress/i18n';
2
+ import { checkAttr, getAttrKey, getOption } from '@eightshift/frontend-libs-tailwind/scripts';
3
+ import {
4
+ BaseControl,
5
+ ButtonGroup,
6
+ ColorPicker,
7
+ ContainerPanel,
8
+ OptionSelect,
9
+ Spacer,
10
+ Responsive,
11
+ InputField,
12
+ } from '@eightshift/ui-components';
13
+ import { icons } from '@eightshift/ui-components/icons';
14
+ import { clsx } from '@eightshift/ui-components/utilities';
15
+ import { getResponsiveData } from '@eightshift/frontend-libs-tailwind/scripts/helpers/breakpoints';
16
+ import { getColorOption, rotationClassName } from '../../assets/scripts/shared';
17
+ import manifest from './../manifest.json';
18
+
19
+ export const WrapperOptions = ({ attributes, setAttributes }) => {
20
+ const wrapperUse = checkAttr('wrapperUse', attributes, manifest);
21
+ const wrapperNoControls = checkAttr('wrapperNoControls', attributes, manifest);
22
+ const wrapperNoWidthControls = checkAttr('wrapperNoWidthControls', attributes, manifest);
23
+
24
+ const wrapperWidth = checkAttr('wrapperWidth', attributes, manifest);
25
+ const wrapperContentWidth = checkAttr('wrapperContentWidth', attributes, manifest);
26
+
27
+ const wrapperBackground = checkAttr('wrapperBackground', attributes, manifest);
28
+ const wrapperGradientDirection = checkAttr('wrapperGradientDirection', attributes, manifest);
29
+
30
+ const wrapperBorderRadius = checkAttr('wrapperBorderRadius', attributes, manifest);
31
+
32
+ const wrapperMarginTop = checkAttr('wrapperMarginTop', attributes, manifest);
33
+ const wrapperMarginBottom = checkAttr('wrapperMarginBottom', attributes, manifest);
34
+
35
+ const wrapperPaddingTop = checkAttr('wrapperPaddingTop', attributes, manifest);
36
+ const wrapperPaddingBottom = checkAttr('wrapperPaddingBottom', attributes, manifest);
37
+
38
+ const wrapperHide = checkAttr('wrapperHide', attributes, manifest);
39
+
40
+ const wrapperId = checkAttr('wrapperId', attributes, manifest);
41
+
42
+ if (wrapperNoControls) {
43
+ return null;
44
+ }
45
+
46
+ let backgroundType = 'none';
47
+
48
+ if (wrapperBackground?.startsWith('solid-')) {
49
+ backgroundType = 'solid';
50
+ } else if (wrapperBackground?.startsWith('gradient-')) {
51
+ backgroundType = 'gradient';
52
+ }
53
+
54
+ const responsiveData = getResponsiveData(true);
55
+
56
+ return (
57
+ <ContainerPanel
58
+ title={__('Wrapper', '%g_textdomain%')}
59
+ use={wrapperUse}
60
+ actions={
61
+ <OptionSelect
62
+ aria-label={__('Width', '%g_textdomain%')}
63
+ value={wrapperWidth}
64
+ onChange={(value) =>
65
+ setAttributes({
66
+ [getAttrKey('wrapperWidth', attributes, manifest)]: value,
67
+ [getAttrKey('wrapperUse', attributes, manifest)]: value !== 'off',
68
+ })
69
+ }
70
+ options={getOption('wrapperWidth', attributes, manifest)}
71
+ hidden={wrapperNoWidthControls}
72
+ type='menu'
73
+ wrapperProps={{
74
+ triggerProps: { size: 'small' },
75
+ }}
76
+ inline
77
+ />
78
+ }
79
+ closable
80
+ >
81
+ <Responsive
82
+ value={wrapperContentWidth}
83
+ onChange={(value) =>
84
+ setAttributes({
85
+ [getAttrKey('wrapperContentWidth', attributes, manifest)]: value,
86
+ })
87
+ }
88
+ icon={icons.containerWidth}
89
+ label={__('Width', '%g_textdomain%')}
90
+ options={getOption('wrapperContentWidth', attributes, manifest)}
91
+ hidden={wrapperNoWidthControls}
92
+ noModeSelect
93
+ inline
94
+ {...responsiveData}
95
+ >
96
+ {({ currentValue, handleChange, options }) => (
97
+ <OptionSelect
98
+ options={options}
99
+ value={currentValue}
100
+ onChange={(value) => handleChange(value)}
101
+ type='menu'
102
+ />
103
+ )}
104
+ </Responsive>
105
+
106
+ <BaseControl
107
+ icon={icons.backgroundType}
108
+ label={__('Background', '%g_textdomain%')}
109
+ inline
110
+ >
111
+ <ButtonGroup>
112
+ <OptionSelect
113
+ options={getOption('wrapperBackground', attributes, manifest)}
114
+ value={backgroundType}
115
+ onChange={(value) => {
116
+ if (value === 'none') {
117
+ setAttributes({ [getAttrKey('wrapperBackground', attributes, manifest)]: undefined });
118
+ } else {
119
+ setAttributes({
120
+ [getAttrKey('wrapperBackground', attributes, manifest)]: Object.keys(
121
+ manifest.tailwind.options.wrapperBackground.twClasses,
122
+ ).find((key) => key.startsWith(value)),
123
+ });
124
+ }
125
+ }}
126
+ aria-label={__('Background type', '%g_textdomain%')}
127
+ type='menu'
128
+ noItemIcon
129
+ />
130
+
131
+ {backgroundType === 'solid' && (
132
+ <ColorPicker
133
+ colors={getColorOption('wrapperBackgroundSolid', manifest)}
134
+ onChange={(value) =>
135
+ setAttributes({ [getAttrKey('wrapperBackground', attributes, manifest)]: `solid-${value}` })
136
+ }
137
+ value={wrapperBackground?.replace('solid-', '')}
138
+ aria-label={__('Background color', '%g_textdomain%')}
139
+ />
140
+ )}
141
+ {backgroundType === 'gradient' && (
142
+ <>
143
+ <OptionSelect
144
+ value={wrapperBackground}
145
+ onChange={(value) => setAttributes({ [getAttrKey('wrapperBackground', attributes, manifest)]: value })}
146
+ options={getOption('wrapperBackgroundGradient', attributes, manifest).map((option) => ({
147
+ ...option,
148
+ icon: (
149
+ <div
150
+ className={clsx(
151
+ 'es-uic-size-5 es-uic-rounded es-uic-border es-uic-border-gray-300 bg-gradient-to-r',
152
+ manifest.tailwind.options.wrapperBackground.twClasses[option.value],
153
+ )}
154
+ />
155
+ ),
156
+ }))}
157
+ wrapperProps={{
158
+ triggerIcon: (
159
+ <div
160
+ className={clsx(
161
+ 'es-uic-size-6 es-uic-rounded es-uic-border es-uic-border-gray-300 es-uic-shadow-sm bg-gradient-to-r',
162
+ manifest.tailwind.options.wrapperBackground.twClasses[wrapperBackground],
163
+ )}
164
+ />
165
+ ),
166
+ }}
167
+ aria-label={__('Gradient style', '%g_textdomain%')}
168
+ noTriggerLabel
169
+ type='menu'
170
+ />
171
+ <OptionSelect
172
+ value={wrapperGradientDirection}
173
+ onChange={(value) =>
174
+ setAttributes({ [getAttrKey('wrapperGradientDirection', attributes, manifest)]: value })
175
+ }
176
+ options={getOption('wrapperGradientDirection', attributes, manifest)}
177
+ wrapperProps={{
178
+ triggerIcon: <div className={rotationClassName[wrapperGradientDirection]}>{icons.arrowUpCircle}</div>,
179
+ }}
180
+ aria-label={__('Gradient angle', '%g_textdomain%')}
181
+ noTriggerLabel
182
+ type='menu'
183
+ />
184
+ </>
185
+ )}
186
+ </ButtonGroup>
187
+ </BaseControl>
188
+
189
+ <OptionSelect
190
+ icon={icons.roundedCorners}
191
+ label={__('Rounded corners', '%g_textdomain%')}
192
+ value={wrapperBorderRadius}
193
+ onChange={(value) => setAttributes({ [getAttrKey('wrapperBorderRadius', attributes, manifest)]: value })}
194
+ options={getOption('wrapperBorderRadius', attributes, manifest)}
195
+ aria-label={__('Rounded corners', '%g_textdomain%')}
196
+ type='menu'
197
+ inline
198
+ />
199
+
200
+ <Spacer />
201
+ <Spacer
202
+ icon={icons.containerSpacingH}
203
+ text={__('Spacing', '%g_textdomain%')}
204
+ border
205
+ />
206
+
207
+ <Responsive
208
+ value={wrapperMarginTop}
209
+ onChange={(value) =>
210
+ setAttributes({
211
+ [getAttrKey('wrapperMarginTop', attributes, manifest)]: value,
212
+ })
213
+ }
214
+ icon={icons.spacingTop}
215
+ label={__('Top margin', '%g_textdomain%')}
216
+ options={getOption('wrapperSpacing', attributes, manifest)}
217
+ noModeSelect
218
+ inline
219
+ {...responsiveData}
220
+ >
221
+ {({ currentValue, handleChange, options }) => (
222
+ <OptionSelect
223
+ options={options}
224
+ value={currentValue}
225
+ onChange={(value) => handleChange(value)}
226
+ type='menu'
227
+ />
228
+ )}
229
+ </Responsive>
230
+
231
+ <Responsive
232
+ value={wrapperMarginBottom}
233
+ onChange={(value) =>
234
+ setAttributes({
235
+ [getAttrKey('wrapperMarginBottom', attributes, manifest)]: value,
236
+ })
237
+ }
238
+ icon={icons.spacingBottom}
239
+ label={__('Bottom margin', '%g_textdomain%')}
240
+ options={getOption('wrapperSpacing', attributes, manifest)}
241
+ noModeSelect
242
+ inline
243
+ {...responsiveData}
244
+ >
245
+ {({ currentValue, handleChange, options }) => (
246
+ <OptionSelect
247
+ options={options}
248
+ value={currentValue}
249
+ onChange={(value) => handleChange(value)}
250
+ type='menu'
251
+ />
252
+ )}
253
+ </Responsive>
254
+
255
+ <Spacer />
256
+
257
+ <Responsive
258
+ value={wrapperPaddingTop}
259
+ onChange={(value) =>
260
+ setAttributes({
261
+ [getAttrKey('wrapperPaddingTop', attributes, manifest)]: value,
262
+ })
263
+ }
264
+ icon={icons.spacingTopIn}
265
+ label={__('Top padding', '%g_textdomain%')}
266
+ options={getOption('wrapperSpacing', attributes, manifest)}
267
+ noModeSelect
268
+ inline
269
+ {...responsiveData}
270
+ >
271
+ {({ currentValue, handleChange, options }) => (
272
+ <OptionSelect
273
+ options={options}
274
+ value={currentValue}
275
+ onChange={(value) => handleChange(value)}
276
+ type='menu'
277
+ />
278
+ )}
279
+ </Responsive>
280
+
281
+ <Responsive
282
+ value={wrapperPaddingBottom}
283
+ onChange={(value) =>
284
+ setAttributes({
285
+ [getAttrKey('wrapperPaddingBottom', attributes, manifest)]: value,
286
+ })
287
+ }
288
+ icon={icons.spacingBottomIn}
289
+ label={__('Bottom padding', '%g_textdomain%')}
290
+ options={getOption('wrapperSpacing', attributes, manifest)}
291
+ noModeSelect
292
+ inline
293
+ {...responsiveData}
294
+ >
295
+ {({ currentValue, handleChange, options }) => (
296
+ <OptionSelect
297
+ options={options}
298
+ value={currentValue}
299
+ onChange={(value) => handleChange(value)}
300
+ type='menu'
301
+ />
302
+ )}
303
+ </Responsive>
304
+
305
+ <Spacer />
306
+ <Spacer
307
+ icon={icons.moreHCircle}
308
+ text={__('Advanced', '%g_textdomain%')}
309
+ border
310
+ />
311
+
312
+ <Responsive
313
+ value={wrapperHide}
314
+ onChange={(value) =>
315
+ setAttributes({
316
+ [getAttrKey('wrapperHide', attributes, manifest)]: value,
317
+ })
318
+ }
319
+ icon={icons.visibility}
320
+ label={__('Visibility', '%g_textdomain%')}
321
+ options={getOption('wrapperHide', attributes, manifest)}
322
+ noModeSelect
323
+ inline
324
+ {...responsiveData}
325
+ >
326
+ {({ currentValue, handleChange, options, isInlineCollapsedView }) => (
327
+ <OptionSelect
328
+ options={options}
329
+ value={String(currentValue)}
330
+ onChange={(value) => handleChange(value)}
331
+ noItemLabel={isInlineCollapsedView}
332
+ noItemIcon={!isInlineCollapsedView}
333
+ />
334
+ )}
335
+ </Responsive>
336
+
337
+ <Spacer />
338
+
339
+ <InputField
340
+ icon={icons.id}
341
+ label={__('Unique identifier', '%g_textdomain%')}
342
+ value={wrapperId}
343
+ onChange={(value) => setAttributes({ [getAttrKey('wrapperId', attributes, manifest)]: value })}
344
+ className='es-uic-font-mono'
345
+ />
346
+ </ContainerPanel>
347
+ );
348
+ };