@eightshift/frontend-libs-tailwind 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +37 -0
- package/.github/CODEOWNERS +1 -0
- package/.github/CONTRIBUTING.md +17 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +10 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +10 -0
- package/.github/ISSUE_TEMPLATE/question.md +10 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +11 -0
- package/.github/workflows/ci.yml +31 -0
- package/.husky/pre-commit +1 -0
- package/.prettierrc +14 -0
- package/.stylelintrc +4 -0
- package/CHANGELOG.md +13 -0
- package/CODE_OF_CONDUCT.md +76 -0
- package/LICENSE +21 -0
- package/README.md +24 -0
- package/blocks/init/assets/application-admin.js +10 -0
- package/blocks/init/assets/application.js +13 -0
- package/blocks/init/assets/images/index.js +5 -0
- package/blocks/init/assets/scripts/application-admin.js +7 -0
- package/blocks/init/assets/scripts/application.js +3 -0
- package/blocks/init/assets/scripts/theme-colors.js +39 -0
- package/blocks/init/assets/styles/application-admin.css +6 -0
- package/blocks/init/assets/styles/application.css +3 -0
- package/blocks/init/src/Blocks/assets/application-blocks-editor.js +14 -0
- package/blocks/init/src/Blocks/assets/application-blocks-frontend.js +13 -0
- package/blocks/init/src/Blocks/assets/application-blocks.js +9 -0
- package/blocks/init/src/Blocks/assets/scripts/application-blocks-editor.js +65 -0
- package/blocks/init/src/Blocks/assets/scripts/application-blocks-frontend.js +24 -0
- package/blocks/init/src/Blocks/assets/scripts/link-section-editor.js +258 -0
- package/blocks/init/src/Blocks/assets/scripts/shared.js +25 -0
- package/blocks/init/src/Blocks/assets/styles/application-blocks-editor.css +15 -0
- package/blocks/init/src/Blocks/assets/styles/application-blocks-frontend.css +12 -0
- package/blocks/init/src/Blocks/assets/styles/application-blocks.css +0 -0
- package/blocks/init/src/Blocks/assets/styles/editor/editor-overrides.css +15 -0
- package/blocks/init/src/Blocks/assets/styles/tailwind.css +34 -0
- package/blocks/init/src/Blocks/components/admin-theme-options/admin-theme-options.php +20 -0
- package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/index.js +36 -0
- package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/pages/parts.js +55 -0
- package/blocks/init/src/Blocks/components/admin-theme-options/manifest.json +5 -0
- package/blocks/init/src/Blocks/components/button/assets/index.js +22 -0
- package/blocks/init/src/Blocks/components/button/button.php +77 -0
- package/blocks/init/src/Blocks/components/button/components/button-editor.js +40 -0
- package/blocks/init/src/Blocks/components/button/components/button-options.js +135 -0
- package/blocks/init/src/Blocks/components/button/manifest.json +299 -0
- package/blocks/init/src/Blocks/components/card/card.php +42 -0
- package/blocks/init/src/Blocks/components/card/components/card-editor.js +39 -0
- package/blocks/init/src/Blocks/components/card/components/card-options.js +56 -0
- package/blocks/init/src/Blocks/components/card/manifest.json +111 -0
- package/blocks/init/src/Blocks/components/head/head.php +52 -0
- package/blocks/init/src/Blocks/components/head/manifest.json +17 -0
- package/blocks/init/src/Blocks/components/heading/components/heading-editor.js +30 -0
- package/blocks/init/src/Blocks/components/heading/components/heading-options.js +62 -0
- package/blocks/init/src/Blocks/components/heading/heading.php +45 -0
- package/blocks/init/src/Blocks/components/heading/manifest.json +76 -0
- package/blocks/init/src/Blocks/components/hero/components/hero-editor.js +42 -0
- package/blocks/init/src/Blocks/components/hero/components/hero-options.js +100 -0
- package/blocks/init/src/Blocks/components/hero/hero.php +45 -0
- package/blocks/init/src/Blocks/components/hero/manifest.json +96 -0
- package/blocks/init/src/Blocks/components/icon/components/icon-editor.js +23 -0
- package/blocks/init/src/Blocks/components/icon/components/icon-options.js +65 -0
- package/blocks/init/src/Blocks/components/icon/icon.php +34 -0
- package/blocks/init/src/Blocks/components/icon/manifest.json +1234 -0
- package/blocks/init/src/Blocks/components/image/components/image-editor.js +65 -0
- package/blocks/init/src/Blocks/components/image/components/image-options.js +111 -0
- package/blocks/init/src/Blocks/components/image/image.php +62 -0
- package/blocks/init/src/Blocks/components/image/manifest.json +125 -0
- package/blocks/init/src/Blocks/components/list/components/list-editor.js +30 -0
- package/blocks/init/src/Blocks/components/list/components/list-options.js +62 -0
- package/blocks/init/src/Blocks/components/list/list.php +32 -0
- package/blocks/init/src/Blocks/components/list/manifest.json +127 -0
- package/blocks/init/src/Blocks/components/load-more/assets/index.js +19 -0
- package/blocks/init/src/Blocks/components/load-more/assets/load-more.js +147 -0
- package/blocks/init/src/Blocks/components/load-more/components/load-more-editor.js +14 -0
- package/blocks/init/src/Blocks/components/load-more/components/load-more-options.js +18 -0
- package/blocks/init/src/Blocks/components/load-more/load-more.php +47 -0
- package/blocks/init/src/Blocks/components/load-more/manifest.json +39 -0
- package/blocks/init/src/Blocks/components/modal/assets/index.js +27 -0
- package/blocks/init/src/Blocks/components/modal/manifest.json +48 -0
- package/blocks/init/src/Blocks/components/modal/modal.php +46 -0
- package/blocks/init/src/Blocks/components/paragraph/components/paragraph-editor.js +40 -0
- package/blocks/init/src/Blocks/components/paragraph/components/paragraph-options.js +48 -0
- package/blocks/init/src/Blocks/components/paragraph/manifest.json +83 -0
- package/blocks/init/src/Blocks/components/paragraph/paragraph.php +33 -0
- package/blocks/init/src/Blocks/components/post-header/manifest.json +5 -0
- package/blocks/init/src/Blocks/components/post-header/post-header.php +24 -0
- package/blocks/init/src/Blocks/components/quote/components/quote-editor.js +53 -0
- package/blocks/init/src/Blocks/components/quote/components/quote-options.js +29 -0
- package/blocks/init/src/Blocks/components/quote/manifest.json +47 -0
- package/blocks/init/src/Blocks/components/quote/quote.php +49 -0
- package/blocks/init/src/Blocks/components/share/assets/index.js +39 -0
- package/blocks/init/src/Blocks/components/share/components/share-editor.js +25 -0
- package/blocks/init/src/Blocks/components/share/components/share-options.js +112 -0
- package/blocks/init/src/Blocks/components/share/manifest.json +72 -0
- package/blocks/init/src/Blocks/components/share/share.php +66 -0
- package/blocks/init/src/Blocks/components/tracking-before-body-end/manifest.json +5 -0
- package/blocks/init/src/Blocks/components/tracking-before-body-end/tracking-before-body-end.php +9 -0
- package/blocks/init/src/Blocks/components/tracking-head/manifest.json +5 -0
- package/blocks/init/src/Blocks/components/tracking-head/tracking-head.php +9 -0
- package/blocks/init/src/Blocks/components/video/components/video-editor.js +74 -0
- package/blocks/init/src/Blocks/components/video/components/video-options.js +280 -0
- package/blocks/init/src/Blocks/components/video/manifest.json +116 -0
- package/blocks/init/src/Blocks/components/video/video.php +72 -0
- package/blocks/init/src/Blocks/custom/accordion/accordion-block.js +15 -0
- package/blocks/init/src/Blocks/custom/accordion/accordion.php +28 -0
- package/blocks/init/src/Blocks/custom/accordion/assets/index.js +37 -0
- package/blocks/init/src/Blocks/custom/accordion/components/accordion-editor.js +17 -0
- package/blocks/init/src/Blocks/custom/accordion/components/accordion-options.js +18 -0
- package/blocks/init/src/Blocks/custom/accordion/manifest.json +32 -0
- package/blocks/init/src/Blocks/custom/accordion-item/accordion-item-block.js +19 -0
- package/blocks/init/src/Blocks/custom/accordion-item/accordion-item.php +46 -0
- package/blocks/init/src/Blocks/custom/accordion-item/components/accordion-item-editor.js +60 -0
- package/blocks/init/src/Blocks/custom/accordion-item/manifest.json +69 -0
- package/blocks/init/src/Blocks/custom/button/button-block.js +13 -0
- package/blocks/init/src/Blocks/custom/button/button.php +11 -0
- package/blocks/init/src/Blocks/custom/button/components/button-editor.js +12 -0
- package/blocks/init/src/Blocks/custom/button/components/button-options.js +12 -0
- package/blocks/init/src/Blocks/custom/button/manifest.json +18 -0
- package/blocks/init/src/Blocks/custom/card/card-block.js +13 -0
- package/blocks/init/src/Blocks/custom/card/card.php +11 -0
- package/blocks/init/src/Blocks/custom/card/components/card-editor.js +12 -0
- package/blocks/init/src/Blocks/custom/card/components/card-options.js +15 -0
- package/blocks/init/src/Blocks/custom/card/manifest.json +18 -0
- package/blocks/init/src/Blocks/custom/carousel/assets/index.js +46 -0
- package/blocks/init/src/Blocks/custom/carousel/assets/navigation.js +31 -0
- package/blocks/init/src/Blocks/custom/carousel/assets/pagination.js +39 -0
- package/blocks/init/src/Blocks/custom/carousel/carousel-block.js +21 -0
- package/blocks/init/src/Blocks/custom/carousel/carousel.php +61 -0
- package/blocks/init/src/Blocks/custom/carousel/components/carousel-editor.js +25 -0
- package/blocks/init/src/Blocks/custom/carousel/components/carousel-options.js +47 -0
- package/blocks/init/src/Blocks/custom/carousel/manifest.json +130 -0
- package/blocks/init/src/Blocks/custom/column/column-block.js +21 -0
- package/blocks/init/src/Blocks/custom/column/column-hooks.js +32 -0
- package/blocks/init/src/Blocks/custom/column/column.php +21 -0
- package/blocks/init/src/Blocks/custom/column/components/column-editor.js +19 -0
- package/blocks/init/src/Blocks/custom/column/components/column-options.js +579 -0
- package/blocks/init/src/Blocks/custom/column/manifest.json +625 -0
- package/blocks/init/src/Blocks/custom/columns/columns-block.js +20 -0
- package/blocks/init/src/Blocks/custom/columns/columns.php +21 -0
- package/blocks/init/src/Blocks/custom/columns/components/columns-editor.js +81 -0
- package/blocks/init/src/Blocks/custom/columns/components/columns-options.js +104 -0
- package/blocks/init/src/Blocks/custom/columns/manifest.json +555 -0
- package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-editor.js +28 -0
- package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-options.js +239 -0
- package/blocks/init/src/Blocks/custom/featured-content/featured-content-block.js +13 -0
- package/blocks/init/src/Blocks/custom/featured-content/featured-content.php +139 -0
- package/blocks/init/src/Blocks/custom/featured-content/manifest.json +131 -0
- package/blocks/init/src/Blocks/custom/featured-content/partials/cards.php +39 -0
- package/blocks/init/src/Blocks/custom/group/components/group-editor.js +8 -0
- package/blocks/init/src/Blocks/custom/group/group-block.js +14 -0
- package/blocks/init/src/Blocks/custom/group/group.php +10 -0
- package/blocks/init/src/Blocks/custom/group/manifest.json +32 -0
- package/blocks/init/src/Blocks/custom/heading/components/heading-editor.js +15 -0
- package/blocks/init/src/Blocks/custom/heading/components/heading-options.js +38 -0
- package/blocks/init/src/Blocks/custom/heading/heading-block.js +13 -0
- package/blocks/init/src/Blocks/custom/heading/heading-transforms.js +25 -0
- package/blocks/init/src/Blocks/custom/heading/heading.php +15 -0
- package/blocks/init/src/Blocks/custom/heading/manifest.json +79 -0
- package/blocks/init/src/Blocks/custom/hero/components/hero-editor.js +12 -0
- package/blocks/init/src/Blocks/custom/hero/components/hero-options.js +14 -0
- package/blocks/init/src/Blocks/custom/hero/hero-block.js +13 -0
- package/blocks/init/src/Blocks/custom/hero/hero.php +11 -0
- package/blocks/init/src/Blocks/custom/hero/manifest.json +17 -0
- package/blocks/init/src/Blocks/custom/image/components/image-editor.js +12 -0
- package/blocks/init/src/Blocks/custom/image/components/image-options.js +14 -0
- package/blocks/init/src/Blocks/custom/image/image-block.js +13 -0
- package/blocks/init/src/Blocks/custom/image/image.php +11 -0
- package/blocks/init/src/Blocks/custom/image/manifest.json +105 -0
- package/blocks/init/src/Blocks/custom/list/components/list-editor.js +14 -0
- package/blocks/init/src/Blocks/custom/list/components/list-options.js +39 -0
- package/blocks/init/src/Blocks/custom/list/list-block.js +13 -0
- package/blocks/init/src/Blocks/custom/list/list.php +15 -0
- package/blocks/init/src/Blocks/custom/list/manifest.json +58 -0
- package/blocks/init/src/Blocks/custom/map/assets/index.js +20 -0
- package/blocks/init/src/Blocks/custom/map/assets/map-controller.js +42 -0
- package/blocks/init/src/Blocks/custom/map/assets/utils.js +161 -0
- package/blocks/init/src/Blocks/custom/map/components/map-components.js +403 -0
- package/blocks/init/src/Blocks/custom/map/components/map-editor.js +56 -0
- package/blocks/init/src/Blocks/custom/map/components/map-options.js +557 -0
- package/blocks/init/src/Blocks/custom/map/manifest.json +79 -0
- package/blocks/init/src/Blocks/custom/map/map-block.js +13 -0
- package/blocks/init/src/Blocks/custom/map/map.php +52 -0
- package/blocks/init/src/Blocks/custom/map/styles.css +2 -0
- package/blocks/init/src/Blocks/custom/modal/components/modal-editor.js +90 -0
- package/blocks/init/src/Blocks/custom/modal/manifest.json +51 -0
- package/blocks/init/src/Blocks/custom/modal/modal-block.js +14 -0
- package/blocks/init/src/Blocks/custom/modal/modal.php +20 -0
- package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-editor.js +41 -0
- package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-options.js +38 -0
- package/blocks/init/src/Blocks/custom/paragraph/manifest.json +79 -0
- package/blocks/init/src/Blocks/custom/paragraph/paragraph-block.js +13 -0
- package/blocks/init/src/Blocks/custom/paragraph/paragraph-transforms.js +45 -0
- package/blocks/init/src/Blocks/custom/paragraph/paragraph.php +15 -0
- package/blocks/init/src/Blocks/custom/quote/components/quote-editor.js +12 -0
- package/blocks/init/src/Blocks/custom/quote/components/quote-options.js +14 -0
- package/blocks/init/src/Blocks/custom/quote/manifest.json +17 -0
- package/blocks/init/src/Blocks/custom/quote/quote-block.js +13 -0
- package/blocks/init/src/Blocks/custom/quote/quote.php +13 -0
- package/blocks/init/src/Blocks/custom/share/components/share-editor.js +6 -0
- package/blocks/init/src/Blocks/custom/share/components/share-options.js +12 -0
- package/blocks/init/src/Blocks/custom/share/manifest.json +19 -0
- package/blocks/init/src/Blocks/custom/share/share-block.js +13 -0
- package/blocks/init/src/Blocks/custom/share/share.php +11 -0
- package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-editor.js +57 -0
- package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-options.js +106 -0
- package/blocks/init/src/Blocks/custom/site-footer/manifest.json +73 -0
- package/blocks/init/src/Blocks/custom/site-footer/site-footer-block.js +13 -0
- package/blocks/init/src/Blocks/custom/site-footer/site-footer.php +72 -0
- package/blocks/init/src/Blocks/custom/site-navigation/assets/index.js +9 -0
- package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-editor.js +42 -0
- package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-options.js +73 -0
- package/blocks/init/src/Blocks/custom/site-navigation/manifest.json +77 -0
- package/blocks/init/src/Blocks/custom/site-navigation/site-navigation-block.js +13 -0
- package/blocks/init/src/Blocks/custom/site-navigation/site-navigation.php +99 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/assets/index.js +58 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-editor.js +38 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-options.js +32 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/manifest.json +48 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents-block.js +13 -0
- package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents.php +31 -0
- package/blocks/init/src/Blocks/custom/video/components/video-editor.js +6 -0
- package/blocks/init/src/Blocks/custom/video/components/video-options.js +12 -0
- package/blocks/init/src/Blocks/custom/video/manifest.json +105 -0
- package/blocks/init/src/Blocks/custom/video/video-block.js +13 -0
- package/blocks/init/src/Blocks/custom/video/video.php +22 -0
- package/blocks/init/src/Blocks/manifest.json +14 -0
- package/blocks/init/src/Blocks/variations/card-simple/manifest.json +17 -0
- package/blocks/init/src/Blocks/wrapper/components/wrapper-editor.js +12 -0
- package/blocks/init/src/Blocks/wrapper/components/wrapper-options.js +348 -0
- package/blocks/init/src/Blocks/wrapper/manifest.json +450 -0
- package/blocks/init/src/Blocks/wrapper/styles-editor.css +13 -0
- package/blocks/init/src/Blocks/wrapper/styles.css +19 -0
- package/blocks/init/src/Blocks/wrapper/wrapper.js +30 -0
- package/blocks/init/src/Blocks/wrapper/wrapper.php +34 -0
- package/eslint.config.mjs +3 -0
- package/linters/base.config.mjs +81 -0
- package/linters/eslint.config.mjs +4 -0
- package/linters/ignore-gitignored.mjs +9 -0
- package/linters/stylelint.config.js +146 -0
- package/package.json +93 -0
- package/readme/packages.md +74 -0
- package/schemas/block.json +302 -0
- package/schemas/component.json +240 -0
- package/schemas/globalManifest.json +73 -0
- package/schemas/variation.json +83 -0
- package/scripts/components/block-inserter.js +70 -0
- package/scripts/components/file-picker.js +243 -0
- package/scripts/components/index.js +6 -0
- package/scripts/components/link-section-editor.js +319 -0
- package/scripts/components/media-picker.js +86 -0
- package/scripts/components/server-side-render.js +37 -0
- package/scripts/components/settings/settings.js +48 -0
- package/scripts/components/settings/use-theme-options.js +52 -0
- package/scripts/editor/attributes.js +304 -0
- package/scripts/editor/colors.js +64 -0
- package/scripts/editor/editor.js +139 -0
- package/scripts/editor/fetch.js +102 -0
- package/scripts/editor/hooks.js +44 -0
- package/scripts/editor/index.js +11 -0
- package/scripts/editor/options.js +152 -0
- package/scripts/editor/registration.js +901 -0
- package/scripts/editor/store.js +213 -0
- package/scripts/editor/tailwindcss.js +224 -0
- package/scripts/editor/utility.js +47 -0
- package/scripts/helpers/breakpoints.js +48 -0
- package/scripts/helpers/cookies.js +65 -0
- package/scripts/helpers/dynamic-import.js +19 -0
- package/scripts/helpers/index.js +11 -0
- package/scripts/index.js +22 -0
- package/scripts/plugins/index.js +3 -0
- package/scripts/plugins/yoast-seo.js +70 -0
- package/webpack/base.mjs +138 -0
- package/webpack/helpers.mjs +67 -0
- package/webpack/index.mjs +52 -0
- package/webpack/production.mjs +60 -0
- package/webpack/project.mjs +55 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Template for the document head section.
|
|
5
|
+
*
|
|
6
|
+
* @package %g_namespace%
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
|
|
10
|
+
|
|
11
|
+
$manifest = Helpers::getManifestByDir(__DIR__);
|
|
12
|
+
|
|
13
|
+
$headFavicon = Helpers::checkAttr('headFavicon', $attributes, $manifest);
|
|
14
|
+
$headCharset = Helpers::checkAttr('headCharset', $attributes, $manifest);
|
|
15
|
+
$headName = Helpers::checkAttr('headName', $attributes, $manifest);
|
|
16
|
+
|
|
17
|
+
?>
|
|
18
|
+
|
|
19
|
+
<?php if (isset($headCharset)) { ?>
|
|
20
|
+
<meta charset="<?php echo esc_attr($headCharset); ?>" />
|
|
21
|
+
<?php } ?>
|
|
22
|
+
|
|
23
|
+
<!-- Responsive -->
|
|
24
|
+
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
|
25
|
+
|
|
26
|
+
<!-- Remove IE's ability to use compatibility mode -->
|
|
27
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
28
|
+
|
|
29
|
+
<!-- Disable phone formatting on Safari -->
|
|
30
|
+
<meta name="format-detection" content="telephone=no">
|
|
31
|
+
|
|
32
|
+
<!-- Speed up fetching of external assets -->
|
|
33
|
+
<link rel="dns-prefetch" href="//fonts.googleapis.com">
|
|
34
|
+
<link rel="dns-prefetch" href="//ajax.googleapis.com">
|
|
35
|
+
<link rel="dns-prefetch" href="//www.google-analytics.com">
|
|
36
|
+
|
|
37
|
+
<!-- Windows (Phone) Meta -->
|
|
38
|
+
<?php if ($headName ?? '') { ?>
|
|
39
|
+
<meta name="application-name" content="<?php echo esc_attr($headName); ?>" />
|
|
40
|
+
<?php } ?>
|
|
41
|
+
|
|
42
|
+
<!-- Apple -->
|
|
43
|
+
<?php if ($headName ?? '') { ?>
|
|
44
|
+
<meta name="apple-mobile-web-app-title" content="<?php echo esc_attr($headName); ?>">
|
|
45
|
+
<?php } ?>
|
|
46
|
+
|
|
47
|
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
48
|
+
|
|
49
|
+
<?php if ($headFavicon ?? '') { ?>
|
|
50
|
+
<link rel="apple-touch-startup-image" href="<?php echo esc_url($headFavicon); ?>">
|
|
51
|
+
<link rel="shortcut icon" href="<?php echo esc_url($headFavicon); ?>" />
|
|
52
|
+
<?php } ?>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
|
|
3
|
+
"componentName": "head",
|
|
4
|
+
"title": "Head",
|
|
5
|
+
"attributes": {
|
|
6
|
+
"headFavicon": {
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
"headCharset": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"default": "utf-8"
|
|
12
|
+
},
|
|
13
|
+
"headName": {
|
|
14
|
+
"type": "string"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import { RichText } from '@wordpress/block-editor';
|
|
3
|
+
import { checkAttr, getAttrKey, getTwClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
4
|
+
import manifest from './../manifest.json';
|
|
5
|
+
|
|
6
|
+
export const HeadingEditor = (attributes) => {
|
|
7
|
+
const {
|
|
8
|
+
setAttributes,
|
|
9
|
+
additionalClass,
|
|
10
|
+
placeholder = __('Heading', '%g_textdomain%'),
|
|
11
|
+
} = attributes;
|
|
12
|
+
|
|
13
|
+
const headingUse = checkAttr('headingUse', attributes, manifest);
|
|
14
|
+
|
|
15
|
+
if (!headingUse) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const headingContent = checkAttr('headingContent', attributes, manifest);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<RichText
|
|
23
|
+
className={getTwClasses(attributes, manifest, additionalClass)}
|
|
24
|
+
placeholder={placeholder}
|
|
25
|
+
value={headingContent}
|
|
26
|
+
onChange={(value) => setAttributes({ [getAttrKey('headingContent', attributes, manifest)]: value })}
|
|
27
|
+
allowedFormats={[]}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import { getOption, checkAttr, getAttrKey, getHiddenOptions } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
3
|
+
import { ComponentToggle, HStack, OptionSelect } from '@eightshift/ui-components';
|
|
4
|
+
import { icons } from '@eightshift/ui-components/icons';
|
|
5
|
+
import manifest from './../manifest.json';
|
|
6
|
+
|
|
7
|
+
export const HeadingOptions = (attributes) => {
|
|
8
|
+
const { setAttributes, hideOptions, additionalControls, ...rest } = attributes;
|
|
9
|
+
|
|
10
|
+
const hiddenOptions = getHiddenOptions(hideOptions);
|
|
11
|
+
|
|
12
|
+
const headingUse = checkAttr('headingUse', attributes, manifest);
|
|
13
|
+
const headingSize = checkAttr('headingSize', attributes, manifest);
|
|
14
|
+
const headingTag = checkAttr('headingTag', attributes, manifest);
|
|
15
|
+
|
|
16
|
+
const headingTags = [
|
|
17
|
+
{ label: __('Heading 1', '%g_textdomain%'), value: 'h1' },
|
|
18
|
+
{ label: __('Heading 2', '%g_textdomain%'), value: 'h2' },
|
|
19
|
+
{ label: __('Heading 3', '%g_textdomain%'), value: 'h3' },
|
|
20
|
+
{ label: __('Heading 4', '%g_textdomain%'), value: 'h4' },
|
|
21
|
+
{ label: __('Heading 5', '%g_textdomain%'), value: 'h5' },
|
|
22
|
+
{ label: __('Heading 6', '%g_textdomain%'), value: 'h6' },
|
|
23
|
+
{ label: __('Paragraph', '%g_textdomain%'), value: 'p' },
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<ComponentToggle
|
|
28
|
+
label={manifest.title}
|
|
29
|
+
icon={icons.heading}
|
|
30
|
+
onChange={(value) => setAttributes({ [getAttrKey('headingUse', attributes, manifest)]: value })}
|
|
31
|
+
useComponent={headingUse}
|
|
32
|
+
{...rest}
|
|
33
|
+
>
|
|
34
|
+
<HStack>
|
|
35
|
+
<OptionSelect
|
|
36
|
+
aria-label={__('Font size', '%g_textdomain%')}
|
|
37
|
+
options={getOption('headingSize', attributes, manifest)}
|
|
38
|
+
onChange={(value) => setAttributes({ [getAttrKey('headingSize', attributes, manifest)]: value })}
|
|
39
|
+
value={headingSize}
|
|
40
|
+
hidden={hiddenOptions?.size}
|
|
41
|
+
type='menu'
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
<OptionSelect
|
|
45
|
+
aria-label={__('Heading level', '%g_textdomain%')}
|
|
46
|
+
options={headingTags}
|
|
47
|
+
value={headingTag}
|
|
48
|
+
onChange={(value) => setAttributes({ [getAttrKey('headingTag', attributes, manifest)]: value })}
|
|
49
|
+
type='menu'
|
|
50
|
+
wrapperProps={{
|
|
51
|
+
triggerIcon: <span className='es-uic-font-mono uppercase'>{headingTag}</span>,
|
|
52
|
+
tooltip: __('Heading level', '%g_textdomain%'),
|
|
53
|
+
}}
|
|
54
|
+
hidden={hiddenOptions?.headingLevel}
|
|
55
|
+
noTriggerLabel
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
{additionalControls}
|
|
59
|
+
</HStack>
|
|
60
|
+
</ComponentToggle>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Heading component template.
|
|
5
|
+
*
|
|
6
|
+
* @package %g_namespace%
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
|
|
10
|
+
|
|
11
|
+
$manifest = Helpers::getManifestByDir(__DIR__);
|
|
12
|
+
|
|
13
|
+
$headingUse = Helpers::checkAttr('headingUse', $attributes, $manifest);
|
|
14
|
+
|
|
15
|
+
if (!$headingUse) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
$additionalClass = $attributes['additionalClass'] ?? '';
|
|
20
|
+
|
|
21
|
+
$headingContent = Helpers::checkAttr('headingContent', $attributes, $manifest);
|
|
22
|
+
$headingTag = Helpers::checkAttr('headingTag', $attributes, $manifest);
|
|
23
|
+
|
|
24
|
+
if (!$headingContent) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
$sanitizedTitle = '';
|
|
29
|
+
|
|
30
|
+
if (function_exists('idn_to_ascii') && function_exists('sanitize_title')) {
|
|
31
|
+
$sanitizedTitle = sanitize_title(idn_to_ascii($headingContent));
|
|
32
|
+
} else {
|
|
33
|
+
$sanitizedTitle = sanitize_title($headingContent);
|
|
34
|
+
}
|
|
35
|
+
?>
|
|
36
|
+
|
|
37
|
+
<<?php echo esc_attr($headingTag); ?>
|
|
38
|
+
data-slug="<?php echo esc_attr($sanitizedTitle) ?>"
|
|
39
|
+
class="<?php echo esc_attr(Helpers::getTwClasses($attributes, $manifest, $additionalClass)); ?>"
|
|
40
|
+
>
|
|
41
|
+
<?php
|
|
42
|
+
// phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
|
|
43
|
+
echo $headingContent;
|
|
44
|
+
?>
|
|
45
|
+
</<?php echo esc_attr($headingTag); ?>>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
|
|
3
|
+
"componentName": "heading",
|
|
4
|
+
"title": "Heading",
|
|
5
|
+
"componentClass": "heading",
|
|
6
|
+
"example": {
|
|
7
|
+
"attributes": {
|
|
8
|
+
"headingContent": "This is heading",
|
|
9
|
+
"headingTag": "h2",
|
|
10
|
+
"headingSize": "base",
|
|
11
|
+
"headingUse": true
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"attributes": {
|
|
15
|
+
"headingContent": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
"headingTag": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"default": "h2"
|
|
21
|
+
},
|
|
22
|
+
"headingSize": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"default": "base"
|
|
25
|
+
},
|
|
26
|
+
"headingUse": {
|
|
27
|
+
"type": "boolean",
|
|
28
|
+
"default": true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"options": {
|
|
32
|
+
"headingSize": [
|
|
33
|
+
{
|
|
34
|
+
"label": "24",
|
|
35
|
+
"value": "sm"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"label": "30",
|
|
39
|
+
"value": "base"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"label": "36",
|
|
43
|
+
"value": "md"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"label": "48",
|
|
47
|
+
"value": "lg"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"label": "60",
|
|
51
|
+
"value": "xl"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"label": "96",
|
|
55
|
+
"value": "2xl"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"tailwind": {
|
|
60
|
+
"base": {
|
|
61
|
+
"twClasses": "font-display text-balance font-synthesis-none font-soft-50 scroll-m-20"
|
|
62
|
+
},
|
|
63
|
+
"options": {
|
|
64
|
+
"headingSize": {
|
|
65
|
+
"twClasses": {
|
|
66
|
+
"sm": "~text-lg/2xl !leading-tight",
|
|
67
|
+
"base": "~text-xl/3xl !leading-none",
|
|
68
|
+
"md": "~text-2xl/4xl !leading-none",
|
|
69
|
+
"lg": "~text-3xl/5xl !leading-none",
|
|
70
|
+
"xl": "~text-4xl/6xl !leading-none",
|
|
71
|
+
"2xl": "~text-5xl/8xl !leading-none !font-soft-25 italic"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { props, checkAttr, getTwPart, getTwClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
2
|
+
import { ImageEditor } from '../../image/components/image-editor';
|
|
3
|
+
import { HeadingEditor } from '../../heading/components/heading-editor';
|
|
4
|
+
import { ParagraphEditor } from '../../paragraph/components/paragraph-editor';
|
|
5
|
+
import { ButtonEditor } from '../../button/components/button-editor';
|
|
6
|
+
import manifest from '../manifest.json';
|
|
7
|
+
|
|
8
|
+
export const HeroEditor = (attributes) => {
|
|
9
|
+
const { additionalClass } = attributes;
|
|
10
|
+
|
|
11
|
+
const heroUse = checkAttr('heroUse', attributes, manifest);
|
|
12
|
+
|
|
13
|
+
if (!heroUse) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div className={getTwClasses(attributes, manifest, additionalClass)}>
|
|
19
|
+
<ImageEditor
|
|
20
|
+
{...props('image', attributes, {
|
|
21
|
+
additionalClass: {
|
|
22
|
+
image: '!size-full grayscale',
|
|
23
|
+
picture: getTwPart('imagePicture', manifest),
|
|
24
|
+
},
|
|
25
|
+
})}
|
|
26
|
+
/>
|
|
27
|
+
|
|
28
|
+
<HeadingEditor {...props('heading', attributes)} />
|
|
29
|
+
|
|
30
|
+
<ParagraphEditor
|
|
31
|
+
{...props('paragraph', attributes, {
|
|
32
|
+
additionalClass: 'mt-4 max-w-96 text-pretty',
|
|
33
|
+
})}
|
|
34
|
+
/>
|
|
35
|
+
|
|
36
|
+
<div className='mt-6 flex gap-2'>
|
|
37
|
+
<ButtonEditor {...props('buttonMain', attributes)} />
|
|
38
|
+
<ButtonEditor {...props('buttonSecondary', attributes)} />
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import { checkAttr, getAttrKey, getOption, props } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
3
|
+
import { ImageOptions } from '../../image/components/image-options';
|
|
4
|
+
import { HeadingOptions } from '../../heading/components/heading-options';
|
|
5
|
+
import { ParagraphOptions } from '../../paragraph/components/paragraph-options';
|
|
6
|
+
import { ButtonOptions } from '../../button/components/button-options';
|
|
7
|
+
import { ComponentToggle, OptionSelect } from '@eightshift/ui-components';
|
|
8
|
+
import { icons } from '@eightshift/ui-components/icons';
|
|
9
|
+
import manifest from '../manifest.json';
|
|
10
|
+
|
|
11
|
+
export const HeroOptions = (attributes) => {
|
|
12
|
+
const { setAttributes, ...rest } = attributes;
|
|
13
|
+
|
|
14
|
+
const heroUse = checkAttr('heroUse', attributes, manifest);
|
|
15
|
+
const heroColor = checkAttr('heroColor', attributes, manifest);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<ComponentToggle
|
|
19
|
+
label={manifest.title}
|
|
20
|
+
icon={icons.image}
|
|
21
|
+
onChange={(value) => setAttributes({ [getAttrKey('heroUse', attributes, manifest)]: value })}
|
|
22
|
+
useComponent={heroUse}
|
|
23
|
+
{...rest}
|
|
24
|
+
>
|
|
25
|
+
<OptionSelect
|
|
26
|
+
icon={icons.paletteColor}
|
|
27
|
+
label={__('Theme', 'eightshift-frontend-libs')}
|
|
28
|
+
value={heroColor}
|
|
29
|
+
onChange={(value) => {
|
|
30
|
+
let mainButtonColor = 'navy-500';
|
|
31
|
+
let secondaryButtonColor = 'navy-800';
|
|
32
|
+
|
|
33
|
+
switch (value) {
|
|
34
|
+
case 'navy-dark':
|
|
35
|
+
mainButtonColor = 'navy-500';
|
|
36
|
+
secondaryButtonColor = 'navy-100';
|
|
37
|
+
break;
|
|
38
|
+
case 'red':
|
|
39
|
+
mainButtonColor = 'red-500';
|
|
40
|
+
secondaryButtonColor = 'red-800';
|
|
41
|
+
break;
|
|
42
|
+
case 'red-dark':
|
|
43
|
+
mainButtonColor = 'red-500';
|
|
44
|
+
secondaryButtonColor = 'red-100';
|
|
45
|
+
break;
|
|
46
|
+
case 'gray':
|
|
47
|
+
mainButtonColor = 'gray-500';
|
|
48
|
+
secondaryButtonColor = 'gray-800';
|
|
49
|
+
break;
|
|
50
|
+
case 'gray-dark':
|
|
51
|
+
mainButtonColor = 'gray-500';
|
|
52
|
+
secondaryButtonColor = 'gray-100';
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return setAttributes({
|
|
59
|
+
[getAttrKey('heroColor', attributes, manifest)]: value,
|
|
60
|
+
[getAttrKey('heroButtonMainColor', attributes, manifest)]: mainButtonColor,
|
|
61
|
+
[getAttrKey('heroButtonSecondaryColor', attributes, manifest)]: secondaryButtonColor,
|
|
62
|
+
});
|
|
63
|
+
}}
|
|
64
|
+
options={getOption('heroColor', attributes, manifest)}
|
|
65
|
+
type='menu'
|
|
66
|
+
inline
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
<div>
|
|
70
|
+
<ImageOptions
|
|
71
|
+
{...props('image', attributes)}
|
|
72
|
+
hideOptions='borderRadius'
|
|
73
|
+
/>
|
|
74
|
+
|
|
75
|
+
<HeadingOptions
|
|
76
|
+
{...props('heading', attributes)}
|
|
77
|
+
hideOptions='size'
|
|
78
|
+
/>
|
|
79
|
+
|
|
80
|
+
<ParagraphOptions
|
|
81
|
+
{...props('paragraph', attributes)}
|
|
82
|
+
hideOptions='size'
|
|
83
|
+
/>
|
|
84
|
+
|
|
85
|
+
<ButtonOptions
|
|
86
|
+
{...props('buttonMain', attributes)}
|
|
87
|
+
label={__('Primary button', 'eightshift-frontend-libs')}
|
|
88
|
+
hideOptions='variant,color'
|
|
89
|
+
icon={icons.buttonFilled}
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
<ButtonOptions
|
|
93
|
+
{...props('buttonSecondary', attributes)}
|
|
94
|
+
label={__('Secondary button', 'eightshift-frontend-libs')}
|
|
95
|
+
hideOptions='variant,color'
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
</ComponentToggle>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hero component template.
|
|
5
|
+
*
|
|
6
|
+
* @package %g_namespace%
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
use %g_namespace_vendor_prefix%\EightshiftLibs\Helpers\Helpers;
|
|
10
|
+
|
|
11
|
+
$manifest = Helpers::getManifestByDir(__DIR__);
|
|
12
|
+
|
|
13
|
+
$heroUse = Helpers::checkAttr('heroUse', $attributes, $manifest);
|
|
14
|
+
|
|
15
|
+
if (!$heroUse) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
$additionalClass = $attributes['additionalClass'] ?? '';
|
|
20
|
+
?>
|
|
21
|
+
|
|
22
|
+
<section class="<?php echo esc_attr(Helpers::getTwClasses($attributes, $manifest, $additionalClass)); ?>">
|
|
23
|
+
<?php
|
|
24
|
+
echo Helpers::render('image', Helpers::props('image', $attributes, [
|
|
25
|
+
'additionalClass' => [
|
|
26
|
+
'image' => 'size-full grayscale',
|
|
27
|
+
'picture' => Helpers::getTwPart('imagePicture', $manifest),
|
|
28
|
+
],
|
|
29
|
+
]));
|
|
30
|
+
?>
|
|
31
|
+
|
|
32
|
+
<?php
|
|
33
|
+
echo Helpers::render('heading', Helpers::props('heading', $attributes)),
|
|
34
|
+
Helpers::render('paragraph', Helpers::props('paragraph', $attributes, [
|
|
35
|
+
'additionalClass' => 'mt-4 max-w-96 text-pretty',
|
|
36
|
+
]));
|
|
37
|
+
?>
|
|
38
|
+
|
|
39
|
+
<div class="flex gap-2 mt-6">
|
|
40
|
+
<?php
|
|
41
|
+
echo Helpers::render('button', Helpers::props('buttonMain', $attributes)),
|
|
42
|
+
Helpers::render('button', Helpers::props('buttonSecondary', $attributes));
|
|
43
|
+
?>
|
|
44
|
+
</div>
|
|
45
|
+
</section>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
|
|
3
|
+
"componentName": "hero",
|
|
4
|
+
"title": "Hero",
|
|
5
|
+
"componentClass": "hero",
|
|
6
|
+
"example": {
|
|
7
|
+
"attributes": {
|
|
8
|
+
"heroContentPosition": "center center",
|
|
9
|
+
"heroUse": true
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"attributes": {
|
|
13
|
+
"heroUse": {
|
|
14
|
+
"type": "boolean",
|
|
15
|
+
"default": true
|
|
16
|
+
},
|
|
17
|
+
"heroColor": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"default": "navy"
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
"heroHeadingSize": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"default": "2xl"
|
|
25
|
+
},
|
|
26
|
+
"heroParagraphSize": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"default": "base"
|
|
29
|
+
},
|
|
30
|
+
"heroButtonMainVariant": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"default": "primary"
|
|
33
|
+
},
|
|
34
|
+
"heroButtonSecondaryVariant": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"default": "secondary"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"components": {
|
|
40
|
+
"image": "image",
|
|
41
|
+
"heading": "heading",
|
|
42
|
+
"paragraph": "paragraph",
|
|
43
|
+
"buttonMain": "button",
|
|
44
|
+
"buttonSecondary": "button"
|
|
45
|
+
},
|
|
46
|
+
"options": {
|
|
47
|
+
"heroColor": [
|
|
48
|
+
{
|
|
49
|
+
"label": "Navy",
|
|
50
|
+
"value": "navy"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"label": "Navy (dark)",
|
|
54
|
+
"value": "navy-dark"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"label": "Red",
|
|
58
|
+
"value": "red"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"label": "Red (dark)",
|
|
62
|
+
"value": "red-dark"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"label": "Gray",
|
|
66
|
+
"value": "gray"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"label": "Gray (dark)",
|
|
70
|
+
"value": "gray-dark"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"tailwind": {
|
|
75
|
+
"base": {
|
|
76
|
+
"twClasses": "relative min-h-[40vh] sm:min-h-[50vh] md:min-h-[60vh] isolate flex flex-col items-center justify-center bg-gradient-to-br text-center rounded-xl ~my-4/8 overflow-hidden shadow-lg p-4"
|
|
77
|
+
},
|
|
78
|
+
"parts": {
|
|
79
|
+
"imagePicture": {
|
|
80
|
+
"twClasses": "absolute inset-0 -z-10 mix-blend-color-burn opacity-50 blur-[2px]"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"options": {
|
|
84
|
+
"heroColor": {
|
|
85
|
+
"twClasses": {
|
|
86
|
+
"navy": "from-white to-navy-50 shadow-navy-600/15 text-navy-950",
|
|
87
|
+
"red": "from-white to-red-50 shadow-red-600/15 text-red-950",
|
|
88
|
+
"gray": "from-white to-gray-50 shadow-gray-600/15 text-gray-950",
|
|
89
|
+
"navy-dark": "from-navy-950 to-navy-800 shadow-navy-600/15 text-navy-100",
|
|
90
|
+
"red-dark": "from-red-950 to-red-800 shadow-red-600/15 text-red-100",
|
|
91
|
+
"gray-dark": "from-gray-950 to-gray-800 shadow-gray-600/15 text-gray-100"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { checkAttr, getTwClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
2
|
+
import { JsxSvg } from '@eightshift/ui-components/icons';
|
|
3
|
+
import manifest from './../manifest.json';
|
|
4
|
+
|
|
5
|
+
export const IconEditor = (attributes) => {
|
|
6
|
+
const { icons: manifestIcons } = manifest;
|
|
7
|
+
|
|
8
|
+
const { additionalClass } = attributes;
|
|
9
|
+
|
|
10
|
+
const iconUse = checkAttr('iconUse', attributes, manifest);
|
|
11
|
+
const iconName = checkAttr('iconName', attributes, manifest);
|
|
12
|
+
|
|
13
|
+
if (!iconUse || !manifestIcons?.[iconName]) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<JsxSvg
|
|
19
|
+
svg={manifestIcons[iconName]}
|
|
20
|
+
className={getTwClasses(attributes, manifest, additionalClass)}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import { checkAttr, getAttrKey, getHiddenOptions, getOption } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
3
|
+
import { RSOption, RSSingleValue, ComponentToggle, Select, RichLabel } from '@eightshift/ui-components';
|
|
4
|
+
import { icons, JsxSvg } from '@eightshift/ui-components/icons';
|
|
5
|
+
import manifest from './../manifest.json';
|
|
6
|
+
|
|
7
|
+
const { icons: manifestIcons } = manifest;
|
|
8
|
+
|
|
9
|
+
const IconPickerOption = (props) => (
|
|
10
|
+
<RSOption {...props}>
|
|
11
|
+
<RichLabel
|
|
12
|
+
icon={<JsxSvg svg={manifestIcons[props.value]} />}
|
|
13
|
+
label={props.label}
|
|
14
|
+
/>
|
|
15
|
+
</RSOption>
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const IconPickerValueDisplay = ({ children, ...props }) => (
|
|
19
|
+
<RSSingleValue {...props}>
|
|
20
|
+
<RichLabel
|
|
21
|
+
icon={<JsxSvg svg={manifestIcons[props.data.value]} />}
|
|
22
|
+
label={children}
|
|
23
|
+
/>
|
|
24
|
+
</RSSingleValue>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export const IconOptions = (attributes) => {
|
|
28
|
+
const { setAttributes, hideOptions, ...rest } = attributes;
|
|
29
|
+
|
|
30
|
+
const hiddenOptions = getHiddenOptions(hideOptions);
|
|
31
|
+
|
|
32
|
+
const iconName = checkAttr('iconName', attributes, manifest);
|
|
33
|
+
const iconSize = checkAttr('iconSize', attributes, manifest);
|
|
34
|
+
const iconUse = checkAttr('iconUse', attributes, manifest);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<ComponentToggle
|
|
38
|
+
label={manifest.title}
|
|
39
|
+
icon={icons.iconGeneric}
|
|
40
|
+
onChange={(value) => setAttributes({ [getAttrKey('iconUse', attributes, manifest)]: value })}
|
|
41
|
+
useComponent={iconUse}
|
|
42
|
+
{...rest}
|
|
43
|
+
>
|
|
44
|
+
<Select
|
|
45
|
+
value={iconName}
|
|
46
|
+
options={getOption('iconName', attributes, manifest)}
|
|
47
|
+
placeholder={__('Select an icon', '%g_textdomain%')}
|
|
48
|
+
customMenuOption={IconPickerOption}
|
|
49
|
+
customValueDisplay={IconPickerValueDisplay}
|
|
50
|
+
onChange={(value) => setAttributes({ [getAttrKey('iconName', attributes, manifest)]: value })}
|
|
51
|
+
simpleValue
|
|
52
|
+
hidden={hiddenOptions?.iconName}
|
|
53
|
+
/>
|
|
54
|
+
|
|
55
|
+
<Select
|
|
56
|
+
value={iconSize}
|
|
57
|
+
options={getOption('iconSize', attributes, manifest)}
|
|
58
|
+
onChange={(value) => setAttributes({ [getAttrKey('iconSize', attributes, manifest)]: value })}
|
|
59
|
+
simpleValue
|
|
60
|
+
noSearch
|
|
61
|
+
hidden={hiddenOptions?.size}
|
|
62
|
+
/>
|
|
63
|
+
</ComponentToggle>
|
|
64
|
+
);
|
|
65
|
+
};
|