@eightshift/frontend-libs-tailwind 1.4.8 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/bun.lockb +0 -0
- package/package.json +28 -35
- package/scripts/components/block-inserter.js +1 -1
- package/scripts/components/file-picker.js +17 -3
- package/scripts/components/picker-placeholder.js +5 -7
- package/scripts/components/server-side-render.js +1 -1
- package/scripts/components/settings/settings.js +21 -20
- 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
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/* global esBlocksLocalization */
|
|
2
|
-
|
|
3
|
-
export class LoadMore {
|
|
4
|
-
constructor({ element }) {
|
|
5
|
-
this.element = element;
|
|
6
|
-
|
|
7
|
-
this.restUrl = esBlocksLocalization?.loadMoreRestUrl ?? '';
|
|
8
|
-
|
|
9
|
-
// Classes.
|
|
10
|
-
this.CLASS_IS_HIDDEN = 'hidden';
|
|
11
|
-
|
|
12
|
-
// Data attributes.
|
|
13
|
-
this.ATTR_PER_PAGE_OVERRIDE = 'data-load-more-per-page-override';
|
|
14
|
-
this.ATTR_INITIAL_ITEMS = 'data-load-more-initial-items';
|
|
15
|
-
this.ATTR_QUERY = 'data-load-more-query';
|
|
16
|
-
this.ATTR_TYPE = 'data-load-more-type';
|
|
17
|
-
this.ATTR_ID = 'data-load-more-id';
|
|
18
|
-
this.ATTR_PAGE = 'data-load-more-page';
|
|
19
|
-
|
|
20
|
-
// Query vars.
|
|
21
|
-
this.QUERY_VAR = 'current-page';
|
|
22
|
-
|
|
23
|
-
// Internal data.
|
|
24
|
-
this.page = this.element.getAttribute(this.ATTR_PAGE) ?? 1;
|
|
25
|
-
this.query = this.element.getAttribute(this.ATTR_QUERY);
|
|
26
|
-
this.loadFromQueryParam = false;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Init all event-listeners.
|
|
31
|
-
*/
|
|
32
|
-
init() {
|
|
33
|
-
const container = document.querySelector(`#${this.element.getAttribute(this.ATTR_ID)}`);
|
|
34
|
-
|
|
35
|
-
// this.updateCurrentPageFromQuery();
|
|
36
|
-
|
|
37
|
-
// Initialize params.
|
|
38
|
-
const initialItems = this.element.getAttribute(this.ATTR_INITIAL_ITEMS);
|
|
39
|
-
const type = this.element.getAttribute(this.ATTR_TYPE);
|
|
40
|
-
const perPageOverride = this.element.getAttribute(this.ATTR_PER_PAGE_OVERRIDE);
|
|
41
|
-
|
|
42
|
-
const params = {
|
|
43
|
-
initialItems: initialItems,
|
|
44
|
-
type: type,
|
|
45
|
-
perPageOverride: perPageOverride,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// Add listener on trigger click.
|
|
49
|
-
this.element.addEventListener('click', async () => {
|
|
50
|
-
this.element.disabled = true;
|
|
51
|
-
|
|
52
|
-
// Get data.
|
|
53
|
-
const received = await this.fetchData({
|
|
54
|
-
...params,
|
|
55
|
-
query: this.query,
|
|
56
|
-
currentPage: this.page,
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// Disable 'Load more' button if something went wrong.
|
|
60
|
-
if (!received || !received?.success) {
|
|
61
|
-
this.element.disabled = true;
|
|
62
|
-
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const { currentPage, query, maxPages, body } = received.data;
|
|
67
|
-
|
|
68
|
-
// Update local params.
|
|
69
|
-
this.query = query;
|
|
70
|
-
this.page = currentPage;
|
|
71
|
-
|
|
72
|
-
this.setCurrentPageQueryParam(currentPage);
|
|
73
|
-
|
|
74
|
-
// Add new items in a staggered manner.
|
|
75
|
-
body.split('<a').forEach((item, i) => {
|
|
76
|
-
setTimeout(() => {
|
|
77
|
-
container.insertAdjacentHTML('beforeend', `<a${item}`);
|
|
78
|
-
}, i * 150);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
// Hide button if at the end, otherwise re-enable it.
|
|
82
|
-
if (currentPage >= maxPages || maxPages === 0 || currentPage === 0) {
|
|
83
|
-
this.element.classList.add(this.CLASS_IS_HIDDEN);
|
|
84
|
-
} else {
|
|
85
|
-
this.element.disabled = false;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
fetchData = async (params) => {
|
|
91
|
-
// Construct URL.
|
|
92
|
-
const url = new URL(this.restUrl);
|
|
93
|
-
|
|
94
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
95
|
-
url.searchParams.append(key, value);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
if (this.loadFromQueryParam) {
|
|
99
|
-
this.loadFromQueryParam = false;
|
|
100
|
-
url.searchParams.set('urlLoadMoreAction', 'true');
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Fetch data.
|
|
104
|
-
const response = await fetch(url.toString(), {
|
|
105
|
-
method: 'GET',
|
|
106
|
-
mode: 'same-origin',
|
|
107
|
-
headers: {
|
|
108
|
-
Accept: 'application/json',
|
|
109
|
-
},
|
|
110
|
-
credentials: 'same-origin',
|
|
111
|
-
redirect: 'follow',
|
|
112
|
-
referrer: 'no-referrer',
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
if (!response.ok) {
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return await response.json();
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
updateCurrentPageFromQuery = () => {
|
|
123
|
-
const url = new URL(window.location);
|
|
124
|
-
|
|
125
|
-
const param = parseInt(url.searchParams.get(this.QUERY_VAR));
|
|
126
|
-
|
|
127
|
-
if (isNaN(param) || param < 1) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
this.page = param;
|
|
132
|
-
this.loadFromQueryParam = true;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
setCurrentPageQueryParam = (page) => {
|
|
136
|
-
if (!('URLSearchParams' in window)) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const url = new URL(window.location);
|
|
141
|
-
|
|
142
|
-
url.searchParams.set(this.QUERY_VAR, page ?? this.page);
|
|
143
|
-
|
|
144
|
-
history.replaceState(null, '', url);
|
|
145
|
-
};
|
|
146
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { props } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
2
|
-
import { ButtonEditor } from '../../../components/button/components/button-editor';
|
|
3
|
-
|
|
4
|
-
export const LoadMoreEditor = (attributes) => {
|
|
5
|
-
const { setAttributes } = attributes;
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
<ButtonEditor
|
|
9
|
-
{...props('button', attributes, {
|
|
10
|
-
setAttributes,
|
|
11
|
-
})}
|
|
12
|
-
/>
|
|
13
|
-
);
|
|
14
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { props, getOptions } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
2
|
-
import { ButtonOptions } from '../../../components/button/components/button-options';
|
|
3
|
-
import manifest from '../manifest.json';
|
|
4
|
-
|
|
5
|
-
export const LoadMoreOptions = (attributes) => {
|
|
6
|
-
const { setAttributes, label, noUseToggle, controlOnly } = attributes;
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<ButtonOptions
|
|
10
|
-
label={label ?? manifest.title}
|
|
11
|
-
{...props('button', attributes, {
|
|
12
|
-
setAttributes: setAttributes,
|
|
13
|
-
})}
|
|
14
|
-
hideOptions='link,uniqueId'
|
|
15
|
-
noUseToggle={noUseToggle}
|
|
16
|
-
controlOnly={controlOnly}
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 'Load more' button 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
|
-
$componentName = $attributes['componentName'] ?? $manifest['componentName'];
|
|
13
|
-
|
|
14
|
-
$loadMoreUse = Helpers::checkAttr('loadMoreUse', $attributes, $manifest, $componentName);
|
|
15
|
-
if (!$loadMoreUse) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
$componentJsClass = $manifest['componentJsClass'] ?? '';
|
|
20
|
-
$additionalClass = $attributes['additionalClass'] ?? '';
|
|
21
|
-
|
|
22
|
-
$loadMoreInitialItems = Helpers::checkAttr('loadMoreInitialItems', $attributes, $manifest, $componentName);
|
|
23
|
-
$loadMoreQuery = Helpers::checkAttr('loadMoreQuery', $attributes, $manifest, $componentName);
|
|
24
|
-
$loadMoreId = Helpers::checkAttr('loadMoreId', $attributes, $manifest, $componentName);
|
|
25
|
-
$loadMoreType = Helpers::checkAttr('loadMoreType', $attributes, $manifest, $componentName);
|
|
26
|
-
$loadMorePerPageOverride = Helpers::checkAttr('loadMorePerPageOverride', $attributes, $manifest, $componentName);
|
|
27
|
-
$loadMorePage = Helpers::checkAttr('loadMorePage', $attributes, $manifest, $componentName);
|
|
28
|
-
|
|
29
|
-
// Bailout if no query is provided.
|
|
30
|
-
if (!$loadMoreQuery) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
$baseAttrs = Helpers::props('button', $attributes, [
|
|
35
|
-
'additionalClass' => $componentJsClass . ' ' . $additionalClass,
|
|
36
|
-
]);
|
|
37
|
-
|
|
38
|
-
echo Helpers::render('button', array_merge($baseAttrs, [
|
|
39
|
-
'additionalAttributes' => [
|
|
40
|
-
'data-load-more-type' => $loadMoreType,
|
|
41
|
-
'data-load-more-id' => $loadMoreId,
|
|
42
|
-
'data-load-more-query' => $loadMoreQuery,
|
|
43
|
-
'data-load-more-initial-items' => $loadMoreInitialItems,
|
|
44
|
-
'data-load-more-per-page-override' => $loadMorePerPageOverride,
|
|
45
|
-
'data-load-more-page' => $loadMorePage,
|
|
46
|
-
],
|
|
47
|
-
]));
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
|
|
3
|
-
"componentName": "load-more",
|
|
4
|
-
"title": "Load more",
|
|
5
|
-
"componentClass": "load-more",
|
|
6
|
-
"componentJsClass": "js-load-more",
|
|
7
|
-
"attributes": {
|
|
8
|
-
"loadMoreQuery": {
|
|
9
|
-
"type": "string"
|
|
10
|
-
},
|
|
11
|
-
"loadMoreType": {
|
|
12
|
-
"type": "string"
|
|
13
|
-
},
|
|
14
|
-
"loadMoreId": {
|
|
15
|
-
"type": "string"
|
|
16
|
-
},
|
|
17
|
-
"loadMoreInitialItems": {
|
|
18
|
-
"type": "string"
|
|
19
|
-
},
|
|
20
|
-
"loadMorePerPageOverride": {
|
|
21
|
-
"type": "integer"
|
|
22
|
-
},
|
|
23
|
-
"loadMorePage": {
|
|
24
|
-
"type": "integer",
|
|
25
|
-
"default": 1
|
|
26
|
-
},
|
|
27
|
-
"loadMoreUse": {
|
|
28
|
-
"type": "boolean",
|
|
29
|
-
"default": true
|
|
30
|
-
},
|
|
31
|
-
"loadMoreButtonContent": {
|
|
32
|
-
"type": "string",
|
|
33
|
-
"default": "Load more"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"components": {
|
|
37
|
-
"button": "button"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import domReady from '@wordpress/dom-ready';
|
|
2
|
-
import MicroModal from 'micromodal';
|
|
3
|
-
import manifest from '../manifest.json';
|
|
4
|
-
|
|
5
|
-
domReady(() => {
|
|
6
|
-
const selector = `.${manifest.componentJsClass}`;
|
|
7
|
-
const elements = document.querySelectorAll(selector);
|
|
8
|
-
|
|
9
|
-
if (elements?.length < 1) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
elements.forEach((element) => {
|
|
14
|
-
document
|
|
15
|
-
.querySelectorAll(`[href=":open-modal-${element.id}:"],[data-micromodal-trigger="${element.id}"]`)
|
|
16
|
-
.forEach((trigger) => {
|
|
17
|
-
trigger.addEventListener('click', (event) => {
|
|
18
|
-
event.preventDefault();
|
|
19
|
-
|
|
20
|
-
MicroModal.show(element.id, {
|
|
21
|
-
disableScroll: true,
|
|
22
|
-
awaitCloseAnimation: true,
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
|
|
3
|
-
"componentName": "modal",
|
|
4
|
-
"title": "Modal",
|
|
5
|
-
"componentClass": "modal",
|
|
6
|
-
"componentJsClass": "js-modal",
|
|
7
|
-
"example": {
|
|
8
|
-
"attributes": {
|
|
9
|
-
"modalUse": true,
|
|
10
|
-
"modalExitButton": true,
|
|
11
|
-
"modalContent": "This is modal",
|
|
12
|
-
"modalId": "modal-id"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"attributes": {
|
|
16
|
-
"modalTitle": {
|
|
17
|
-
"type": "string"
|
|
18
|
-
},
|
|
19
|
-
"modalContent": {
|
|
20
|
-
"type": "string"
|
|
21
|
-
},
|
|
22
|
-
"modalId": {
|
|
23
|
-
"type": "string"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"nodeDependency": [
|
|
27
|
-
"micromodal"
|
|
28
|
-
],
|
|
29
|
-
"tailwind": {
|
|
30
|
-
"parts": {
|
|
31
|
-
"button": {
|
|
32
|
-
"twClasses": "size-9 flex items-center justify-center rounded-md border border-gray-500 hover:bg-gray-500 focus:outline-none focus-visible:ring focus-visible:ring-navy-500/30 text-gray-600 hover:text-white transition"
|
|
33
|
-
},
|
|
34
|
-
"modalWrapper": {
|
|
35
|
-
"twClasses": "hidden open:block group"
|
|
36
|
-
},
|
|
37
|
-
"modalBackdrop": {
|
|
38
|
-
"twClasses": "fixed inset-0 wp-admin-bar-offset bg-black/50 z-30 duration-300 group-aria-hidden:animate-out group-aria-hidden:fade-out animate-in fade-in-0 flex"
|
|
39
|
-
},
|
|
40
|
-
"modalContent": {
|
|
41
|
-
"twClasses": "flex flex-col bg-white rounded-t-lg sm:rounded-lg mx-auto mt-auto sm:my-auto min-h-[40vh] w-[90vw] sm:w-full sm:max-w-[50vw] max-h-[80vh] p-6 sm:p-4 sm:pl-6 space-y-3 sm:ml-auto shadow-md animate-in slide-in-from-top-4 group-aria-hidden:animate-out group-aria-hidden:slide-out-to-top-4"
|
|
42
|
-
},
|
|
43
|
-
"modalHeader": {
|
|
44
|
-
"twClasses": "flex items-center justify-between gap-4"
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Modal 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
|
-
$componentJsClass = $manifest['componentJsClass'] ?? '';
|
|
14
|
-
$additionalClass = $attributes['additionalClass'] ?? '';
|
|
15
|
-
|
|
16
|
-
$modalId = Helpers::checkAttr('modalId', $attributes, $manifest);
|
|
17
|
-
$modalTitle = Helpers::checkAttr('modalTitle', $attributes, $manifest);
|
|
18
|
-
$modalContent = Helpers::checkAttr('modalContent', $attributes, $manifest);
|
|
19
|
-
?>
|
|
20
|
-
|
|
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
|
-
<?php if (!empty($modalTitle)) { ?>
|
|
26
|
-
<p id="<?php echo esc_attr($modalId); ?>-title">
|
|
27
|
-
<?php echo esc_html($modalTitle); ?>
|
|
28
|
-
</p>
|
|
29
|
-
<?php } ?>
|
|
30
|
-
|
|
31
|
-
<button class="<?php echo esc_attr(Helpers::tailwindClasses('button', $attributes, $manifest, 'ml-auto')); ?>" aria-label="Close menu" data-micromodal-close>
|
|
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
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12" />
|
|
34
|
-
</svg>
|
|
35
|
-
</button>
|
|
36
|
-
</header>
|
|
37
|
-
|
|
38
|
-
<div id="<?php echo esc_attr($modalId); ?>-content" class="grow">
|
|
39
|
-
<?php
|
|
40
|
-
// phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
|
|
41
|
-
echo $modalContent;
|
|
42
|
-
?>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { __ } from '@wordpress/i18n';
|
|
2
|
-
import { RichText } from '@wordpress/block-editor';
|
|
3
|
-
import { checkAttr, getAttrKey, tailwindClasses } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
4
|
-
import manifest from './../manifest.json';
|
|
5
|
-
|
|
6
|
-
export const ParagraphEditor = (attributes) => {
|
|
7
|
-
const {
|
|
8
|
-
setAttributes,
|
|
9
|
-
placeholder = __('Add content', '%g_textdomain%'),
|
|
10
|
-
additionalClass,
|
|
11
|
-
|
|
12
|
-
mergeBlocks,
|
|
13
|
-
onReplace,
|
|
14
|
-
onRemove,
|
|
15
|
-
} = attributes;
|
|
16
|
-
|
|
17
|
-
const paragraphUse = checkAttr('paragraphUse', attributes, manifest);
|
|
18
|
-
const paragraphContent = checkAttr('paragraphContent', attributes, manifest);
|
|
19
|
-
|
|
20
|
-
if (!paragraphUse) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<RichText
|
|
26
|
-
identifier={getAttrKey('paragraphContent', attributes, manifest)}
|
|
27
|
-
className={tailwindClasses(attributes, manifest, additionalClass)}
|
|
28
|
-
placeholder={placeholder}
|
|
29
|
-
value={paragraphContent}
|
|
30
|
-
onChange={(value) => setAttributes({ [getAttrKey('paragraphContent', attributes, manifest)]: value })}
|
|
31
|
-
allowedFormats={['core/bold', 'core/link', 'core/italic']}
|
|
32
|
-
onMerge={mergeBlocks}
|
|
33
|
-
onReplace={onReplace}
|
|
34
|
-
onRemove={onRemove}
|
|
35
|
-
deleteEnter
|
|
36
|
-
/>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { __ } from '@wordpress/i18n';
|
|
2
|
-
import { checkAttr, getAttrKey, getHiddenOptions, getOption } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
3
|
-
import { ComponentToggle, HStack, OptionSelect, ToggleButton } from '@eightshift/ui-components';
|
|
4
|
-
import { icons } from '@eightshift/ui-components/icons';
|
|
5
|
-
import manifest from './../manifest.json';
|
|
6
|
-
|
|
7
|
-
export const ParagraphOptions = (attributes) => {
|
|
8
|
-
const { setAttributes, hideOptions, additionalControls, ...rest } = attributes;
|
|
9
|
-
|
|
10
|
-
const hiddenOptions = getHiddenOptions(hideOptions);
|
|
11
|
-
|
|
12
|
-
const paragraphUse = checkAttr('paragraphUse', attributes, manifest);
|
|
13
|
-
const paragraphSize = checkAttr('paragraphSize', attributes, manifest);
|
|
14
|
-
const paragraphFontWeight = checkAttr('paragraphFontWeight', attributes, manifest);
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<ComponentToggle
|
|
18
|
-
label={manifest.title}
|
|
19
|
-
icon={icons.paragraph}
|
|
20
|
-
onChange={(value) => setAttributes({ [getAttrKey('paragraphUse', attributes, manifest)]: value })}
|
|
21
|
-
useComponent={paragraphUse}
|
|
22
|
-
{...rest}
|
|
23
|
-
>
|
|
24
|
-
<HStack>
|
|
25
|
-
<OptionSelect
|
|
26
|
-
aria-label={__('Font size', '%g_textdomain%')}
|
|
27
|
-
options={getOption('paragraphSize', attributes, manifest)}
|
|
28
|
-
onChange={(value) => setAttributes({ [getAttrKey('paragraphSize', attributes, manifest)]: value })}
|
|
29
|
-
value={paragraphSize}
|
|
30
|
-
type='menu'
|
|
31
|
-
hidden={hiddenOptions.size}
|
|
32
|
-
/>
|
|
33
|
-
|
|
34
|
-
<ToggleButton
|
|
35
|
-
selected={paragraphFontWeight === '700'}
|
|
36
|
-
icon={icons.bold}
|
|
37
|
-
onChange={(value) =>
|
|
38
|
-
setAttributes({ [getAttrKey('paragraphFontWeight', attributes, manifest)]: value ? '700' : '400' })
|
|
39
|
-
}
|
|
40
|
-
tooltip={__('Bold', '%g_textdomain%')}
|
|
41
|
-
hidden={hiddenOptions.weight}
|
|
42
|
-
/>
|
|
43
|
-
|
|
44
|
-
{additionalControls}
|
|
45
|
-
</HStack>
|
|
46
|
-
</ComponentToggle>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
|
|
3
|
-
"componentName": "paragraph",
|
|
4
|
-
"title": "Paragraph",
|
|
5
|
-
"componentClass": "paragraph",
|
|
6
|
-
"example": {
|
|
7
|
-
"attributes": {
|
|
8
|
-
"paragraphContent": "This is paragraph",
|
|
9
|
-
"paragraphSize": "base",
|
|
10
|
-
"paragraphFontWeight": "400",
|
|
11
|
-
"paragraphUse": true
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"attributes": {
|
|
15
|
-
"paragraphContent": {
|
|
16
|
-
"type": "string"
|
|
17
|
-
},
|
|
18
|
-
"paragraphSize": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
"default": "base"
|
|
21
|
-
},
|
|
22
|
-
"paragraphFontWeight": {
|
|
23
|
-
"type": "string",
|
|
24
|
-
"default": "400"
|
|
25
|
-
},
|
|
26
|
-
"paragraphUse": {
|
|
27
|
-
"type": "boolean",
|
|
28
|
-
"default": true
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"options": {
|
|
32
|
-
"paragraphSize": [
|
|
33
|
-
{
|
|
34
|
-
"label": "24",
|
|
35
|
-
"value": "lg"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"label": "20",
|
|
39
|
-
"value": "md"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"label": "16",
|
|
43
|
-
"value": "base"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"label": "14",
|
|
47
|
-
"value": "sm"
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
"paragraphFontWeight": [
|
|
51
|
-
{
|
|
52
|
-
"label": "Normal",
|
|
53
|
-
"value": "400"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"label": "Bold",
|
|
57
|
-
"value": "700"
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
},
|
|
61
|
-
"tailwind": {
|
|
62
|
-
"base": {
|
|
63
|
-
"twClasses": "font-sans [&>a]:underline font-synthesis-none"
|
|
64
|
-
},
|
|
65
|
-
"options": {
|
|
66
|
-
"paragraphSize": {
|
|
67
|
-
"twClasses": {
|
|
68
|
-
"sm": "text-sm",
|
|
69
|
-
"base": "~sm/md:~text-sm/base",
|
|
70
|
-
"md": "~sm/md:~text-lg/2xl",
|
|
71
|
-
"lg": "~sm/md:~text-xl/3xl"
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
"paragraphFontWeight": {
|
|
75
|
-
"twClasses": {
|
|
76
|
-
"700": "font-bold"
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Paragraph 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
|
-
$paragraphUse = Helpers::checkAttr('paragraphUse', $attributes, $manifest);
|
|
14
|
-
|
|
15
|
-
if (!$paragraphUse) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
$additionalClass = $attributes['additionalClass'] ?? '';
|
|
20
|
-
|
|
21
|
-
$paragraphContent = Helpers::checkAttr('paragraphContent', $attributes, $manifest);
|
|
22
|
-
|
|
23
|
-
if (!$paragraphContent) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
?>
|
|
27
|
-
|
|
28
|
-
<p class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass)); ?>">
|
|
29
|
-
<?php
|
|
30
|
-
// phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
|
|
31
|
-
echo $paragraphContent;
|
|
32
|
-
?>
|
|
33
|
-
</p>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Post header 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
|
-
$featuredImage = get_the_post_thumbnail_url(get_the_ID(), 'full') ?? '';
|
|
14
|
-
?>
|
|
15
|
-
|
|
16
|
-
<div class="isolate bg-gray-200 !col-span-full min-h-80 grid grid-cols-[auto_1fr_auto] md:grid-cols-subgrid grid-rows-1 mb-10">
|
|
17
|
-
<?php if (!empty($featuredImage)) { ?>
|
|
18
|
-
<img class="w-full h-80 col-span-full -z-10 object-cover row-start-1" src="<?php echo esc_attr($featuredImage); ?>" alt="" role="presentation">
|
|
19
|
-
<?php } ?>
|
|
20
|
-
<div class="~sm/md:~mx-4/12 ~sm/md:~px-4/8 ~sm/md:~py-4/6 col-start-2 row-start-1 bg-black/75 text-white border border-b-0 border-black/25 backdrop-blur-2xl backdrop-brightness-110 backdrop-saturate-150 self-end">
|
|
21
|
-
<h1 class="font-display text-balance font-synthesis-none ~text-5xl/6xl !leading-none font-soft-25 italic"><?php echo esc_html(get_the_title()); ?></h1>
|
|
22
|
-
<span class="opacity-75 text-sm"><?php echo esc_html(get_the_date()); ?></span>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { __ } from '@wordpress/i18n';
|
|
2
|
-
import { RichText } from '@wordpress/block-editor';
|
|
3
|
-
import { checkAttr, tailwindClasses, getAttrKey } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
4
|
-
import { AnimatedVisibility } from '@eightshift/ui-components';
|
|
5
|
-
import { JsxSvg } from '@eightshift/ui-components/icons';
|
|
6
|
-
import manifest from './../manifest.json';
|
|
7
|
-
|
|
8
|
-
export const QuoteEditor = (attributes) => {
|
|
9
|
-
const { additionalClass, setAttributes } = attributes;
|
|
10
|
-
|
|
11
|
-
const quoteUse = checkAttr('quoteUse', attributes, manifest);
|
|
12
|
-
|
|
13
|
-
if (!quoteUse) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const quoteShowIcon = checkAttr('quoteShowIcon', attributes, manifest);
|
|
18
|
-
const quoteText = checkAttr('quoteText', attributes, manifest);
|
|
19
|
-
const quoteAuthor = checkAttr('quoteAuthor', attributes, manifest);
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<figure className={tailwindClasses('container', attributes, manifest, additionalClass)}>
|
|
23
|
-
<AnimatedVisibility
|
|
24
|
-
visible={quoteShowIcon}
|
|
25
|
-
noInitial
|
|
26
|
-
>
|
|
27
|
-
<JsxSvg
|
|
28
|
-
className={tailwindClasses('icon', attributes, manifest)}
|
|
29
|
-
svg={manifest.resources.quoteIcon}
|
|
30
|
-
/>
|
|
31
|
-
</AnimatedVisibility>
|
|
32
|
-
|
|
33
|
-
<RichText
|
|
34
|
-
tagName='blockquote'
|
|
35
|
-
className={tailwindClasses('quote-text', attributes, manifest)}
|
|
36
|
-
placeholder={__('Quote text', '%g_textdomain%')}
|
|
37
|
-
value={quoteText}
|
|
38
|
-
onChange={(value) => setAttributes({ [getAttrKey('quoteText', attributes, manifest)]: value })}
|
|
39
|
-
allowedFormats={[]}
|
|
40
|
-
/>
|
|
41
|
-
|
|
42
|
-
<figcaption className={tailwindClasses('author', attributes, manifest)}>
|
|
43
|
-
—
|
|
44
|
-
<RichText
|
|
45
|
-
placeholder={__('Quote author', '%g_textdomain%')}
|
|
46
|
-
value={quoteAuthor}
|
|
47
|
-
onChange={(value) => setAttributes({ [getAttrKey('quoteAuthor', attributes, manifest)]: value })}
|
|
48
|
-
allowedFormats={[]}
|
|
49
|
-
/>
|
|
50
|
-
</figcaption>
|
|
51
|
-
</figure>
|
|
52
|
-
);
|
|
53
|
-
};
|