@eightshift/frontend-libs-tailwind 1.3.3 → 1.4.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.
- package/.husky/pre-commit +0 -0
- package/CHANGELOG.md +12 -0
- package/blocks/init/src/Blocks/components/button/button.php +1 -1
- package/blocks/init/src/Blocks/components/button/components/button-editor.js +2 -2
- package/blocks/init/src/Blocks/components/card/card.php +7 -7
- package/blocks/init/src/Blocks/components/card/components/card-editor.js +12 -8
- package/blocks/init/src/Blocks/components/heading/components/heading-editor.js +2 -2
- package/blocks/init/src/Blocks/components/heading/components/heading-options.js +1 -1
- package/blocks/init/src/Blocks/components/heading/heading.php +1 -1
- package/blocks/init/src/Blocks/components/hero/components/hero-editor.js +3 -3
- package/blocks/init/src/Blocks/components/hero/hero.php +2 -2
- package/blocks/init/src/Blocks/components/icon/components/icon-editor.js +2 -2
- package/blocks/init/src/Blocks/components/icon/icon.php +1 -1
- package/blocks/init/src/Blocks/components/image/components/image-editor.js +2 -3
- package/blocks/init/src/Blocks/components/image/image.php +1 -1
- package/blocks/init/src/Blocks/components/list/components/list-editor.js +2 -2
- package/blocks/init/src/Blocks/components/list/list.php +1 -1
- package/blocks/init/src/Blocks/components/list/manifest.json +2 -2
- package/blocks/init/src/Blocks/components/modal/modal.php +5 -5
- package/blocks/init/src/Blocks/components/paragraph/components/paragraph-editor.js +2 -2
- package/blocks/init/src/Blocks/components/paragraph/paragraph.php +1 -1
- package/blocks/init/src/Blocks/components/quote/components/quote-editor.js +5 -5
- package/blocks/init/src/Blocks/components/quote/manifest.json +1 -1
- package/blocks/init/src/Blocks/components/quote/quote.php +4 -4
- package/blocks/init/src/Blocks/components/share/components/share-editor.js +3 -3
- package/blocks/init/src/Blocks/components/share/manifest.json +1 -1
- package/blocks/init/src/Blocks/components/share/share.php +3 -3
- package/blocks/init/src/Blocks/components/video/components/video-editor.js +2 -2
- package/blocks/init/src/Blocks/components/video/video.php +1 -1
- package/blocks/init/src/Blocks/custom/accordion-item/accordion-item.php +2 -2
- package/blocks/init/src/Blocks/custom/accordion-item/components/accordion-item-editor.js +5 -5
- package/blocks/init/src/Blocks/custom/accordion-item/manifest.json +4 -4
- package/blocks/init/src/Blocks/custom/carousel/carousel.php +2 -2
- package/blocks/init/src/Blocks/custom/carousel/components/carousel-editor.js +3 -3
- package/blocks/init/src/Blocks/custom/carousel/manifest.json +2 -2
- package/blocks/init/src/Blocks/custom/column/column-hooks.js +2 -2
- package/blocks/init/src/Blocks/custom/column/column.php +1 -1
- package/blocks/init/src/Blocks/custom/column/manifest.json +1 -1
- package/blocks/init/src/Blocks/custom/columns/columns.php +1 -1
- package/blocks/init/src/Blocks/custom/columns/components/columns-editor.js +2 -2
- package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-editor.js +2 -2
- package/blocks/init/src/Blocks/custom/featured-content/featured-content.php +2 -2
- package/blocks/init/src/Blocks/custom/heading/components/heading-editor.js +2 -2
- package/blocks/init/src/Blocks/custom/heading/heading.php +1 -1
- package/blocks/init/src/Blocks/custom/list/components/list-editor.js +2 -2
- package/blocks/init/src/Blocks/custom/list/list.php +1 -1
- package/blocks/init/src/Blocks/custom/map/components/map-components.js +2 -2
- package/blocks/init/src/Blocks/custom/map/map.php +1 -1
- package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-editor.js +2 -2
- package/blocks/init/src/Blocks/custom/paragraph/paragraph.php +1 -1
- package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-editor.js +10 -10
- package/blocks/init/src/Blocks/custom/site-footer/manifest.json +2 -2
- package/blocks/init/src/Blocks/custom/site-footer/site-footer.php +9 -9
- package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-editor.js +5 -5
- package/blocks/init/src/Blocks/custom/site-navigation/manifest.json +3 -3
- package/blocks/init/src/Blocks/custom/site-navigation/site-navigation.php +11 -11
- package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-editor.js +3 -3
- package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents.php +2 -2
- package/blocks/init/src/Blocks/wrapper/components/wrapper-editor.js +2 -2
- package/blocks/init/src/Blocks/wrapper/manifest.json +2 -2
- package/blocks/init/src/Blocks/wrapper/wrapper.php +1 -1
- package/linters/stylelint.config.js +7 -0
- package/package.json +91 -92
- package/schemas/block.json +129 -20
- package/schemas/component.json +129 -20
- package/schemas/globalManifest.json +1 -1
- package/scripts/editor/tailwindcss.js +209 -0
package/.husky/pre-commit
CHANGED
|
File without changes
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/).
|
|
6
6
|
|
|
7
|
+
## [1.4.0] - 2024-09-30
|
|
8
|
+
- Introduced new, more flexible, and simpler to use `tailwindClasses` function. Replaces `getTwPart`, `getTwDynamicPart`, and `getTwClasses`.
|
|
9
|
+
- **Potentially breaking**: `twClassesEditor` is now appended to `twClasses`. If you need editor-only classes, you can now use the `twClassesEditorOnly` key. Editor-only classes replace `twClasses`, but will also have classes from `twClassesEditor`.
|
|
10
|
+
- **Potentially breaking**: `parts` key in manifest now supports specifying multiple parts just with a comma-separated string.
|
|
11
|
+
- You can now apply classes to multiple parts within one option or combination! Also work with responsive options.
|
|
12
|
+
- There are now (basic) warnings for misconfigurations of parts and options.
|
|
13
|
+
- Updated block and component schemas with new Tailwind functionalities.
|
|
14
|
+
- Updated dependencies.
|
|
15
|
+
- Updated default blocks with new Tailwind functions.
|
|
16
|
+
- Default Stylelint config will no longer report `@tailwind` rules.
|
|
17
|
+
|
|
7
18
|
## [1.3.3] - 2024-09-24
|
|
8
19
|
- Updating schema.
|
|
9
20
|
|
|
@@ -49,6 +60,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a
|
|
|
49
60
|
|
|
50
61
|
[Unreleased]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/master...HEAD
|
|
51
62
|
|
|
63
|
+
[1.4.0]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.3.3...1.4.0
|
|
52
64
|
[1.3.3]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.3.2...1.3.3
|
|
53
65
|
[1.3.2]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.3.1...1.3.2
|
|
54
66
|
[1.3.1]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.3.0...1.3.1
|
|
@@ -56,7 +56,7 @@ if (!empty($buttonAriaLabel)) {
|
|
|
56
56
|
$buttonAttrs['aria-label'] = $buttonAriaLabel;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
$buttonAttrs['class'] = Helpers::
|
|
59
|
+
$buttonAttrs['class'] = Helpers::tailwindClasses('base', $attributes, $manifest, 'button', $additionalClass);
|
|
60
60
|
|
|
61
61
|
$buttonTag = !empty($buttonUrl) ? 'a' : 'button';
|
|
62
62
|
?>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
2
|
import { RichText } from '@wordpress/block-editor';
|
|
3
|
-
import { checkAttr, getAttrKey,
|
|
3
|
+
import { checkAttr, getAttrKey, tailwindClasses, props } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
4
4
|
import { IconEditor } from '../../icon/components/icon-editor';
|
|
5
5
|
import manifest from './../manifest.json';
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ export const ButtonEditor = (attributes) => {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
|
-
<div className={
|
|
20
|
+
<div className={tailwindClasses(attributes, manifest, additionalClass)}>
|
|
21
21
|
<IconEditor
|
|
22
22
|
{...props('icon', attributes, {
|
|
23
23
|
blockClass: componentClass,
|
|
@@ -12,30 +12,30 @@ $manifest = Helpers::getManifestByDir(__DIR__);
|
|
|
12
12
|
$additionalClass = $attributes['additionalClass'] ?? '';
|
|
13
13
|
?>
|
|
14
14
|
|
|
15
|
-
<div class="<?php echo esc_attr(Helpers::
|
|
15
|
+
<div class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass)); ?>" >
|
|
16
16
|
<?php
|
|
17
17
|
echo Helpers::render('image', Helpers::props('image', $attributes, [
|
|
18
18
|
'additionalClass' => [
|
|
19
|
-
'image' => Helpers::
|
|
20
|
-
'picture' => Helpers::
|
|
19
|
+
'image' => Helpers::tailwindClasses('image', $attributes, $manifest),
|
|
20
|
+
'picture' => Helpers::tailwindClasses('imagePicture', $attributes, $manifest),
|
|
21
21
|
]
|
|
22
22
|
]));
|
|
23
23
|
?>
|
|
24
24
|
|
|
25
|
-
<div class="<?php echo esc_attr(Helpers::
|
|
25
|
+
<div class="<?php echo esc_attr(Helpers::tailwindClasses('content-container', $attributes, $manifest)); ?>">
|
|
26
26
|
<?php
|
|
27
27
|
echo Helpers::render('paragraph', Helpers::props('intro', $attributes, [
|
|
28
|
-
'additionalClass' => Helpers::
|
|
28
|
+
'additionalClass' => Helpers::tailwindClasses('intro', $attributes, $manifest),
|
|
29
29
|
])),
|
|
30
30
|
|
|
31
31
|
Helpers::render('heading', Helpers::props('heading', $attributes)),
|
|
32
32
|
|
|
33
33
|
Helpers::render('paragraph', Helpers::props('paragraph', $attributes, [
|
|
34
|
-
'additionalClass' => Helpers::
|
|
34
|
+
'additionalClass' => Helpers::tailwindClasses('text', $attributes, $manifest),
|
|
35
35
|
])),
|
|
36
36
|
|
|
37
37
|
Helpers::render('button', Helpers::props('button', $attributes, [
|
|
38
|
-
'additionalClass' => Helpers::
|
|
38
|
+
'additionalClass' => Helpers::tailwindClasses('button', $attributes, $manifest),
|
|
39
39
|
]));
|
|
40
40
|
?>
|
|
41
41
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { props,
|
|
1
|
+
import { props, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
2
2
|
import { ImageEditor } from '../../image/components/image-editor';
|
|
3
3
|
import { HeadingEditor } from '../../heading/components/heading-editor';
|
|
4
4
|
import { ParagraphEditor } from '../../paragraph/components/paragraph-editor';
|
|
@@ -9,30 +9,34 @@ export const CardEditor = (attributes) => {
|
|
|
9
9
|
const { additionalClass } = attributes;
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
|
-
<div className={
|
|
12
|
+
<div className={tailwindClasses(attributes, manifest, additionalClass)}>
|
|
13
13
|
<ImageEditor
|
|
14
14
|
{...props('image', attributes, {
|
|
15
15
|
additionalClass: {
|
|
16
|
-
image:
|
|
17
|
-
picture:
|
|
16
|
+
image: tailwindClasses('image', attributes, manifest),
|
|
17
|
+
picture: tailwindClasses('imagePicture', attributes, manifest),
|
|
18
18
|
imagePlaceholder:
|
|
19
19
|
'!border-x-0 !border-t-0 !border-solid !w-full !h-auto aspect-3/2 [&_svg]:!size-12 border-b !rounded-none bg-gray-100 !border-b-gray-200',
|
|
20
20
|
},
|
|
21
21
|
})}
|
|
22
22
|
/>
|
|
23
23
|
|
|
24
|
-
<div className={
|
|
24
|
+
<div className={tailwindClasses('content-container', attributes, manifest)}>
|
|
25
25
|
<ParagraphEditor
|
|
26
26
|
{...props('intro', attributes, {
|
|
27
|
-
additionalClass:
|
|
27
|
+
additionalClass: tailwindClasses('intro', attributes, manifest),
|
|
28
28
|
})}
|
|
29
29
|
/>
|
|
30
30
|
|
|
31
31
|
<HeadingEditor {...props('heading', attributes)} />
|
|
32
32
|
|
|
33
|
-
<ParagraphEditor
|
|
33
|
+
<ParagraphEditor
|
|
34
|
+
{...props('paragraph', attributes, { additionalClass: tailwindClasses('text', attributes, manifest) })}
|
|
35
|
+
/>
|
|
34
36
|
|
|
35
|
-
<ButtonEditor
|
|
37
|
+
<ButtonEditor
|
|
38
|
+
{...props('button', attributes, { additionalClass: tailwindClasses('button', attributes, manifest) })}
|
|
39
|
+
/>
|
|
36
40
|
</div>
|
|
37
41
|
</div>
|
|
38
42
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
2
|
import { RichText } from '@wordpress/block-editor';
|
|
3
|
-
import { checkAttr, getAttrKey,
|
|
3
|
+
import { checkAttr, getAttrKey, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
4
4
|
import manifest from './../manifest.json';
|
|
5
5
|
|
|
6
6
|
export const HeadingEditor = (attributes) => {
|
|
@@ -16,7 +16,7 @@ export const HeadingEditor = (attributes) => {
|
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
18
|
<RichText
|
|
19
|
-
className={
|
|
19
|
+
className={tailwindClasses(attributes, manifest, additionalClass)}
|
|
20
20
|
placeholder={placeholder}
|
|
21
21
|
value={headingContent}
|
|
22
22
|
onChange={(value) => setAttributes({ [getAttrKey('headingContent', attributes, manifest)]: value })}
|
|
@@ -49,10 +49,10 @@ export const HeadingOptions = (attributes) => {
|
|
|
49
49
|
type='menu'
|
|
50
50
|
wrapperProps={{
|
|
51
51
|
triggerIcon: <span className='es-uic-font-mono uppercase'>{headingTag}</span>,
|
|
52
|
-
tooltip: __('Heading level', '%g_textdomain%'),
|
|
53
52
|
}}
|
|
54
53
|
hidden={hiddenOptions?.headingLevel}
|
|
55
54
|
noTriggerLabel
|
|
55
|
+
tooltip
|
|
56
56
|
/>
|
|
57
57
|
|
|
58
58
|
{additionalControls}
|
|
@@ -36,7 +36,7 @@ if (function_exists('idn_to_ascii') && function_exists('sanitize_title')) {
|
|
|
36
36
|
|
|
37
37
|
<<?php echo esc_attr($headingTag); ?>
|
|
38
38
|
data-slug="<?php echo esc_attr($sanitizedTitle) ?>"
|
|
39
|
-
class="<?php echo esc_attr(Helpers::
|
|
39
|
+
class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass)); ?>"
|
|
40
40
|
>
|
|
41
41
|
<?php
|
|
42
42
|
// phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { props, checkAttr,
|
|
1
|
+
import { props, checkAttr, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
2
2
|
import { ImageEditor } from '../../image/components/image-editor';
|
|
3
3
|
import { HeadingEditor } from '../../heading/components/heading-editor';
|
|
4
4
|
import { ParagraphEditor } from '../../paragraph/components/paragraph-editor';
|
|
@@ -15,12 +15,12 @@ export const HeroEditor = (attributes) => {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
|
-
<div className={
|
|
18
|
+
<div className={tailwindClasses(attributes, manifest, additionalClass)}>
|
|
19
19
|
<ImageEditor
|
|
20
20
|
{...props('image', attributes, {
|
|
21
21
|
additionalClass: {
|
|
22
22
|
image: '!size-full grayscale',
|
|
23
|
-
picture:
|
|
23
|
+
picture: tailwindClasses('imagePicture', attributes, manifest),
|
|
24
24
|
},
|
|
25
25
|
})}
|
|
26
26
|
/>
|
|
@@ -19,12 +19,12 @@ if (!$heroUse) {
|
|
|
19
19
|
$additionalClass = $attributes['additionalClass'] ?? '';
|
|
20
20
|
?>
|
|
21
21
|
|
|
22
|
-
<section class="<?php echo esc_attr(Helpers::
|
|
22
|
+
<section class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass)); ?>">
|
|
23
23
|
<?php
|
|
24
24
|
echo Helpers::render('image', Helpers::props('image', $attributes, [
|
|
25
25
|
'additionalClass' => [
|
|
26
26
|
'image' => 'size-full grayscale',
|
|
27
|
-
'picture' => Helpers::
|
|
27
|
+
'picture' => Helpers::tailwindClasses('imagePicture', $attributes, $manifest),
|
|
28
28
|
],
|
|
29
29
|
]));
|
|
30
30
|
?>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { checkAttr,
|
|
1
|
+
import { checkAttr, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
2
2
|
import { JsxSvg } from '@eightshift/ui-components/icons';
|
|
3
3
|
import manifest from './../manifest.json';
|
|
4
4
|
|
|
@@ -17,7 +17,7 @@ export const IconEditor = (attributes) => {
|
|
|
17
17
|
return (
|
|
18
18
|
<JsxSvg
|
|
19
19
|
svg={manifestIcons[iconName]}
|
|
20
|
-
className={
|
|
20
|
+
className={tailwindClasses(attributes, manifest, additionalClass)}
|
|
21
21
|
/>
|
|
22
22
|
);
|
|
23
23
|
};
|
|
@@ -26,7 +26,7 @@ if (!isset($manifest['icons'][$iconName])) {
|
|
|
26
26
|
|
|
27
27
|
$icon = $manifest['icons'][$iconName];
|
|
28
28
|
|
|
29
|
-
$className = Helpers::
|
|
29
|
+
$className = Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass);
|
|
30
30
|
|
|
31
31
|
if (!empty($className)) {
|
|
32
32
|
$icon = str_replace('<svg ', '<svg class="' . htmlspecialchars($className) . '" ', $icon);
|
|
@@ -2,8 +2,7 @@ import {
|
|
|
2
2
|
checkAttr,
|
|
3
3
|
getBreakpointData,
|
|
4
4
|
getBreakpointNames,
|
|
5
|
-
|
|
6
|
-
getTwPart,
|
|
5
|
+
tailwindClasses,
|
|
7
6
|
} from '@eightshift/frontend-libs-tailwind/scripts';
|
|
8
7
|
import { ImagePlaceholder } from '@eightshift/ui-components';
|
|
9
8
|
import manifest from './../manifest.json';
|
|
@@ -47,7 +46,7 @@ export const ImageEditor = (attributes) => {
|
|
|
47
46
|
);
|
|
48
47
|
})}
|
|
49
48
|
<img
|
|
50
|
-
className={
|
|
49
|
+
className={tailwindClasses(attributes, manifest, additionalClass?.image ?? additionalClass)}
|
|
51
50
|
src={imageData?.['_default'].url}
|
|
52
51
|
/>
|
|
53
52
|
</picture>
|
|
@@ -57,6 +57,6 @@ $breakpoints = Helpers::getTwBreakpoints($isMobileFirst);
|
|
|
57
57
|
<img
|
|
58
58
|
src="<?php echo esc_url($imageData['_default']['url'] ?? ''); ?>"
|
|
59
59
|
alt="<?php echo esc_attr($imageAlt); ?>"
|
|
60
|
-
class="<?php echo esc_attr(Helpers::
|
|
60
|
+
class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass['image'] ?? $additionalClass)); ?>"
|
|
61
61
|
/>
|
|
62
62
|
</picture>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
2
|
import { RichText } from '@wordpress/block-editor';
|
|
3
|
-
import { checkAttr, getAttrKey,
|
|
3
|
+
import { checkAttr, getAttrKey, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
4
4
|
import manifest from '../manifest.json';
|
|
5
5
|
|
|
6
6
|
export const ListEditor = (attributes) => {
|
|
@@ -16,7 +16,7 @@ export const ListEditor = (attributes) => {
|
|
|
16
16
|
const listType = checkAttr('listType', attributes, manifest);
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
|
-
<div className={
|
|
19
|
+
<div className={tailwindClasses(attributes, manifest, additionalClass)}>
|
|
20
20
|
<RichText
|
|
21
21
|
tagName={listType}
|
|
22
22
|
multiline='li'
|
|
@@ -23,7 +23,7 @@ $listType = Helpers::checkAttr('listType', $attributes, $manifest);
|
|
|
23
23
|
?>
|
|
24
24
|
|
|
25
25
|
<<?php echo esc_attr($listType); ?>
|
|
26
|
-
class="<?php echo esc_attr(Helpers::
|
|
26
|
+
class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass)); ?>"
|
|
27
27
|
>
|
|
28
28
|
<?php
|
|
29
29
|
// phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"tailwind": {
|
|
93
93
|
"base": {
|
|
94
94
|
"twClasses": "font-sans [&_a]:underline font-synthesis-none",
|
|
95
|
-
"
|
|
95
|
+
"twClassesEditorOnly": "font-sans [&>a]:underline font-synthesis-none"
|
|
96
96
|
},
|
|
97
97
|
"options": {
|
|
98
98
|
"listSize": {
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"decimal": "list-decimal ml-[1.125em]",
|
|
116
116
|
"checks": "list-['✓_'] ml-[1em]"
|
|
117
117
|
},
|
|
118
|
-
"
|
|
118
|
+
"twClassesEditorOnly": {
|
|
119
119
|
"none": "*:list-none",
|
|
120
120
|
"disc": "*:list-disc *:ml-[1.125em]",
|
|
121
121
|
"decimal": "*:list-decimal *:ml-[1.125em]",
|
|
@@ -18,17 +18,17 @@ $modalTitle = Helpers::checkAttr('modalTitle', $attributes, $manifest);
|
|
|
18
18
|
$modalContent = Helpers::checkAttr('modalContent', $attributes, $manifest);
|
|
19
19
|
?>
|
|
20
20
|
|
|
21
|
-
<div id="<?php echo esc_attr($modalId); ?>" aria-hidden="true" class="<?php echo esc_attr(Helpers::
|
|
22
|
-
<div tabindex="-1" class="<?php echo esc_attr(Helpers::
|
|
23
|
-
<div class="<?php echo esc_attr(Helpers::
|
|
24
|
-
<header class="<?php echo esc_attr(Helpers::
|
|
21
|
+
<div id="<?php echo esc_attr($modalId); ?>" aria-hidden="true" class="<?php echo esc_attr(Helpers::tailwindClasses('modalWrapper', $attributes, $manifest, $componentJsClass)); ?>">
|
|
22
|
+
<div tabindex="-1" class="<?php echo esc_attr(Helpers::tailwindClasses('modalBackdrop', $attributes, $manifest)); ?>" data-micromodal-close>
|
|
23
|
+
<div class="<?php echo esc_attr(Helpers::tailwindClasses('modalContent', $attributes, $manifest)); ?>" role="dialog" aria-modal="true" aria-labelledby="<?php echo esc_attr($modalId); ?>-title">
|
|
24
|
+
<header class="<?php echo esc_attr(Helpers::tailwindClasses('modalHeader', $attributes, $manifest)); ?>">
|
|
25
25
|
<?php if (!empty($modalTitle)) { ?>
|
|
26
26
|
<p id="<?php echo esc_attr($modalId); ?>-title">
|
|
27
27
|
<?php echo esc_html($modalTitle); ?>
|
|
28
28
|
</p>
|
|
29
29
|
<?php } ?>
|
|
30
30
|
|
|
31
|
-
<button class="<?php echo esc_attr(Helpers::
|
|
31
|
+
<button class="<?php echo esc_attr(Helpers::tailwindClasses('button', $attributes, $manifest, 'ml-auto')); ?>" aria-label="Close menu" data-micromodal-close>
|
|
32
32
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
|
|
33
33
|
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12" />
|
|
34
34
|
</svg>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
2
|
import { RichText } from '@wordpress/block-editor';
|
|
3
|
-
import { checkAttr, getAttrKey,
|
|
3
|
+
import { checkAttr, getAttrKey, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
4
4
|
import manifest from './../manifest.json';
|
|
5
5
|
|
|
6
6
|
export const ParagraphEditor = (attributes) => {
|
|
@@ -25,7 +25,7 @@ export const ParagraphEditor = (attributes) => {
|
|
|
25
25
|
return (
|
|
26
26
|
<RichText
|
|
27
27
|
identifier={getAttrKey('paragraphContent', attributes, manifest)}
|
|
28
|
-
className={
|
|
28
|
+
className={tailwindClasses(attributes, manifest, additionalClass)}
|
|
29
29
|
placeholder={placeholder}
|
|
30
30
|
value={paragraphContent}
|
|
31
31
|
onChange={(value) => setAttributes({ [getAttrKey('paragraphContent', attributes, manifest)]: value })}
|
|
@@ -25,7 +25,7 @@ if (!$paragraphContent) {
|
|
|
25
25
|
}
|
|
26
26
|
?>
|
|
27
27
|
|
|
28
|
-
<p class="<?php echo esc_attr(Helpers::
|
|
28
|
+
<p class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass)); ?>">
|
|
29
29
|
<?php
|
|
30
30
|
// phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
|
|
31
31
|
echo $paragraphContent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
2
|
import { RichText } from '@wordpress/block-editor';
|
|
3
|
-
import { checkAttr,
|
|
3
|
+
import { checkAttr, tailwindClasses, getAttrKey } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
4
4
|
import { AnimatedVisibility } from '@eightshift/ui-components';
|
|
5
5
|
import { JsxSvg } from '@eightshift/ui-components/icons';
|
|
6
6
|
import manifest from './../manifest.json';
|
|
@@ -19,27 +19,27 @@ export const QuoteEditor = (attributes) => {
|
|
|
19
19
|
const quoteAuthor = checkAttr('quoteAuthor', attributes, manifest);
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
|
-
<figure className={
|
|
22
|
+
<figure className={tailwindClasses('container', attributes, manifest, additionalClass)}>
|
|
23
23
|
<AnimatedVisibility
|
|
24
24
|
visible={quoteShowIcon}
|
|
25
25
|
noInitial
|
|
26
26
|
>
|
|
27
27
|
<JsxSvg
|
|
28
|
-
className={
|
|
28
|
+
className={tailwindClasses('icon', attributes, manifest)}
|
|
29
29
|
svg={manifest.resources.quoteIcon}
|
|
30
30
|
/>
|
|
31
31
|
</AnimatedVisibility>
|
|
32
32
|
|
|
33
33
|
<RichText
|
|
34
34
|
tagName='blockquote'
|
|
35
|
-
className={
|
|
35
|
+
className={tailwindClasses('quote-text', attributes, manifest)}
|
|
36
36
|
placeholder={__('Quote text', '%g_textdomain%')}
|
|
37
37
|
value={quoteText}
|
|
38
38
|
onChange={(value) => setAttributes({ [getAttrKey('quoteText', attributes, manifest)]: value })}
|
|
39
39
|
allowedFormats={[]}
|
|
40
40
|
/>
|
|
41
41
|
|
|
42
|
-
<figcaption className={
|
|
42
|
+
<figcaption className={tailwindClasses('author', attributes, manifest)}>
|
|
43
43
|
—
|
|
44
44
|
<RichText
|
|
45
45
|
placeholder={__('Quote author', '%g_textdomain%')}
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"author": {
|
|
39
39
|
"twClasses": "font-sans text-sm text-gray-500 mt-4 font-light",
|
|
40
|
-
"
|
|
40
|
+
"twClassesEditorOnly": "inline-flex gap-1 font-sans text-sm text-gray-500 mt-2 font-light"
|
|
41
41
|
},
|
|
42
42
|
"icon": {
|
|
43
43
|
"twClasses": "ml-1 ~mb-3/4 pointer-events-none text-gray-400 size-6"
|
|
@@ -21,14 +21,14 @@ $quoteText = Helpers::checkAttr('quoteText', $attributes, $manifest);
|
|
|
21
21
|
$quoteAuthor = Helpers::checkAttr('quoteAuthor', $attributes, $manifest);
|
|
22
22
|
$quoteShowIcon = Helpers::checkAttr('quoteShowIcon', $attributes, $manifest);
|
|
23
23
|
|
|
24
|
-
$iconClass = Helpers::
|
|
24
|
+
$iconClass = Helpers::tailwindClasses('icon', $attributes, $manifest);
|
|
25
25
|
|
|
26
26
|
$icon = $manifest['resources']['quoteIcon'];
|
|
27
27
|
$icon = str_replace('<svg', '<svg class="' . $iconClass . '"', $icon);
|
|
28
28
|
$icon = str_replace('<svg', '<svg aria-hidden="true"', $icon);
|
|
29
29
|
?>
|
|
30
30
|
|
|
31
|
-
<figure class="<?php echo esc_attr(Helpers::
|
|
31
|
+
<figure class="<?php echo esc_attr(Helpers::tailwindClasses('container', $attributes, $manifest, $additionalClass)); ?>">
|
|
32
32
|
<?php
|
|
33
33
|
if ($quoteShowIcon) {
|
|
34
34
|
// phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
|
|
@@ -36,12 +36,12 @@ $icon = str_replace('<svg', '<svg aria-hidden="true"', $icon);
|
|
|
36
36
|
}
|
|
37
37
|
?>
|
|
38
38
|
|
|
39
|
-
<blockquote class="<?php echo esc_attr(Helpers::
|
|
39
|
+
<blockquote class="<?php echo esc_attr(Helpers::tailwindClasses('quote-text', $attributes, $manifest)); ?>">
|
|
40
40
|
<?php echo wp_kses_post($quoteText); ?>
|
|
41
41
|
</blockquote>
|
|
42
42
|
|
|
43
43
|
<?php if (!empty($quoteAuthor)) { ?>
|
|
44
|
-
<figcaption class="<?php echo esc_attr(Helpers::
|
|
44
|
+
<figcaption class="<?php echo esc_attr(Helpers::tailwindClasses('author', $attributes, $manifest)); ?>">
|
|
45
45
|
—
|
|
46
46
|
<?php echo wp_kses_post($quoteAuthor); ?>
|
|
47
47
|
</figcaption>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { checkAttr, classnames, getAttrKey,
|
|
1
|
+
import { checkAttr, classnames, getAttrKey, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
2
2
|
import { JsxSvg } from '@eightshift/ui-components/icons';
|
|
3
3
|
import manifest from '../manifest.json';
|
|
4
4
|
|
|
@@ -14,11 +14,11 @@ export const ShareEditor = (attributes) => {
|
|
|
14
14
|
const shareTargets = checkAttr('shareTargets', attributes, manifest);
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
|
-
<div className={
|
|
17
|
+
<div className={tailwindClasses('container', attributes, manifest, additionalClass)}>
|
|
18
18
|
{shareTargets.map((network) => {
|
|
19
19
|
return (
|
|
20
20
|
<JsxSvg
|
|
21
|
-
className={
|
|
21
|
+
className={tailwindClasses('icon', attributes, manifest)}
|
|
22
22
|
svg={manifest?.networks?.[network]?.icon}
|
|
23
23
|
/>
|
|
24
24
|
);
|
|
@@ -23,7 +23,7 @@ $additionalClass = $attributes['additionalClass'] ?? '';
|
|
|
23
23
|
|
|
24
24
|
?>
|
|
25
25
|
<div
|
|
26
|
-
class="<?php echo esc_attr(Helpers::
|
|
26
|
+
class="<?php echo esc_attr(Helpers::tailwindClasses('container', $attributes, $manifest, $additionalClass, $manifest['componentJsClass'])); ?>"
|
|
27
27
|
data-mode="<?php echo esc_attr($shareMode); ?>"
|
|
28
28
|
>
|
|
29
29
|
<?php
|
|
@@ -35,7 +35,7 @@ $additionalClass = $attributes['additionalClass'] ?? '';
|
|
|
35
35
|
$shareUrl = str_replace('POST_FEATURED_IMAGE', get_the_post_thumbnail_url(get_the_ID(), 'large'), $shareUrl);
|
|
36
36
|
?>
|
|
37
37
|
<button
|
|
38
|
-
class="<?php echo esc_attr(Helpers::
|
|
38
|
+
class="<?php echo esc_attr(Helpers::tailwindClasses('icon', $attributes, $manifest, "{$manifest['componentJsClass']}-link")); ?>"
|
|
39
39
|
data-network="<?php echo esc_attr($networkName); ?>"
|
|
40
40
|
data-share-url="<?php echo esc_url($shareUrl); ?>"
|
|
41
41
|
data-page-title="<?php echo esc_attr(get_the_title()); ?>"
|
|
@@ -51,7 +51,7 @@ $additionalClass = $attributes['additionalClass'] ?? '';
|
|
|
51
51
|
foreach ($shareTargets as $networkName) {
|
|
52
52
|
?>
|
|
53
53
|
<a
|
|
54
|
-
class="<?php echo esc_attr(Helpers::
|
|
54
|
+
class="<?php echo esc_attr(Helpers::tailwindClasses('icon', $attributes, $manifest)); ?>"
|
|
55
55
|
href="<?php echo esc_url($manifest['networks'][$networkName]['url'] ?? ''); ?>"
|
|
56
56
|
title="<?php echo esc_attr($manifest['networks'][$networkName]['title'] ?? ''); ?>"
|
|
57
57
|
target="_blank"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
|
-
import { ManageFileButton, checkAttr, getAttrKey,
|
|
2
|
+
import { ManageFileButton, checkAttr, getAttrKey, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
3
3
|
import { HStack, MediaPlaceholder, VStack } from '@eightshift/ui-components';
|
|
4
4
|
import { icons } from '@eightshift/ui-components/icons';
|
|
5
5
|
import manifest from '../manifest.json';
|
|
@@ -63,7 +63,7 @@ export const VideoEditor = (attributes) => {
|
|
|
63
63
|
|
|
64
64
|
{hasVideo && (
|
|
65
65
|
<video
|
|
66
|
-
className={
|
|
66
|
+
className={tailwindClasses('video', attributes, manifest, additionalClass)}
|
|
67
67
|
src={videoUrl}
|
|
68
68
|
controls
|
|
69
69
|
muted
|
|
@@ -43,7 +43,7 @@ $additionalAttributes = Helpers::classnames([
|
|
|
43
43
|
?>
|
|
44
44
|
|
|
45
45
|
<video
|
|
46
|
-
class="<?php echo esc_attr(Helpers::
|
|
46
|
+
class="<?php echo esc_attr(Helpers::tailwindClasses('video', $attributes, $manifest)); ?>"
|
|
47
47
|
<?php echo esc_attr($additionalAttributes); ?>
|
|
48
48
|
preload="<?php echo esc_attr($videoPreload); ?>"
|
|
49
49
|
<?php if ($videoPosterUrl) { ?>
|
|
@@ -24,7 +24,7 @@ $accordionItemLabel = Helpers::checkAttr('accordionItemLabel', $attributes, $man
|
|
|
24
24
|
id="<?php echo esc_attr($triggerId); ?>"
|
|
25
25
|
aria-expanded="false"
|
|
26
26
|
aria-controls="<?php echo esc_attr($panelId); ?>"
|
|
27
|
-
class="<?php echo esc_attr(Helpers::
|
|
27
|
+
class="<?php echo esc_attr(Helpers::tailwindClasses('trigger', $attributes, $manifest)); ?>"
|
|
28
28
|
data-accordion-header
|
|
29
29
|
>
|
|
30
30
|
<?php
|
|
@@ -36,7 +36,7 @@ $accordionItemLabel = Helpers::checkAttr('accordionItemLabel', $attributes, $man
|
|
|
36
36
|
<section
|
|
37
37
|
id="<?php echo esc_attr($panelId); ?>"
|
|
38
38
|
aria-labelledby="<?php echo esc_attr($triggerId); ?>"
|
|
39
|
-
class="<?php echo esc_attr(Helpers::
|
|
39
|
+
class="<?php echo esc_attr(Helpers::tailwindClasses('content-container', $attributes, $manifest)); ?>"
|
|
40
40
|
hidden
|
|
41
41
|
>
|
|
42
42
|
<?php
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useId, useState, useRef } from 'react';
|
|
2
2
|
import { __ } from '@wordpress/i18n';
|
|
3
|
-
import { BlockInserter, checkAttr, getAttrKey,
|
|
3
|
+
import { BlockInserter, checkAttr, getAttrKey, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
4
4
|
import { RichText, useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
5
5
|
import manifest from '../manifest.json';
|
|
6
6
|
import { JsxSvg } from '@eightshift/ui-components/icons';
|
|
@@ -25,7 +25,7 @@ export const AccordionItemEditor = ({ attributes, setAttributes, clientId }) =>
|
|
|
25
25
|
<>
|
|
26
26
|
<div
|
|
27
27
|
aria-expanded={expanded}
|
|
28
|
-
className={
|
|
28
|
+
className={tailwindClasses('trigger', attributes, manifest)}
|
|
29
29
|
>
|
|
30
30
|
<RichText
|
|
31
31
|
placeholder={__('Section title', '%g_textdomain%')}
|
|
@@ -37,11 +37,11 @@ export const AccordionItemEditor = ({ attributes, setAttributes, clientId }) =>
|
|
|
37
37
|
|
|
38
38
|
<button
|
|
39
39
|
onClick={(e) => setExpanded(!expanded)}
|
|
40
|
-
className={
|
|
40
|
+
className={tailwindClasses('editor-trigger', attributes, manifest)}
|
|
41
41
|
>
|
|
42
42
|
<JsxSvg
|
|
43
43
|
svg={manifest.resources.icon}
|
|
44
|
-
className={
|
|
44
|
+
className={tailwindClasses('editor-trigger-icon', attributes, manifest, expanded && 'rotate-45')}
|
|
45
45
|
/>
|
|
46
46
|
</button>
|
|
47
47
|
</div>
|
|
@@ -52,7 +52,7 @@ export const AccordionItemEditor = ({ attributes, setAttributes, clientId }) =>
|
|
|
52
52
|
>
|
|
53
53
|
<div
|
|
54
54
|
{...innerBlocksProps}
|
|
55
|
-
className={
|
|
55
|
+
className={tailwindClasses('content-container', attributes, manifest)}
|
|
56
56
|
/>
|
|
57
57
|
</AnimatedVisibility>
|
|
58
58
|
</>
|
|
@@ -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
|
-
"
|
|
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
|
-
"
|
|
59
|
+
"twClassesEditorOnly": "pl-2 pr-8 pb-4 *:!m-0"
|
|
60
60
|
},
|
|
61
61
|
"editor-trigger": {
|
|
62
|
-
"
|
|
62
|
+
"twClassesEditorOnly": "focus:outline-none focus-visible:ring focus-visible:ring-navy-500/30 transition"
|
|
63
63
|
},
|
|
64
64
|
"editor-trigger-icon": {
|
|
65
|
-
"
|
|
65
|
+
"twClassesEditorOnly": "size-5 transition duration-300"
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}
|