@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,579 @@
1
+ import { __, _n, sprintf } from '@wordpress/i18n';
2
+ import { getAttrKey, checkAttr, getOption, generateOptionsFromValue } from '@eightshift/frontend-libs-tailwind/scripts';
3
+ import {
4
+ Button,
5
+ ColumnConfigSlider,
6
+ NumberPicker,
7
+ OptionSelect,
8
+ Responsive,
9
+ Spacer,
10
+ getColumnConfigOutputText,
11
+ BaseControl,
12
+ ButtonGroup,
13
+ ColorPicker,
14
+ } from '@eightshift/ui-components';
15
+ import { icons } from '@eightshift/ui-components/icons';
16
+ import { clsx } from '@eightshift/ui-components/utilities';
17
+ import { getBreakpointNames, getResponsiveData } from '@eightshift/frontend-libs-tailwind/scripts/helpers/breakpoints';
18
+ import { rotationClassName, getColorOption } from '../../../assets/scripts/shared';
19
+ import manifest from './../manifest.json';
20
+
21
+ export const ColumnOptions = ({ attributes, setAttributes }) => {
22
+ const columnOffset = checkAttr('columnOffset', attributes, manifest);
23
+ const columnWidth = checkAttr('columnWidth', attributes, manifest);
24
+ const columnRowSpan = checkAttr('columnRowSpan', attributes, manifest);
25
+
26
+ const columnHide = checkAttr('columnHide', attributes, manifest);
27
+ const columnVerticalAlign = checkAttr('columnVerticalAlign', attributes, manifest);
28
+ const columnHorizontalAlign = checkAttr('columnHorizontalAlign', attributes, manifest);
29
+
30
+ const columnPaddingLeft = checkAttr('columnPaddingLeft', attributes, manifest);
31
+ const columnPaddingRight = checkAttr('columnPaddingRight', attributes, manifest);
32
+ const columnPaddingTop = checkAttr('columnPaddingTop', attributes, manifest);
33
+ const columnPaddingBottom = checkAttr('columnPaddingBottom', attributes, manifest);
34
+
35
+ const columnBackground = checkAttr('columnBackground', attributes, manifest);
36
+ const columnGradientDirection = checkAttr('columnGradientDirection', attributes, manifest);
37
+ const columnBorderRadius = checkAttr('columnBorderRadius', attributes, manifest);
38
+
39
+ const columnShadow = checkAttr('columnShadow', attributes, manifest);
40
+ const columnBorder = checkAttr('columnBorder', attributes, manifest);
41
+
42
+ const columnOverflow = checkAttr('columnOverflow', attributes, manifest);
43
+
44
+ const breakpointNames = getBreakpointNames();
45
+ const responsiveData = getResponsiveData(true);
46
+
47
+ const allBreakpoints = [...breakpointNames.toReversed(), '_default'];
48
+
49
+ const columnsConfig = attributes?.columnsConfig;
50
+
51
+ const hasEqualColumnConfigs = Object.keys(columnsConfig ?? {}).length <= 2;
52
+
53
+ const widthOffsetValue = Object.keys(columnOffset)
54
+ .filter((breakpoint) => breakpoint !== '_desktopFirst')
55
+ .reduce(
56
+ (prev, breakpoint) => {
57
+ return {
58
+ ...prev,
59
+ [breakpoint]: `${breakpoint},${columnOffset?.[breakpoint]},${columnWidth?.[breakpoint]}`,
60
+ };
61
+ },
62
+ { _desktopFirst: true },
63
+ );
64
+
65
+ const widthOffsetOptions = generateOptionsFromValue(widthOffsetValue, (value, breakpoint) => {
66
+ const [_, offset, width] = value.split(',');
67
+ const numColumns = parseInt(columnsConfig?.[breakpoint] ?? columnsConfig?.['_default']);
68
+ return getColumnConfigOutputText(numColumns, parseInt(offset), parseInt(width));
69
+ });
70
+
71
+ let backgroundType = 'none';
72
+
73
+ if (columnBackground?.startsWith('solid-')) {
74
+ backgroundType = 'solid';
75
+ } else if (columnBackground?.startsWith('gradient-')) {
76
+ backgroundType = 'gradient';
77
+ }
78
+
79
+ return (
80
+ <>
81
+ <Responsive
82
+ value={widthOffsetValue}
83
+ onChange={(newValue) => {
84
+ const valueKeys = Object.keys(newValue);
85
+
86
+ let newColumnOffset = { ...columnOffset };
87
+ let newColumnWidth = { ...columnWidth };
88
+
89
+ Object.keys(columnOffset).forEach((breakpoint) => {
90
+ if (breakpoint === '_default' || breakpoint === '_desktopFirst') {
91
+ return;
92
+ }
93
+
94
+ if (valueKeys.includes(breakpoint)) {
95
+ return;
96
+ }
97
+
98
+ delete newColumnOffset[breakpoint];
99
+ delete newColumnWidth[breakpoint];
100
+ });
101
+
102
+ setAttributes({
103
+ [getAttrKey('columnOffset', attributes, manifest)]: newColumnOffset,
104
+ [getAttrKey('columnWidth', attributes, manifest)]: newColumnWidth,
105
+ });
106
+ }}
107
+ icon={icons.positioningWidthGuide}
108
+ label={__('Placement', '%g_textdomain%')}
109
+ options={widthOffsetOptions}
110
+ innerContentAlign='stretch'
111
+ noModeSelect
112
+ {...responsiveData}
113
+ >
114
+ {({ breakpoint }) => {
115
+ let localBreakpoints = [...allBreakpoints];
116
+ const isUnset = !columnOffset[breakpoint] || !columnWidth[breakpoint];
117
+
118
+ if (breakpoint !== '_default') {
119
+ localBreakpoints = localBreakpoints.slice(localBreakpoints?.findIndex((v) => v === breakpoint) + 1);
120
+ }
121
+
122
+ const numOfColumns = parseInt(columnsConfig?.[breakpoint] ?? columnsConfig?.['_default']);
123
+
124
+ let offset = columnOffset[breakpoint];
125
+ let width = columnWidth[breakpoint];
126
+
127
+ if (!offset && breakpoint !== '_default' && hasEqualColumnConfigs) {
128
+ offset = columnOffset?.[localBreakpoints.find((breakpoint) => columnOffset?.[breakpoint])];
129
+ } else if (!offset && breakpoint !== '_default' && !hasEqualColumnConfigs) {
130
+ offset = '1';
131
+ }
132
+
133
+ if (!width && breakpoint !== '_default' && hasEqualColumnConfigs) {
134
+ width = columnWidth?.[localBreakpoints.find((breakpoint) => columnWidth?.[breakpoint])];
135
+ } else if (!width && breakpoint !== '_default' && !hasEqualColumnConfigs) {
136
+ width = columnsConfig?.[breakpoint] ?? '1';
137
+ }
138
+
139
+ if (numOfColumns === 1 && !(breakpoint in columnOffset) && !(breakpoint in columnWidth)) {
140
+ setAttributes({
141
+ [getAttrKey('columnOffset', attributes, manifest)]: {
142
+ ...columnOffset,
143
+ [breakpoint]: '1',
144
+ },
145
+ [getAttrKey('columnWidth', attributes, manifest)]: {
146
+ ...columnWidth,
147
+ [breakpoint]: '1',
148
+ },
149
+ });
150
+ }
151
+
152
+ if (isUnset && numOfColumns > 1) {
153
+ return (
154
+ <Button
155
+ onPress={() => {
156
+ setAttributes({
157
+ [getAttrKey('columnOffset', attributes, manifest)]: {
158
+ ...columnOffset,
159
+ [breakpoint]: '1',
160
+ },
161
+ [getAttrKey('columnWidth', attributes, manifest)]: {
162
+ ...columnWidth,
163
+ [breakpoint]: `${numOfColumns}`,
164
+ },
165
+ });
166
+ }}
167
+ className='min-h-10 justify-center'
168
+ >
169
+ {__('Set value', '%g_textdomain%')}
170
+ </Button>
171
+ );
172
+ }
173
+
174
+ return (
175
+ <ColumnConfigSlider
176
+ key={breakpoint}
177
+ columns={numOfColumns}
178
+ onChange={([newOffset, newWidth]) => {
179
+ const o = isNaN(newOffset) ? 1 : newOffset;
180
+ const w = isNaN(newWidth) ? 1 : newWidth;
181
+
182
+ setAttributes({
183
+ [getAttrKey('columnOffset', attributes, manifest)]: {
184
+ ...columnOffset,
185
+ [breakpoint]: `${o}`,
186
+ },
187
+ [getAttrKey('columnWidth', attributes, manifest)]: {
188
+ ...columnWidth,
189
+ [breakpoint]: `${w - o + 1}`,
190
+ },
191
+ });
192
+ }}
193
+ value={[parseInt(offset), parseInt(offset) + parseInt(width) - 1]}
194
+ disableOffset={numOfColumns === 1}
195
+ disableWidth={numOfColumns === 1}
196
+ aria-label={sprintf(__('Column: width and offset - %s', '%g_textdomain%'), breakpoint)}
197
+ />
198
+ );
199
+ }}
200
+ </Responsive>
201
+
202
+ <Responsive
203
+ value={columnRowSpan}
204
+ onChange={(value) =>
205
+ setAttributes({
206
+ [getAttrKey('columnRowSpan', attributes, manifest)]: value,
207
+ })
208
+ }
209
+ icon={icons.gridAutoRows}
210
+ label={__('Row span', '%g_textdomain%')}
211
+ options={generateOptionsFromValue(columnRowSpan, (v) =>
212
+ !v ? __('Not set', '%g_textdomain%') : sprintf(_n('1 row', '%d rows', v, '%g_textdomain%'), v),
213
+ )}
214
+ noModeSelect
215
+ inline
216
+ {...responsiveData}
217
+ >
218
+ {({ currentValue, handleChange, breakpoint }) => (
219
+ <NumberPicker
220
+ value={parseInt(currentValue)}
221
+ onChange={(value) => handleChange(`${value}`)}
222
+ min={1}
223
+ max={12}
224
+ step={1}
225
+ aria-label={sprintf(__('Column: row span - %s', '%g_textdomain%'), breakpoint)}
226
+ size='small'
227
+ fixedWidth={2.5}
228
+ placeholder='–'
229
+ />
230
+ )}
231
+ </Responsive>
232
+
233
+ <Spacer />
234
+ <Spacer
235
+ icon={icons.alignHorizontalVerticalAlt2}
236
+ text={__('Content alignment', '%g_textdomain%')}
237
+ border
238
+ />
239
+
240
+ <Responsive
241
+ value={columnHorizontalAlign}
242
+ onChange={(value) =>
243
+ setAttributes({
244
+ [getAttrKey('columnHorizontalAlign', attributes, manifest)]: value,
245
+ })
246
+ }
247
+ icon={icons.horizontalAlign}
248
+ label={__('Horizontal', '%g_textdomain%')}
249
+ options={getOption('columnHorizontalAlign', attributes, manifest)}
250
+ noModeSelect
251
+ inline
252
+ {...responsiveData}
253
+ >
254
+ {({ currentValue, handleChange, options, isInlineCollapsedView, breakpoint }) => (
255
+ <OptionSelect
256
+ options={options}
257
+ value={currentValue}
258
+ onChange={(value) => handleChange(value)}
259
+ type={isInlineCollapsedView ? 'menu' : 'toggleButtons'}
260
+ noItemIcon={!isInlineCollapsedView}
261
+ noTriggerLabel
262
+ aria-label={sprintf(__('Column: content horizontal align - %s', '%g_textdomain%'), breakpoint)}
263
+ />
264
+ )}
265
+ </Responsive>
266
+
267
+ <Responsive
268
+ value={columnVerticalAlign}
269
+ onChange={(value) =>
270
+ setAttributes({
271
+ [getAttrKey('columnVerticalAlign', attributes, manifest)]: value,
272
+ })
273
+ }
274
+ icon={icons.verticalAlign}
275
+ label={__('Vertical', '%g_textdomain%')}
276
+ options={getOption('columnVerticalAlign', attributes, manifest)}
277
+ noModeSelect
278
+ inline
279
+ {...responsiveData}
280
+ >
281
+ {({ currentValue, handleChange, options, isInlineCollapsedView, breakpoint }) => (
282
+ <OptionSelect
283
+ options={options}
284
+ value={currentValue}
285
+ onChange={(value) => handleChange(value)}
286
+ type={isInlineCollapsedView ? 'menu' : 'toggleButtons'}
287
+ noItemIcon={!isInlineCollapsedView}
288
+ noTriggerLabel
289
+ aria-label={sprintf(__('Column: content vertical align - %s', '%g_textdomain%'), breakpoint)}
290
+ />
291
+ )}
292
+ </Responsive>
293
+
294
+ <Spacer />
295
+ <Spacer
296
+ icon={icons.design}
297
+ text={__('Design', '%g_textdomain%')}
298
+ border
299
+ />
300
+
301
+ <BaseControl
302
+ icon={icons.backgroundType}
303
+ label={__('Background', '%g_textdomain%')}
304
+ inline
305
+ >
306
+ <ButtonGroup>
307
+ <OptionSelect
308
+ options={getOption('columnBackground', attributes, manifest)}
309
+ value={backgroundType}
310
+ onChange={(value) => {
311
+ if (value === 'none') {
312
+ setAttributes({ [getAttrKey('columnBackground', attributes, manifest)]: undefined });
313
+ } else {
314
+ setAttributes({
315
+ [getAttrKey('columnBackground', attributes, manifest)]: Object.keys(
316
+ manifest.tailwind.options.columnBackground.twClasses,
317
+ ).find((key) => key.startsWith(value)),
318
+ });
319
+ }
320
+ }}
321
+ aria-label={__('Background type', '%g_textdomain%')}
322
+ type='menu'
323
+ noItemIcon
324
+ />
325
+
326
+ {backgroundType === 'solid' && (
327
+ <ColorPicker
328
+ colors={getColorOption('columnBackgroundSolid', manifest)}
329
+ onChange={(value) =>
330
+ setAttributes({ [getAttrKey('columnBackground', attributes, manifest)]: `solid-${value}` })
331
+ }
332
+ value={columnBackground?.replace('solid-', '')}
333
+ aria-label={__('Background color', '%g_textdomain%')}
334
+ />
335
+ )}
336
+ {backgroundType === 'gradient' && (
337
+ <>
338
+ <OptionSelect
339
+ value={columnBackground}
340
+ onChange={(value) => setAttributes({ [getAttrKey('columnBackground', attributes, manifest)]: value })}
341
+ options={getOption('columnBackgroundGradient', attributes, manifest).map((option) => ({
342
+ ...option,
343
+ endIcon: (
344
+ <div
345
+ className={clsx(
346
+ 'es-uic-size-5 es-uic-rounded es-uic-border es-uic-border-gray-300 bg-gradient-to-r',
347
+ manifest.tailwind.options.columnBackground.twClasses[option.value],
348
+ )}
349
+ />
350
+ ),
351
+ }))}
352
+ wrapperProps={{
353
+ triggerIcon: (
354
+ <div
355
+ className={clsx(
356
+ 'es-uic-size-6 es-uic-rounded es-uic-border es-uic-border-gray-300 es-uic-shadow-sm bg-gradient-to-r',
357
+ manifest.tailwind.options.columnBackground.twClasses[columnBackground],
358
+ )}
359
+ />
360
+ ),
361
+ }}
362
+ aria-label={__('Gradient style', '%g_textdomain%')}
363
+ noTriggerLabel
364
+ type='menu'
365
+ />
366
+ <OptionSelect
367
+ value={columnGradientDirection}
368
+ onChange={(value) =>
369
+ setAttributes({ [getAttrKey('columnGradientDirection', attributes, manifest)]: value })
370
+ }
371
+ options={getOption('columnGradientDirection', attributes, manifest)}
372
+ wrapperProps={{
373
+ triggerIcon: <div className={rotationClassName[columnGradientDirection]}>{icons.arrowUpCircle}</div>,
374
+ }}
375
+ aria-label={__('Gradient angle', '%g_textdomain%')}
376
+ noTriggerLabel
377
+ type='menu'
378
+ />
379
+ </>
380
+ )}
381
+ </ButtonGroup>
382
+ </BaseControl>
383
+
384
+ <ColorPicker
385
+ icon={icons.border}
386
+ label={__('Border', '%g_textdomain%')}
387
+ colors={getColorOption('columnBorder', manifest)}
388
+ onChange={(value) => setAttributes({ [getAttrKey('columnBorder', attributes, manifest)]: value })}
389
+ value={columnBorder}
390
+ aria-label={__('Border', '%g_textdomain%')}
391
+ clearable
392
+ inline
393
+ />
394
+
395
+ <OptionSelect
396
+ icon={icons.roundedCorners}
397
+ label={__('Rounded corners', '%g_textdomain%')}
398
+ value={columnBorderRadius}
399
+ onChange={(value) => setAttributes({ [getAttrKey('columnBorderRadius', attributes, manifest)]: value })}
400
+ options={getOption('columnBorderRadius', attributes, manifest)}
401
+ aria-label={__('Rounded corners', '%g_textdomain%')}
402
+ type='menu'
403
+ inline
404
+ />
405
+
406
+ <OptionSelect
407
+ icon={icons.shadow}
408
+ label={__('Shadow', '%g_textdomain%')}
409
+ value={columnShadow}
410
+ onChange={(value) => setAttributes({ [getAttrKey('columnShadow', attributes, manifest)]: value })}
411
+ options={getOption('columnShadow', attributes, manifest)}
412
+ aria-label={__('Shadow', '%g_textdomain%')}
413
+ type='menu'
414
+ inline
415
+ />
416
+
417
+ <Spacer />
418
+ <Spacer
419
+ icon={icons.containerSpacingH}
420
+ text={__('Padding', '%g_textdomain%')}
421
+ border
422
+ />
423
+
424
+ <Responsive
425
+ value={columnPaddingTop}
426
+ onChange={(value) =>
427
+ setAttributes({
428
+ [getAttrKey('columnPaddingTop', attributes, manifest)]: value,
429
+ })
430
+ }
431
+ icon={icons.spacingTopIn}
432
+ label={__('Top', '%g_textdomain%')}
433
+ options={getOption('columnSpacing', attributes, manifest)}
434
+ noModeSelect
435
+ inline
436
+ {...responsiveData}
437
+ >
438
+ {({ currentValue, handleChange, options }) => (
439
+ <OptionSelect
440
+ options={options}
441
+ value={currentValue}
442
+ onChange={(value) => handleChange(value)}
443
+ type='menu'
444
+ />
445
+ )}
446
+ </Responsive>
447
+
448
+ <Responsive
449
+ value={columnPaddingRight}
450
+ onChange={(value) =>
451
+ setAttributes({
452
+ [getAttrKey('columnPaddingRight', attributes, manifest)]: value,
453
+ })
454
+ }
455
+ icon={icons.spacingRightIn}
456
+ label={__('Right', '%g_textdomain%')}
457
+ options={getOption('columnSpacing', attributes, manifest)}
458
+ noModeSelect
459
+ inline
460
+ {...responsiveData}
461
+ >
462
+ {({ currentValue, handleChange, options }) => (
463
+ <OptionSelect
464
+ options={options}
465
+ value={currentValue}
466
+ onChange={(value) => handleChange(value)}
467
+ type='menu'
468
+ />
469
+ )}
470
+ </Responsive>
471
+
472
+ <Responsive
473
+ value={columnPaddingBottom}
474
+ onChange={(value) =>
475
+ setAttributes({
476
+ [getAttrKey('columnPaddingBottom', attributes, manifest)]: value,
477
+ })
478
+ }
479
+ icon={icons.spacingBottomIn}
480
+ label={__('Bottom', '%g_textdomain%')}
481
+ options={getOption('columnSpacing', attributes, manifest)}
482
+ noModeSelect
483
+ inline
484
+ {...responsiveData}
485
+ >
486
+ {({ currentValue, handleChange, options }) => (
487
+ <OptionSelect
488
+ options={options}
489
+ value={currentValue}
490
+ onChange={(value) => handleChange(value)}
491
+ type='menu'
492
+ />
493
+ )}
494
+ </Responsive>
495
+
496
+ <Responsive
497
+ value={columnPaddingLeft}
498
+ onChange={(value) =>
499
+ setAttributes({
500
+ [getAttrKey('columnPaddingLeft', attributes, manifest)]: value,
501
+ })
502
+ }
503
+ icon={icons.spacingLeftIn}
504
+ label={__('Left', '%g_textdomain%')}
505
+ options={getOption('columnSpacing', attributes, manifest)}
506
+ noModeSelect
507
+ inline
508
+ {...responsiveData}
509
+ >
510
+ {({ currentValue, handleChange, options }) => (
511
+ <OptionSelect
512
+ options={options}
513
+ value={currentValue}
514
+ onChange={(value) => handleChange(value)}
515
+ type='menu'
516
+ />
517
+ )}
518
+ </Responsive>
519
+
520
+ <Spacer />
521
+ <Spacer
522
+ icon={icons.moreHCircle}
523
+ text={__('Advanced', '%g_textdomain%')}
524
+ border
525
+ />
526
+
527
+ <Responsive
528
+ value={columnHide}
529
+ onChange={(value) =>
530
+ setAttributes({
531
+ [getAttrKey('columnHide', attributes, manifest)]: value,
532
+ })
533
+ }
534
+ icon={icons.visibility}
535
+ label={__('Visibility', '%g_textdomain%')}
536
+ options={getOption('columnHide', attributes, manifest)}
537
+ noModeSelect
538
+ inline
539
+ {...responsiveData}
540
+ >
541
+ {({ currentValue, handleChange, options, isInlineCollapsedView, breakpoint }) => (
542
+ <OptionSelect
543
+ options={options}
544
+ value={String(currentValue)}
545
+ onChange={(value) => handleChange(value)}
546
+ noItemLabel={isInlineCollapsedView}
547
+ noItemIcon={!isInlineCollapsedView}
548
+ aria-label={sprintf(__('Column: visibility - %s', '%g_textdomain%'), breakpoint)}
549
+ />
550
+ )}
551
+ </Responsive>
552
+
553
+ <Responsive
554
+ value={columnOverflow}
555
+ onChange={(value) =>
556
+ setAttributes({
557
+ [getAttrKey('columnOverflow', attributes, manifest)]: value,
558
+ })
559
+ }
560
+ icon={icons.wrapperOverflow}
561
+ label={__('Content overflow', '%g_textdomain%')}
562
+ options={getOption('columnOverflow', attributes, manifest)}
563
+ noModeSelect
564
+ inline
565
+ {...responsiveData}
566
+ >
567
+ {({ currentValue, handleChange, options, breakpoint }) => (
568
+ <OptionSelect
569
+ options={options}
570
+ value={String(currentValue)}
571
+ onChange={(value) => handleChange(value)}
572
+ aria-label={sprintf(__('Column: content overflow - %s', '%g_textdomain%'), breakpoint)}
573
+ type='menu'
574
+ />
575
+ )}
576
+ </Responsive>
577
+ </>
578
+ );
579
+ };