@eightshift/frontend-libs-tailwind 1.5.0 → 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 (229) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/package.json +11 -18
  3. package/blocks/init/assets/application-admin.js +0 -10
  4. package/blocks/init/assets/application.js +0 -13
  5. package/blocks/init/assets/fonts/fraunces-italic-latin-extended.woff2 +0 -0
  6. package/blocks/init/assets/fonts/fraunces-italic-latin.woff2 +0 -0
  7. package/blocks/init/assets/fonts/fraunces-latin-extended.woff2 +0 -0
  8. package/blocks/init/assets/fonts/fraunces-latin.woff2 +0 -0
  9. package/blocks/init/assets/fonts/noto-sans-italic-latin-extended.woff2 +0 -0
  10. package/blocks/init/assets/fonts/noto-sans-italic-latin.woff2 +0 -0
  11. package/blocks/init/assets/fonts/noto-sans-latin-extended.woff2 +0 -0
  12. package/blocks/init/assets/fonts/noto-sans-latin.woff2 +0 -0
  13. package/blocks/init/assets/images/index.js +0 -5
  14. package/blocks/init/assets/scripts/application-admin.js +0 -7
  15. package/blocks/init/assets/scripts/application.js +0 -3
  16. package/blocks/init/assets/scripts/theme-colors.js +0 -39
  17. package/blocks/init/assets/styles/application-admin.css +0 -6
  18. package/blocks/init/assets/styles/application.css +0 -3
  19. package/blocks/init/src/Blocks/assets/application-blocks-editor.js +0 -14
  20. package/blocks/init/src/Blocks/assets/application-blocks-frontend.js +0 -13
  21. package/blocks/init/src/Blocks/assets/application-blocks.js +0 -9
  22. package/blocks/init/src/Blocks/assets/scripts/application-blocks-editor.js +0 -65
  23. package/blocks/init/src/Blocks/assets/scripts/application-blocks-frontend.js +0 -24
  24. package/blocks/init/src/Blocks/assets/scripts/link-section-editor.js +0 -262
  25. package/blocks/init/src/Blocks/assets/scripts/shared.js +0 -25
  26. package/blocks/init/src/Blocks/assets/styles/application-blocks-editor.css +0 -15
  27. package/blocks/init/src/Blocks/assets/styles/application-blocks-frontend.css +0 -9
  28. package/blocks/init/src/Blocks/assets/styles/application-blocks.css +0 -1
  29. package/blocks/init/src/Blocks/assets/styles/editor/editor-overrides.css +0 -15
  30. package/blocks/init/src/Blocks/assets/styles/fonts.css +0 -90
  31. package/blocks/init/src/Blocks/assets/styles/tailwind.css +0 -30
  32. package/blocks/init/src/Blocks/components/admin-theme-options/admin-theme-options.php +0 -20
  33. package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/index.js +0 -36
  34. package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/pages/parts.js +0 -56
  35. package/blocks/init/src/Blocks/components/admin-theme-options/manifest.json +0 -5
  36. package/blocks/init/src/Blocks/components/button/assets/index.js +0 -22
  37. package/blocks/init/src/Blocks/components/button/button.php +0 -88
  38. package/blocks/init/src/Blocks/components/button/components/button-editor.js +0 -36
  39. package/blocks/init/src/Blocks/components/button/components/button-options.js +0 -134
  40. package/blocks/init/src/Blocks/components/button/manifest.json +0 -302
  41. package/blocks/init/src/Blocks/components/card/card.php +0 -42
  42. package/blocks/init/src/Blocks/components/card/components/card-editor.js +0 -43
  43. package/blocks/init/src/Blocks/components/card/components/card-options.js +0 -55
  44. package/blocks/init/src/Blocks/components/card/manifest.json +0 -111
  45. package/blocks/init/src/Blocks/components/head/head.php +0 -52
  46. package/blocks/init/src/Blocks/components/head/manifest.json +0 -17
  47. package/blocks/init/src/Blocks/components/heading/components/heading-editor.js +0 -26
  48. package/blocks/init/src/Blocks/components/heading/components/heading-options.js +0 -62
  49. package/blocks/init/src/Blocks/components/heading/heading.php +0 -45
  50. package/blocks/init/src/Blocks/components/heading/manifest.json +0 -76
  51. package/blocks/init/src/Blocks/components/hero/components/hero-editor.js +0 -42
  52. package/blocks/init/src/Blocks/components/hero/components/hero-options.js +0 -100
  53. package/blocks/init/src/Blocks/components/hero/hero.php +0 -45
  54. package/blocks/init/src/Blocks/components/hero/manifest.json +0 -96
  55. package/blocks/init/src/Blocks/components/icon/components/icon-editor.js +0 -23
  56. package/blocks/init/src/Blocks/components/icon/components/icon-options.js +0 -65
  57. package/blocks/init/src/Blocks/components/icon/icon.php +0 -53
  58. package/blocks/init/src/Blocks/components/icon/manifest.json +0 -1238
  59. package/blocks/init/src/Blocks/components/image/components/image-editor.js +0 -64
  60. package/blocks/init/src/Blocks/components/image/components/image-options.js +0 -111
  61. package/blocks/init/src/Blocks/components/image/image.php +0 -68
  62. package/blocks/init/src/Blocks/components/image/manifest.json +0 -125
  63. package/blocks/init/src/Blocks/components/list/components/list-editor.js +0 -30
  64. package/blocks/init/src/Blocks/components/list/components/list-options.js +0 -62
  65. package/blocks/init/src/Blocks/components/list/list.php +0 -32
  66. package/blocks/init/src/Blocks/components/list/manifest.json +0 -127
  67. package/blocks/init/src/Blocks/components/load-more/assets/index.js +0 -19
  68. package/blocks/init/src/Blocks/components/load-more/assets/load-more.js +0 -146
  69. package/blocks/init/src/Blocks/components/load-more/components/load-more-editor.js +0 -14
  70. package/blocks/init/src/Blocks/components/load-more/components/load-more-options.js +0 -19
  71. package/blocks/init/src/Blocks/components/load-more/load-more.php +0 -47
  72. package/blocks/init/src/Blocks/components/load-more/manifest.json +0 -39
  73. package/blocks/init/src/Blocks/components/modal/assets/index.js +0 -27
  74. package/blocks/init/src/Blocks/components/modal/manifest.json +0 -48
  75. package/blocks/init/src/Blocks/components/modal/modal.php +0 -46
  76. package/blocks/init/src/Blocks/components/paragraph/components/paragraph-editor.js +0 -38
  77. package/blocks/init/src/Blocks/components/paragraph/components/paragraph-options.js +0 -48
  78. package/blocks/init/src/Blocks/components/paragraph/manifest.json +0 -81
  79. package/blocks/init/src/Blocks/components/paragraph/paragraph.php +0 -33
  80. package/blocks/init/src/Blocks/components/post-header/manifest.json +0 -5
  81. package/blocks/init/src/Blocks/components/post-header/post-header.php +0 -24
  82. package/blocks/init/src/Blocks/components/quote/components/quote-editor.js +0 -53
  83. package/blocks/init/src/Blocks/components/quote/components/quote-options.js +0 -29
  84. package/blocks/init/src/Blocks/components/quote/manifest.json +0 -47
  85. package/blocks/init/src/Blocks/components/quote/quote.php +0 -49
  86. package/blocks/init/src/Blocks/components/share/assets/index.js +0 -39
  87. package/blocks/init/src/Blocks/components/share/components/share-editor.js +0 -28
  88. package/blocks/init/src/Blocks/components/share/components/share-options.js +0 -112
  89. package/blocks/init/src/Blocks/components/share/manifest.json +0 -72
  90. package/blocks/init/src/Blocks/components/share/share.php +0 -69
  91. package/blocks/init/src/Blocks/components/tracking-before-body-end/manifest.json +0 -5
  92. package/blocks/init/src/Blocks/components/tracking-before-body-end/tracking-before-body-end.php +0 -9
  93. package/blocks/init/src/Blocks/components/tracking-head/manifest.json +0 -5
  94. package/blocks/init/src/Blocks/components/tracking-head/tracking-head.php +0 -9
  95. package/blocks/init/src/Blocks/components/video/components/video-editor.js +0 -74
  96. package/blocks/init/src/Blocks/components/video/components/video-options.js +0 -279
  97. package/blocks/init/src/Blocks/components/video/manifest.json +0 -120
  98. package/blocks/init/src/Blocks/components/video/video.php +0 -70
  99. package/blocks/init/src/Blocks/custom/accordion/accordion-block.js +0 -15
  100. package/blocks/init/src/Blocks/custom/accordion/accordion.php +0 -28
  101. package/blocks/init/src/Blocks/custom/accordion/assets/index.js +0 -37
  102. package/blocks/init/src/Blocks/custom/accordion/components/accordion-editor.js +0 -22
  103. package/blocks/init/src/Blocks/custom/accordion/components/accordion-options.js +0 -18
  104. package/blocks/init/src/Blocks/custom/accordion/manifest.json +0 -32
  105. package/blocks/init/src/Blocks/custom/accordion-item/accordion-item-block.js +0 -19
  106. package/blocks/init/src/Blocks/custom/accordion-item/accordion-item.php +0 -46
  107. package/blocks/init/src/Blocks/custom/accordion-item/components/accordion-item-editor.js +0 -60
  108. package/blocks/init/src/Blocks/custom/accordion-item/manifest.json +0 -69
  109. package/blocks/init/src/Blocks/custom/button/button-block.js +0 -13
  110. package/blocks/init/src/Blocks/custom/button/button.php +0 -11
  111. package/blocks/init/src/Blocks/custom/button/components/button-editor.js +0 -12
  112. package/blocks/init/src/Blocks/custom/button/components/button-options.js +0 -12
  113. package/blocks/init/src/Blocks/custom/button/manifest.json +0 -18
  114. package/blocks/init/src/Blocks/custom/card/card-block.js +0 -13
  115. package/blocks/init/src/Blocks/custom/card/card.php +0 -11
  116. package/blocks/init/src/Blocks/custom/card/components/card-editor.js +0 -12
  117. package/blocks/init/src/Blocks/custom/card/components/card-options.js +0 -15
  118. package/blocks/init/src/Blocks/custom/card/manifest.json +0 -18
  119. package/blocks/init/src/Blocks/custom/carousel/assets/index.js +0 -46
  120. package/blocks/init/src/Blocks/custom/carousel/assets/navigation.js +0 -31
  121. package/blocks/init/src/Blocks/custom/carousel/assets/pagination.js +0 -40
  122. package/blocks/init/src/Blocks/custom/carousel/carousel-block.js +0 -21
  123. package/blocks/init/src/Blocks/custom/carousel/carousel.php +0 -61
  124. package/blocks/init/src/Blocks/custom/carousel/components/carousel-editor.js +0 -25
  125. package/blocks/init/src/Blocks/custom/carousel/components/carousel-options.js +0 -47
  126. package/blocks/init/src/Blocks/custom/carousel/manifest.json +0 -130
  127. package/blocks/init/src/Blocks/custom/column/column-block.js +0 -21
  128. package/blocks/init/src/Blocks/custom/column/column-hooks.js +0 -32
  129. package/blocks/init/src/Blocks/custom/column/column.php +0 -21
  130. package/blocks/init/src/Blocks/custom/column/components/column-editor.js +0 -22
  131. package/blocks/init/src/Blocks/custom/column/components/column-options.js +0 -580
  132. package/blocks/init/src/Blocks/custom/column/manifest.json +0 -625
  133. package/blocks/init/src/Blocks/custom/columns/columns-block.js +0 -20
  134. package/blocks/init/src/Blocks/custom/columns/columns.php +0 -21
  135. package/blocks/init/src/Blocks/custom/columns/components/columns-editor.js +0 -81
  136. package/blocks/init/src/Blocks/custom/columns/components/columns-options.js +0 -104
  137. package/blocks/init/src/Blocks/custom/columns/manifest.json +0 -581
  138. package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-editor.js +0 -28
  139. package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-options.js +0 -248
  140. package/blocks/init/src/Blocks/custom/featured-content/featured-content-block.js +0 -13
  141. package/blocks/init/src/Blocks/custom/featured-content/featured-content.php +0 -139
  142. package/blocks/init/src/Blocks/custom/featured-content/manifest.json +0 -131
  143. package/blocks/init/src/Blocks/custom/featured-content/partials/cards.php +0 -39
  144. package/blocks/init/src/Blocks/custom/group/components/group-editor.js +0 -6
  145. package/blocks/init/src/Blocks/custom/group/group-block.js +0 -14
  146. package/blocks/init/src/Blocks/custom/group/group.php +0 -10
  147. package/blocks/init/src/Blocks/custom/group/manifest.json +0 -32
  148. package/blocks/init/src/Blocks/custom/heading/components/heading-editor.js +0 -15
  149. package/blocks/init/src/Blocks/custom/heading/components/heading-options.js +0 -38
  150. package/blocks/init/src/Blocks/custom/heading/heading-block.js +0 -13
  151. package/blocks/init/src/Blocks/custom/heading/heading-transforms.js +0 -26
  152. package/blocks/init/src/Blocks/custom/heading/heading.php +0 -15
  153. package/blocks/init/src/Blocks/custom/heading/manifest.json +0 -79
  154. package/blocks/init/src/Blocks/custom/hero/components/hero-editor.js +0 -12
  155. package/blocks/init/src/Blocks/custom/hero/components/hero-options.js +0 -14
  156. package/blocks/init/src/Blocks/custom/hero/hero-block.js +0 -13
  157. package/blocks/init/src/Blocks/custom/hero/hero.php +0 -11
  158. package/blocks/init/src/Blocks/custom/hero/manifest.json +0 -17
  159. package/blocks/init/src/Blocks/custom/image/components/image-editor.js +0 -12
  160. package/blocks/init/src/Blocks/custom/image/components/image-options.js +0 -14
  161. package/blocks/init/src/Blocks/custom/image/image-block.js +0 -13
  162. package/blocks/init/src/Blocks/custom/image/image.php +0 -11
  163. package/blocks/init/src/Blocks/custom/image/manifest.json +0 -33
  164. package/blocks/init/src/Blocks/custom/list/components/list-editor.js +0 -14
  165. package/blocks/init/src/Blocks/custom/list/components/list-options.js +0 -39
  166. package/blocks/init/src/Blocks/custom/list/list-block.js +0 -13
  167. package/blocks/init/src/Blocks/custom/list/list.php +0 -15
  168. package/blocks/init/src/Blocks/custom/list/manifest.json +0 -58
  169. package/blocks/init/src/Blocks/custom/map/assets/index.js +0 -20
  170. package/blocks/init/src/Blocks/custom/map/assets/map-controller.js +0 -41
  171. package/blocks/init/src/Blocks/custom/map/assets/utils.js +0 -161
  172. package/blocks/init/src/Blocks/custom/map/components/map-components.js +0 -403
  173. package/blocks/init/src/Blocks/custom/map/components/map-editor.js +0 -56
  174. package/blocks/init/src/Blocks/custom/map/components/map-options.js +0 -550
  175. package/blocks/init/src/Blocks/custom/map/manifest.json +0 -79
  176. package/blocks/init/src/Blocks/custom/map/map-block.js +0 -13
  177. package/blocks/init/src/Blocks/custom/map/map.php +0 -52
  178. package/blocks/init/src/Blocks/custom/map/styles.css +0 -2
  179. package/blocks/init/src/Blocks/custom/modal/components/modal-editor.js +0 -90
  180. package/blocks/init/src/Blocks/custom/modal/manifest.json +0 -51
  181. package/blocks/init/src/Blocks/custom/modal/modal-block.js +0 -14
  182. package/blocks/init/src/Blocks/custom/modal/modal.php +0 -20
  183. package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-editor.js +0 -17
  184. package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-options.js +0 -38
  185. package/blocks/init/src/Blocks/custom/paragraph/manifest.json +0 -82
  186. package/blocks/init/src/Blocks/custom/paragraph/paragraph-block.js +0 -13
  187. package/blocks/init/src/Blocks/custom/paragraph/paragraph-transforms.js +0 -46
  188. package/blocks/init/src/Blocks/custom/paragraph/paragraph.php +0 -15
  189. package/blocks/init/src/Blocks/custom/quote/components/quote-editor.js +0 -12
  190. package/blocks/init/src/Blocks/custom/quote/components/quote-options.js +0 -14
  191. package/blocks/init/src/Blocks/custom/quote/manifest.json +0 -17
  192. package/blocks/init/src/Blocks/custom/quote/quote-block.js +0 -13
  193. package/blocks/init/src/Blocks/custom/quote/quote.php +0 -13
  194. package/blocks/init/src/Blocks/custom/share/components/share-editor.js +0 -6
  195. package/blocks/init/src/Blocks/custom/share/components/share-options.js +0 -12
  196. package/blocks/init/src/Blocks/custom/share/manifest.json +0 -19
  197. package/blocks/init/src/Blocks/custom/share/share-block.js +0 -13
  198. package/blocks/init/src/Blocks/custom/share/share.php +0 -11
  199. package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-editor.js +0 -57
  200. package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-options.js +0 -106
  201. package/blocks/init/src/Blocks/custom/site-footer/manifest.json +0 -73
  202. package/blocks/init/src/Blocks/custom/site-footer/site-footer-block.js +0 -13
  203. package/blocks/init/src/Blocks/custom/site-footer/site-footer.php +0 -74
  204. package/blocks/init/src/Blocks/custom/site-navigation/assets/index.js +0 -9
  205. package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-editor.js +0 -42
  206. package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-options.js +0 -73
  207. package/blocks/init/src/Blocks/custom/site-navigation/manifest.json +0 -77
  208. package/blocks/init/src/Blocks/custom/site-navigation/site-navigation-block.js +0 -13
  209. package/blocks/init/src/Blocks/custom/site-navigation/site-navigation.php +0 -99
  210. package/blocks/init/src/Blocks/custom/table-of-contents/assets/index.js +0 -58
  211. package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-editor.js +0 -38
  212. package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-options.js +0 -32
  213. package/blocks/init/src/Blocks/custom/table-of-contents/manifest.json +0 -48
  214. package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents-block.js +0 -13
  215. package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents.php +0 -31
  216. package/blocks/init/src/Blocks/custom/video/components/video-editor.js +0 -6
  217. package/blocks/init/src/Blocks/custom/video/components/video-options.js +0 -12
  218. package/blocks/init/src/Blocks/custom/video/manifest.json +0 -29
  219. package/blocks/init/src/Blocks/custom/video/video-block.js +0 -13
  220. package/blocks/init/src/Blocks/custom/video/video.php +0 -22
  221. package/blocks/init/src/Blocks/manifest.json +0 -32
  222. package/blocks/init/src/Blocks/variations/card-simple/manifest.json +0 -17
  223. package/blocks/init/src/Blocks/wrapper/components/wrapper-editor.js +0 -12
  224. package/blocks/init/src/Blocks/wrapper/components/wrapper-options.js +0 -364
  225. package/blocks/init/src/Blocks/wrapper/manifest.json +0 -459
  226. package/blocks/init/src/Blocks/wrapper/styles-editor.css +0 -13
  227. package/blocks/init/src/Blocks/wrapper/styles.css +0 -19
  228. package/blocks/init/src/Blocks/wrapper/wrapper.js +0 -27
  229. package/blocks/init/src/Blocks/wrapper/wrapper.php +0 -34
@@ -1,60 +0,0 @@
1
- import React, { useId, useState, useRef } from 'react';
2
- import { __ } from '@wordpress/i18n';
3
- import { BlockInserter, checkAttr, getAttrKey, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
4
- import { RichText, useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
5
- import manifest from '../manifest.json';
6
- import { JsxSvg } from '@eightshift/ui-components/icons';
7
- import { AnimatedVisibility } from '@eightshift/ui-components';
8
-
9
- export const AccordionItemEditor = ({ attributes, setAttributes, clientId }) => {
10
- const accordionItemLabel = checkAttr('accordionItemLabel', attributes, manifest);
11
-
12
- const blockProps = useBlockProps();
13
- const innerBlocksProps = useInnerBlocksProps(blockProps, {
14
- renderAppender: () => (
15
- <BlockInserter
16
- clientId={clientId}
17
- small
18
- />
19
- ),
20
- });
21
-
22
- const [expanded, setExpanded] = useState(false);
23
-
24
- return (
25
- <>
26
- <div
27
- aria-expanded={expanded}
28
- className={tailwindClasses('trigger', attributes, manifest)}
29
- >
30
- <RichText
31
- placeholder={__('Section title', '%g_textdomain%')}
32
- value={accordionItemLabel}
33
- onChange={(value) => setAttributes({ [getAttrKey('accordionItemLabel', attributes, manifest)]: value })}
34
- allowedFormats={['core/bold']}
35
- className='mr-auto w-fit'
36
- />
37
-
38
- <button
39
- onClick={(e) => setExpanded(!expanded)}
40
- className={tailwindClasses('editor-trigger', attributes, manifest)}
41
- >
42
- <JsxSvg
43
- svg={manifest.resources.icon}
44
- className={tailwindClasses('editor-trigger-icon', attributes, manifest, expanded && 'rotate-45')}
45
- />
46
- </button>
47
- </div>
48
-
49
- <AnimatedVisibility
50
- visible={expanded}
51
- noInitial
52
- >
53
- <div
54
- {...innerBlocksProps}
55
- className={tailwindClasses('content-container', attributes, manifest)}
56
- />
57
- </AnimatedVisibility>
58
- </>
59
- );
60
- };
@@ -1,69 +0,0 @@
1
- {
2
- "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/block.json",
3
- "blockName": "accordion-item",
4
- "title": "Accordion item",
5
- "description" : "Single accordion panel.",
6
- "category": "eightshift",
7
- "icon": {
8
- "src": "es-accordion"
9
- },
10
- "keywords": [
11
- "accordion",
12
- "item"
13
- ],
14
- "example": {
15
- "innerBlocks": [
16
- {
17
- "name": "eightshift-boilerplate/heading",
18
- "attributes": {
19
- "headingHeadingContent": "Lorem ipsum dolor sit amet"
20
- }
21
- },
22
- {
23
- "name": "eightshift-boilerplate/paragraph",
24
- "attributes": {
25
- "paragraphParagraphContent": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam aliquam est id semper aliquet. Aenean accumsan lacus justo, a lacinia turpis semper condimentum. "
26
- }
27
- }
28
- ]
29
- },
30
- "attributes": {
31
- "accordionItemLabel": {
32
- "type": "string"
33
- },
34
-
35
- "wrapperUse": {
36
- "type": "boolean",
37
- "default": false
38
- },
39
- "wrapperNoControls": {
40
- "type": "boolean",
41
- "default": true
42
- }
43
- },
44
- "hasInnerBlocks": true,
45
- "resources": {
46
- "icon": "<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M12 3v18m-9-9h18' stroke='#14142B' strokeWidth='2' strokeLinecap='round' strokeLinejoin='round' fill='none'/></svg>"
47
- },
48
- "parent": [
49
- "eightshift-boilerplate/accordion"
50
- ],
51
- "tailwind": {
52
- "parts": {
53
- "trigger": {
54
- "twClasses": "flex items-center justify-between gap-2 group px-2 py-4 w-full border-t border-t-gray-400 text-sm font-medium focus:outline-none focus-visible:ring focus-visible:ring-navy-500/30 transition [&>svg]:size-5 [&>svg]:transition-transform [&[aria-expanded=true]>svg]:rotate-45",
55
- "twClassesEditorOnly": "flex items-center justify-between gap-2 group px-2 py-4 w-full border-t border-t-gray-400 text-sm font-medium"
56
- },
57
- "content-container": {
58
- "twClasses": "pl-2 pr-8 pb-4 animate-in fade-in duration-500 fill-mode-forwards",
59
- "twClassesEditorOnly": "pl-2 pr-8 pb-4 *:!m-0"
60
- },
61
- "editor-trigger": {
62
- "twClassesEditorOnly": "focus:outline-none focus-visible:ring focus-visible:ring-navy-500/30 transition"
63
- },
64
- "editor-trigger-icon": {
65
- "twClassesEditorOnly": "size-5 transition duration-300"
66
- }
67
- }
68
- }
69
- }
@@ -1,13 +0,0 @@
1
- import { ButtonEditor } from './components/button-editor';
2
- import { ButtonOptions } from './components/button-options';
3
- import { GutenbergBlock } from '@eightshift/frontend-libs-tailwind/scripts';
4
-
5
- export const Button = (props) => {
6
- return (
7
- <GutenbergBlock
8
- {...props}
9
- options={ButtonOptions}
10
- editor={ButtonEditor}
11
- />
12
- );
13
- };
@@ -1,11 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Button block template.
5
- *
6
- * @package %g_namespace%
7
- */
8
-
9
- use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
10
-
11
- echo Helpers::render('button', Helpers::props('button', $attributes));
@@ -1,12 +0,0 @@
1
- import { props } from '@eightshift/frontend-libs-tailwind/scripts';
2
- import { ButtonEditor as EditorComponent } from '../../../components/button/components/button-editor';
3
-
4
- export const ButtonEditor = ({ attributes, setAttributes }) => {
5
- return (
6
- <EditorComponent
7
- {...props('button', attributes, {
8
- setAttributes,
9
- })}
10
- />
11
- );
12
- };
@@ -1,12 +0,0 @@
1
- import { __ } from '@wordpress/i18n';
2
- import { props } from '@eightshift/frontend-libs-tailwind/scripts';
3
- import { ButtonOptions as OptionsComponent } from '../../../components/button/components/button-options';
4
-
5
- export const ButtonOptions = ({ attributes, setAttributes }) => {
6
- return (
7
- <OptionsComponent
8
- {...props('button', attributes, { setAttributes })}
9
- controlOnly
10
- />
11
- );
12
- };
@@ -1,18 +0,0 @@
1
- {
2
- "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/block.json",
3
- "blockName": "button",
4
- "title": "Button",
5
- "description": "The most common interactive element.",
6
- "category": "eightshift",
7
- "icon": {
8
- "src": "es-button"
9
- },
10
- "keywords": [
11
- "button",
12
- "btn",
13
- "link"
14
- ],
15
- "components": {
16
- "button": "button"
17
- }
18
- }
@@ -1,13 +0,0 @@
1
- import { CardEditor } from './components/card-editor';
2
- import { CardOptions } from './components/card-options';
3
- import { GutenbergBlock } from '@eightshift/frontend-libs-tailwind/scripts';
4
-
5
- export const Card = (props) => {
6
- return (
7
- <GutenbergBlock
8
- {...props}
9
- options={CardOptions}
10
- editor={CardEditor}
11
- />
12
- );
13
- };
@@ -1,11 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Card block template.
5
- *
6
- * @package %g_namespace%
7
- */
8
-
9
- use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
10
-
11
- echo Helpers::render('card', Helpers::props('card', $attributes));
@@ -1,12 +0,0 @@
1
- import { props } from '@eightshift/frontend-libs-tailwind/scripts';
2
- import { CardEditor as EditorComponent } from '../../../components/card/components/card-editor';
3
-
4
- export const CardEditor = ({ attributes, setAttributes }) => {
5
- return (
6
- <EditorComponent
7
- {...props('card', attributes, {
8
- setAttributes,
9
- })}
10
- />
11
- );
12
- };
@@ -1,15 +0,0 @@
1
- import { __ } from '@wordpress/i18n';
2
- import { props, getOptions } from '@eightshift/frontend-libs-tailwind/scripts';
3
- import { CardOptions as OptionsComponent } from '../../../components/card/components/card-options';
4
- import manifest from './../manifest.json';
5
-
6
- export const CardOptions = ({ attributes, setAttributes }) => {
7
- return (
8
- <OptionsComponent
9
- {...props('card', attributes, {
10
- setAttributes,
11
- options: getOptions(attributes, manifest),
12
- })}
13
- />
14
- );
15
- };
@@ -1,18 +0,0 @@
1
- {
2
- "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/block.json",
3
- "blockName": "card",
4
- "title": "Card",
5
- "description" : "A bit of text, image, and a button all wrapped up in a beautiful combination.",
6
- "category": "eightshift",
7
- "icon": {
8
- "src": "es-card"
9
- },
10
- "keywords": [
11
- "Service",
12
- "Box",
13
- "Card"
14
- ],
15
- "components": {
16
- "card": "card"
17
- }
18
- }
@@ -1,46 +0,0 @@
1
- import domReady from '@wordpress/dom-ready';
2
- import manifest from '../manifest.json';
3
- import EmblaCarousel from 'embla-carousel';
4
- import { addPagination } from './pagination';
5
- import { setUpNavigation } from './navigation';
6
-
7
- domReady(async () => {
8
- const { blockJsClass } = manifest;
9
-
10
- const selector = `.${blockJsClass}`;
11
- const elements = document.querySelectorAll(selector);
12
-
13
- if (!elements.length) {
14
- return;
15
- }
16
-
17
- elements.forEach((element) => {
18
- const container = element.querySelector(`${selector}-container`);
19
-
20
- if (!container) {
21
- return;
22
- }
23
-
24
- const loop = element.hasAttribute('data-loop');
25
-
26
- const embla = EmblaCarousel(container, {
27
- loop: loop,
28
- skipSnaps: true,
29
- });
30
-
31
- const prevButton = element.querySelector(`${selector}-prev`);
32
- const nextButton = element.querySelector(`${selector}-next`);
33
-
34
- if (prevButton && nextButton) {
35
- const removeNavigationHandlers = setUpNavigation(embla, prevButton, nextButton);
36
- embla.on('destroy', removeNavigationHandlers);
37
- }
38
-
39
- const paginationContainer = element.querySelector(`${selector}-pagination`);
40
-
41
- if (paginationContainer) {
42
- const removePaginationHandlers = addPagination(embla, paginationContainer);
43
- embla.on('destroy', removePaginationHandlers);
44
- }
45
- });
46
- });
@@ -1,31 +0,0 @@
1
- // Based on Embla carousel docs.
2
-
3
- const setUpNavigationStateChange = (emblaApi, prevBtn, nextBtn) => {
4
- const toggleNavigationState = () => {
5
- prevBtn.disabled = !emblaApi.canScrollPrev();
6
- nextBtn.disabled = !emblaApi.canScrollNext();
7
- };
8
-
9
- emblaApi.on('select', toggleNavigationState).on('init', toggleNavigationState).on('reInit', toggleNavigationState);
10
-
11
- return () => {
12
- prevBtn.removeAttribute('disabled');
13
- nextBtn.removeAttribute('disabled');
14
- };
15
- };
16
-
17
- export const setUpNavigation = (emblaApi, prevBtn, nextBtn) => {
18
- const scrollPrev = () => emblaApi.scrollPrev();
19
- const scrollNext = () => emblaApi.scrollNext();
20
-
21
- prevBtn.addEventListener('click', scrollPrev, false);
22
- nextBtn.addEventListener('click', scrollNext, false);
23
-
24
- const removeNavigationStateChangeEvents = setUpNavigationStateChange(emblaApi, prevBtn, nextBtn);
25
-
26
- return () => {
27
- removeNavigationStateChangeEvents();
28
- prevBtn.removeEventListener('click', scrollPrev, false);
29
- nextBtn.removeEventListener('click', scrollNext, false);
30
- };
31
- };
@@ -1,40 +0,0 @@
1
- // Based on Embla carousel docs.
2
-
3
- export const addPagination = (emblaApi, dotsNode) => {
4
- let dotNodes = [];
5
-
6
- const addDots = () => {
7
- dotsNode.innerHTML = '';
8
-
9
- dotNodes = emblaApi.scrollSnapList().map((_, index) => {
10
- const elem = document.createElement('button');
11
- elem.className =
12
- 'size-2.5 rounded-full border border-gray-500 transition hover:scale-105 focus:outline-none focus-visible:ring focus-visible:ring-navy-500/30';
13
-
14
- elem.addEventListener('click', () => emblaApi.scrollTo(index), false);
15
- dotsNode.appendChild(elem);
16
-
17
- return elem;
18
- });
19
- };
20
-
21
- const toggleDotBtnsActive = () => {
22
- const previous = emblaApi.previousScrollSnap();
23
- const selected = emblaApi.selectedScrollSnap();
24
- ['border-navy-500', 'bg-navy-500', 'shadow-sm', 'shadow-navy-500/30'].forEach((className) => {
25
- dotNodes[previous].classList.remove(className);
26
- dotNodes[selected].classList.add(className);
27
- });
28
- };
29
-
30
- emblaApi
31
- .on('init', addDots)
32
- .on('reInit', addDots)
33
- .on('init', toggleDotBtnsActive)
34
- .on('reInit', toggleDotBtnsActive)
35
- .on('select', toggleDotBtnsActive);
36
-
37
- return () => {
38
- dotsNode.innerHTML = '';
39
- };
40
- };
@@ -1,21 +0,0 @@
1
- import { useSelect } from '@wordpress/data';
2
- import { GutenbergBlock, overrideInnerBlockAttributes } from '@eightshift/frontend-libs-tailwind/scripts/editor';
3
- import { CarouselOptions } from './components/carousel-options';
4
- import { CarouselEditor } from './components/carousel-editor';
5
-
6
- export const Carousel = (props) => {
7
- useSelect((select) => {
8
- overrideInnerBlockAttributes(select, props.clientId, {
9
- wrapperUse: false,
10
- wrapperNoControls: true,
11
- });
12
- });
13
-
14
- return (
15
- <GutenbergBlock
16
- {...props}
17
- options={CarouselOptions}
18
- editor={CarouselEditor}
19
- />
20
- );
21
- };
@@ -1,61 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Carousel 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
- $blockJsClass = $manifest['blockJsClass'] ?? $attributes['blockJsClass'] ?? '';
14
-
15
- $carouselLoop = Helpers::checkAttr('carouselLoop', $attributes, $manifest);
16
- $carouselNavigation = Helpers::checkAttr('carouselNavigation', $attributes, $manifest);
17
- $carouselPagination = Helpers::checkAttr('carouselPagination', $attributes, $manifest);
18
- ?>
19
-
20
- <div
21
- class="<?php echo esc_attr($blockJsClass); ?>"
22
- <?php if ($carouselLoop) { ?>
23
- data-loop
24
- <?php } ?>
25
- >
26
- <?php if ($carouselNavigation || $carouselPagination) { ?>
27
- <div class="hidden sm:flex items-center justify-center gap-2 mb-4">
28
- <?php if ($carouselPagination) { ?>
29
- <div class="<?php echo esc_attr(Helpers::classnames(["{$blockJsClass}-pagination", $carouselNavigation ? 'mr-auto' : '', 'max-sm:hidden space-x-0.5'])); ?>"></div>
30
- <?php } ?>
31
-
32
- <?php
33
- if ($carouselNavigation) {
34
- echo Helpers::render('button', [
35
- 'iconName' => 'back-arrow',
36
- 'buttonSize' => 'square',
37
- 'buttonVariant' => 'primary',
38
- 'buttonColor' => 'navy-800',
39
- 'additionalClass' => "{$blockJsClass}-prev",
40
- ]),
41
- Helpers::render('button', [
42
- 'iconName' => 'forward-arrow',
43
- 'buttonSize' => 'square',
44
- 'buttonVariant' => 'primary',
45
- 'buttonColor' => 'navy-800',
46
- 'additionalClass' => "{$blockJsClass}-next",
47
- ]);
48
- }
49
- ?>
50
- </div>
51
- <?php } ?>
52
-
53
- <div class="<?php echo esc_attr(Helpers::tailwindClasses('container', $attributes, $manifest, "{$blockJsClass}-container")); ?>">
54
- <div class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest)); ?>">
55
- <?php
56
- // phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
57
- echo $renderContent;
58
- ?>
59
- </div>
60
- </div>
61
- </div>
@@ -1,25 +0,0 @@
1
- import { __ } from '@wordpress/i18n';
2
- import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
3
- import { BlockInserter, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
4
- import manifest from '../manifest.json';
5
-
6
- export const CarouselEditor = ({ attributes, clientId }) => {
7
- const blockProps = useBlockProps();
8
- const innerBlocksProps = useInnerBlocksProps(blockProps, {
9
- renderAppender: false,
10
- orientation: 'horizontal',
11
- });
12
-
13
- return (
14
- <div className='flex items-center gap-2'>
15
- <div className={tailwindClasses('container', attributes, manifest)}>
16
- <div
17
- {...innerBlocksProps}
18
- className={tailwindClasses(attributes, manifest)}
19
- />
20
- </div>
21
-
22
- <BlockInserter clientId={clientId} />
23
- </div>
24
- );
25
- };
@@ -1,47 +0,0 @@
1
- import { __ } from '@wordpress/i18n';
2
- import { checkAttr, getAttrKey, getOption } from '@eightshift/frontend-libs-tailwind/scripts';
3
- import { OptionSelect, Spacer, Toggle } from '@eightshift/ui-components';
4
- import { icons } from '@eightshift/ui-components/icons';
5
- import manifest from './../manifest.json';
6
-
7
- export const CarouselOptions = ({ attributes, setAttributes }) => {
8
- const carouselLoop = checkAttr('carouselLoop', attributes, manifest);
9
- const carouselNavigation = checkAttr('carouselNavigation', attributes, manifest);
10
- const carouselPagination = checkAttr('carouselPagination', attributes, manifest);
11
- const carouselItemGap = checkAttr('carouselItemGap', attributes, manifest);
12
-
13
- return (
14
- <>
15
- <OptionSelect
16
- icon={icons.gutter}
17
- label={__('Item gap', '%g_textdomain%')}
18
- value={carouselItemGap}
19
- onChange={(value) => setAttributes({ [getAttrKey('carouselItemGap', attributes, manifest)]: value })}
20
- options={getOption('carouselItemGap', attributes, manifest)}
21
- />
22
-
23
- <Spacer />
24
-
25
- <Toggle
26
- icon={icons.loopMode}
27
- label={__('Loop', '%g_textdomain%')}
28
- checked={carouselLoop}
29
- onChange={(value) => setAttributes({ [getAttrKey('carouselLoop', attributes, manifest)]: value })}
30
- />
31
-
32
- <Toggle
33
- icon={icons.navigationButtons}
34
- label={__('Prev/next buttons', '%g_textdomain%')}
35
- checked={carouselNavigation}
36
- onChange={(value) => setAttributes({ [getAttrKey('carouselNavigation', attributes, manifest)]: value })}
37
- />
38
-
39
- <Toggle
40
- icon={icons.pagination}
41
- label={__('Pagination', '%g_textdomain%')}
42
- checked={carouselPagination}
43
- onChange={(value) => setAttributes({ [getAttrKey('carouselPagination', attributes, manifest)]: value })}
44
- />
45
- </>
46
- );
47
- };