@eightshift/frontend-libs-tailwind 1.5.0 → 2.0.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.
- package/.gitattributes +8 -30
- package/.github/workflows/ci.yml +2 -1
- package/CHANGELOG.md +29 -1
- package/bun.lock +1009 -0
- package/package.json +16 -26
- package/schemas/globalManifest.json +5 -0
- package/scripts/components/picker-placeholder.js +1 -1
- package/scripts/editor/colors.js +2 -2
- package/scripts/editor/options.js +1 -1
- package/scripts/editor/registration.js +4 -7
- package/scripts/editor/store.js +19 -0
- package/scripts/helpers/cookies.js +24 -16
- package/scripts/plugins/yoast-seo.js +71 -45
- package/webpack/base.mjs +0 -5
- package/webpack/helpers.mjs +1 -5
- package/webpack/index.mjs +0 -1
- package/webpack/project.mjs +0 -5
- package/blocks/init/assets/application-admin.js +0 -10
- package/blocks/init/assets/application.js +0 -13
- package/blocks/init/assets/fonts/fraunces-italic-latin-extended.woff2 +0 -0
- package/blocks/init/assets/fonts/fraunces-italic-latin.woff2 +0 -0
- package/blocks/init/assets/fonts/fraunces-latin-extended.woff2 +0 -0
- package/blocks/init/assets/fonts/fraunces-latin.woff2 +0 -0
- package/blocks/init/assets/fonts/noto-sans-italic-latin-extended.woff2 +0 -0
- package/blocks/init/assets/fonts/noto-sans-italic-latin.woff2 +0 -0
- package/blocks/init/assets/fonts/noto-sans-latin-extended.woff2 +0 -0
- package/blocks/init/assets/fonts/noto-sans-latin.woff2 +0 -0
- package/blocks/init/assets/images/index.js +0 -5
- package/blocks/init/assets/scripts/application-admin.js +0 -7
- package/blocks/init/assets/scripts/application.js +0 -3
- package/blocks/init/assets/scripts/theme-colors.js +0 -39
- package/blocks/init/assets/styles/application-admin.css +0 -6
- package/blocks/init/assets/styles/application.css +0 -3
- package/blocks/init/src/Blocks/assets/application-blocks-editor.js +0 -14
- package/blocks/init/src/Blocks/assets/application-blocks-frontend.js +0 -13
- package/blocks/init/src/Blocks/assets/application-blocks.js +0 -9
- package/blocks/init/src/Blocks/assets/scripts/application-blocks-editor.js +0 -65
- package/blocks/init/src/Blocks/assets/scripts/application-blocks-frontend.js +0 -24
- package/blocks/init/src/Blocks/assets/scripts/link-section-editor.js +0 -262
- package/blocks/init/src/Blocks/assets/scripts/shared.js +0 -25
- package/blocks/init/src/Blocks/assets/styles/application-blocks-editor.css +0 -15
- package/blocks/init/src/Blocks/assets/styles/application-blocks-frontend.css +0 -9
- package/blocks/init/src/Blocks/assets/styles/application-blocks.css +0 -1
- package/blocks/init/src/Blocks/assets/styles/editor/editor-overrides.css +0 -15
- package/blocks/init/src/Blocks/assets/styles/fonts.css +0 -90
- package/blocks/init/src/Blocks/assets/styles/tailwind.css +0 -30
- package/blocks/init/src/Blocks/components/admin-theme-options/admin-theme-options.php +0 -20
- package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/index.js +0 -36
- package/blocks/init/src/Blocks/components/admin-theme-options/assets-admin/pages/parts.js +0 -56
- package/blocks/init/src/Blocks/components/admin-theme-options/manifest.json +0 -5
- package/blocks/init/src/Blocks/components/button/assets/index.js +0 -22
- package/blocks/init/src/Blocks/components/button/button.php +0 -88
- package/blocks/init/src/Blocks/components/button/components/button-editor.js +0 -36
- package/blocks/init/src/Blocks/components/button/components/button-options.js +0 -134
- package/blocks/init/src/Blocks/components/button/manifest.json +0 -302
- package/blocks/init/src/Blocks/components/card/card.php +0 -42
- package/blocks/init/src/Blocks/components/card/components/card-editor.js +0 -43
- package/blocks/init/src/Blocks/components/card/components/card-options.js +0 -55
- package/blocks/init/src/Blocks/components/card/manifest.json +0 -111
- package/blocks/init/src/Blocks/components/head/head.php +0 -52
- package/blocks/init/src/Blocks/components/head/manifest.json +0 -17
- package/blocks/init/src/Blocks/components/heading/components/heading-editor.js +0 -26
- package/blocks/init/src/Blocks/components/heading/components/heading-options.js +0 -62
- package/blocks/init/src/Blocks/components/heading/heading.php +0 -45
- package/blocks/init/src/Blocks/components/heading/manifest.json +0 -76
- package/blocks/init/src/Blocks/components/hero/components/hero-editor.js +0 -42
- package/blocks/init/src/Blocks/components/hero/components/hero-options.js +0 -100
- package/blocks/init/src/Blocks/components/hero/hero.php +0 -45
- package/blocks/init/src/Blocks/components/hero/manifest.json +0 -96
- package/blocks/init/src/Blocks/components/icon/components/icon-editor.js +0 -23
- package/blocks/init/src/Blocks/components/icon/components/icon-options.js +0 -65
- package/blocks/init/src/Blocks/components/icon/icon.php +0 -53
- package/blocks/init/src/Blocks/components/icon/manifest.json +0 -1238
- package/blocks/init/src/Blocks/components/image/components/image-editor.js +0 -64
- package/blocks/init/src/Blocks/components/image/components/image-options.js +0 -111
- package/blocks/init/src/Blocks/components/image/image.php +0 -68
- package/blocks/init/src/Blocks/components/image/manifest.json +0 -125
- package/blocks/init/src/Blocks/components/list/components/list-editor.js +0 -30
- package/blocks/init/src/Blocks/components/list/components/list-options.js +0 -62
- package/blocks/init/src/Blocks/components/list/list.php +0 -32
- package/blocks/init/src/Blocks/components/list/manifest.json +0 -127
- package/blocks/init/src/Blocks/components/load-more/assets/index.js +0 -19
- package/blocks/init/src/Blocks/components/load-more/assets/load-more.js +0 -146
- package/blocks/init/src/Blocks/components/load-more/components/load-more-editor.js +0 -14
- package/blocks/init/src/Blocks/components/load-more/components/load-more-options.js +0 -19
- package/blocks/init/src/Blocks/components/load-more/load-more.php +0 -47
- package/blocks/init/src/Blocks/components/load-more/manifest.json +0 -39
- package/blocks/init/src/Blocks/components/modal/assets/index.js +0 -27
- package/blocks/init/src/Blocks/components/modal/manifest.json +0 -48
- package/blocks/init/src/Blocks/components/modal/modal.php +0 -46
- package/blocks/init/src/Blocks/components/paragraph/components/paragraph-editor.js +0 -38
- package/blocks/init/src/Blocks/components/paragraph/components/paragraph-options.js +0 -48
- package/blocks/init/src/Blocks/components/paragraph/manifest.json +0 -81
- package/blocks/init/src/Blocks/components/paragraph/paragraph.php +0 -33
- package/blocks/init/src/Blocks/components/post-header/manifest.json +0 -5
- package/blocks/init/src/Blocks/components/post-header/post-header.php +0 -24
- package/blocks/init/src/Blocks/components/quote/components/quote-editor.js +0 -53
- package/blocks/init/src/Blocks/components/quote/components/quote-options.js +0 -29
- package/blocks/init/src/Blocks/components/quote/manifest.json +0 -47
- package/blocks/init/src/Blocks/components/quote/quote.php +0 -49
- package/blocks/init/src/Blocks/components/share/assets/index.js +0 -39
- package/blocks/init/src/Blocks/components/share/components/share-editor.js +0 -28
- package/blocks/init/src/Blocks/components/share/components/share-options.js +0 -112
- package/blocks/init/src/Blocks/components/share/manifest.json +0 -72
- package/blocks/init/src/Blocks/components/share/share.php +0 -69
- package/blocks/init/src/Blocks/components/tracking-before-body-end/manifest.json +0 -5
- package/blocks/init/src/Blocks/components/tracking-before-body-end/tracking-before-body-end.php +0 -9
- package/blocks/init/src/Blocks/components/tracking-head/manifest.json +0 -5
- package/blocks/init/src/Blocks/components/tracking-head/tracking-head.php +0 -9
- package/blocks/init/src/Blocks/components/video/components/video-editor.js +0 -74
- package/blocks/init/src/Blocks/components/video/components/video-options.js +0 -279
- package/blocks/init/src/Blocks/components/video/manifest.json +0 -120
- package/blocks/init/src/Blocks/components/video/video.php +0 -70
- package/blocks/init/src/Blocks/custom/accordion/accordion-block.js +0 -15
- package/blocks/init/src/Blocks/custom/accordion/accordion.php +0 -28
- package/blocks/init/src/Blocks/custom/accordion/assets/index.js +0 -37
- package/blocks/init/src/Blocks/custom/accordion/components/accordion-editor.js +0 -22
- package/blocks/init/src/Blocks/custom/accordion/components/accordion-options.js +0 -18
- package/blocks/init/src/Blocks/custom/accordion/manifest.json +0 -32
- package/blocks/init/src/Blocks/custom/accordion-item/accordion-item-block.js +0 -19
- package/blocks/init/src/Blocks/custom/accordion-item/accordion-item.php +0 -46
- package/blocks/init/src/Blocks/custom/accordion-item/components/accordion-item-editor.js +0 -60
- package/blocks/init/src/Blocks/custom/accordion-item/manifest.json +0 -69
- package/blocks/init/src/Blocks/custom/button/button-block.js +0 -13
- package/blocks/init/src/Blocks/custom/button/button.php +0 -11
- package/blocks/init/src/Blocks/custom/button/components/button-editor.js +0 -12
- package/blocks/init/src/Blocks/custom/button/components/button-options.js +0 -12
- package/blocks/init/src/Blocks/custom/button/manifest.json +0 -18
- package/blocks/init/src/Blocks/custom/card/card-block.js +0 -13
- package/blocks/init/src/Blocks/custom/card/card.php +0 -11
- package/blocks/init/src/Blocks/custom/card/components/card-editor.js +0 -12
- package/blocks/init/src/Blocks/custom/card/components/card-options.js +0 -15
- package/blocks/init/src/Blocks/custom/card/manifest.json +0 -18
- package/blocks/init/src/Blocks/custom/carousel/assets/index.js +0 -46
- package/blocks/init/src/Blocks/custom/carousel/assets/navigation.js +0 -31
- package/blocks/init/src/Blocks/custom/carousel/assets/pagination.js +0 -40
- package/blocks/init/src/Blocks/custom/carousel/carousel-block.js +0 -21
- package/blocks/init/src/Blocks/custom/carousel/carousel.php +0 -61
- package/blocks/init/src/Blocks/custom/carousel/components/carousel-editor.js +0 -25
- package/blocks/init/src/Blocks/custom/carousel/components/carousel-options.js +0 -47
- package/blocks/init/src/Blocks/custom/carousel/manifest.json +0 -130
- package/blocks/init/src/Blocks/custom/column/column-block.js +0 -21
- package/blocks/init/src/Blocks/custom/column/column-hooks.js +0 -32
- package/blocks/init/src/Blocks/custom/column/column.php +0 -21
- package/blocks/init/src/Blocks/custom/column/components/column-editor.js +0 -22
- package/blocks/init/src/Blocks/custom/column/components/column-options.js +0 -580
- package/blocks/init/src/Blocks/custom/column/manifest.json +0 -625
- package/blocks/init/src/Blocks/custom/columns/columns-block.js +0 -20
- package/blocks/init/src/Blocks/custom/columns/columns.php +0 -21
- package/blocks/init/src/Blocks/custom/columns/components/columns-editor.js +0 -81
- package/blocks/init/src/Blocks/custom/columns/components/columns-options.js +0 -104
- package/blocks/init/src/Blocks/custom/columns/manifest.json +0 -581
- package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-editor.js +0 -28
- package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-options.js +0 -248
- package/blocks/init/src/Blocks/custom/featured-content/featured-content-block.js +0 -13
- package/blocks/init/src/Blocks/custom/featured-content/featured-content.php +0 -139
- package/blocks/init/src/Blocks/custom/featured-content/manifest.json +0 -131
- package/blocks/init/src/Blocks/custom/featured-content/partials/cards.php +0 -39
- package/blocks/init/src/Blocks/custom/group/components/group-editor.js +0 -6
- package/blocks/init/src/Blocks/custom/group/group-block.js +0 -14
- package/blocks/init/src/Blocks/custom/group/group.php +0 -10
- package/blocks/init/src/Blocks/custom/group/manifest.json +0 -32
- package/blocks/init/src/Blocks/custom/heading/components/heading-editor.js +0 -15
- package/blocks/init/src/Blocks/custom/heading/components/heading-options.js +0 -38
- package/blocks/init/src/Blocks/custom/heading/heading-block.js +0 -13
- package/blocks/init/src/Blocks/custom/heading/heading-transforms.js +0 -26
- package/blocks/init/src/Blocks/custom/heading/heading.php +0 -15
- package/blocks/init/src/Blocks/custom/heading/manifest.json +0 -79
- package/blocks/init/src/Blocks/custom/hero/components/hero-editor.js +0 -12
- package/blocks/init/src/Blocks/custom/hero/components/hero-options.js +0 -14
- package/blocks/init/src/Blocks/custom/hero/hero-block.js +0 -13
- package/blocks/init/src/Blocks/custom/hero/hero.php +0 -11
- package/blocks/init/src/Blocks/custom/hero/manifest.json +0 -17
- package/blocks/init/src/Blocks/custom/image/components/image-editor.js +0 -12
- package/blocks/init/src/Blocks/custom/image/components/image-options.js +0 -14
- package/blocks/init/src/Blocks/custom/image/image-block.js +0 -13
- package/blocks/init/src/Blocks/custom/image/image.php +0 -11
- package/blocks/init/src/Blocks/custom/image/manifest.json +0 -33
- package/blocks/init/src/Blocks/custom/list/components/list-editor.js +0 -14
- package/blocks/init/src/Blocks/custom/list/components/list-options.js +0 -39
- package/blocks/init/src/Blocks/custom/list/list-block.js +0 -13
- package/blocks/init/src/Blocks/custom/list/list.php +0 -15
- package/blocks/init/src/Blocks/custom/list/manifest.json +0 -58
- package/blocks/init/src/Blocks/custom/map/assets/index.js +0 -20
- package/blocks/init/src/Blocks/custom/map/assets/map-controller.js +0 -41
- package/blocks/init/src/Blocks/custom/map/assets/utils.js +0 -161
- package/blocks/init/src/Blocks/custom/map/components/map-components.js +0 -403
- package/blocks/init/src/Blocks/custom/map/components/map-editor.js +0 -56
- package/blocks/init/src/Blocks/custom/map/components/map-options.js +0 -550
- package/blocks/init/src/Blocks/custom/map/manifest.json +0 -79
- package/blocks/init/src/Blocks/custom/map/map-block.js +0 -13
- package/blocks/init/src/Blocks/custom/map/map.php +0 -52
- package/blocks/init/src/Blocks/custom/map/styles.css +0 -2
- package/blocks/init/src/Blocks/custom/modal/components/modal-editor.js +0 -90
- package/blocks/init/src/Blocks/custom/modal/manifest.json +0 -51
- package/blocks/init/src/Blocks/custom/modal/modal-block.js +0 -14
- package/blocks/init/src/Blocks/custom/modal/modal.php +0 -20
- package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-editor.js +0 -17
- package/blocks/init/src/Blocks/custom/paragraph/components/paragraph-options.js +0 -38
- package/blocks/init/src/Blocks/custom/paragraph/manifest.json +0 -82
- package/blocks/init/src/Blocks/custom/paragraph/paragraph-block.js +0 -13
- package/blocks/init/src/Blocks/custom/paragraph/paragraph-transforms.js +0 -46
- package/blocks/init/src/Blocks/custom/paragraph/paragraph.php +0 -15
- package/blocks/init/src/Blocks/custom/quote/components/quote-editor.js +0 -12
- package/blocks/init/src/Blocks/custom/quote/components/quote-options.js +0 -14
- package/blocks/init/src/Blocks/custom/quote/manifest.json +0 -17
- package/blocks/init/src/Blocks/custom/quote/quote-block.js +0 -13
- package/blocks/init/src/Blocks/custom/quote/quote.php +0 -13
- package/blocks/init/src/Blocks/custom/share/components/share-editor.js +0 -6
- package/blocks/init/src/Blocks/custom/share/components/share-options.js +0 -12
- package/blocks/init/src/Blocks/custom/share/manifest.json +0 -19
- package/blocks/init/src/Blocks/custom/share/share-block.js +0 -13
- package/blocks/init/src/Blocks/custom/share/share.php +0 -11
- package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-editor.js +0 -57
- package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-options.js +0 -106
- package/blocks/init/src/Blocks/custom/site-footer/manifest.json +0 -73
- package/blocks/init/src/Blocks/custom/site-footer/site-footer-block.js +0 -13
- package/blocks/init/src/Blocks/custom/site-footer/site-footer.php +0 -74
- package/blocks/init/src/Blocks/custom/site-navigation/assets/index.js +0 -9
- package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-editor.js +0 -42
- package/blocks/init/src/Blocks/custom/site-navigation/components/site-navigation-options.js +0 -73
- package/blocks/init/src/Blocks/custom/site-navigation/manifest.json +0 -77
- package/blocks/init/src/Blocks/custom/site-navigation/site-navigation-block.js +0 -13
- package/blocks/init/src/Blocks/custom/site-navigation/site-navigation.php +0 -99
- package/blocks/init/src/Blocks/custom/table-of-contents/assets/index.js +0 -58
- package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-editor.js +0 -38
- package/blocks/init/src/Blocks/custom/table-of-contents/components/table-of-contents-options.js +0 -32
- package/blocks/init/src/Blocks/custom/table-of-contents/manifest.json +0 -48
- package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents-block.js +0 -13
- package/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents.php +0 -31
- package/blocks/init/src/Blocks/custom/video/components/video-editor.js +0 -6
- package/blocks/init/src/Blocks/custom/video/components/video-options.js +0 -12
- package/blocks/init/src/Blocks/custom/video/manifest.json +0 -29
- package/blocks/init/src/Blocks/custom/video/video-block.js +0 -13
- package/blocks/init/src/Blocks/custom/video/video.php +0 -22
- package/blocks/init/src/Blocks/manifest.json +0 -32
- package/blocks/init/src/Blocks/variations/card-simple/manifest.json +0 -17
- package/blocks/init/src/Blocks/wrapper/components/wrapper-editor.js +0 -12
- package/blocks/init/src/Blocks/wrapper/components/wrapper-options.js +0 -364
- package/blocks/init/src/Blocks/wrapper/manifest.json +0 -459
- package/blocks/init/src/Blocks/wrapper/styles-editor.css +0 -13
- package/blocks/init/src/Blocks/wrapper/styles.css +0 -19
- package/blocks/init/src/Blocks/wrapper/wrapper.js +0 -27
- package/blocks/init/src/Blocks/wrapper/wrapper.php +0 -34
- package/bun.lockb +0 -0
- package/readme/packages.md +0 -74
|
@@ -1,96 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { checkAttr, tailwindClasses } 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={tailwindClasses(attributes, manifest, additionalClass)}
|
|
21
|
-
/>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Icon 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
|
-
$iconUse = Helpers::checkAttr('iconUse', $attributes, $manifest);
|
|
14
|
-
|
|
15
|
-
if (!$iconUse) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
$additionalClass = $attributes['additionalClass'] ?? '';
|
|
20
|
-
|
|
21
|
-
$iconName = Helpers::checkAttr('iconName', $attributes, $manifest);
|
|
22
|
-
$iconAriaHidden = Helpers::checkAttr('iconAriaHidden', $attributes, $manifest);
|
|
23
|
-
|
|
24
|
-
if (!isset($manifest['icons'][$iconName])) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
$icon = $manifest['icons'][$iconName];
|
|
29
|
-
|
|
30
|
-
$className = Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass);
|
|
31
|
-
|
|
32
|
-
if (!empty($className)) {
|
|
33
|
-
$icon = str_replace('<svg ', '<svg class="' . esc_attr($className) . '" ', $icon);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if ($iconAriaHidden) {
|
|
37
|
-
$icon = str_replace('<svg ', '<svg aria-hidden="true" ', $icon);
|
|
38
|
-
} else {
|
|
39
|
-
$iconTitle = '';
|
|
40
|
-
$iconOption = array_filter($manifest['options']['iconName'], fn($option) => $option['value'] === $iconName);
|
|
41
|
-
|
|
42
|
-
if (!empty($iconOption)) {
|
|
43
|
-
$iconTitle = reset($iconOption)['label'];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (!empty($iconTitle)) {
|
|
47
|
-
$titleTag = '<title>' . esc_html($iconTitle) . '</title>';
|
|
48
|
-
$icon = str_replace('</svg>', $titleTag . '</svg>', $icon);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
|
|
53
|
-
echo $icon;
|