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