@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,279 +0,0 @@
|
|
|
1
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
2
|
-
import {
|
|
3
|
-
getOption,
|
|
4
|
-
checkAttr,
|
|
5
|
-
getAttrKey,
|
|
6
|
-
FileSelector,
|
|
7
|
-
getHiddenOptions,
|
|
8
|
-
MediaPicker,
|
|
9
|
-
} from '@eightshift/frontend-libs-tailwind/scripts';
|
|
10
|
-
import {
|
|
11
|
-
AnimatedVisibility,
|
|
12
|
-
BaseControl,
|
|
13
|
-
Expandable,
|
|
14
|
-
InputField,
|
|
15
|
-
Notice,
|
|
16
|
-
OptionSelect,
|
|
17
|
-
Repeater,
|
|
18
|
-
RepeaterItem,
|
|
19
|
-
Spacer,
|
|
20
|
-
Toggle,
|
|
21
|
-
} from '@eightshift/ui-components';
|
|
22
|
-
import { icons } from '@eightshift/ui-components/icons';
|
|
23
|
-
import manifest from '../manifest.json';
|
|
24
|
-
|
|
25
|
-
export const VideoOptions = (attributes) => {
|
|
26
|
-
const { setAttributes, hideOptions } = attributes;
|
|
27
|
-
|
|
28
|
-
const hiddenOptions = getHiddenOptions(hideOptions);
|
|
29
|
-
|
|
30
|
-
const videoUrl = checkAttr('videoUrl', attributes, manifest, true);
|
|
31
|
-
const videoId = checkAttr('videoId', attributes, manifest, true);
|
|
32
|
-
const videoPosterId = checkAttr('videoPosterId', attributes, manifest);
|
|
33
|
-
const videoPosterUrl = checkAttr('videoPosterUrl', attributes, manifest);
|
|
34
|
-
const videoLoop = checkAttr('videoLoop', attributes, manifest);
|
|
35
|
-
const videoAutoplay = checkAttr('videoAutoplay', attributes, manifest);
|
|
36
|
-
const videoControls = checkAttr('videoControls', attributes, manifest);
|
|
37
|
-
const videoMuted = checkAttr('videoMuted', attributes, manifest);
|
|
38
|
-
const videoPreload = checkAttr('videoPreload', attributes, manifest);
|
|
39
|
-
const videoSubtitleTracks = checkAttr('videoSubtitleTracks', attributes, manifest);
|
|
40
|
-
|
|
41
|
-
const getTrackIcon = (kind) => {
|
|
42
|
-
switch (kind) {
|
|
43
|
-
case 'subtitles':
|
|
44
|
-
return icons.videoSubtitle;
|
|
45
|
-
case 'captions':
|
|
46
|
-
return icons.closedCaptions;
|
|
47
|
-
case 'descriptions':
|
|
48
|
-
return icons.hide;
|
|
49
|
-
case 'chapters':
|
|
50
|
-
return icons.videoChapters;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return icons.emptyRect;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<>
|
|
58
|
-
<AnimatedVisibility
|
|
59
|
-
visible={videoPosterId && !videoControls}
|
|
60
|
-
noInitial
|
|
61
|
-
>
|
|
62
|
-
<Notice
|
|
63
|
-
type='warning'
|
|
64
|
-
label={__('Playback controls disabled', '%g_textdomain%')}
|
|
65
|
-
subtitle={__('Poster image might prevent users from playing the video', '%g_textdomain%')}
|
|
66
|
-
/>
|
|
67
|
-
</AnimatedVisibility>
|
|
68
|
-
|
|
69
|
-
<FileSelector
|
|
70
|
-
onChange={({ id, url, mime, mime_type }) =>
|
|
71
|
-
setAttributes({
|
|
72
|
-
[getAttrKey('videoId', attributes, manifest)]: id,
|
|
73
|
-
[getAttrKey('videoUrl', attributes, manifest)]: url,
|
|
74
|
-
[getAttrKey('videoMimeType', attributes, manifest)]: typeof mime === 'undefined' ? mime_type : mime,
|
|
75
|
-
})
|
|
76
|
-
}
|
|
77
|
-
fileId={videoId}
|
|
78
|
-
fileName={videoUrl?.slice(videoUrl?.lastIndexOf('/') + 1)}
|
|
79
|
-
allowedTypes={manifest.allowedTypes}
|
|
80
|
-
kind='video'
|
|
81
|
-
/>
|
|
82
|
-
|
|
83
|
-
<Spacer />
|
|
84
|
-
|
|
85
|
-
<Spacer
|
|
86
|
-
icon={icons.playbackOptions}
|
|
87
|
-
text={__('Playback', '%g_textdomain%')}
|
|
88
|
-
border
|
|
89
|
-
/>
|
|
90
|
-
|
|
91
|
-
<Toggle
|
|
92
|
-
icon={icons.videoControls}
|
|
93
|
-
label={__('Video controls', '%g_textdomain%')}
|
|
94
|
-
checked={videoControls}
|
|
95
|
-
onChange={(value) => setAttributes({ [getAttrKey('videoControls', attributes, manifest)]: value })}
|
|
96
|
-
hidden={hiddenOptions?.playbackControls}
|
|
97
|
-
/>
|
|
98
|
-
|
|
99
|
-
<Toggle
|
|
100
|
-
icon={icons.loopMode}
|
|
101
|
-
label={__('Loop', '%g_textdomain%')}
|
|
102
|
-
checked={videoLoop}
|
|
103
|
-
onChange={(value) => setAttributes({ [getAttrKey('videoLoop', attributes, manifest)]: value })}
|
|
104
|
-
hidden={hiddenOptions?.loop}
|
|
105
|
-
/>
|
|
106
|
-
|
|
107
|
-
<Toggle
|
|
108
|
-
icon={icons.autoplayAlt}
|
|
109
|
-
label={__('Autoplay', '%g_textdomain%')}
|
|
110
|
-
checked={videoAutoplay}
|
|
111
|
-
onChange={(value) => setAttributes({ [getAttrKey('videoAutoplay', attributes, manifest)]: value })}
|
|
112
|
-
hidden={hiddenOptions?.autoplay}
|
|
113
|
-
/>
|
|
114
|
-
|
|
115
|
-
<Toggle
|
|
116
|
-
icon={icons.muteCentered}
|
|
117
|
-
label={__('Mute', '%g_textdomain%')}
|
|
118
|
-
checked={videoMuted}
|
|
119
|
-
onChange={(value) => setAttributes({ [getAttrKey('videoMuted', attributes, manifest)]: value })}
|
|
120
|
-
hidden={hiddenOptions?.mute}
|
|
121
|
-
/>
|
|
122
|
-
|
|
123
|
-
<AnimatedVisibility
|
|
124
|
-
visible={videoAutoplay && !videoMuted && !videoControls}
|
|
125
|
-
noInitial
|
|
126
|
-
>
|
|
127
|
-
<Notice
|
|
128
|
-
type='warning'
|
|
129
|
-
label={__('Video plays automatically, with sound, and without controls', '%g_textdomain%')}
|
|
130
|
-
subtitle={__(
|
|
131
|
-
'This will bother most users and is an accessibility issue. Consider changing some of the options.',
|
|
132
|
-
'%g_textdomain%',
|
|
133
|
-
)}
|
|
134
|
-
icon={icons.a11yWarning}
|
|
135
|
-
alignIconToTitle
|
|
136
|
-
/>
|
|
137
|
-
</AnimatedVisibility>
|
|
138
|
-
|
|
139
|
-
<Spacer />
|
|
140
|
-
|
|
141
|
-
<Spacer
|
|
142
|
-
icon={icons.a11y}
|
|
143
|
-
text={__('Accessibility', '%g_textdomain%')}
|
|
144
|
-
border
|
|
145
|
-
/>
|
|
146
|
-
|
|
147
|
-
<Repeater
|
|
148
|
-
icon={icons.videoSubtitleAlt}
|
|
149
|
-
label={__('Captions', '%g_textdomain%')}
|
|
150
|
-
items={videoSubtitleTracks}
|
|
151
|
-
onChange={(value) => setAttributes({ [getAttrKey('videoSubtitleTracks', attributes, manifest)]: value })}
|
|
152
|
-
>
|
|
153
|
-
{(item) => {
|
|
154
|
-
const { trackId, trackFileName, kind, srclang, label, updateData, itemIndex: index } = item;
|
|
155
|
-
|
|
156
|
-
return (
|
|
157
|
-
<RepeaterItem
|
|
158
|
-
icon={getTrackIcon(kind)}
|
|
159
|
-
label={label ? sprintf(__('Track %d', '%g_textdomain%'), index + 1) : __('New track', '%g_textdomain%')}
|
|
160
|
-
subtitle={label}
|
|
161
|
-
>
|
|
162
|
-
<FileSelector
|
|
163
|
-
onChange={({ id, url }) =>
|
|
164
|
-
updateData({
|
|
165
|
-
trackId: id,
|
|
166
|
-
trackFileName: url,
|
|
167
|
-
})
|
|
168
|
-
}
|
|
169
|
-
fileId={trackId}
|
|
170
|
-
fileName={trackFileName?.slice(trackFileName?.lastIndexOf('/') + 1)}
|
|
171
|
-
allowedTypes={['text/vtt']}
|
|
172
|
-
kind='subtitle'
|
|
173
|
-
>
|
|
174
|
-
{__('Upload a VTT file containing captions, subtitles, descriptions or chapters', '%g_textdomain%')}
|
|
175
|
-
</FileSelector>
|
|
176
|
-
|
|
177
|
-
<Spacer />
|
|
178
|
-
|
|
179
|
-
<OptionSelect
|
|
180
|
-
icon={icons.optionListAlt}
|
|
181
|
-
label={__('Type', '%g_textdomain%')}
|
|
182
|
-
value={kind}
|
|
183
|
-
options={getOption('videoSubtitleTrackKind', attributes, manifest)}
|
|
184
|
-
onChange={(value) => updateData({ kind: value })}
|
|
185
|
-
vertical
|
|
186
|
-
/>
|
|
187
|
-
|
|
188
|
-
<Spacer />
|
|
189
|
-
|
|
190
|
-
<InputField
|
|
191
|
-
icon={icons.titleGeneric}
|
|
192
|
-
label={__('Label', '%g_textdomain%')}
|
|
193
|
-
help={__('Shows in the list of available tracks', '%g_textdomain%')}
|
|
194
|
-
value={label}
|
|
195
|
-
onChange={(value) => updateData({ label: value })}
|
|
196
|
-
/>
|
|
197
|
-
|
|
198
|
-
<InputField
|
|
199
|
-
icon={icons.flag}
|
|
200
|
-
label={__('Language code', '%g_textdomain%')}
|
|
201
|
-
help={
|
|
202
|
-
<>
|
|
203
|
-
{__('Should follow IETF (BCP47).', '%g_textdomain%')}
|
|
204
|
-
{kind === 'subtitles' && ' ' + __('Required.', '%g_textdomain%')}
|
|
205
|
-
</>
|
|
206
|
-
}
|
|
207
|
-
value={srclang}
|
|
208
|
-
onChange={(value) => updateData({ srclang: value })}
|
|
209
|
-
/>
|
|
210
|
-
|
|
211
|
-
<Spacer />
|
|
212
|
-
|
|
213
|
-
<div className='es-uic-space-y-1'>
|
|
214
|
-
<Spacer text={__('List of language tags', '%g_textdomain%')} />
|
|
215
|
-
|
|
216
|
-
<a
|
|
217
|
-
href='https://en.wikipedia.org/wiki/IETF_language_tag#List_of_major_primary_language_subtags'
|
|
218
|
-
target='_blank'
|
|
219
|
-
rel='external'
|
|
220
|
-
className='es-uic-flex es-uic-items-center es-uic-gap-1.5 es-uic-text-sm [&>svg]:es-uic-size-4 [&>svg]:es-uic-stroke-[1.5]'
|
|
221
|
-
>
|
|
222
|
-
{__('Common languages', '%g_textdomain%')}
|
|
223
|
-
{icons.externalLink}
|
|
224
|
-
</a>
|
|
225
|
-
|
|
226
|
-
<a
|
|
227
|
-
href='https://r12a.github.io/app-subtags/'
|
|
228
|
-
target='_blank'
|
|
229
|
-
rel='external'
|
|
230
|
-
className='es-uic-flex es-uic-items-center es-uic-gap-1.5 es-uic-text-sm [&>svg]:es-uic-size-4 [&>svg]:es-uic-stroke-[1.5]'
|
|
231
|
-
>
|
|
232
|
-
{__('All languages', '%g_textdomain%')}
|
|
233
|
-
{icons.externalLink}
|
|
234
|
-
</a>
|
|
235
|
-
</div>
|
|
236
|
-
</RepeaterItem>
|
|
237
|
-
);
|
|
238
|
-
}}
|
|
239
|
-
</Repeater>
|
|
240
|
-
|
|
241
|
-
<Spacer />
|
|
242
|
-
|
|
243
|
-
<Expandable
|
|
244
|
-
icon={icons.moreHCircle}
|
|
245
|
-
label={__('Advanced', '%g_textdomain%')}
|
|
246
|
-
>
|
|
247
|
-
<BaseControl
|
|
248
|
-
icon={icons.videoPosterImage}
|
|
249
|
-
label={__('Poster image', '%g_textdomain%')}
|
|
250
|
-
subtitle={__('Visible before the video is played', '%g_textdomain%')}
|
|
251
|
-
hidden={hiddenOptions?.posterImage}
|
|
252
|
-
>
|
|
253
|
-
<MediaPicker
|
|
254
|
-
onChange={({ id, url }) =>
|
|
255
|
-
setAttributes({
|
|
256
|
-
[getAttrKey('videoPosterId', attributes, manifest)]: id,
|
|
257
|
-
[getAttrKey('videoPosterUrl', attributes, manifest)]: url,
|
|
258
|
-
})
|
|
259
|
-
}
|
|
260
|
-
imageId={videoPosterId}
|
|
261
|
-
imageUrl={videoPosterUrl}
|
|
262
|
-
/>
|
|
263
|
-
</BaseControl>
|
|
264
|
-
|
|
265
|
-
<Spacer />
|
|
266
|
-
|
|
267
|
-
<OptionSelect
|
|
268
|
-
icon={icons.preload}
|
|
269
|
-
label={__('Preload', '%g_textdomain%')}
|
|
270
|
-
value={videoPreload}
|
|
271
|
-
options={getOption('videoPreload', attributes, manifest)}
|
|
272
|
-
alignment='vertical'
|
|
273
|
-
onChange={(value) => setAttributes({ [getAttrKey('videoPreload', attributes, manifest)]: value })}
|
|
274
|
-
hidden={hiddenOptions?.preload}
|
|
275
|
-
/>
|
|
276
|
-
</Expandable>
|
|
277
|
-
</>
|
|
278
|
-
);
|
|
279
|
-
};
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/component.json",
|
|
3
|
-
"componentName": "video",
|
|
4
|
-
"title": "Video",
|
|
5
|
-
"componentClass": "video",
|
|
6
|
-
"example": {
|
|
7
|
-
"attributes": {
|
|
8
|
-
"videoUrl": [
|
|
9
|
-
{
|
|
10
|
-
"url": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4",
|
|
11
|
-
"mime": "video/mp4"
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
"videoPoster": "https://loremflickr.com/300/200",
|
|
15
|
-
"videoAccept": ".mp4,.webm",
|
|
16
|
-
"videoAllowedTypes": [
|
|
17
|
-
"video/mp4",
|
|
18
|
-
"video/webm"
|
|
19
|
-
],
|
|
20
|
-
"videoUse": true
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"attributes": {
|
|
24
|
-
"videoUrl": {
|
|
25
|
-
"type": "string"
|
|
26
|
-
},
|
|
27
|
-
"videoId": {
|
|
28
|
-
"type": "string"
|
|
29
|
-
},
|
|
30
|
-
"videoMimeType": {
|
|
31
|
-
"type": "string"
|
|
32
|
-
},
|
|
33
|
-
"videoLoop": {
|
|
34
|
-
"type": "boolean",
|
|
35
|
-
"default": true
|
|
36
|
-
},
|
|
37
|
-
"videoAutoplay": {
|
|
38
|
-
"type": "boolean",
|
|
39
|
-
"default": true
|
|
40
|
-
},
|
|
41
|
-
"videoControls": {
|
|
42
|
-
"type": "boolean",
|
|
43
|
-
"default": false
|
|
44
|
-
},
|
|
45
|
-
"videoMuted": {
|
|
46
|
-
"type": "boolean",
|
|
47
|
-
"default": true
|
|
48
|
-
},
|
|
49
|
-
"videoPreload": {
|
|
50
|
-
"type": "string",
|
|
51
|
-
"default": "metadata"
|
|
52
|
-
},
|
|
53
|
-
"videoPosterId": {
|
|
54
|
-
"type": "number"
|
|
55
|
-
},
|
|
56
|
-
"videoPosterUrl": {
|
|
57
|
-
"type": "string"
|
|
58
|
-
},
|
|
59
|
-
"videoUse": {
|
|
60
|
-
"type": "boolean",
|
|
61
|
-
"default": true
|
|
62
|
-
},
|
|
63
|
-
"videoSubtitleTracks": {
|
|
64
|
-
"type": "array",
|
|
65
|
-
"items": {
|
|
66
|
-
"type": "object"
|
|
67
|
-
},
|
|
68
|
-
"default": []
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
"options": {
|
|
72
|
-
"videoPreload": [
|
|
73
|
-
{
|
|
74
|
-
"label": "Video & metadata",
|
|
75
|
-
"value": "auto"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"label": "Metadata",
|
|
79
|
-
"value": "metadata"
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"label": "Nothing",
|
|
83
|
-
"value": "none"
|
|
84
|
-
}
|
|
85
|
-
],
|
|
86
|
-
"videoSubtitleTrackKind": [
|
|
87
|
-
{
|
|
88
|
-
"label": "Subtitles",
|
|
89
|
-
"value": "subtitles",
|
|
90
|
-
"icon": "videoSubtitle"
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"label": "Captions",
|
|
94
|
-
"value": "captions",
|
|
95
|
-
"icon": "closedCaptions"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"label": "Descriptions",
|
|
99
|
-
"value": "descriptions",
|
|
100
|
-
"icon": "hide"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
"label": "Chapters",
|
|
104
|
-
"value": "chapters",
|
|
105
|
-
"icon": "videoChapters"
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
},
|
|
109
|
-
"tailwind":{
|
|
110
|
-
"parts": {
|
|
111
|
-
"video": {
|
|
112
|
-
"twClasses": "aspect-video w-full rounded-xl border border-gray-800 bg-gradient-to-br from-gray-800 to-black shadow-md"
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
"allowedTypes": [
|
|
117
|
-
"video/mp4",
|
|
118
|
-
"video/webm"
|
|
119
|
-
]
|
|
120
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Video 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
|
-
$videoUse = Helpers::checkAttr('videoUse', $attributes, $manifest);
|
|
15
|
-
|
|
16
|
-
if (!$videoUse) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
$additionalClass = $attributes['additionalClass'] ?? '';
|
|
21
|
-
|
|
22
|
-
$videoUrl = Helpers::checkAttr('videoUrl', $attributes, $manifest, true);
|
|
23
|
-
|
|
24
|
-
if (empty($videoUrl)) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
$videoMimeType = Helpers::checkAttr('videoMimeType', $attributes, $manifest);
|
|
29
|
-
$videoPosterUrl = Helpers::checkAttr('videoPosterUrl', $attributes, $manifest);
|
|
30
|
-
$videoLoop = Helpers::checkAttr('videoLoop', $attributes, $manifest);
|
|
31
|
-
$videoAutoplay = Helpers::checkAttr('videoAutoplay', $attributes, $manifest);
|
|
32
|
-
$videoControls = Helpers::checkAttr('videoControls', $attributes, $manifest);
|
|
33
|
-
$videoMuted = Helpers::checkAttr('videoMuted', $attributes, $manifest);
|
|
34
|
-
$videoPreload = Helpers::checkAttr('videoPreload', $attributes, $manifest);
|
|
35
|
-
$videoSubtitleTracks = Helpers::checkAttr('videoSubtitleTracks', $attributes, $manifest) ?? [];
|
|
36
|
-
|
|
37
|
-
$additionalAttributes = Helpers::classnames([
|
|
38
|
-
$videoLoop ? 'loop' : '',
|
|
39
|
-
$videoAutoplay ? 'autoplay playsinline' : '',
|
|
40
|
-
$videoControls ? 'controls' : '',
|
|
41
|
-
$videoMuted ? 'muted' : '',
|
|
42
|
-
]);
|
|
43
|
-
?>
|
|
44
|
-
|
|
45
|
-
<video
|
|
46
|
-
class="<?php echo esc_attr(Helpers::tailwindClasses('video', $attributes, $manifest)); ?>"
|
|
47
|
-
<?php echo esc_attr($additionalAttributes); ?>
|
|
48
|
-
preload="<?php echo esc_attr($videoPreload); ?>"
|
|
49
|
-
<?php if ($videoPosterUrl) { ?>
|
|
50
|
-
poster="<?php echo esc_attr($videoPosterUrl); ?>"
|
|
51
|
-
<?php } ?>
|
|
52
|
-
>
|
|
53
|
-
<source src="<?php echo esc_url($videoUrl); ?>" type="<?php echo esc_attr($videoMimeType); ?>" />
|
|
54
|
-
|
|
55
|
-
<?php foreach ($videoSubtitleTracks as $track) {
|
|
56
|
-
if (!($track['trackFileName'] ?? '') || !($track['kind'] ?? '') || !($track['label'])) {
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
?>
|
|
60
|
-
|
|
61
|
-
<track
|
|
62
|
-
src="<?php echo esc_url($track['trackFileName']); ?>"
|
|
63
|
-
kind="<?php echo esc_attr($track['kind']); ?>"
|
|
64
|
-
label="<?php echo esc_attr($track['label']); ?>"
|
|
65
|
-
<?php if ($track['srclang']) { ?>
|
|
66
|
-
srclang="<?php echo esc_attr($track['srclang']); ?>"
|
|
67
|
-
<?php } ?>
|
|
68
|
-
>
|
|
69
|
-
<?php } ?>
|
|
70
|
-
</video>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { GutenbergBlock } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
2
|
-
import { AccordionEditor } from './components/accordion-editor';
|
|
3
|
-
import { AccordionOptions } from './components/accordion-options';
|
|
4
|
-
import manifest from './manifest.json';
|
|
5
|
-
|
|
6
|
-
export const Accordion = (props) => {
|
|
7
|
-
return (
|
|
8
|
-
<GutenbergBlock
|
|
9
|
-
{...props}
|
|
10
|
-
options={AccordionOptions}
|
|
11
|
-
editor={AccordionEditor}
|
|
12
|
-
title={manifest.title}
|
|
13
|
-
/>
|
|
14
|
-
);
|
|
15
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Accordion block 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
|
-
$blockJsClass = $attributes['blockJsClass'] ?? '';
|
|
14
|
-
|
|
15
|
-
$accordionCloseAdjacent = Helpers::checkAttr('accordionCloseAdjacent', $attributes, $manifest);
|
|
16
|
-
?>
|
|
17
|
-
|
|
18
|
-
<div
|
|
19
|
-
class="<?php echo esc_attr($blockJsClass); ?>"
|
|
20
|
-
<?php if ($accordionCloseAdjacent) {
|
|
21
|
-
?> data-close-adjacent <?php
|
|
22
|
-
} ?>
|
|
23
|
-
>
|
|
24
|
-
<?php
|
|
25
|
-
// phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
|
|
26
|
-
echo $renderContent;
|
|
27
|
-
?>
|
|
28
|
-
</div>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import domReady from '@wordpress/dom-ready';
|
|
2
|
-
|
|
3
|
-
domReady(async () => {
|
|
4
|
-
const selector = '.js-block-accordion';
|
|
5
|
-
const elements = document.querySelectorAll(selector);
|
|
6
|
-
|
|
7
|
-
if (elements?.length < 1) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
elements.forEach((element) => {
|
|
12
|
-
let activeElement;
|
|
13
|
-
|
|
14
|
-
const accordionTriggers = element.querySelectorAll('[data-accordion-header]');
|
|
15
|
-
|
|
16
|
-
const closeAdjacent = element.hasAttribute('data-close-adjacent');
|
|
17
|
-
|
|
18
|
-
accordionTriggers.forEach((trigger) => {
|
|
19
|
-
const target = trigger.nextElementSibling;
|
|
20
|
-
|
|
21
|
-
trigger.addEventListener('click', () => {
|
|
22
|
-
if (closeAdjacent) {
|
|
23
|
-
if (activeElement) {
|
|
24
|
-
activeElement.setAttribute('aria-expanded', false);
|
|
25
|
-
activeElement.nextElementSibling.hidden = true;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
activeElement = trigger;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const expanded = (trigger.getAttribute('aria-expanded') ?? 'false') === 'true';
|
|
32
|
-
trigger.setAttribute('aria-expanded', !expanded);
|
|
33
|
-
target.hidden = expanded;
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { BlockInserter } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
2
|
-
import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
3
|
-
|
|
4
|
-
export const AccordionEditor = ({ clientId }) => {
|
|
5
|
-
const blockProps = useBlockProps();
|
|
6
|
-
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
|
7
|
-
allowedBlocks: ['eightshift-boilerplate/accordion-item'],
|
|
8
|
-
renderAppender: () => (
|
|
9
|
-
<BlockInserter
|
|
10
|
-
clientId={clientId}
|
|
11
|
-
label
|
|
12
|
-
/>
|
|
13
|
-
),
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<div
|
|
18
|
-
{...innerBlocksProps}
|
|
19
|
-
className='space-y-0 *:!m-0'
|
|
20
|
-
/>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { __ } from '@wordpress/i18n';
|
|
2
|
-
import { checkAttr, getAttrKey } from '@eightshift/frontend-libs-tailwind/scripts';
|
|
3
|
-
import { Toggle } from '@eightshift/ui-components';
|
|
4
|
-
import { icons } from '@eightshift/ui-components/icons';
|
|
5
|
-
import manifest from '../manifest.json';
|
|
6
|
-
|
|
7
|
-
export const AccordionOptions = ({ attributes, setAttributes }) => {
|
|
8
|
-
const accordionCloseAdjacent = checkAttr('accordionCloseAdjacent', attributes, manifest);
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<Toggle
|
|
12
|
-
icon={icons.dropdownClose}
|
|
13
|
-
label={__('Allow only one panel to be open', '%g_textdomain%')}
|
|
14
|
-
checked={accordionCloseAdjacent}
|
|
15
|
-
onChange={(value) => setAttributes({ [getAttrKey('accordionCloseAdjacent', attributes, manifest)]: value })}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/infinum/eightshift-frontend-libs-tailwind/main/schemas/block.json",
|
|
3
|
-
"blockName": "accordion",
|
|
4
|
-
"blockJsClass": "js-block-accordion",
|
|
5
|
-
"title": "Accordion",
|
|
6
|
-
"description" : "Hide and show additional content.",
|
|
7
|
-
"category": "eightshift",
|
|
8
|
-
"icon": {
|
|
9
|
-
"src": "es-accordion"
|
|
10
|
-
},
|
|
11
|
-
"keywords": [
|
|
12
|
-
"accordion"
|
|
13
|
-
],
|
|
14
|
-
"example": {
|
|
15
|
-
"innerBlocks": [
|
|
16
|
-
{
|
|
17
|
-
"name": "eightshift-boilerplate/accordion-item",
|
|
18
|
-
"attributes": {
|
|
19
|
-
"accordionItemAccordionItemTitle": "Demo accordion",
|
|
20
|
-
"accordionItemAccordionItemContent": "Demo accordion content"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
|
-
"hasInnerBlocks": true,
|
|
26
|
-
"attributes": {
|
|
27
|
-
"accordionCloseAdjacent": {
|
|
28
|
-
"type": "boolean",
|
|
29
|
-
"default": false
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useSelect } from '@wordpress/data';
|
|
2
|
-
import { GutenbergBlock, overrideInnerBlockAttributes } from '@eightshift/frontend-libs-tailwind/scripts/editor';
|
|
3
|
-
import { AccordionItemEditor } from './components/accordion-item-editor';
|
|
4
|
-
|
|
5
|
-
export const AccordionItem = (props) => {
|
|
6
|
-
useSelect((select) => {
|
|
7
|
-
overrideInnerBlockAttributes(select, props.clientId, {
|
|
8
|
-
wrapperNoWidthControls: true,
|
|
9
|
-
wrapperWidth: 'none',
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<GutenbergBlock
|
|
15
|
-
{...props}
|
|
16
|
-
editor={AccordionItemEditor}
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Accordion item block 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
|
-
$blockJsClass = $attributes['blockJsClass'] ?? '';
|
|
14
|
-
|
|
15
|
-
$uniqueId = Helpers::getUnique();
|
|
16
|
-
|
|
17
|
-
$panelId = "{$uniqueId}-panel";
|
|
18
|
-
$triggerId = "{$uniqueId}-header";
|
|
19
|
-
|
|
20
|
-
$accordionItemLabel = Helpers::checkAttr('accordionItemLabel', $attributes, $manifest);
|
|
21
|
-
?>
|
|
22
|
-
|
|
23
|
-
<button
|
|
24
|
-
id="<?php echo esc_attr($triggerId); ?>"
|
|
25
|
-
aria-expanded="false"
|
|
26
|
-
aria-controls="<?php echo esc_attr($panelId); ?>"
|
|
27
|
-
class="<?php echo esc_attr(Helpers::tailwindClasses('trigger', $attributes, $manifest)); ?>"
|
|
28
|
-
data-accordion-header
|
|
29
|
-
>
|
|
30
|
-
<?php
|
|
31
|
-
echo esc_attr($accordionItemLabel),
|
|
32
|
-
// phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
|
|
33
|
-
$manifest['resources']['icon'];
|
|
34
|
-
?>
|
|
35
|
-
</button>
|
|
36
|
-
<section
|
|
37
|
-
id="<?php echo esc_attr($panelId); ?>"
|
|
38
|
-
aria-labelledby="<?php echo esc_attr($triggerId); ?>"
|
|
39
|
-
class="<?php echo esc_attr(Helpers::tailwindClasses('content-container', $attributes, $manifest)); ?>"
|
|
40
|
-
hidden
|
|
41
|
-
>
|
|
42
|
-
<?php
|
|
43
|
-
// phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
|
|
44
|
-
echo $renderContent;
|
|
45
|
-
?>
|
|
46
|
-
</section>
|