@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,64 +0,0 @@
1
- import {
2
- checkAttr,
3
- getBreakpointData,
4
- getBreakpointNames,
5
- tailwindClasses,
6
- } from '@eightshift/frontend-libs-tailwind/scripts';
7
- import { ImagePlaceholder } from '@eightshift/ui-components';
8
- import manifest from './../manifest.json';
9
-
10
- export const ImageEditor = (attributes) => {
11
- const { additionalClass } = attributes;
12
-
13
- const imageUse = checkAttr('imageUse', attributes, manifest);
14
- const imageData = checkAttr('imageData', attributes, manifest);
15
-
16
- if (!imageUse || typeof imageData?.['_default'] === 'undefined') {
17
- return null;
18
- }
19
-
20
- const isDesktopFirst = imageData['_desktopFirst'] ?? false;
21
-
22
- const breakpointNames = getBreakpointNames();
23
- const breakpointData = getBreakpointData();
24
-
25
- return (
26
- <>
27
- {imageData?.['_default']?.url && (
28
- <picture className={additionalClass?.picture ?? ''}>
29
- {breakpointNames.map((breakpointName) => {
30
- if (!imageData?.[breakpointName]?.url) {
31
- return null;
32
- }
33
-
34
- const breakpointWidth = breakpointData?.[breakpointName];
35
-
36
- if (!breakpointWidth) {
37
- return null;
38
- }
39
-
40
- return (
41
- <source
42
- key={breakpointName}
43
- srcSet={imageData?.[breakpointName]?.url}
44
- media={`(${isDesktopFirst ? 'max-width' : 'min-width'}: ${breakpointWidth}em)`}
45
- />
46
- );
47
- })}
48
- <img
49
- className={tailwindClasses(attributes, manifest, additionalClass?.image ?? additionalClass)}
50
- src={imageData?.['_default'].url}
51
- />
52
- </picture>
53
- )}
54
-
55
- {!imageData?.['_default']?.url && (
56
- <ImagePlaceholder
57
- style='simple'
58
- size='large'
59
- className={additionalClass?.imagePlaceholder}
60
- />
61
- )}
62
- </>
63
- );
64
- };
@@ -1,111 +0,0 @@
1
- import { __ } from '@wordpress/i18n';
2
- import {
3
- checkAttr,
4
- getAttrKey,
5
- MediaPicker,
6
- generateOptionsFromValue,
7
- getOption,
8
- getHiddenOptions,
9
- getResponsiveData,
10
- } from '@eightshift/frontend-libs-tailwind/scripts';
11
- import manifest from './../manifest.json';
12
- import { ComponentToggle, OptionSelect, Responsive, Spacer, Toggle } from '@eightshift/ui-components';
13
- import { icons } from '@eightshift/ui-components/icons';
14
- import { truncateMiddle } from '@eightshift/ui-components/utilities';
15
-
16
- export const ImageOptions = (attributes) => {
17
- const { setAttributes, hideOptions, additionalControls, ...rest } = attributes;
18
-
19
- const hiddenOptions = getHiddenOptions(hideOptions);
20
-
21
- const imageUse = checkAttr('imageUse', attributes, manifest);
22
- const imageRoundedCorners = checkAttr('imageRoundedCorners', attributes, manifest);
23
- const imageAspectRatio = checkAttr('imageAspectRatio', attributes, manifest);
24
- const imageSize = checkAttr('imageSize', attributes, manifest);
25
-
26
- const imageData = checkAttr('imageData', attributes, manifest);
27
-
28
- const responsiveData = getResponsiveData(true);
29
-
30
- return (
31
- <ComponentToggle
32
- label={manifest.title}
33
- icon={icons.image}
34
- onChange={(value) => setAttributes({ [getAttrKey('imageUse', attributes, manifest)]: value })}
35
- useComponent={imageUse}
36
- {...rest}
37
- >
38
- <Responsive
39
- value={imageData}
40
- onChange={(value) => setAttributes({ [getAttrKey('imageData', attributes, manifest)]: value })}
41
- icon={icons.imageFile}
42
- label={__('Image', 'eightshift-ui-components')}
43
- options={generateOptionsFromValue(imageData, (v) =>
44
- truncateMiddle(
45
- v?.url?.replace(window.location.origin, '')?.replace(/\/wp-content\/uploads\/\d{4}\/\d{2}\//g, '') ??
46
- __('Not set', '%g_textdomain%'),
47
- 15,
48
- ),
49
- )}
50
- hidden={hiddenOptions?.imagePicker}
51
- {...responsiveData}
52
- >
53
- {({ breakpoint, currentValue, handleChange }) => (
54
- <MediaPicker
55
- onChange={({ id, url }) => handleChange({ id: id, url: url })}
56
- imageId={currentValue?.id}
57
- imageUrl={currentValue?.url}
58
- noDelete={breakpoint !== '_default'}
59
- />
60
- )}
61
- </Responsive>
62
-
63
- <Spacer hidden={hiddenOptions?.borderRadius} />
64
-
65
- <OptionSelect
66
- icon={icons.roundedCorners}
67
- label={__('Rounded corners', '%g_textdomain%')}
68
- options={getOption('imageRoundedCorners', attributes, manifest)}
69
- value={imageRoundedCorners}
70
- onChange={(value) =>
71
- setAttributes({
72
- [getAttrKey('imageRoundedCorners', attributes, manifest)]: value,
73
- })
74
- }
75
- type='menu'
76
- hidden={hiddenOptions?.borderRadius}
77
- inline
78
- />
79
-
80
- <Spacer hidden={hiddenOptions?.aspectRatio || hiddenOptions?.stretch} />
81
-
82
- <OptionSelect
83
- icon={icons.aspectRatio}
84
- label={__('Aspect ratio', '%g_textdomain%')}
85
- options={getOption('imageAspectRatio', attributes, manifest)}
86
- value={imageAspectRatio}
87
- onChange={(value) =>
88
- setAttributes({
89
- [getAttrKey('imageAspectRatio', attributes, manifest)]: value,
90
- })
91
- }
92
- type='menu'
93
- hidden={hiddenOptions?.aspectRatio}
94
- inline
95
- />
96
-
97
- <Toggle
98
- icon={icons.expandXl}
99
- label={__('Stretch', '%g_textdomain%')}
100
- checked={imageSize === 'stretch'}
101
- onChange={(value) =>
102
- setAttributes({ [getAttrKey('imageSize', attributes, manifest)]: value ? 'stretch' : 'default' })
103
- }
104
- hidden={hiddenOptions?.stretch}
105
- />
106
-
107
- <Spacer hidden={!additionalControls} />
108
- {additionalControls}
109
- </ComponentToggle>
110
- );
111
- };
@@ -1,68 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Image component template.
5
- *
6
- * @package %g_namespace%
7
- */
8
-
9
- use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
10
-
11
- $globalManifest = Helpers::getSettings();
12
- $manifest = Helpers::getManifestByDir(__DIR__);
13
-
14
- $additionalClass = $attributes['additionalClass'] ?? '';
15
-
16
- $imageUse = Helpers::checkAttr('imageUse', $attributes, $manifest) ?? false;
17
- $imageData = Helpers::checkAttr('imageData', $attributes, $manifest);
18
-
19
- if (!$imageUse || empty($imageData['_default']['url'])) {
20
- return;
21
- }
22
-
23
- $imageAlt = get_post_meta($imageData['_default']['id'], '_wp_attachment_image_alt', true) ?? '';
24
-
25
- $isDesktopFirst = $imageData['_desktopFirst'] ?? false;
26
-
27
- $breakpointData = Helpers::getSettingsGlobalVariablesBreakpoints();
28
- $breakpoints = Helpers::getTwBreakpoints($isDesktopFirst);
29
-
30
- if (!$isDesktopFirst) {
31
- $breakpoints = array_reverse($breakpoints);
32
- }
33
- ?>
34
-
35
- <picture
36
- <?php if (!empty($additionalClass['picture'])) { ?>
37
- class="<?php echo esc_attr($additionalClass['picture']); ?>"
38
- <?php } ?>
39
- >
40
- <?php
41
- foreach ($breakpoints as $breakpoint) { ?>
42
- <?php
43
- if (!isset($imageData[$breakpoint])) {
44
- continue;
45
- }
46
-
47
- $value = $imageData[$breakpoint]['url'] ?? '';
48
-
49
- if (empty($value)) {
50
- continue;
51
- }
52
-
53
- $breakpointWidth = $breakpointData[str_replace('max-', '', $breakpoint)];
54
-
55
- $widthMode = $isDesktopFirst ? 'max-width' : 'min-width';
56
-
57
- // phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
58
- echo '<source srcset="' . esc_url($value) . '" media="(' . $widthMode . ': ' . $breakpointWidth . 'em)" />';
59
- ?>
60
- <?php } ?>
61
-
62
- <img
63
- src="<?php echo esc_url($imageData['_default']['url'] ?? ''); ?>"
64
- alt="<?php echo esc_attr($imageAlt); ?>"
65
- class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass['image'] ?? '')); ?>"
66
- />
67
- </picture>
68
-
@@ -1,125 +0,0 @@
1
- {
2
- "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
3
- "componentName": "image",
4
- "title": "Image",
5
- "componentClass": "image",
6
- "example": {
7
- "attributes": {
8
- "imageData": {
9
- "_desktopFirst": false,
10
- "_default": {
11
- "id": "1",
12
- "url": "https://loremflickr.com/1000/800"
13
- }
14
- },
15
- "imageUse": true
16
- }
17
- },
18
- "attributes": {
19
- "imageData": {
20
- "type": "object",
21
- "default": {
22
- "_desktopFirst": false,
23
- "_default": {
24
- "id": "",
25
- "url": ""
26
- }
27
- }
28
- },
29
- "imageUse": {
30
- "type": "boolean",
31
- "default": true
32
- },
33
- "imageRoundedCorners": {
34
- "type": "string",
35
- "default": "none"
36
- },
37
- "imageAspectRatio": {
38
- "type": "string",
39
- "default": "auto"
40
- },
41
- "imageSize": {
42
- "type": "string",
43
- "default": "default"
44
- }
45
- },
46
- "options": {
47
- "imageRoundedCorners": [
48
- {
49
- "label": "0",
50
- "value": "none"
51
- },
52
- {
53
- "label": "4",
54
- "value": "small"
55
- },
56
- {
57
- "label": "8",
58
- "value": "medium"
59
- },
60
- {
61
- "label": "16",
62
- "value": "large"
63
- },
64
- {
65
- "label": "Full",
66
- "value": "full"
67
- }
68
- ],
69
- "imageAspectRatio": [
70
- {
71
- "label": "Auto",
72
- "value": "auto"
73
- },
74
- {
75
- "label": "Square",
76
- "value": "square"
77
- },
78
- {
79
- "label": "3/2",
80
- "value": "three-two"
81
- },
82
- {
83
- "label": "5/4",
84
- "value": "five-four"
85
- },
86
- {
87
- "label": "16/9",
88
- "value": "sixteen-nine"
89
- },
90
- {
91
- "label": "21/9",
92
- "value": "twentyone-nine"
93
- }
94
- ]
95
- },
96
- "tailwind": {
97
- "base": {
98
- "twClasses": "object-cover"
99
- },
100
- "options": {
101
- "imageRoundedCorners": {
102
- "twClasses": {
103
- "small": "rounded",
104
- "medium": "rounded-lg",
105
- "large": "rounded-2xl",
106
- "full": "rounded-full"
107
- }
108
- },
109
- "imageAspectRatio": {
110
- "twClasses": {
111
- "square": "aspect-square",
112
- "three-two": "aspect-3/2",
113
- "five-four": "aspect-5/4",
114
- "sixteen-nine": "aspect-video",
115
- "twentyone-nine": "aspect-21/9"
116
- }
117
- },
118
- "imageSize": {
119
- "twClasses": {
120
- "stretch": "size-full"
121
- }
122
- }
123
- }
124
- }
125
- }
@@ -1,30 +0,0 @@
1
- import { __ } from '@wordpress/i18n';
2
- import { RichText } from '@wordpress/block-editor';
3
- import { checkAttr, getAttrKey, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
4
- import manifest from '../manifest.json';
5
-
6
- export const ListEditor = (attributes) => {
7
- const { setAttributes, additionalClass, placeholder = __('Add content', '%g_textdomain%') } = attributes;
8
-
9
- const listUse = checkAttr('listUse', attributes, manifest);
10
-
11
- if (!listUse) {
12
- return null;
13
- }
14
-
15
- const listContent = checkAttr('listContent', attributes, manifest);
16
- const listType = checkAttr('listType', attributes, manifest);
17
-
18
- return (
19
- <div className={tailwindClasses(attributes, manifest, additionalClass)}>
20
- <RichText
21
- tagName={listType}
22
- multiline='li'
23
- placeholder={placeholder}
24
- value={listContent}
25
- onChange={(value) => setAttributes({ [getAttrKey('listContent', attributes, manifest)]: value })}
26
- allowedFormats={['core/bold', 'core/link']}
27
- />
28
- </div>
29
- );
30
- };
@@ -1,62 +0,0 @@
1
- import { __ } from '@wordpress/i18n';
2
- import { getOption, getAttrKey, checkAttr, getHiddenOptions } from '@eightshift/frontend-libs-tailwind/scripts';
3
- import { ComponentToggle, OptionSelect, HStack, ToggleButton } from '@eightshift/ui-components';
4
- import { icons } from '@eightshift/ui-components/icons';
5
- import manifest from '../manifest.json';
6
-
7
- export const ListOptions = (attributes) => {
8
- const { setAttributes, additionalControls, hideOptions, ...rest } = attributes;
9
-
10
- const hiddenOptions = getHiddenOptions(hideOptions);
11
-
12
- const listUse = checkAttr('listUse', attributes, manifest);
13
- const listSize = checkAttr('listSize', attributes, manifest);
14
- const listFontWeight = checkAttr('listFontWeight', attributes, manifest);
15
- const listStyle = checkAttr('listStyle', attributes, manifest);
16
-
17
- return (
18
- <ComponentToggle
19
- label={manifest.title}
20
- icon={icons.listUnordered}
21
- onChange={(value) => setAttributes({ [getAttrKey('listUse', attributes, manifest)]: value })}
22
- useComponent={listUse}
23
- {...rest}
24
- >
25
- <HStack>
26
- <OptionSelect
27
- options={getOption('listSize', attributes, manifest)}
28
- onChange={(value) => setAttributes({ [getAttrKey('listSize', attributes, manifest)]: value })}
29
- value={listSize}
30
- aria-label={__('Font size', '%g_textdomain%')}
31
- hidden={hiddenOptions.size}
32
- type='menu'
33
- />
34
-
35
- <ToggleButton
36
- selected={listFontWeight === '700'}
37
- icon={icons.bold}
38
- onChange={(value) =>
39
- setAttributes({ [getAttrKey('listFontWeight', attributes, manifest)]: value ? '700' : '400' })
40
- }
41
- tooltip={__('Bold', '%g_textdomain%')}
42
- hidden={hiddenOptions.weight}
43
- />
44
-
45
- <OptionSelect
46
- value={listStyle}
47
- onChange={(value) =>
48
- setAttributes({
49
- [getAttrKey('listStyle', attributes, manifest)]: value,
50
- [getAttrKey('listType', attributes, manifest)]: value === 'decimal' ? 'ol' : 'ul',
51
- })
52
- }
53
- aria-label={__('List style', '%g_textdomain%')}
54
- options={getOption('listStyle', attributes, manifest)}
55
- noItemLabel
56
- />
57
- </HStack>
58
-
59
- {additionalControls}
60
- </ComponentToggle>
61
- );
62
- };
@@ -1,32 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * List 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
- $listUse = Helpers::checkAttr('listUse', $attributes, $manifest);
14
-
15
- if (!$listUse) {
16
- return;
17
- }
18
-
19
- $additionalClass = $attributes['additionalClass'] ?? '';
20
-
21
- $listContent = Helpers::checkAttr('listContent', $attributes, $manifest);
22
- $listType = Helpers::checkAttr('listType', $attributes, $manifest);
23
- ?>
24
-
25
- <<?php echo esc_attr($listType); ?>
26
- class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass)); ?>"
27
- >
28
- <?php
29
- // phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
30
- echo $listContent;
31
- ?>
32
- </<?php echo esc_attr($listType); ?>>
@@ -1,127 +0,0 @@
1
- {
2
- "$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
3
- "componentName": "list",
4
- "title": "List",
5
- "componentClass": "list",
6
- "example": {
7
- "attributes": {
8
- "listContent": "<li>List item 1</li><li>List item 2</li><li>List item 3</li>",
9
- "listType": "ul",
10
- "listSize": "default",
11
- "listColor": "primary500",
12
- "listUse": true
13
- }
14
- },
15
- "attributes": {
16
- "listContent": {
17
- "type": "string"
18
- },
19
- "listType": {
20
- "type": "string",
21
- "default": "ul"
22
- },
23
- "listStyle": {
24
- "type": "string",
25
- "default": "disc"
26
- },
27
- "listSize": {
28
- "type": "string",
29
- "default": "base"
30
- },
31
- "listFontWeight": {
32
- "type": "string",
33
- "default": "400"
34
- },
35
- "listUse": {
36
- "type": "boolean",
37
- "default": true
38
- }
39
- },
40
- "options": {
41
- "listSize": [
42
- {
43
- "label": "24",
44
- "value": "lg"
45
- },
46
- {
47
- "label": "20",
48
- "value": "md"
49
- },
50
- {
51
- "label": "16",
52
- "value": "base"
53
- },
54
- {
55
- "label": "14",
56
- "value": "sm"
57
- }
58
- ],
59
- "listFontWeight": [
60
- {
61
- "label": "Normal",
62
- "value": "400"
63
- },
64
- {
65
- "label": "Bold",
66
- "value": "700"
67
- }
68
- ],
69
- "listStyle": [
70
- {
71
- "label": "No list markers",
72
- "value": "none",
73
- "icon": "emptyCircle"
74
- },
75
- {
76
- "label": "Numeric list",
77
- "value": "decimal",
78
- "icon": "listOrdered"
79
- },
80
- {
81
- "label": "Bulleted list",
82
- "value": "disc",
83
- "icon": "listUnordered"
84
- },
85
- {
86
- "label": "Checkmark list",
87
- "value": "checks",
88
- "icon": "optionList"
89
- }
90
- ]
91
- },
92
- "tailwind": {
93
- "base": {
94
- "twClasses": "font-sans [&_a]:underline font-synthesis-none",
95
- "twClassesEditorOnly": "font-sans [&>a]:underline font-synthesis-none"
96
- },
97
- "options": {
98
- "listSize": {
99
- "twClasses": {
100
- "sm": "text-sm",
101
- "base": "~sm/md:~text-sm/base",
102
- "md": "~sm/md:~text-lg/2xl",
103
- "lg": "~sm/md:~text-xl/3xl"
104
- }
105
- },
106
- "listFontWeight": {
107
- "twClasses": {
108
- "700": "font-bold"
109
- }
110
- },
111
- "listStyle": {
112
- "twClasses": {
113
- "none": "list-none",
114
- "disc": "list-disc ml-[1.125em]",
115
- "decimal": "list-decimal ml-[1.125em]",
116
- "checks": "list-['✓_'] ml-[1em]"
117
- },
118
- "twClassesEditorOnly": {
119
- "none": "*:list-none",
120
- "disc": "*:list-disc *:ml-[1.125em]",
121
- "decimal": "*:list-decimal *:ml-[1.125em]",
122
- "checks": "*:list-['✓_'] *:ml-[1em]"
123
- }
124
- }
125
- }
126
- }
127
- }
@@ -1,19 +0,0 @@
1
- import domReady from '@wordpress/dom-ready';
2
- import manifest from './../manifest.json';
3
-
4
- domReady(async () => {
5
- const selectors = `.${manifest.componentJsClass}`;
6
- const elements = document.querySelectorAll(selectors);
7
-
8
- if (!elements.length) {
9
- return;
10
- }
11
-
12
- const { LoadMore } = await import('./load-more');
13
-
14
- elements.forEach((element) => {
15
- new LoadMore({
16
- element,
17
- }).init();
18
- });
19
- });