@eightshift/frontend-libs-tailwind 1.3.3 → 1.4.1

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 (67) hide show
  1. package/.husky/pre-commit +0 -0
  2. package/CHANGELOG.md +16 -0
  3. package/blocks/init/src/Blocks/components/button/button.php +1 -1
  4. package/blocks/init/src/Blocks/components/button/components/button-editor.js +2 -2
  5. package/blocks/init/src/Blocks/components/card/card.php +7 -7
  6. package/blocks/init/src/Blocks/components/card/components/card-editor.js +12 -8
  7. package/blocks/init/src/Blocks/components/heading/components/heading-editor.js +2 -2
  8. package/blocks/init/src/Blocks/components/heading/components/heading-options.js +1 -1
  9. package/blocks/init/src/Blocks/components/heading/heading.php +1 -1
  10. package/blocks/init/src/Blocks/components/hero/components/hero-editor.js +3 -3
  11. package/blocks/init/src/Blocks/components/hero/hero.php +2 -2
  12. package/blocks/init/src/Blocks/components/icon/components/icon-editor.js +2 -2
  13. package/blocks/init/src/Blocks/components/icon/icon.php +1 -1
  14. package/blocks/init/src/Blocks/components/image/components/image-editor.js +2 -3
  15. package/blocks/init/src/Blocks/components/image/image.php +1 -1
  16. package/blocks/init/src/Blocks/components/list/components/list-editor.js +2 -2
  17. package/blocks/init/src/Blocks/components/list/list.php +1 -1
  18. package/blocks/init/src/Blocks/components/list/manifest.json +2 -2
  19. package/blocks/init/src/Blocks/components/modal/modal.php +5 -5
  20. package/blocks/init/src/Blocks/components/paragraph/components/paragraph-editor.js +2 -2
  21. package/blocks/init/src/Blocks/components/paragraph/paragraph.php +1 -1
  22. package/blocks/init/src/Blocks/components/quote/components/quote-editor.js +5 -5
  23. package/blocks/init/src/Blocks/components/quote/manifest.json +1 -1
  24. package/blocks/init/src/Blocks/components/quote/quote.php +4 -4
  25. package/blocks/init/src/Blocks/components/share/components/share-editor.js +3 -3
  26. package/blocks/init/src/Blocks/components/share/manifest.json +1 -1
  27. package/blocks/init/src/Blocks/components/share/share.php +3 -3
  28. package/blocks/init/src/Blocks/components/video/components/video-editor.js +2 -2
  29. package/blocks/init/src/Blocks/components/video/video.php +1 -1
  30. package/blocks/init/src/Blocks/custom/accordion-item/accordion-item.php +2 -2
  31. package/blocks/init/src/Blocks/custom/accordion-item/components/accordion-item-editor.js +5 -5
  32. package/blocks/init/src/Blocks/custom/accordion-item/manifest.json +4 -4
  33. package/blocks/init/src/Blocks/custom/carousel/carousel.php +2 -2
  34. package/blocks/init/src/Blocks/custom/carousel/components/carousel-editor.js +3 -3
  35. package/blocks/init/src/Blocks/custom/carousel/manifest.json +2 -2
  36. package/blocks/init/src/Blocks/custom/column/column-hooks.js +2 -2
  37. package/blocks/init/src/Blocks/custom/column/column.php +1 -1
  38. package/blocks/init/src/Blocks/custom/column/manifest.json +1 -1
  39. package/blocks/init/src/Blocks/custom/columns/columns.php +1 -1
  40. package/blocks/init/src/Blocks/custom/columns/components/columns-editor.js +2 -2
  41. package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-editor.js +2 -2
  42. package/blocks/init/src/Blocks/custom/featured-content/featured-content.php +2 -2
  43. package/blocks/init/src/Blocks/custom/heading/components/heading-editor.js +2 -2
  44. package/blocks/init/src/Blocks/custom/heading/heading.php +1 -1
  45. package/blocks/init/src/Blocks/custom/list/components/list-editor.js +2 -2
  46. package/blocks/init/src/Blocks/custom/list/list.php +1 -1
  47. package/blocks/init/src/Blocks/custom/map/components/map-components.js +2 -2
  48. package/blocks/init/src/Blocks/custom/map/map.php +1 -1
  49. package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-editor.js +2 -2
  50. package/blocks/init/src/Blocks/custom/paragraph/paragraph.php +1 -1
  51. package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-editor.js +10 -10
  52. package/blocks/init/src/Blocks/custom/site-footer/manifest.json +2 -2
  53. package/blocks/init/src/Blocks/custom/site-footer/site-footer.php +9 -9
  54. package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-editor.js +5 -5
  55. package/blocks/init/src/Blocks/custom/site-navigation/manifest.json +3 -3
  56. package/blocks/init/src/Blocks/custom/site-navigation/site-navigation.php +11 -11
  57. package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-editor.js +3 -3
  58. package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents.php +2 -2
  59. package/blocks/init/src/Blocks/wrapper/components/wrapper-editor.js +2 -2
  60. package/blocks/init/src/Blocks/wrapper/manifest.json +2 -2
  61. package/blocks/init/src/Blocks/wrapper/wrapper.php +1 -1
  62. package/linters/stylelint.config.js +7 -0
  63. package/package.json +91 -92
  64. package/schemas/block.json +129 -20
  65. package/schemas/component.json +129 -20
  66. package/schemas/globalManifest.json +1 -1
  67. package/scripts/editor/tailwindcss.js +214 -0
@@ -52,17 +52,17 @@
52
52
  "parts": {
53
53
  "trigger": {
54
54
  "twClasses": "flex items-center justify-between gap-2 group px-2 py-4 w-full border-t border-t-gray-400 text-sm font-medium focus:outline-none focus-visible:ring focus-visible:ring-navy-500/30 transition [&>svg]:size-5 [&>svg]:transition-transform [&[aria-expanded=true]>svg]:rotate-45",
55
- "twClassesEditor": "flex items-center justify-between gap-2 group px-2 py-4 w-full border-t border-t-gray-400 text-sm font-medium"
55
+ "twClassesEditorOnly": "flex items-center justify-between gap-2 group px-2 py-4 w-full border-t border-t-gray-400 text-sm font-medium"
56
56
  },
57
57
  "content-container": {
58
58
  "twClasses": "pl-2 pr-8 pb-4 animate-in fade-in duration-500 fill-mode-forwards",
59
- "twClassesEditor": "pl-2 pr-8 pb-4 *:!m-0"
59
+ "twClassesEditorOnly": "pl-2 pr-8 pb-4 *:!m-0"
60
60
  },
61
61
  "editor-trigger": {
62
- "twClassesEditor": "focus:outline-none focus-visible:ring focus-visible:ring-navy-500/30 transition"
62
+ "twClassesEditorOnly": "focus:outline-none focus-visible:ring focus-visible:ring-navy-500/30 transition"
63
63
  },
64
64
  "editor-trigger-icon": {
65
- "twClassesEditor": "size-5 transition duration-300"
65
+ "twClassesEditorOnly": "size-5 transition duration-300"
66
66
  }
67
67
  }
68
68
  }
@@ -50,8 +50,8 @@ $carouselPagination = Helpers::checkAttr('carouselPagination', $attributes, $man
50
50
  </div>
51
51
  <?php } ?>
52
52
 
53
- <div class="<?php echo esc_attr(Helpers::getTwPart('container', $manifest, "{$blockJsClass}-container")); ?>">
54
- <div class="<?php echo esc_attr(Helpers::getTwClasses($attributes, $manifest)); ?>">
53
+ <div class="<?php echo esc_attr(Helpers::tailwindClasses('container', $attributes, $manifest, "{$blockJsClass}-container")); ?>">
54
+ <div class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest)); ?>">
55
55
  <?php
56
56
  // phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
57
57
  echo $renderContent;
@@ -1,6 +1,6 @@
1
1
  import { __ } from '@wordpress/i18n';
2
2
  import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
3
- import { BlockInserter, getTwClasses, getTwPart } from '@eightshift/frontend-libs-tailwind/scripts';
3
+ import { BlockInserter, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
4
4
  import manifest from '../manifest.json';
5
5
 
6
6
  export const CarouselEditor = ({ attributes, clientId }) => {
@@ -12,10 +12,10 @@ export const CarouselEditor = ({ attributes, clientId }) => {
12
12
 
13
13
  return (
14
14
  <div className='flex items-center gap-2'>
15
- <div className={getTwPart('container', manifest)}>
15
+ <div className={tailwindClasses('container', attributes, manifest)}>
16
16
  <div
17
17
  {...innerBlocksProps}
18
- className={getTwClasses(attributes, manifest)}
18
+ className={tailwindClasses(attributes, manifest)}
19
19
  />
20
20
  </div>
21
21
 
@@ -107,12 +107,12 @@
107
107
  "tailwind": {
108
108
  "base": {
109
109
  "twClasses": "grid grid-flow-col justify-items-center auto-cols-[85%] sm:auto-cols-[minmax(20rem,_auto)] *:select-none",
110
- "twClassesEditor": "grid grid-flow-col justify-items-center auto-cols-[minmax(20rem,_auto)]"
110
+ "twClassesEditorOnly": "grid grid-flow-col justify-items-center auto-cols-[minmax(20rem,_auto)]"
111
111
  },
112
112
  "parts": {
113
113
  "container": {
114
114
  "twClasses": "overflow-hidden py-2",
115
- "twClassesEditor": "overflow-y-hidden overflow-x-auto w-full has-[>_:empty]:hidden"
115
+ "twClassesEditorOnly": "overflow-y-hidden overflow-x-auto w-full has-[>_:empty]:hidden"
116
116
  }
117
117
  },
118
118
  "options": {
@@ -2,7 +2,7 @@ import { createHigherOrderComponent } from '@wordpress/compose';
2
2
  import { addFilter } from '@wordpress/hooks';
3
3
  import globalManifest from '../../manifest.json';
4
4
  import manifest from './manifest.json';
5
- import { getTwClasses } from '@eightshift/frontend-libs-tailwind/scripts';
5
+ import { tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
6
6
 
7
7
  const { namespace } = globalManifest;
8
8
 
@@ -19,7 +19,7 @@ const parentComponentBlock = createHigherOrderComponent((BlockListBlock) => {
19
19
  if (name === fullBlockName) {
20
20
  updatedProps = {
21
21
  ...innerProps,
22
- className: getTwClasses(attributes, manifest, '[&_>_.wp-block]:!mx-0 !m-0'),
22
+ className: tailwindClasses(attributes, manifest, '[&_>_.wp-block]:!mx-0 !m-0'),
23
23
  };
24
24
  }
25
25
 
@@ -10,7 +10,7 @@ use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
10
10
 
11
11
  $manifest = Helpers::getManifestByDir(__DIR__);
12
12
 
13
- $blockClass = Helpers::getTwClasses($attributes, $manifest);
13
+ $blockClass = Helpers::tailwindClasses('base', $attributes, $manifest);
14
14
  ?>
15
15
 
16
16
  <div class="<?php echo esc_attr($blockClass); ?>" >
@@ -473,7 +473,7 @@
473
473
  "true": "hidden",
474
474
  "false": "flex"
475
475
  },
476
- "twClassesEditor": {
476
+ "twClassesEditorOnly": {
477
477
  "true": "opacity-25",
478
478
  "false": "opacity-100"
479
479
  }
@@ -10,7 +10,7 @@ use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
10
10
 
11
11
  $manifest = Helpers::getManifestByDir(__DIR__);
12
12
 
13
- $blockClass = Helpers::getTwClasses($attributes, $manifest);
13
+ $blockClass = Helpers::tailwindClasses('base', $attributes, $manifest);
14
14
  ?>
15
15
 
16
16
  <div class="<?php echo esc_attr($blockClass); ?>" >
@@ -1,7 +1,7 @@
1
1
  import { __ } from '@wordpress/i18n';
2
2
  import { useSelect, dispatch } from '@wordpress/data';
3
3
  import { createBlock } from '@wordpress/blocks';
4
- import { BlockInserter, getTwClasses, checkAttr } from '@eightshift/frontend-libs-tailwind/scripts';
4
+ import { BlockInserter, tailwindClasses, checkAttr } from '@eightshift/frontend-libs-tailwind/scripts';
5
5
  import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
6
6
  import { Button, RichLabel } from '@eightshift/ui-components';
7
7
  import { icons, BlockIcon } from '@eightshift/ui-components/icons';
@@ -66,7 +66,7 @@ export const ColumnsEditor = ({ attributes, setAttributes, clientId }) => {
66
66
 
67
67
  <div
68
68
  {...innerBlocksProps}
69
- className={getTwClasses(attributes, manifest, '[&>.block-list-appender]:hidden')}
69
+ className={tailwindClasses(attributes, manifest, '[&>.block-list-appender]:hidden')}
70
70
  />
71
71
 
72
72
  {innerBlockCount > 0 && (
@@ -1,4 +1,4 @@
1
- import { ServerSideRender, getTwPart, props } from '@eightshift/frontend-libs-tailwind/scripts';
1
+ import { ServerSideRender, tailwindClasses, props } from '@eightshift/frontend-libs-tailwind/scripts';
2
2
  import { LoadMoreEditor } from '../../../components/load-more/components/load-more-editor';
3
3
  import manifest from '../manifest.json';
4
4
 
@@ -16,7 +16,7 @@ export const FeaturedContentEditor = ({ attributes, setAttributes }) => {
16
16
  }}
17
17
  />
18
18
 
19
- <div className={getTwPart('loadMoreContainer', manifest)}>
19
+ <div className={tailwindClasses('loadMoreContainer', attributes, manifest)}>
20
20
  <LoadMoreEditor
21
21
  {...props('loadMore', attributes, {
22
22
  setAttributes,
@@ -105,7 +105,7 @@ $args['posts_per_page'] = $featuredContentPerPage;
105
105
  <div>
106
106
  <div
107
107
  id="<?php echo esc_attr($loadMoreId); ?>"
108
- class="<?php echo esc_attr(Helpers::getTwClasses($attributes, $manifest)); ?>"
108
+ class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest)); ?>"
109
109
  aria-live="polite"
110
110
  >
111
111
  <?php
@@ -124,7 +124,7 @@ $args['posts_per_page'] = $featuredContentPerPage;
124
124
  <?php
125
125
  // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
126
126
  if (!$featuredContentServerSideRender && $mainQuery->max_num_pages > 1) { ?>
127
- <div class="<?php echo esc_attr(Helpers::getTwPart('loadMoreContainer', $manifest)); ?>">
127
+ <div class="<?php echo esc_attr(Helpers::tailwindClasses('loadMoreContainer', $attributes, $manifest)); ?>">
128
128
  <?php
129
129
  echo Helpers::render('load-more', Helpers::props('loadMore', $attributes, [
130
130
  'loadMoreInitialItems' => wp_json_encode($mainQuery->posts),
@@ -1,5 +1,5 @@
1
1
  import React, { useMemo } from 'react';
2
- import { getTwClasses, props } from '@eightshift/frontend-libs-tailwind/scripts';
2
+ import { tailwindClasses, props } from '@eightshift/frontend-libs-tailwind/scripts';
3
3
  import { HeadingEditor as EditorComponent } from '../../../components/heading/components/heading-editor';
4
4
  import manifest from './../manifest.json';
5
5
 
@@ -9,7 +9,7 @@ export const HeadingEditor = ({ attributes, setAttributes }) => {
9
9
  {...props('heading', attributes, {
10
10
  setAttributes,
11
11
  })}
12
- additionalClass={getTwClasses(attributes, manifest)}
12
+ additionalClass={tailwindClasses(attributes, manifest)}
13
13
  />
14
14
  );
15
15
  };
@@ -11,5 +11,5 @@ use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
11
11
  $manifest = Helpers::getManifestByDir(__DIR__);
12
12
 
13
13
  echo Helpers::render('heading', Helpers::props('heading', $attributes, [
14
- 'additionalClass' => Helpers::getTwClasses($attributes, $manifest),
14
+ 'additionalClass' => Helpers::tailwindClasses('base', $attributes, $manifest),
15
15
  ]));
@@ -1,4 +1,4 @@
1
- import { getTwClasses, props } from '@eightshift/frontend-libs-tailwind/scripts';
1
+ import { tailwindClasses, props } from '@eightshift/frontend-libs-tailwind/scripts';
2
2
  import { ListEditor as EditorComponent } from '../../../components/list/components/list-editor';
3
3
  import manifest from '../manifest.json';
4
4
 
@@ -7,7 +7,7 @@ export const ListEditor = ({ attributes, setAttributes }) => {
7
7
  <EditorComponent
8
8
  {...props('list', attributes, {
9
9
  setAttributes,
10
- additionalClass: getTwClasses(attributes, manifest),
10
+ additionalClass: tailwindClasses(attributes, manifest),
11
11
  })}
12
12
  />
13
13
  );
@@ -11,5 +11,5 @@ use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
11
11
  $manifest = Helpers::getManifestByDir(__DIR__);
12
12
 
13
13
  echo Helpers::render('list', Helpers::props('list', $attributes, [
14
- 'additionalClass' => Helpers::getTwClasses($attributes, $manifest),
14
+ 'additionalClass' => Helpers::tailwindClasses('base', $attributes, $manifest),
15
15
  ]));
@@ -24,7 +24,7 @@ import { applyStyle as OLMBStyleApply } from 'ol-mapbox-style';
24
24
  import { Style, Fill, Stroke, Icon } from 'ol/style';
25
25
 
26
26
  import manifest from '../manifest.json';
27
- import { getTwClasses } from '@eightshift/frontend-libs-tailwind/scripts';
27
+ import { tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
28
28
 
29
29
  export const MapContext = new createContext();
30
30
 
@@ -72,7 +72,7 @@ export const OpenLayersMap = ({ children, zoom, center, attributes, manifest })
72
72
  <MapContext.Provider value={{ map }}>
73
73
  <div
74
74
  ref={mapRef}
75
- className={getTwClasses(attributes, manifest)}
75
+ className={tailwindClasses(attributes, manifest)}
76
76
  >
77
77
  {children}
78
78
  </div>
@@ -41,7 +41,7 @@ $activeLayers = array_values($activeLayers);
41
41
  ?>
42
42
 
43
43
  <div
44
- class="<?php echo esc_attr(Helpers::getTwClasses($attributes, $manifest, $blockJsClass)); ?>"
44
+ class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest, $blockJsClass)); ?>"
45
45
  data-center-lat="<?php echo esc_attr($mapCenterLat); ?>"
46
46
  data-center-lon="<?php echo esc_attr($mapCenterLon); ?>"
47
47
  data-center-zoom="<?php echo esc_attr($mapZoom); ?>"
@@ -1,6 +1,6 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { createBlock } from '@wordpress/blocks';
3
- import { getTwClasses, props } from '@eightshift/frontend-libs-tailwind/scripts';
3
+ import { tailwindClasses, props } from '@eightshift/frontend-libs-tailwind/scripts';
4
4
  import { ParagraphEditor as EditorComponent } from '../../../components/paragraph/components/paragraph-editor';
5
5
  import manifest from './../manifest.json';
6
6
  import globalManifest from './../../../manifest.json';
@@ -35,7 +35,7 @@ export const ParagraphEditor = (keyProps) => {
35
35
  mergeBlocks={mergeBlocks}
36
36
  onReplace={onReplace}
37
37
  onRemove={onReplace ? () => onReplace([]) : undefined}
38
- additionalClass={getTwClasses(attributes, manifest)}
38
+ additionalClass={tailwindClasses(attributes, manifest)}
39
39
  />
40
40
  );
41
41
  };
@@ -11,5 +11,5 @@ use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
11
11
  $manifest = Helpers::getManifestByDir(__DIR__);
12
12
 
13
13
  echo Helpers::render('paragraph', Helpers::props('paragraph', $attributes, [
14
- 'additionalClass' => Helpers::getTwClasses($attributes, $manifest),
14
+ 'additionalClass' => Helpers::tailwindClasses('base', $attributes, $manifest),
15
15
  ]));
@@ -1,6 +1,6 @@
1
1
  import { __ } from '@wordpress/i18n';
2
2
  import { RichText } from '@wordpress/block-editor';
3
- import { checkAttr, getAttrKey, getTwClasses, getTwPart, props } from '@eightshift/frontend-libs-tailwind/scripts';
3
+ import { checkAttr, getAttrKey, tailwindClasses, props } from '@eightshift/frontend-libs-tailwind/scripts';
4
4
  import { ImagePlaceholder } from '@eightshift/ui-components';
5
5
  import { ShareEditor } from '../../../components/share/components/share-editor';
6
6
  import { LinkSectionEditor } from '../../../assets/scripts/link-section-editor';
@@ -12,31 +12,31 @@ export const SiteFooterEditor = ({ attributes, setAttributes }) => {
12
12
  const siteFooterLogoUrl = checkAttr('siteFooterLogoUrl', attributes, manifest);
13
13
 
14
14
  return (
15
- <div className={getTwClasses(attributes, manifest)}>
16
- <div className={getTwPart('topContainer', manifest)}>
15
+ <div className={tailwindClasses(attributes, manifest)}>
16
+ <div className={tailwindClasses('topContainer', attributes, manifest)}>
17
17
  <ImagePlaceholder
18
18
  style='simple'
19
19
  imageMode='contain'
20
20
  url={siteFooterLogoUrl}
21
21
  size='fullWidth'
22
- className={getTwPart('logo', manifest)}
22
+ className={tailwindClasses('logo', attributes, manifest)}
23
23
  />
24
24
 
25
- <div className={getTwPart('linksContainer', manifest)}>
25
+ <div className={tailwindClasses('linksContainer', attributes, manifest)}>
26
26
  <LinkSectionEditor
27
27
  links={siteFooterPrimary}
28
28
  onChange={(value) => setAttributes({ [getAttrKey('siteFooterPrimary', attributes, manifest)]: value })}
29
29
  classNames={{
30
- sectionContainer: getTwPart('sectionContainer', manifest),
31
- sectionTitle: getTwPart('sectionTitle', manifest),
32
- link: getTwPart('link', manifest),
30
+ sectionContainer: tailwindClasses('sectionContainer', attributes, manifest),
31
+ sectionTitle: tailwindClasses('sectionTitle', attributes, manifest),
32
+ link: tailwindClasses('link', attributes, manifest),
33
33
  }}
34
34
  />
35
35
  </div>
36
36
  </div>
37
37
 
38
- <div className={getTwPart('bottomContainer', manifest)}>
39
- <span className={getTwPart('copyright', manifest)}>
38
+ <div className={tailwindClasses('bottomContainer', attributes, manifest)}>
39
+ <span className={tailwindClasses('copyright', attributes, manifest)}>
40
40
  &copy;
41
41
  <RichText
42
42
  placeholder={__('Copyright', '%g_textdomain%')}
@@ -59,11 +59,11 @@
59
59
  },
60
60
  "link": {
61
61
  "twClasses": "block w-fit text-base text-gray-700 hover:underline underline-offset-2 decoration-navy-500 decoration-2",
62
- "twClassesEditor": "text-base text-gray-700"
62
+ "twClassesEditorOnly": "text-base text-gray-700"
63
63
  },
64
64
  "logo": {
65
65
  "twClasses": "min-h-16 w-28",
66
- "twClassesEditor": "min-h-16 max-w-28 p-1 [&_img]:!object-contain"
66
+ "twClassesEditorOnly": "min-h-16 max-w-28 p-1 [&_img]:!object-contain"
67
67
  },
68
68
  "share": {
69
69
  "twClasses": "mt-5"
@@ -19,24 +19,24 @@ $siteFooterLogoId = Helpers::checkAttr('siteFooterLogoId', $attributes, $manifes
19
19
  $logoAlt = get_post_meta($siteFooterLogoId, '_wp_attachment_image_alt', true) ?? '';
20
20
  ?>
21
21
 
22
- <div class="<?php echo esc_attr(Helpers::getTwClasses($attributes, $manifest)); ?>">
23
- <div class="<?php echo esc_attr(Helpers::getTwPart('topContainer', $manifest)); ?>">
22
+ <div class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest)); ?>">
23
+ <div class="<?php echo esc_attr(Helpers::tailwindClasses('topContainer', $attributes, $manifest)); ?>">
24
24
  <a href="<?php echo esc_url(get_home_url()); ?>">
25
25
  <img
26
26
  src="<?php echo esc_attr($siteFooterLogoUrl); ?>"
27
27
  alt="<?php echo esc_attr($logoAlt); ?>"
28
- class="<?php echo esc_attr(Helpers::getTwPart('logo', $manifest)); ?>"
28
+ class="<?php echo esc_attr(Helpers::tailwindClasses('logo', $attributes, $manifest)); ?>"
29
29
  >
30
30
  </a>
31
- <div class="<?php echo esc_attr(Helpers::getTwPart('linksContainer', $manifest)); ?>">
31
+ <div class="<?php echo esc_attr(Helpers::tailwindClasses('linksContainer', $attributes, $manifest)); ?>">
32
32
 
33
33
  <?php
34
34
  foreach ($siteFooterPrimary as $index => $value) {
35
35
  $items = $value['items'] ?? [];
36
36
  $header = $value['header'] ?? '';
37
37
  ?>
38
- <div class="<?php echo esc_attr(Helpers::getTwPart('sectionContainer', $manifest)); ?>">
39
- <p class="<?php echo esc_attr(Helpers::getTwPart('sectionTitle', $manifest)); ?>">
38
+ <div class="<?php echo esc_attr(Helpers::tailwindClasses('sectionContainer', $attributes, $manifest)); ?>">
39
+ <p class="<?php echo esc_attr(Helpers::tailwindClasses('sectionTitle', $attributes, $manifest)); ?>">
40
40
  <?php echo wp_kses_post($header); ?>
41
41
  </p>
42
42
 
@@ -46,7 +46,7 @@ $logoAlt = get_post_meta($siteFooterLogoId, '_wp_attachment_image_alt', true) ??
46
46
  ?>
47
47
  <a
48
48
  href="<?php echo esc_url($item['url']); ?>"
49
- class="<?php echo esc_attr(Helpers::getTwPart('link', $manifest)); ?>"
49
+ class="<?php echo esc_attr(Helpers::tailwindClasses('link', $attributes, $manifest)); ?>"
50
50
  <?php if ($item['newTab'] ?? false) { ?>
51
51
  target="_blank"
52
52
  rel="noopener noreferrer"
@@ -60,9 +60,9 @@ $logoAlt = get_post_meta($siteFooterLogoId, '_wp_attachment_image_alt', true) ??
60
60
  </div>
61
61
  </div>
62
62
 
63
- <div class="<?php echo esc_attr(Helpers::getTwPart('bottomContainer', $manifest)); ?>">
63
+ <div class="<?php echo esc_attr(Helpers::tailwindClasses('bottomContainer', $attributes, $manifest)); ?>">
64
64
  <?php if (!empty($siteFooterCopyright)) { ?>
65
- <span class="<?php echo esc_attr(Helpers::getTwPart('copyright', $manifest)); ?>">
65
+ <span class="<?php echo esc_attr(Helpers::tailwindClasses('copyright', $attributes, $manifest)); ?>">
66
66
  &copy; <?php echo esc_attr($siteFooterCopyright); ?>
67
67
  </span>
68
68
  <?php } ?>
@@ -1,6 +1,6 @@
1
1
  import { __ } from '@wordpress/i18n';
2
2
  import { RichText } from '@wordpress/block-editor';
3
- import { checkAttr, getAttrKey, getTwClasses, getTwPart } from '@eightshift/frontend-libs-tailwind/scripts';
3
+ import { checkAttr, getAttrKey, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
4
4
  import { ImagePlaceholder } from '@eightshift/ui-components';
5
5
  import manifest from '../manifest.json';
6
6
 
@@ -9,16 +9,16 @@ export const SiteNavigationEditor = ({ attributes, setAttributes }) => {
9
9
  const siteNavigationLogoUrl = checkAttr('siteNavigationLogoUrl', attributes, manifest);
10
10
 
11
11
  return (
12
- <div className={getTwClasses(attributes, manifest)}>
12
+ <div className={tailwindClasses(attributes, manifest)}>
13
13
  <ImagePlaceholder
14
14
  style='simple'
15
15
  imageMode='contain'
16
16
  url={siteNavigationLogoUrl}
17
17
  size='fullWidth'
18
- className={getTwPart('logo', manifest)}
18
+ className={tailwindClasses('logo', attributes, manifest)}
19
19
  />
20
20
 
21
- <div className={getTwPart('linkContainer', manifest)}>
21
+ <div className={tailwindClasses('linkContainer', attributes, manifest)}>
22
22
  {siteNavigationLinks.map(({ text }, index) => {
23
23
  return (
24
24
  <RichText
@@ -30,7 +30,7 @@ export const SiteNavigationEditor = ({ attributes, setAttributes }) => {
30
30
  setAttributes({ [getAttrKey('siteNavigationLinks', attributes, manifest)]: newLinks });
31
31
  }}
32
32
  allowedFormats={[]}
33
- className={getTwPart('link', manifest)}
33
+ className={tailwindClasses('link', attributes, manifest)}
34
34
  withoutInteractiveFormatting
35
35
  disableLineBreaks
36
36
  />
@@ -40,7 +40,7 @@
40
40
  "tailwind": {
41
41
  "base": {
42
42
  "twClasses": "flex items-center justify-between gap-4 max-w-screen-md mx-auto h-full ~sm/md:~px-8/20",
43
- "twClassesEditor": "flex items-center justify-between gap-4 p-1"
43
+ "twClassesEditorOnly": "flex items-center justify-between gap-4 p-1"
44
44
  },
45
45
  "parts": {
46
46
  "wrapper": {
@@ -48,11 +48,11 @@
48
48
  },
49
49
  "logo": {
50
50
  "twClasses": "~sm/md:~w-20/28",
51
- "twClassesEditor": "max-w-32"
51
+ "twClassesEditorOnly": "max-w-32"
52
52
  },
53
53
  "link": {
54
54
  "twClasses": "text-base text-gray-700 hover:underline underline-offset-2 decoration-red-500 decoration-2",
55
- "twClassesEditor": "text-base"
55
+ "twClassesEditorOnly": "text-base"
56
56
  },
57
57
  "drawerLink": {
58
58
  "twClasses": "text-lg sm:text-base text-gray-700 hover:underline underline-offset-2 decoration-red-500 decoration-2 block py-4 sm:py-2"
@@ -21,17 +21,17 @@ $logoAlt = get_post_meta($siteNavigationLogoId, '_wp_attachment_image_alt', true
21
21
  $drawerId = 'navbar-mobile-flyout';
22
22
  ?>
23
23
 
24
- <nav class="<?php echo esc_attr(Helpers::getTwPart('wrapper', $manifest)); ?>">
25
- <div class="<?php echo esc_attr(Helpers::getTwClasses($attributes, $manifest)); ?>">
24
+ <nav class="<?php echo esc_attr(Helpers::tailwindClasses('wrapper', $attributes, $manifest)); ?>">
25
+ <div class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest)); ?>">
26
26
  <a href="<?php echo esc_url(get_home_url()); ?>">
27
27
  <img
28
28
  src="<?php echo esc_attr($siteNavigationLogoUrl); ?>"
29
29
  alt="<?php echo esc_attr($logoAlt); ?>"
30
- class="<?php echo esc_attr(Helpers::getTwPart('logo', $manifest)); ?>"
30
+ class="<?php echo esc_attr(Helpers::tailwindClasses('logo', $attributes, $manifest)); ?>"
31
31
  >
32
32
  </a>
33
33
 
34
- <div class="<?php echo esc_attr(Helpers::getTwPart('linkContainer', $manifest)); ?>">
34
+ <div class="<?php echo esc_attr(Helpers::tailwindClasses('linkContainer', $attributes, $manifest)); ?>">
35
35
  <?php
36
36
  foreach ($siteNavigationLinks as $navLink) {
37
37
  $url = $navLink['url'] ?? '';
@@ -43,7 +43,7 @@ $drawerId = 'navbar-mobile-flyout';
43
43
  ?>
44
44
  <a
45
45
  href="<?php echo esc_attr($url); ?>"
46
- class="<?php echo esc_attr(Helpers::getTwPart('link', $manifest)); ?>"
46
+ class="<?php echo esc_attr(Helpers::tailwindClasses('link', $attributes, $manifest)); ?>"
47
47
  <?php if ($navLink['newTab'] ?? false) { ?>
48
48
  target="_blank"
49
49
  rel="noopener noreferrer"
@@ -54,7 +54,7 @@ $drawerId = 'navbar-mobile-flyout';
54
54
  <?php } ?>
55
55
  </div>
56
56
 
57
- <button class="<?php echo esc_attr(Helpers::getTwPart('button', $manifest, 'sm:hidden')); ?>" data-micromodal-trigger="<?php echo esc_attr($drawerId); ?>">
57
+ <button class="<?php echo esc_attr(Helpers::tailwindClasses('button', $attributes, $manifest, 'sm:hidden')); ?>" data-micromodal-trigger="<?php echo esc_attr($drawerId); ?>">
58
58
  <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
59
59
  <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" />
60
60
  </svg>
@@ -63,10 +63,10 @@ $drawerId = 'navbar-mobile-flyout';
63
63
  </nav>
64
64
 
65
65
 
66
- <div id="<?php echo esc_attr($drawerId); ?>" aria-hidden="true" class="<?php echo esc_attr(Helpers::getTwPart('modalWrapper', $manifest)); ?>">
67
- <div tabindex="-1" class="<?php echo esc_attr(Helpers::getTwPart('modalBackdrop', $manifest)); ?>" data-micromodal-close>
68
- <div class="<?php echo esc_attr(Helpers::getTwPart('modalContent', $manifest)); ?>" role="dialog" aria-modal="true" aria-label="<?php echo esc_html__('Main menu', '%g_textdomain%'); ?>-title">
69
- <button class="<?php echo esc_attr(Helpers::getTwPart('button', $manifest, 'ml-auto')); ?>" aria-label="Close menu" data-micromodal-close>
66
+ <div id="<?php echo esc_attr($drawerId); ?>" aria-hidden="true" class="<?php echo esc_attr(Helpers::tailwindClasses('modalWrapper', $attributes, $manifest)); ?>">
67
+ <div tabindex="-1" class="<?php echo esc_attr(Helpers::tailwindClasses('modalBackdrop', $attributes, $manifest)); ?>" data-micromodal-close>
68
+ <div class="<?php echo esc_attr(Helpers::tailwindClasses('modalContent', $attributes, $manifest)); ?>" role="dialog" aria-modal="true" aria-label="<?php echo esc_html__('Main menu', '%g_textdomain%'); ?>-title">
69
+ <button class="<?php echo esc_attr(Helpers::tailwindClasses('button', $attributes, $manifest, 'ml-auto')); ?>" aria-label="Close menu" data-micromodal-close>
70
70
  <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
71
71
  <path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12" />
72
72
  </svg>
@@ -84,7 +84,7 @@ $drawerId = 'navbar-mobile-flyout';
84
84
  ?>
85
85
  <a
86
86
  href="<?php echo esc_attr($url); ?>"
87
- class="<?php echo esc_attr(Helpers::getTwPart('drawerLink', $manifest)); ?>"
87
+ class="<?php echo esc_attr(Helpers::tailwindClasses('drawerLink', $attributes, $manifest)); ?>"
88
88
  <?php if ($navLink['newTab'] ?? false) { ?>
89
89
  target="_blank"
90
90
  rel="noopener noreferrer"
@@ -1,6 +1,6 @@
1
1
  import { __, sprintf } from '@wordpress/i18n';
2
2
  import { RichText } from '@wordpress/block-editor';
3
- import { checkAttr, getTwPart } from '@eightshift/frontend-libs-tailwind/scripts';
3
+ import { checkAttr, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
4
4
  import { clsx } from '@eightshift/ui-components/utilities';
5
5
  import manifest from '../manifest.json';
6
6
 
@@ -9,13 +9,13 @@ export const TableOfContentsEditor = ({ attributes, setAttributes }) => {
9
9
  const tableOfContentsHeadingLevels = checkAttr('tableOfContentsHeadingLevels', attributes, manifest);
10
10
 
11
11
  return (
12
- <div className={getTwPart('container', manifest)}>
12
+ <div className={tailwindClasses('container', attributes, manifest)}>
13
13
  <RichText
14
14
  placeholder={manifest.attributes.tableOfContentsDescription.default}
15
15
  value={tableOfContentsDescription}
16
16
  onChange={(value) => setAttributes({ [getAttrKey('tableOfContentsDescription', attributes, manifest)]: value })}
17
17
  allowedFormats={[]}
18
- className={getTwPart('description', manifest)}
18
+ className={tailwindClasses('description', attributes, manifest)}
19
19
  />
20
20
 
21
21
  {Object.entries(tableOfContentsHeadingLevels).map(([tag, enabled = false]) => (
@@ -14,7 +14,7 @@ $blockClass = $attributes['blockClass'] ?? '';
14
14
  $blockJsClass = $attributes['blockJsClass'] ?? '';
15
15
 
16
16
  $tocClass = Helpers::classnames([
17
- Helpers::getTwPart('container', $manifest),
17
+ Helpers::tailwindClasses('container', $attributes, $manifest),
18
18
  $blockJsClass,
19
19
  ]);
20
20
 
@@ -25,7 +25,7 @@ $headingLevelsToUse = implode(',', array_keys(array_filter($tableOfContentsHeadi
25
25
  ?>
26
26
 
27
27
  <div class="<?php echo esc_attr($tocClass); ?>" data-levels="<?php echo esc_attr($headingLevelsToUse); ?>">
28
- <p class="<?php echo esc_attr(Helpers::getTwPart('description', $manifest)); ?>">
28
+ <p class="<?php echo esc_attr(Helpers::tailwindClasses('description', $attributes, $manifest)); ?>">
29
29
  <?php echo esc_attr($tableOfContentsDescription); ?>
30
30
  </p>
31
31
  </div>
@@ -1,4 +1,4 @@
1
- import { checkAttr, getTwClasses } from '@eightshift/frontend-libs-tailwind/scripts';
1
+ import { checkAttr, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
2
2
  import manifest from './../manifest.json';
3
3
 
4
4
  export const WrapperEditor = ({ attributes, children }) => {
@@ -8,5 +8,5 @@ export const WrapperEditor = ({ attributes, children }) => {
8
8
  return children;
9
9
  }
10
10
 
11
- return <div className={getTwClasses(attributes, manifest)}>{children}</div>;
11
+ return <div className={tailwindClasses(attributes, manifest)}>{children}</div>;
12
12
  };
@@ -327,7 +327,7 @@
327
327
  "tailwind": {
328
328
  "base": {
329
329
  "twClasses": "scroll-my-24",
330
- "twClassesEditor": "flow-root"
330
+ "twClassesEditorOnly": "flow-root"
331
331
  },
332
332
  "options": {
333
333
  "wrapperBackground": {
@@ -384,7 +384,7 @@
384
384
  "true": "hidden",
385
385
  "false": "block"
386
386
  },
387
- "twClassesEditor": {
387
+ "twClassesEditorOnly": {
388
388
  "true": "opacity-25"
389
389
  }
390
390
  },
@@ -22,7 +22,7 @@ $wrapperId = Helpers::checkAttr('wrapperId', $attributes, $manifest);
22
22
  ?>
23
23
 
24
24
  <div
25
- class="<?php echo esc_attr(Helpers::getTwClasses($attributes, $manifest)); ?>"
25
+ class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest)); ?>"
26
26
  <?php if (!empty($wrapperId)) { ?>
27
27
  id="<?php echo esc_attr($wrapperId); ?>"
28
28
  <?php } ?>
@@ -138,5 +138,12 @@ module.exports = {
138
138
  'no-descending-specificity': null,
139
139
 
140
140
  'import-notation': null,
141
+
142
+ 'at-rule-no-unknown': [
143
+ true,
144
+ {
145
+ ignoreAtRules: ['tailwind'],
146
+ },
147
+ ],
141
148
  },
142
149
  };