@brilo/base-blocks 0.1.43 → 0.1.45
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/build/.tsbuildinfo +1 -1
- package/build/blocks/compare/compare-group/constants.d.ts +27 -0
- package/build/blocks/compare/compare-group/constants.d.ts.map +1 -1
- package/build/blocks/compare/compare-group/constants.js +23 -0
- package/build/blocks/compare/compare-group/edit.d.ts.map +1 -1
- package/build/blocks/compare/compare-group/edit.js +12 -7
- package/build/blocks/compare/compare-group/factory.d.ts.map +1 -1
- package/build/blocks/compare/compare-group/factory.js +10 -1
- package/build/blocks/compare/compare-group/index.d.ts +1 -1
- package/build/blocks/compare/compare-group/index.d.ts.map +1 -1
- package/build/blocks/compare/compare-group/types.d.ts +7 -1
- package/build/blocks/compare/compare-group/types.d.ts.map +1 -1
- package/build/blocks/compare/compare-item/edit.d.ts.map +1 -1
- package/build/blocks/compare/compare-item/edit.js +6 -4
- package/build/blocks/compare/compare-item/factory.d.ts.map +1 -1
- package/build/blocks/compare/compare-item/factory.js +4 -0
- package/build/blocks/compare/compare-item/index.js +1 -1
- package/build/blocks/compare/compare-item/types.d.ts +2 -0
- package/build/blocks/compare/compare-item/types.d.ts.map +1 -1
- package/build/blocks/core/basic-icon/buildPreviewStyle.d.ts +8 -0
- package/build/blocks/core/basic-icon/buildPreviewStyle.d.ts.map +1 -0
- package/build/blocks/core/basic-icon/buildPreviewStyle.js +22 -0
- package/build/blocks/core/basic-icon/constants.d.ts +84 -0
- package/build/blocks/core/basic-icon/constants.d.ts.map +1 -0
- package/build/blocks/core/basic-icon/constants.js +41 -0
- package/build/blocks/core/basic-icon/edit.d.ts +6 -0
- package/build/blocks/core/basic-icon/edit.d.ts.map +1 -0
- package/build/blocks/core/basic-icon/edit.js +22 -0
- package/build/blocks/core/basic-icon/factory.d.ts +5 -0
- package/build/blocks/core/basic-icon/factory.d.ts.map +1 -0
- package/build/blocks/core/basic-icon/factory.js +38 -0
- package/build/blocks/core/basic-icon/index.d.ts +5 -0
- package/build/blocks/core/basic-icon/index.d.ts.map +1 -0
- package/build/blocks/core/basic-icon/index.js +7 -0
- package/build/blocks/core/basic-icon/types.d.ts +30 -0
- package/build/blocks/core/basic-icon/types.d.ts.map +1 -0
- package/build/blocks/core/basic-icon/types.js +1 -0
- package/build/blocks/faq/faq-group/constants.d.ts +29 -0
- package/build/blocks/faq/faq-group/constants.d.ts.map +1 -1
- package/build/blocks/faq/faq-group/constants.js +15 -0
- package/build/blocks/faq/faq-group/edit.d.ts.map +1 -1
- package/build/blocks/faq/faq-group/edit.js +14 -5
- package/build/blocks/faq/faq-group/factory.d.ts.map +1 -1
- package/build/blocks/faq/faq-group/factory.js +37 -17
- package/build/blocks/faq/faq-group/index.d.ts +1 -1
- package/build/blocks/faq/faq-group/index.d.ts.map +1 -1
- package/build/blocks/faq/faq-group/types.d.ts +21 -1
- package/build/blocks/faq/faq-group/types.d.ts.map +1 -1
- package/build/blocks/gallery/gallery-group/edit.d.ts.map +1 -1
- package/build/blocks/gallery/gallery-group/edit.js +4 -2
- package/build/blocks/gallery/gallery-group/factory.d.ts.map +1 -1
- package/build/blocks/gallery/gallery-group/factory.js +2 -0
- package/build/blocks/gallery/gallery-group/types.d.ts +1 -0
- package/build/blocks/gallery/gallery-group/types.d.ts.map +1 -1
- package/build/blocks/groups/text-and-media-group/index.d.ts.map +1 -1
- package/build/blocks/groups/text-and-media-group/index.js +1 -0
- package/build/blocks/list/list-group/constants.d.ts +21 -0
- package/build/blocks/list/list-group/constants.d.ts.map +1 -0
- package/build/blocks/list/list-group/constants.js +12 -0
- package/build/blocks/list/list-group/edit.d.ts +6 -0
- package/build/blocks/list/list-group/edit.d.ts.map +1 -0
- package/build/blocks/list/list-group/edit.js +30 -0
- package/build/blocks/list/list-group/factory.d.ts +7 -0
- package/build/blocks/list/list-group/factory.d.ts.map +1 -0
- package/build/blocks/list/list-group/factory.js +29 -0
- package/build/blocks/list/list-group/icon.d.ts +2 -0
- package/build/blocks/list/list-group/icon.d.ts.map +1 -0
- package/build/blocks/list/list-group/icon.js +2 -0
- package/build/blocks/list/list-group/index.d.ts +5 -0
- package/build/blocks/list/list-group/index.d.ts.map +1 -0
- package/build/blocks/list/list-group/index.js +11 -0
- package/build/blocks/list/list-group/types.d.ts +22 -0
- package/build/blocks/list/list-group/types.d.ts.map +1 -0
- package/build/blocks/list/list-group/types.js +1 -0
- package/build/blocks/list/list-item/buildPreviewStyle.d.ts +20 -0
- package/build/blocks/list/list-item/buildPreviewStyle.d.ts.map +1 -0
- package/build/blocks/list/list-item/buildPreviewStyle.js +18 -0
- package/build/blocks/list/list-item/constants.d.ts +36 -0
- package/build/blocks/list/list-item/constants.d.ts.map +1 -0
- package/build/blocks/list/list-item/constants.js +16 -0
- package/build/blocks/list/list-item/edit.d.ts +11 -0
- package/build/blocks/list/list-item/edit.d.ts.map +1 -0
- package/build/blocks/list/list-item/edit.js +18 -0
- package/build/blocks/list/list-item/factory.d.ts +5 -0
- package/build/blocks/list/list-item/factory.d.ts.map +1 -0
- package/build/blocks/list/list-item/factory.js +29 -0
- package/build/blocks/list/list-item/index.d.ts +5 -0
- package/build/blocks/list/list-item/index.d.ts.map +1 -0
- package/build/blocks/list/list-item/index.js +7 -0
- package/build/blocks/list/list-item/types.d.ts +21 -0
- package/build/blocks/list/list-item/types.d.ts.map +1 -0
- package/build/blocks/list/list-item/types.js +1 -0
- package/build/blocks/priceplan/priceplan-group/edit.d.ts +5 -2
- package/build/blocks/priceplan/priceplan-group/edit.d.ts.map +1 -1
- package/build/blocks/priceplan/priceplan-group/edit.js +7 -3
- package/build/blocks/priceplan/priceplan-group/factory.d.ts.map +1 -1
- package/build/blocks/priceplan/priceplan-group/factory.js +2 -1
- package/build/blocks/priceplan/priceplan-group/types.d.ts +1 -0
- package/build/blocks/priceplan/priceplan-group/types.d.ts.map +1 -1
- package/build/blocks/review/review-group/constants.d.ts +10 -0
- package/build/blocks/review/review-group/constants.d.ts.map +1 -1
- package/build/blocks/review/review-group/constants.js +5 -0
- package/build/blocks/review/review-group/edit.d.ts.map +1 -1
- package/build/blocks/review/review-group/edit.js +10 -6
- package/build/blocks/review/review-group/factory.d.ts.map +1 -1
- package/build/blocks/review/review-group/factory.js +36 -21
- package/build/blocks/review/review-group/index.d.ts +1 -1
- package/build/blocks/review/review-group/index.d.ts.map +1 -1
- package/build/blocks/review/review-group/types.d.ts +11 -1
- package/build/blocks/review/review-group/types.d.ts.map +1 -1
- package/build/blocks/sections/base-section/constants.d.ts +35 -0
- package/build/blocks/sections/base-section/constants.d.ts.map +1 -1
- package/build/blocks/sections/base-section/constants.js +10 -0
- package/build/blocks/sections/base-section/controls.d.ts.map +1 -1
- package/build/blocks/sections/base-section/controls.js +26 -12
- package/build/blocks/sections/base-section/edit.d.ts.map +1 -1
- package/build/blocks/sections/base-section/edit.js +12 -4
- package/build/blocks/sections/base-section/types.d.ts +9 -1
- package/build/blocks/sections/base-section/types.d.ts.map +1 -1
- package/build/blocks/signpost/signpost-group/edit.d.ts.map +1 -1
- package/build/blocks/signpost/signpost-group/edit.js +4 -2
- package/build/blocks/signpost/signpost-group/factory.d.ts.map +1 -1
- package/build/blocks/signpost/signpost-group/factory.js +2 -0
- package/build/blocks/signpost/signpost-group/types.d.ts +1 -0
- package/build/blocks/signpost/signpost-group/types.d.ts.map +1 -1
- package/build/blocks/step/step-group/edit.d.ts.map +1 -1
- package/build/blocks/step/step-group/edit.js +4 -3
- package/build/blocks/step/step-group/factory.d.ts.map +1 -1
- package/build/blocks/step/step-group/factory.js +2 -0
- package/build/blocks/step/step-group/types.d.ts +1 -0
- package/build/blocks/step/step-group/types.d.ts.map +1 -1
- package/build/blocks/text-and-form/text-and-form-text-column/index.d.ts.map +1 -1
- package/build/blocks/text-and-form/text-and-form-text-column/index.js +1 -0
- package/build/blocks/usp/usp-group/edit.d.ts.map +1 -1
- package/build/blocks/usp/usp-group/edit.js +4 -3
- package/build/blocks/usp/usp-group/factory.d.ts.map +1 -1
- package/build/blocks/usp/usp-group/factory.js +2 -0
- package/build/blocks/usp/usp-group/types.d.ts +1 -0
- package/build/blocks/usp/usp-group/types.d.ts.map +1 -1
- package/build/blocks/video/video-group/constants.d.ts +1 -0
- package/build/blocks/video/video-group/constants.d.ts.map +1 -1
- package/build/blocks/video/video-group/constants.js +1 -0
- package/build/blocks/video/video-group/edit.d.ts.map +1 -1
- package/build/blocks/video/video-group/edit.js +7 -5
- package/build/blocks/video/video-group/factory.d.ts.map +1 -1
- package/build/blocks/video/video-group/factory.js +9 -1
- package/build/blocks/video/video-group/types.d.ts +2 -0
- package/build/blocks/video/video-group/types.d.ts.map +1 -1
- package/build/components/ItemSpacingControl/index.d.ts +23 -0
- package/build/components/ItemSpacingControl/index.d.ts.map +1 -0
- package/build/components/ItemSpacingControl/index.js +32 -0
- package/build/index.d.ts +6 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -0
- package/package.json +1 -1
- package/src/blocks/compare/compare-group/constants.ts +27 -0
- package/src/blocks/compare/compare-group/edit.tsx +27 -4
- package/src/blocks/compare/compare-group/factory.tsx +10 -1
- package/src/blocks/compare/compare-group/index.ts +7 -1
- package/src/blocks/compare/compare-group/types.ts +5 -1
- package/src/blocks/compare/compare-item/edit.tsx +32 -13
- package/src/blocks/compare/compare-item/editor.scss +16 -0
- package/src/blocks/compare/compare-item/factory.tsx +4 -0
- package/src/blocks/compare/compare-item/index.ts +1 -1
- package/src/blocks/compare/compare-item/types.ts +2 -0
- package/src/blocks/core/basic-icon/buildPreviewStyle.ts +40 -0
- package/src/blocks/core/basic-icon/constants.ts +48 -0
- package/src/blocks/core/basic-icon/edit.tsx +170 -0
- package/src/blocks/core/basic-icon/editor.scss +119 -0
- package/src/blocks/core/basic-icon/factory.tsx +42 -0
- package/src/blocks/core/basic-icon/index.ts +17 -0
- package/src/blocks/core/basic-icon/types.ts +34 -0
- package/src/blocks/faq/faq-group/constants.ts +18 -0
- package/src/blocks/faq/faq-group/edit.tsx +121 -4
- package/src/blocks/faq/faq-group/factory.tsx +35 -13
- package/src/blocks/faq/faq-group/index.ts +9 -1
- package/src/blocks/faq/faq-group/types.ts +23 -1
- package/src/blocks/gallery/gallery-group/edit.tsx +4 -1
- package/src/blocks/gallery/gallery-group/factory.tsx +2 -0
- package/src/blocks/gallery/gallery-group/types.ts +1 -0
- package/src/blocks/groups/text-and-media-group/index.ts +1 -0
- package/src/blocks/list/list-group/constants.ts +15 -0
- package/src/blocks/list/list-group/edit.tsx +102 -0
- package/src/blocks/list/list-group/editor.scss +14 -0
- package/src/blocks/list/list-group/factory.tsx +35 -0
- package/src/blocks/list/list-group/icon.tsx +11 -0
- package/src/blocks/list/list-group/index.ts +15 -0
- package/src/blocks/list/list-group/types.ts +21 -0
- package/src/blocks/list/list-item/buildPreviewStyle.ts +52 -0
- package/src/blocks/list/list-item/constants.ts +18 -0
- package/src/blocks/list/list-item/edit.tsx +108 -0
- package/src/blocks/list/list-item/editor.scss +108 -0
- package/src/blocks/list/list-item/factory.tsx +33 -0
- package/src/blocks/list/list-item/index.ts +11 -0
- package/src/blocks/list/list-item/types.ts +23 -0
- package/src/blocks/priceplan/priceplan-group/edit.tsx +21 -5
- package/src/blocks/priceplan/priceplan-group/factory.tsx +2 -1
- package/src/blocks/priceplan/priceplan-group/types.ts +3 -1
- package/src/blocks/review/review-group/constants.ts +6 -0
- package/src/blocks/review/review-group/edit.tsx +50 -4
- package/src/blocks/review/review-group/factory.tsx +33 -16
- package/src/blocks/review/review-group/index.ts +10 -1
- package/src/blocks/review/review-group/types.ts +12 -1
- package/src/blocks/sections/base-section/constants.ts +14 -0
- package/src/blocks/sections/base-section/controls.tsx +93 -9
- package/src/blocks/sections/base-section/edit.tsx +10 -2
- package/src/blocks/sections/base-section/types.ts +14 -1
- package/src/blocks/signpost/signpost-group/edit.tsx +4 -1
- package/src/blocks/signpost/signpost-group/factory.tsx +2 -0
- package/src/blocks/signpost/signpost-group/types.ts +1 -0
- package/src/blocks/step/step-group/edit.tsx +4 -2
- package/src/blocks/step/step-group/factory.tsx +2 -0
- package/src/blocks/step/step-group/types.ts +1 -0
- package/src/blocks/text-and-form/text-and-form-text-column/index.ts +1 -0
- package/src/blocks/usp/usp-group/edit.tsx +4 -2
- package/src/blocks/usp/usp-group/factory.tsx +2 -0
- package/src/blocks/usp/usp-group/types.ts +1 -0
- package/src/blocks/video/video-group/constants.ts +2 -0
- package/src/blocks/video/video-group/edit.tsx +33 -2
- package/src/blocks/video/video-group/editor.scss +6 -1
- package/src/blocks/video/video-group/factory.tsx +9 -1
- package/src/blocks/video/video-group/types.ts +2 -0
- package/src/components/ItemSpacingControl/index.tsx +59 -0
- package/src/editor.scss +3 -0
- package/src/index.ts +11 -0
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from '@wordpress/components'
|
|
8
8
|
import {__} from '@wordpress/i18n'
|
|
9
9
|
import clsx from 'clsx'
|
|
10
|
+
import {ItemSpacingPanel, itemSpacingStyle} from '~/components/ItemSpacingControl'
|
|
10
11
|
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
11
12
|
import type {OptionArray} from '~/types'
|
|
12
13
|
import type {StepGroupAttributes, StepGroupOptions, StepVariant} from './types'
|
|
@@ -22,12 +23,12 @@ export function createStepGroupEdit<TVariants extends OptionArray = typeof DEFAU
|
|
|
22
23
|
attributes: StepGroupAttributes
|
|
23
24
|
setAttributes: (a: Partial<StepGroupAttributes>) => void
|
|
24
25
|
}) {
|
|
25
|
-
const {variant, disableIcon} = attributes
|
|
26
|
+
const {variant, disableIcon, spacing} = attributes
|
|
26
27
|
|
|
27
28
|
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
28
29
|
blockClassName: clsx(options.blockClassName ?? 'g-step wp-block-section', `--variant-${variant}`, disableIcon && '--disable-icon'),
|
|
29
30
|
containerClassName: [options.containerClassName ?? 'g-step__container', 'u-grid-responsive', '--cols-3'],
|
|
30
|
-
containerStyle: {'--grid-max-col-count': 3},
|
|
31
|
+
containerStyle: {'--grid-max-col-count': 3, ...itemSpacingStyle(spacing)},
|
|
31
32
|
allowedBlocks: options.allowedBlocks,
|
|
32
33
|
orientation: 'horizontal',
|
|
33
34
|
template: options.template,
|
|
@@ -54,6 +55,7 @@ export function createStepGroupEdit<TVariants extends OptionArray = typeof DEFAU
|
|
|
54
55
|
onChange={(v) => setAttributes({disableIcon: v})}
|
|
55
56
|
/>
|
|
56
57
|
</PanelBody>
|
|
58
|
+
<ItemSpacingPanel spacing={spacing} onChange={(v) => setAttributes({spacing: v})} />
|
|
57
59
|
</InspectorControls>
|
|
58
60
|
<div {...blockProps}>
|
|
59
61
|
<div {...innerBlocksProps} />
|
|
@@ -5,6 +5,7 @@ import {DEFAULT_VARIANTS} from './constants'
|
|
|
5
5
|
import {createStepGroupEdit} from './edit'
|
|
6
6
|
import type {StepGroupAttributes, StepGroupOptions} from './types'
|
|
7
7
|
import {icon} from '~/blocks/step/step-group/icon'
|
|
8
|
+
import {ITEM_SPACING_ATTRIBUTE} from '~/components/ItemSpacingControl'
|
|
8
9
|
import type {OptionArray} from '~/types'
|
|
9
10
|
|
|
10
11
|
export function createStepGroupBlock<TVariants extends OptionArray = typeof DEFAULT_VARIANTS>(
|
|
@@ -29,6 +30,7 @@ export function createStepGroupBlock<TVariants extends OptionArray = typeof DEFA
|
|
|
29
30
|
type: 'boolean',
|
|
30
31
|
default: false,
|
|
31
32
|
},
|
|
33
|
+
...ITEM_SPACING_ATTRIBUTE,
|
|
32
34
|
},
|
|
33
35
|
edit: createStepGroupEdit(options as unknown as StepGroupOptions),
|
|
34
36
|
save: () => <InnerBlocks.Content />,
|
|
@@ -6,6 +6,7 @@ export type StepVariant = (typeof DEFAULT_VARIANTS)[number]['value']
|
|
|
6
6
|
export interface StepGroupAttributes<TVariant extends string = StepVariant> extends Record<string, unknown> {
|
|
7
7
|
variant: TVariant
|
|
8
8
|
disableIcon: boolean
|
|
9
|
+
spacing?: number
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export interface StepGroupOptions<TVariants extends OptionArray = typeof DEFAULT_VARIANTS> extends BriloBlockType {
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from '@wordpress/components'
|
|
12
12
|
import {__} from '@wordpress/i18n'
|
|
13
13
|
import clsx from 'clsx'
|
|
14
|
+
import {ItemSpacingPanel, itemSpacingStyle} from '~/components/ItemSpacingControl'
|
|
14
15
|
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
15
16
|
import {useTenantColorPalette} from '~/hooks/useTenantColorPalette'
|
|
16
17
|
import {
|
|
@@ -89,7 +90,7 @@ export function createUspGroupEdit(options: UspGroupOptions) {
|
|
|
89
90
|
attributes: UspGroupAttributes
|
|
90
91
|
setAttributes: (a: Partial<UspGroupAttributes>) => void
|
|
91
92
|
}) {
|
|
92
|
-
const {columns, headingSettings, content, style} = attributes
|
|
93
|
+
const {columns, headingSettings, content, style, spacing} = attributes
|
|
93
94
|
const {paletteColors} = useTenantColorPalette()
|
|
94
95
|
|
|
95
96
|
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
@@ -100,7 +101,7 @@ export function createUspGroupEdit(options: UspGroupOptions) {
|
|
|
100
101
|
style.shadow !== 'none' && `--shadow-${style.shadow}`,
|
|
101
102
|
),
|
|
102
103
|
containerClassName: [options.containerClassName ?? 'u-grid-responsive', `--cols-${columns}`],
|
|
103
|
-
containerStyle: {'--grid-max-col-count': columns},
|
|
104
|
+
containerStyle: {'--grid-max-col-count': columns, ...itemSpacingStyle(spacing)},
|
|
104
105
|
allowedBlocks: options.allowedBlocks,
|
|
105
106
|
orientation: 'horizontal',
|
|
106
107
|
template: options.template,
|
|
@@ -285,6 +286,7 @@ export function createUspGroupEdit(options: UspGroupOptions) {
|
|
|
285
286
|
/>
|
|
286
287
|
)}
|
|
287
288
|
</PanelBody>
|
|
289
|
+
<ItemSpacingPanel spacing={spacing} onChange={(v) => setAttributes({spacing: v})} />
|
|
288
290
|
</InspectorControls>
|
|
289
291
|
<div {...blockProps}>
|
|
290
292
|
<div {...innerBlocksProps} />
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {InnerBlocks} from '@wordpress/block-editor'
|
|
2
2
|
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
3
3
|
import {__} from '@wordpress/i18n'
|
|
4
|
+
import {ITEM_SPACING_ATTRIBUTE} from '~/components/ItemSpacingControl'
|
|
4
5
|
import type {NumberArray, OptionArray} from '~/types'
|
|
5
6
|
import {
|
|
6
7
|
DEFAULT_ALIGNMENTS,
|
|
@@ -91,6 +92,7 @@ export function createUspGroupBlock<
|
|
|
91
92
|
},
|
|
92
93
|
},
|
|
93
94
|
},
|
|
95
|
+
...ITEM_SPACING_ATTRIBUTE,
|
|
94
96
|
},
|
|
95
97
|
edit: createUspGroupEdit(options as unknown as UspGroupOptions),
|
|
96
98
|
save: () => <InnerBlocks.Content />,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {InspectorControls, MediaUpload, MediaUploadCheck, RichText, useBlockProps} from '@wordpress/block-editor'
|
|
2
2
|
import type {BlockEditProps} from '@wordpress/blocks'
|
|
3
3
|
import {
|
|
4
|
+
BaseControl,
|
|
4
5
|
Button,
|
|
6
|
+
ColorPalette,
|
|
5
7
|
PanelBody,
|
|
6
8
|
TextControl,
|
|
7
9
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
@@ -9,7 +11,8 @@ import {
|
|
|
9
11
|
} from '@wordpress/components'
|
|
10
12
|
import {__} from '@wordpress/i18n'
|
|
11
13
|
import clsx from 'clsx'
|
|
12
|
-
import {
|
|
14
|
+
import {useTenantColorPalette} from '~/hooks/useTenantColorPalette'
|
|
15
|
+
import {DEFAULT_OVERLAY_COLOR, SIZES, VIDEO_TYPES} from './constants'
|
|
13
16
|
import type {VideoGroupAttributes, VideoGroupOptions, VideoSize, VideoType} from './types'
|
|
14
17
|
|
|
15
18
|
function extractYoutubeId(url: string): string | null {
|
|
@@ -19,7 +22,8 @@ function extractYoutubeId(url: string): string | null {
|
|
|
19
22
|
|
|
20
23
|
export function createVideoGroupEdit(_options: VideoGroupOptions) {
|
|
21
24
|
return function VideoGroupEdit({attributes, setAttributes}: BlockEditProps<VideoGroupAttributes>) {
|
|
22
|
-
const {type, url, mediaId, caption, size, poster} = attributes
|
|
25
|
+
const {type, url, mediaId, caption, size, poster, playButtonTitle, overlayColor} = attributes
|
|
26
|
+
const {paletteColors} = useTenantColorPalette()
|
|
23
27
|
|
|
24
28
|
const youtubeId = type === 'youtube' ? extractYoutubeId(url) : null
|
|
25
29
|
const youtubeThumbnail = youtubeId ? `https://img.youtube.com/vi/${youtubeId}/maxresdefault.jpg` : null
|
|
@@ -42,6 +46,13 @@ export function createVideoGroupEdit(_options: VideoGroupOptions) {
|
|
|
42
46
|
<ToggleGroupControlOption key={t.value} value={t.value} label={t.label} />
|
|
43
47
|
))}
|
|
44
48
|
</ToggleGroupControl>
|
|
49
|
+
|
|
50
|
+
<TextControl
|
|
51
|
+
label={__('Text tlačítka přehrát', 'brilo-blocks')}
|
|
52
|
+
value={playButtonTitle}
|
|
53
|
+
onChange={(value) => setAttributes({playButtonTitle: value})}
|
|
54
|
+
placeholder={__('Přehrát video', 'brilo-blocks')}
|
|
55
|
+
/>
|
|
45
56
|
</PanelBody>
|
|
46
57
|
|
|
47
58
|
{type === 'youtube' && (
|
|
@@ -85,6 +96,24 @@ export function createVideoGroupEdit(_options: VideoGroupOptions) {
|
|
|
85
96
|
</MediaUploadCheck>
|
|
86
97
|
</PanelBody>
|
|
87
98
|
|
|
99
|
+
<PanelBody title={__('Barevná vrstva', 'brilo-blocks')} initialOpen={false}>
|
|
100
|
+
<BaseControl
|
|
101
|
+
label={__('Barva překrytí náhledu', 'brilo-blocks')}
|
|
102
|
+
help={__('Ztmaví náhled videa, aby tlačítko přehrát více vyniklo. Výchozí je černá s 25% průhledností.', 'brilo-blocks')}
|
|
103
|
+
>
|
|
104
|
+
<ColorPalette
|
|
105
|
+
colors={paletteColors}
|
|
106
|
+
value={overlayColor || undefined}
|
|
107
|
+
onChange={(value) => setAttributes({overlayColor: value ?? ''})}
|
|
108
|
+
enableAlpha
|
|
109
|
+
clearable
|
|
110
|
+
/>
|
|
111
|
+
</BaseControl>
|
|
112
|
+
<Button onClick={() => setAttributes({overlayColor: DEFAULT_OVERLAY_COLOR})} variant="tertiary" size="small">
|
|
113
|
+
{__('Obnovit výchozí barvu', 'brilo-blocks')}
|
|
114
|
+
</Button>
|
|
115
|
+
</PanelBody>
|
|
116
|
+
|
|
88
117
|
<PanelBody title={__('Rozložení', 'brilo-blocks')} initialOpen={false}>
|
|
89
118
|
<ToggleGroupControl
|
|
90
119
|
label={__('Velikost', 'brilo-blocks')}
|
|
@@ -105,6 +134,7 @@ export function createVideoGroupEdit(_options: VideoGroupOptions) {
|
|
|
105
134
|
youtubeThumbnail ? (
|
|
106
135
|
<div className="g-video__youtube-preview">
|
|
107
136
|
<img src={youtubeThumbnail} alt="" />
|
|
137
|
+
<div className="g-video__overlay" style={overlayColor ? {backgroundColor: overlayColor} : undefined} />
|
|
108
138
|
<div className="g-video__play-icon" />
|
|
109
139
|
</div>
|
|
110
140
|
) : (
|
|
@@ -128,6 +158,7 @@ export function createVideoGroupEdit(_options: VideoGroupOptions) {
|
|
|
128
158
|
<video src={url} poster={poster?.src || undefined}>
|
|
129
159
|
<track kind="captions" />
|
|
130
160
|
</video>
|
|
161
|
+
<div className="g-video__overlay" style={overlayColor ? {backgroundColor: overlayColor} : undefined} />
|
|
131
162
|
<Button onClick={open} variant="primary" className="g-video__change-btn">
|
|
132
163
|
{__('Změnit video', 'brilo-blocks')}
|
|
133
164
|
</Button>
|
|
@@ -23,13 +23,18 @@
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
.g-video__overlay {
|
|
27
|
+
position: absolute;
|
|
28
|
+
inset: 0;
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
26
32
|
.g-video__play-icon {
|
|
27
33
|
position: absolute;
|
|
28
34
|
inset: 0;
|
|
29
35
|
display: flex;
|
|
30
36
|
align-items: center;
|
|
31
37
|
justify-content: center;
|
|
32
|
-
background: rgba(0, 0, 0, 0.2);
|
|
33
38
|
pointer-events: none;
|
|
34
39
|
|
|
35
40
|
&::after {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
2
2
|
import {__} from '@wordpress/i18n'
|
|
3
|
-
import {SIZES, VIDEO_TYPES} from './constants'
|
|
3
|
+
import {DEFAULT_OVERLAY_COLOR, SIZES, VIDEO_TYPES} from './constants'
|
|
4
4
|
import {createVideoGroupEdit} from './edit'
|
|
5
5
|
import {icon as defaultIcon} from './icon'
|
|
6
6
|
import type {VideoGroupAttributes, VideoGroupOptions} from './types'
|
|
@@ -44,6 +44,14 @@ export function createVideoGroupBlock(options: VideoGroupOptions): BlockConfigur
|
|
|
44
44
|
id: 0,
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
|
+
playButtonTitle: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
default: __('Přehrát video', 'brilo-blocks'),
|
|
50
|
+
},
|
|
51
|
+
overlayColor: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
default: DEFAULT_OVERLAY_COLOR,
|
|
54
|
+
},
|
|
47
55
|
},
|
|
48
56
|
edit: createVideoGroupEdit(options),
|
|
49
57
|
save: () => null,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {PanelBody, RangeControl} from '@wordpress/components'
|
|
2
|
+
import {__} from '@wordpress/i18n'
|
|
3
|
+
|
|
4
|
+
export const ITEM_SPACING_MIN = 0
|
|
5
|
+
export const ITEM_SPACING_MAX = 48
|
|
6
|
+
export const ITEM_SPACING_STEP = 4
|
|
7
|
+
|
|
8
|
+
const ITEM_SPACING_MARKS = [
|
|
9
|
+
{value: 0, label: '0'},
|
|
10
|
+
{value: 8, label: '8'},
|
|
11
|
+
{value: 16, label: '16'},
|
|
12
|
+
{value: 24, label: '24'},
|
|
13
|
+
{value: 32, label: '32'},
|
|
14
|
+
{value: 40, label: '40'},
|
|
15
|
+
{value: 48, label: '48'},
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Shared `spacing` attribute for group blocks. Intentionally has no `default`,
|
|
20
|
+
* so an unset value means "keep the block's default gap-* class".
|
|
21
|
+
*/
|
|
22
|
+
export const ITEM_SPACING_ATTRIBUTE = {
|
|
23
|
+
spacing: {type: 'number'},
|
|
24
|
+
} as const
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Editor container style fragment. Returns `undefined` when spacing is unset so
|
|
28
|
+
* the block keeps its default gap. Spread into an existing `containerStyle`.
|
|
29
|
+
*/
|
|
30
|
+
export function itemSpacingStyle(spacing: number | undefined): Record<string, string> | undefined {
|
|
31
|
+
return typeof spacing === 'number' ? {gap: `${spacing}px`} : undefined
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function ItemSpacingPanel({
|
|
35
|
+
spacing,
|
|
36
|
+
onChange,
|
|
37
|
+
initialOpen = false,
|
|
38
|
+
}: {
|
|
39
|
+
spacing: number | undefined
|
|
40
|
+
onChange: (spacing: number | undefined) => void
|
|
41
|
+
initialOpen?: boolean
|
|
42
|
+
}) {
|
|
43
|
+
return (
|
|
44
|
+
<PanelBody title={__('Mezery', 'brilo-blocks')} initialOpen={initialOpen}>
|
|
45
|
+
<RangeControl
|
|
46
|
+
label={__('Mezera mezi položkami (px)', 'brilo-blocks')}
|
|
47
|
+
help={__('Není-li nastaveno, použije se výchozí mezera bloku.', 'brilo-blocks')}
|
|
48
|
+
value={spacing}
|
|
49
|
+
onChange={onChange}
|
|
50
|
+
min={ITEM_SPACING_MIN}
|
|
51
|
+
max={ITEM_SPACING_MAX}
|
|
52
|
+
step={ITEM_SPACING_STEP}
|
|
53
|
+
marks={ITEM_SPACING_MARKS}
|
|
54
|
+
allowReset
|
|
55
|
+
withInputField
|
|
56
|
+
/>
|
|
57
|
+
</PanelBody>
|
|
58
|
+
)
|
|
59
|
+
}
|
package/src/editor.scss
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
@forward "./blocks/contact/contact-item/editor";
|
|
11
11
|
@forward "./blocks/core/basic-button/editor";
|
|
12
12
|
@forward "./blocks/core/basic-heading/editor";
|
|
13
|
+
@forward "./blocks/core/basic-icon/editor";
|
|
13
14
|
@forward "./blocks/core/basic-overline/editor";
|
|
14
15
|
@forward "./blocks/faq/faq-group/editor";
|
|
15
16
|
@forward "./blocks/faq/faq-item/editor";
|
|
@@ -34,6 +35,8 @@
|
|
|
34
35
|
@forward "./blocks/text-and-form/text-and-form-text-column/editor";
|
|
35
36
|
@forward "./blocks/usp/usp-group/editor";
|
|
36
37
|
@forward "./blocks/usp/usp-item/editor";
|
|
38
|
+
@forward "./blocks/list/list-group/editor";
|
|
39
|
+
@forward "./blocks/list/list-item/editor";
|
|
37
40
|
@forward "./blocks/person/person-group/editor";
|
|
38
41
|
@forward "./blocks/person/person-item/editor";
|
|
39
42
|
@forward "./blocks/event/event-calendar-group/editor";
|
package/src/index.ts
CHANGED
|
@@ -48,6 +48,13 @@ export type {BasicHeadingAttributes, BasicHeadingOptions} from './blocks/core/ba
|
|
|
48
48
|
export {basicHeadingDefaults, createBasicHeadingBlock} from './blocks/core/basic-heading'
|
|
49
49
|
export type {BasicOverlineAttributes, BasicOverlineOptions} from './blocks/core/basic-overline'
|
|
50
50
|
export {basicOverlineDefaults, createBasicOverlineBlock} from './blocks/core/basic-overline'
|
|
51
|
+
export type {
|
|
52
|
+
BasicIconAlignment,
|
|
53
|
+
BasicIconAttributes,
|
|
54
|
+
BasicIconBackgroundShape,
|
|
55
|
+
BasicIconOptions,
|
|
56
|
+
} from './blocks/core/basic-icon'
|
|
57
|
+
export {basicIconDefaults, createBasicIconBlock} from './blocks/core/basic-icon'
|
|
51
58
|
export type {HeroItemAttributes, HeroItemOptions} from './blocks/hero/hero-item'
|
|
52
59
|
export {createHeroItemBlock, heroItemDefaults} from './blocks/hero/hero-item'
|
|
53
60
|
export type {HeroGroupAttributes, HeroGroupOptions} from './blocks/hero/hero-group'
|
|
@@ -72,6 +79,10 @@ export type {UspGroupAttributes, UspGroupOptions} from './blocks/usp/usp-group'
|
|
|
72
79
|
export {createUspGroupBlock, uspGroupDefaults} from './blocks/usp/usp-group'
|
|
73
80
|
export type {UspItemAttributes, UspItemOptions} from './blocks/usp/usp-item'
|
|
74
81
|
export {createUspItemBlock, uspItemDefaults} from './blocks/usp/usp-item'
|
|
82
|
+
export type {ListContentSize, ListGroupAttributes, ListGroupOptions} from './blocks/list/list-group'
|
|
83
|
+
export {createListGroupBlock, listGroupDefaults} from './blocks/list/list-group'
|
|
84
|
+
export type {ListBulletShape, ListItemAttributes, ListItemOptions} from './blocks/list/list-item'
|
|
85
|
+
export {createListItemBlock, listItemDefaults} from './blocks/list/list-item'
|
|
75
86
|
export type {GalleryGroupAttributes, GalleryGroupOptions} from './blocks/gallery/gallery-group'
|
|
76
87
|
export {createGalleryGroupBlock, galleryGroupDefaults} from './blocks/gallery/gallery-group'
|
|
77
88
|
export type {GalleryItemAttributes, GalleryItemOptions} from './blocks/gallery/gallery-item'
|