@brilo/base-blocks 0.1.7 → 0.1.9
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/blocks/column/column-item/constants.d.ts +13 -0
- package/build/blocks/column/column-item/constants.d.ts.map +1 -1
- package/build/blocks/column/column-item/constants.js +19 -0
- package/build/blocks/column/column-item/edit.d.ts.map +1 -1
- package/build/blocks/column/column-item/edit.js +6 -6
- package/build/blocks/column/column-item/factory.d.ts.map +1 -1
- package/build/blocks/column/column-item/factory.js +5 -0
- package/build/blocks/column/column-item/index.d.ts.map +1 -1
- package/build/blocks/column/column-item/index.js +11 -1
- package/build/blocks/column/column-item/types.d.ts +1 -0
- package/build/blocks/column/column-item/types.d.ts.map +1 -1
- package/build/blocks/contact/contact-item/factory.d.ts +7 -2
- package/build/blocks/contact/contact-item/factory.d.ts.map +1 -1
- package/build/blocks/contact/contact-item/factory.js +2 -2
- package/build/blocks/core/basic-button/edit.d.ts.map +1 -1
- package/build/blocks/core/basic-button/edit.js +12 -5
- package/build/blocks/core/basic-button/factory.d.ts.map +1 -1
- package/build/blocks/core/basic-button/factory.js +4 -0
- package/build/blocks/core/basic-button/index.d.ts.map +1 -1
- package/build/blocks/core/basic-button/index.js +2 -0
- package/build/blocks/core/basic-button/types.d.ts +12 -1
- package/build/blocks/core/basic-button/types.d.ts.map +1 -1
- package/build/blocks/gallery/gallery-group/constants.d.ts +21 -0
- package/build/blocks/gallery/gallery-group/constants.d.ts.map +1 -0
- package/build/blocks/gallery/gallery-group/constants.js +9 -0
- package/build/blocks/gallery/gallery-group/edit.d.ts +7 -0
- package/build/blocks/gallery/gallery-group/edit.d.ts.map +1 -0
- package/build/blocks/gallery/gallery-group/edit.js +46 -0
- package/build/blocks/gallery/gallery-group/factory.d.ts +5 -0
- package/build/blocks/gallery/gallery-group/factory.d.ts.map +1 -0
- package/build/blocks/gallery/gallery-group/factory.js +33 -0
- package/build/blocks/gallery/gallery-group/index.d.ts +5 -0
- package/build/blocks/gallery/gallery-group/index.d.ts.map +1 -0
- package/build/blocks/gallery/gallery-group/index.js +7 -0
- package/build/blocks/gallery/gallery-group/types.d.ts +15 -0
- package/build/blocks/gallery/gallery-group/types.d.ts.map +1 -0
- package/build/blocks/gallery/gallery-group/types.js +1 -0
- package/build/blocks/gallery/gallery-item/edit.d.ts +6 -0
- package/build/blocks/gallery/gallery-item/edit.d.ts.map +1 -0
- package/build/blocks/gallery/gallery-item/edit.js +13 -0
- package/build/blocks/gallery/gallery-item/factory.d.ts +5 -0
- package/build/blocks/gallery/gallery-item/factory.d.ts.map +1 -0
- package/build/blocks/gallery/gallery-item/factory.js +22 -0
- package/build/blocks/gallery/gallery-item/index.d.ts +5 -0
- package/build/blocks/gallery/gallery-item/index.d.ts.map +1 -0
- package/build/blocks/gallery/gallery-item/index.js +6 -0
- package/build/blocks/gallery/gallery-item/types.d.ts +7 -0
- package/build/blocks/gallery/gallery-item/types.d.ts.map +1 -0
- package/build/blocks/gallery/gallery-item/types.js +1 -0
- package/build/blocks/groups/content-group/factory.d.ts +2 -2
- package/build/blocks/groups/content-group/factory.d.ts.map +1 -1
- package/build/blocks/groups/content-group/factory.js +8 -8
- package/build/blocks/groups/content-group/icon.d.ts.map +1 -1
- package/build/blocks/link/link-item/constants.d.ts +11 -0
- package/build/blocks/link/link-item/constants.d.ts.map +1 -0
- package/build/blocks/link/link-item/constants.js +6 -0
- package/build/blocks/link/link-item/edit.d.ts +6 -0
- package/build/blocks/link/link-item/edit.d.ts.map +1 -0
- package/build/blocks/link/link-item/edit.js +25 -0
- package/build/blocks/link/link-item/factory.d.ts +4 -0
- package/build/blocks/link/link-item/factory.d.ts.map +1 -0
- package/build/blocks/link/link-item/factory.js +28 -0
- package/build/blocks/link/link-item/icon.d.ts +2 -0
- package/build/blocks/link/link-item/icon.d.ts.map +1 -0
- package/build/blocks/link/link-item/icon.js +2 -0
- package/build/blocks/link/link-item/index.d.ts +5 -0
- package/build/blocks/link/link-item/index.d.ts.map +1 -0
- package/build/blocks/link/link-item/index.js +6 -0
- package/build/blocks/link/link-item/types.d.ts +26 -0
- package/build/blocks/link/link-item/types.d.ts.map +1 -0
- package/build/blocks/link/link-item/types.js +1 -0
- package/build/blocks/map/map-group/constants.d.ts +1 -0
- package/build/blocks/map/map-group/constants.d.ts.map +1 -1
- package/build/blocks/map/map-group/constants.js +2 -0
- package/build/blocks/map/map-group/edit.d.ts.map +1 -1
- package/build/blocks/map/map-group/edit.js +19 -11
- package/build/blocks/map/map-group/factory.d.ts +3 -1
- package/build/blocks/map/map-group/factory.d.ts.map +1 -1
- package/build/blocks/map/map-group/factory.js +24 -5
- package/build/blocks/map/map-group/index.d.ts.map +1 -1
- package/build/blocks/map/map-group/index.js +1 -0
- package/build/blocks/map/map-group/types.d.ts +18 -4
- package/build/blocks/map/map-group/types.d.ts.map +1 -1
- package/build/blocks/person/person-group/constants.d.ts +3 -0
- package/build/blocks/person/person-group/constants.d.ts.map +1 -0
- package/build/blocks/person/person-group/constants.js +2 -0
- package/build/blocks/person/person-group/edit.d.ts +6 -0
- package/build/blocks/person/person-group/edit.d.ts.map +1 -0
- package/build/blocks/person/person-group/edit.js +23 -0
- package/build/blocks/person/person-group/factory.d.ts +5 -0
- package/build/blocks/person/person-group/factory.d.ts.map +1 -0
- package/build/blocks/person/person-group/factory.js +32 -0
- package/build/blocks/person/person-group/icon.d.ts +2 -0
- package/build/blocks/person/person-group/icon.d.ts.map +1 -0
- package/build/blocks/person/person-group/icon.js +2 -0
- package/build/blocks/person/person-group/index.d.ts +5 -0
- package/build/blocks/person/person-group/index.d.ts.map +1 -0
- package/build/blocks/person/person-group/index.js +11 -0
- package/build/blocks/person/person-group/types.d.ts +8 -0
- package/build/blocks/person/person-group/types.d.ts.map +1 -0
- package/build/blocks/person/person-group/types.js +1 -0
- package/build/blocks/person/person-item/constants.d.ts +2 -0
- package/build/blocks/person/person-item/constants.d.ts.map +1 -0
- package/build/blocks/person/person-item/constants.js +1 -0
- package/build/blocks/person/person-item/edit.d.ts +6 -0
- package/build/blocks/person/person-item/edit.d.ts.map +1 -0
- package/build/blocks/person/person-item/edit.js +23 -0
- package/build/blocks/person/person-item/factory.d.ts +5 -0
- package/build/blocks/person/person-item/factory.d.ts.map +1 -0
- package/build/blocks/person/person-item/factory.js +26 -0
- package/build/blocks/person/person-item/icon.d.ts +2 -0
- package/build/blocks/person/person-item/icon.d.ts.map +1 -0
- package/build/blocks/person/person-item/icon.js +3 -0
- package/build/blocks/person/person-item/index.d.ts +5 -0
- package/build/blocks/person/person-item/index.d.ts.map +1 -0
- package/build/blocks/person/person-item/index.js +6 -0
- package/build/blocks/person/person-item/types.d.ts +12 -0
- package/build/blocks/person/person-item/types.d.ts.map +1 -0
- package/build/blocks/person/person-item/types.js +1 -0
- package/build/blocks/sections/base-section/attributes.d.ts +5 -1
- package/build/blocks/sections/base-section/attributes.d.ts.map +1 -1
- package/build/blocks/sections/base-section/attributes.js +5 -1
- package/build/blocks/sections/base-section/constants.d.ts +0 -16
- package/build/blocks/sections/base-section/constants.d.ts.map +1 -1
- package/build/blocks/sections/base-section/constants.js +0 -7
- package/build/blocks/sections/base-section/controls.d.ts.map +1 -1
- package/build/blocks/sections/base-section/controls.js +6 -3
- package/build/blocks/sections/base-section/edit.d.ts.map +1 -1
- package/build/blocks/sections/base-section/edit.js +8 -1
- package/build/blocks/sections/base-section/factory.d.ts.map +1 -1
- package/build/blocks/sections/base-section/factory.js +3 -8
- package/build/blocks/sections/base-section/index.d.ts +1 -1
- package/build/blocks/sections/base-section/index.d.ts.map +1 -1
- package/build/blocks/sections/base-section/index.js +1 -1
- package/build/blocks/sections/base-section/types.d.ts +1 -0
- package/build/blocks/sections/base-section/types.d.ts.map +1 -1
- package/build/components/ImagePicker/ImagePicker.d.ts +5 -0
- package/build/components/ImagePicker/ImagePicker.d.ts.map +1 -1
- package/build/components/ImagePicker/ImagePicker.js +18 -11
- package/build/hooks/useTenantColorPalette.d.ts +9 -0
- package/build/hooks/useTenantColorPalette.d.ts.map +1 -0
- package/build/hooks/useTenantColorPalette.js +12 -0
- package/build/index.d.ts +11 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +6 -1
- package/build/types.d.ts +2 -0
- package/build/types.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/blocks/column/column-item/constants.ts +20 -0
- package/src/blocks/column/column-item/edit.tsx +20 -4
- package/src/blocks/column/column-item/factory.tsx +5 -0
- package/src/blocks/column/column-item/index.ts +11 -1
- package/src/blocks/column/column-item/types.ts +1 -0
- package/src/blocks/contact/contact-item/editor.scss +4 -0
- package/src/blocks/contact/contact-item/factory.tsx +13 -5
- package/src/blocks/core/basic-button/edit.tsx +50 -1
- package/src/blocks/core/basic-button/factory.tsx +4 -0
- package/src/blocks/core/basic-button/index.ts +2 -0
- package/src/blocks/core/basic-button/types.ts +13 -1
- package/src/blocks/gallery/gallery-group/constants.ts +10 -0
- package/src/blocks/gallery/gallery-group/edit.tsx +117 -0
- package/src/blocks/gallery/gallery-group/editor.scss +18 -0
- package/src/blocks/gallery/gallery-group/factory.tsx +36 -0
- package/src/blocks/gallery/gallery-group/index.ts +11 -0
- package/src/blocks/gallery/gallery-group/types.ts +21 -0
- package/src/blocks/gallery/gallery-item/edit.tsx +46 -0
- package/src/blocks/gallery/gallery-item/editor.scss +8 -0
- package/src/blocks/gallery/gallery-item/factory.tsx +26 -0
- package/src/blocks/gallery/gallery-item/index.ts +10 -0
- package/src/blocks/gallery/gallery-item/types.ts +7 -0
- package/src/blocks/groups/content-group/factory.tsx +11 -11
- package/src/blocks/groups/content-group/icon.tsx +1 -1
- package/src/blocks/link/link-item/constants.ts +7 -0
- package/src/blocks/link/link-item/edit.tsx +124 -0
- package/src/blocks/link/link-item/editor.scss +11 -0
- package/src/blocks/link/link-item/factory.tsx +30 -0
- package/src/blocks/link/link-item/icon.tsx +6 -0
- package/src/blocks/link/link-item/index.ts +10 -0
- package/src/blocks/link/link-item/types.ts +25 -0
- package/src/blocks/map/map-group/constants.ts +3 -0
- package/src/blocks/map/map-group/edit.tsx +75 -5
- package/src/blocks/map/map-group/editor.scss +7 -0
- package/src/blocks/map/map-group/factory.tsx +26 -4
- package/src/blocks/map/map-group/index.ts +1 -0
- package/src/blocks/map/map-group/types.ts +16 -4
- package/src/blocks/person/person-group/constants.ts +2 -0
- package/src/blocks/person/person-group/edit.tsx +65 -0
- package/src/blocks/person/person-group/editor.scss +0 -0
- package/src/blocks/person/person-group/factory.tsx +35 -0
- package/src/blocks/person/person-group/icon.tsx +14 -0
- package/src/blocks/person/person-group/index.ts +15 -0
- package/src/blocks/person/person-group/types.ts +8 -0
- package/src/blocks/person/person-item/constants.ts +4 -0
- package/src/blocks/person/person-item/edit.tsx +103 -0
- package/src/blocks/person/person-item/editor.scss +35 -0
- package/src/blocks/person/person-item/factory.tsx +29 -0
- package/src/blocks/person/person-item/icon.tsx +7 -0
- package/src/blocks/person/person-item/index.ts +10 -0
- package/src/blocks/person/person-item/types.ts +12 -0
- package/src/blocks/responsive-grid/responsive-grid-item/editor.scss +9 -0
- package/src/blocks/sections/base-section/attributes.ts +5 -1
- package/src/blocks/sections/base-section/constants.ts +0 -8
- package/src/blocks/sections/base-section/controls.tsx +18 -8
- package/src/blocks/sections/base-section/edit.tsx +8 -1
- package/src/blocks/sections/base-section/factory.tsx +3 -7
- package/src/blocks/sections/base-section/index.ts +1 -1
- package/src/blocks/sections/base-section/types.ts +1 -0
- package/src/components/ImagePicker/ImagePicker.tsx +22 -10
- package/src/components/ImagePicker/editor.scss +2 -2
- package/src/editor.scss +6 -0
- package/src/hooks/useTenantColorPalette.ts +21 -0
- package/src/index.ts +10 -1
- package/src/types.ts +3 -0
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import {InspectorControls} from '@wordpress/block-editor'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
PanelBody,
|
|
4
|
+
RangeControl,
|
|
5
|
+
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
6
|
+
__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,
|
|
7
|
+
} from '@wordpress/components'
|
|
3
8
|
import {__} from '@wordpress/i18n'
|
|
4
9
|
import clsx from 'clsx'
|
|
5
10
|
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
6
11
|
import type {ColumnItemAttributes, ColumnItemOptions} from './types'
|
|
7
|
-
import {SIZES} from './constants'
|
|
12
|
+
import {ALIGN, SIZES} from './constants'
|
|
13
|
+
import {Icon} from '@wordpress/icons'
|
|
8
14
|
|
|
9
15
|
export function createColumnItemEdit(options: ColumnItemOptions) {
|
|
10
16
|
return function Edit({
|
|
@@ -14,9 +20,9 @@ export function createColumnItemEdit(options: ColumnItemOptions) {
|
|
|
14
20
|
attributes: ColumnItemAttributes
|
|
15
21
|
setAttributes: (a: Partial<ColumnItemAttributes>) => void
|
|
16
22
|
}) {
|
|
17
|
-
const {size} = attributes
|
|
23
|
+
const {size, align} = attributes
|
|
18
24
|
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
19
|
-
blockClassName: clsx(options.blockClassName ?? 'i-column', `--size-${size}`),
|
|
25
|
+
blockClassName: clsx(options.blockClassName ?? 'i-column', `--size-${size}`, align && `--align-${align}`),
|
|
20
26
|
containerClassName: options.containerClassName ?? 'i-column__inner',
|
|
21
27
|
allowedBlocks: options.allowedBlocks,
|
|
22
28
|
template: options.template,
|
|
@@ -37,6 +43,16 @@ export function createColumnItemEdit(options: ColumnItemOptions) {
|
|
|
37
43
|
withInputField={false}
|
|
38
44
|
marks={SIZES.map((s, i) => ({label: s, value: i}))}
|
|
39
45
|
/>
|
|
46
|
+
<ToggleGroupControl
|
|
47
|
+
label={__('Zarovnání', 'brilo-blocks')}
|
|
48
|
+
value={align}
|
|
49
|
+
onChange={(v) => setAttributes({align: v as string})}
|
|
50
|
+
isBlock
|
|
51
|
+
>
|
|
52
|
+
{ALIGN.map((item) => (
|
|
53
|
+
<ToggleGroupControlOptionIcon key={item.value} value={item.value} label={item.label} icon={item.icon} />
|
|
54
|
+
))}
|
|
55
|
+
</ToggleGroupControl>
|
|
40
56
|
</PanelBody>
|
|
41
57
|
</InspectorControls>
|
|
42
58
|
<div {...blockProps}>
|
|
@@ -3,6 +3,7 @@ import type {BlockConfiguration} from '@wordpress/blocks'
|
|
|
3
3
|
import {__} from '@wordpress/i18n'
|
|
4
4
|
import {createColumnItemEdit} from './edit'
|
|
5
5
|
import type {ColumnItemAttributes, ColumnItemOptions} from './types'
|
|
6
|
+
import {ALIGN} from './constants'
|
|
6
7
|
|
|
7
8
|
export function createColumnItemBlock(options: ColumnItemOptions): BlockConfiguration<ColumnItemAttributes> {
|
|
8
9
|
return {
|
|
@@ -18,6 +19,10 @@ export function createColumnItemBlock(options: ColumnItemOptions): BlockConfigur
|
|
|
18
19
|
type: 'string',
|
|
19
20
|
default: '1/2',
|
|
20
21
|
},
|
|
22
|
+
align: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
default: ALIGN[0],
|
|
25
|
+
},
|
|
21
26
|
},
|
|
22
27
|
edit: createColumnItemEdit(options),
|
|
23
28
|
save: () => <InnerBlocks.Content />,
|
|
@@ -6,5 +6,15 @@ import type {ColumnItemOptions} from './types'
|
|
|
6
6
|
export const columnItemDefaults: ColumnItemOptions = {
|
|
7
7
|
name: 'brilo/column-item',
|
|
8
8
|
parent: ['brilo/column-group'],
|
|
9
|
-
allowedBlocks: [
|
|
9
|
+
allowedBlocks: [
|
|
10
|
+
'core/paragraph',
|
|
11
|
+
'core/list',
|
|
12
|
+
'core/image',
|
|
13
|
+
'core/heading',
|
|
14
|
+
'core/embed',
|
|
15
|
+
'core/quote',
|
|
16
|
+
'core/table',
|
|
17
|
+
'core/gallery',
|
|
18
|
+
'brilo/link-item',
|
|
19
|
+
],
|
|
10
20
|
}
|
|
@@ -12,11 +12,15 @@
|
|
|
12
12
|
grid-column: span var(--col-span, 1);
|
|
13
13
|
margin-inline: 0;
|
|
14
14
|
width: 100%;
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
border: 1px solid #eee;
|
|
17
|
+
padding: 8px;
|
|
15
18
|
|
|
16
19
|
.i-contact__inner {
|
|
17
20
|
display: flex;
|
|
18
21
|
flex-direction: column;
|
|
19
22
|
gap: 8px;
|
|
23
|
+
width: 100%;
|
|
20
24
|
|
|
21
25
|
p,
|
|
22
26
|
h3,
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import {InnerBlocks} from '@wordpress/block-editor'
|
|
2
|
-
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
2
|
+
import type {BlockConfiguration, BlockEditProps} from '@wordpress/blocks'
|
|
3
3
|
import {__} from '@wordpress/i18n'
|
|
4
|
+
import type {Icon} from '~/types'
|
|
5
|
+
import type {IconType} from '~/components/IconControl/IconControl'
|
|
4
6
|
import {CONTACT_COLUMNS_CONTEXT} from '../contact-group/constants'
|
|
5
7
|
import {CONTACT_ICON_SIZE_DEFAULT, CONTACT_ICON_TYPES} from './constants'
|
|
6
|
-
import {createContactItemEdit} from './edit'
|
|
7
8
|
import type {ContactItemAttributes, ContactItemOptions} from './types'
|
|
8
9
|
|
|
9
10
|
export type {ContactItemAttributes, ContactItemOptions}
|
|
10
11
|
|
|
11
|
-
export function createContactItemBlock
|
|
12
|
+
export function createContactItemBlock<T extends ContactItemAttributes = ContactItemAttributes>(
|
|
13
|
+
options: ContactItemOptions & {
|
|
14
|
+
icons: IconType[]
|
|
15
|
+
iconsSrc: string
|
|
16
|
+
edit: (props: BlockEditProps<T>) => JSX.Element
|
|
17
|
+
},
|
|
18
|
+
): BlockConfiguration<T> {
|
|
12
19
|
return {
|
|
13
20
|
name: options.name,
|
|
14
21
|
title: options.title ?? __('Kontaktní položka', 'brilo-blocks'),
|
|
@@ -19,6 +26,7 @@ export function createContactItemBlock(options: ContactItemOptions): BlockConfig
|
|
|
19
26
|
supports: {html: false, customClassName: false},
|
|
20
27
|
usesContext: [CONTACT_COLUMNS_CONTEXT],
|
|
21
28
|
attributes: {
|
|
29
|
+
...(options.attributes as any),
|
|
22
30
|
colSpan: {type: 'number', default: 1},
|
|
23
31
|
icon: {
|
|
24
32
|
type: 'object',
|
|
@@ -29,7 +37,7 @@ export function createContactItemBlock(options: ContactItemOptions): BlockConfig
|
|
|
29
37
|
default: {variant: 'md', custom: CONTACT_ICON_SIZE_DEFAULT},
|
|
30
38
|
},
|
|
31
39
|
},
|
|
32
|
-
edit:
|
|
40
|
+
edit: options.edit,
|
|
33
41
|
save: () => <InnerBlocks.Content />,
|
|
34
|
-
} as
|
|
42
|
+
} as BlockConfiguration<T>
|
|
35
43
|
}
|
|
@@ -5,11 +5,14 @@ import {
|
|
|
5
5
|
ToggleControl,
|
|
6
6
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
7
7
|
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
8
|
+
RangeControl,
|
|
8
9
|
} from '@wordpress/components'
|
|
9
10
|
import {__} from '@wordpress/i18n'
|
|
10
11
|
import clsx from 'clsx'
|
|
11
12
|
import {DEFAULT_FULL_WIDTH_OPTIONS, DEFAULT_SIZES, DEFAULT_VARIANTS} from './constants'
|
|
12
13
|
import type {BasicButtonAttributes, BasicButtonOptions, ButtonFullWidth, ButtonSize, ButtonVariant} from './types'
|
|
14
|
+
import {ItemIconControl, ItemIconPreview} from '~/components/ItemIconControl'
|
|
15
|
+
import {ICON_TYPES} from '~/blocks/link/link-item/constants'
|
|
13
16
|
|
|
14
17
|
export function createBasicButtonEdit(options: BasicButtonOptions) {
|
|
15
18
|
const VARIANTS = options.variants ?? DEFAULT_VARIANTS
|
|
@@ -23,7 +26,12 @@ export function createBasicButtonEdit(options: BasicButtonOptions) {
|
|
|
23
26
|
attributes: BasicButtonAttributes
|
|
24
27
|
setAttributes: (a: Partial<BasicButtonAttributes>) => void
|
|
25
28
|
}) {
|
|
26
|
-
const {title, variant, outline, fullWidth, size, url} = attributes
|
|
29
|
+
const {title, variant, outline, fullWidth, size, url, icon} = attributes
|
|
30
|
+
const hasIcon = icon.type !== 'none' && (icon.src || icon.media?.id)
|
|
31
|
+
|
|
32
|
+
const setIconBase = (attrs: {icon: import('~/types').Icon}) => {
|
|
33
|
+
setAttributes({icon: {...icon, ...attrs.icon} as typeof icon})
|
|
34
|
+
}
|
|
27
35
|
const blockProps = useBlockProps({
|
|
28
36
|
className: clsx(
|
|
29
37
|
options.blockClassName ?? 'i-button',
|
|
@@ -34,6 +42,8 @@ export function createBasicButtonEdit(options: BasicButtonOptions) {
|
|
|
34
42
|
),
|
|
35
43
|
})
|
|
36
44
|
|
|
45
|
+
const iconPreviewStyle = {maxWidth: icon.size, flex: `0 0 ${icon.size}px`} as React.CSSProperties
|
|
46
|
+
|
|
37
47
|
return (
|
|
38
48
|
<>
|
|
39
49
|
<InspectorControls>
|
|
@@ -88,8 +98,42 @@ export function createBasicButtonEdit(options: BasicButtonOptions) {
|
|
|
88
98
|
onChange={(value) => setAttributes({url: {...url, blank: value}})}
|
|
89
99
|
/>
|
|
90
100
|
</PanelBody>
|
|
101
|
+
<PanelBody title={__('Ikona', 'brilo-blocks')} initialOpen={false}>
|
|
102
|
+
<ItemIconControl
|
|
103
|
+
icon={icon as unknown as import('~/types').Icon}
|
|
104
|
+
setAttributes={setIconBase}
|
|
105
|
+
iconTypes={ICON_TYPES}
|
|
106
|
+
options={options}
|
|
107
|
+
/>
|
|
108
|
+
{hasIcon && (
|
|
109
|
+
<>
|
|
110
|
+
<ToggleGroupControl
|
|
111
|
+
isBlock
|
|
112
|
+
label={__('Pozice', 'brilo-blocks')}
|
|
113
|
+
value={icon.position}
|
|
114
|
+
onChange={(v) => setAttributes({icon: {...icon, position: String(v) as 'before' | 'after'}})}
|
|
115
|
+
>
|
|
116
|
+
<ToggleGroupControlOption value="before" label={__('Před', 'brilo-blocks')} />
|
|
117
|
+
<ToggleGroupControlOption value="after" label={__('Za', 'brilo-blocks')} />
|
|
118
|
+
</ToggleGroupControl>
|
|
119
|
+
<RangeControl
|
|
120
|
+
label={__('Velikost (px)', 'brilo-blocks')}
|
|
121
|
+
value={icon.size}
|
|
122
|
+
onChange={(v) => setAttributes({icon: {...icon, size: v ?? 24}})}
|
|
123
|
+
min={8}
|
|
124
|
+
max={80}
|
|
125
|
+
step={1}
|
|
126
|
+
/>
|
|
127
|
+
</>
|
|
128
|
+
)}
|
|
129
|
+
</PanelBody>
|
|
91
130
|
</InspectorControls>
|
|
92
131
|
<div {...blockProps}>
|
|
132
|
+
{hasIcon && icon.position === 'before' && (
|
|
133
|
+
<span className="link-item__icon" style={iconPreviewStyle}>
|
|
134
|
+
<ItemIconPreview icon={icon as unknown as import('~/types').Icon} setAttributes={setIconBase} options={options} />
|
|
135
|
+
</span>
|
|
136
|
+
)}
|
|
93
137
|
<div className="i-button__inner">
|
|
94
138
|
<RichText
|
|
95
139
|
tagName="span"
|
|
@@ -100,6 +144,11 @@ export function createBasicButtonEdit(options: BasicButtonOptions) {
|
|
|
100
144
|
allowedFormats={[]}
|
|
101
145
|
/>
|
|
102
146
|
</div>
|
|
147
|
+
{hasIcon && icon.position === 'after' && (
|
|
148
|
+
<span className="link-item__icon" style={iconPreviewStyle}>
|
|
149
|
+
<ItemIconPreview icon={icon as unknown as import('~/types').Icon} setAttributes={setIconBase} options={options} />
|
|
150
|
+
</span>
|
|
151
|
+
)}
|
|
103
152
|
</div>
|
|
104
153
|
</>
|
|
105
154
|
)
|
|
@@ -45,6 +45,10 @@ export function createBasicButtonBlock<
|
|
|
45
45
|
enum: sizes.map((s) => s.value),
|
|
46
46
|
},
|
|
47
47
|
url: {type: 'object', default: {src: '', blank: false}},
|
|
48
|
+
icon: {
|
|
49
|
+
type: 'object',
|
|
50
|
+
default: {type: 'none', src: '', media: {}, position: 'after', size: 24},
|
|
51
|
+
},
|
|
48
52
|
},
|
|
49
53
|
edit: createBasicButtonEdit(options as unknown as BasicButtonOptions),
|
|
50
54
|
save: () => null,
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import type {BriloBlockType, OptionArray} from '~/types'
|
|
1
|
+
import type {BriloBlockType, Media, OptionArray} from '~/types'
|
|
2
2
|
import type {DEFAULT_FULL_WIDTH_OPTIONS, DEFAULT_SIZES, DEFAULT_VARIANTS} from './constants'
|
|
3
|
+
import type {IconType} from '~/components/IconControl/IconControl'
|
|
3
4
|
|
|
4
5
|
export type ButtonVariant = (typeof DEFAULT_VARIANTS)[number]['value']
|
|
5
6
|
export type ButtonSize = (typeof DEFAULT_SIZES)[number]['value']
|
|
6
7
|
export type ButtonFullWidth = (typeof DEFAULT_FULL_WIDTH_OPTIONS)[number]['value']
|
|
7
8
|
|
|
9
|
+
export interface LinkItemIcon {
|
|
10
|
+
type: 'preselected' | 'media' | 'none'
|
|
11
|
+
src: string
|
|
12
|
+
media: Media
|
|
13
|
+
position: 'before' | 'after'
|
|
14
|
+
size: number
|
|
15
|
+
}
|
|
16
|
+
|
|
8
17
|
export interface BasicButtonAttributes<
|
|
9
18
|
TVariant extends string = ButtonVariant,
|
|
10
19
|
TSize extends string = ButtonSize,
|
|
@@ -15,6 +24,7 @@ export interface BasicButtonAttributes<
|
|
|
15
24
|
outline: boolean
|
|
16
25
|
fullWidth: TFullWidth
|
|
17
26
|
size: TSize
|
|
27
|
+
icon: LinkItemIcon
|
|
18
28
|
url: {src: string; blank: boolean}
|
|
19
29
|
}
|
|
20
30
|
|
|
@@ -26,4 +36,6 @@ export interface BasicButtonOptions<
|
|
|
26
36
|
variants?: TVariants
|
|
27
37
|
sizes?: TSizes
|
|
28
38
|
fullWidthOptions?: TFullWidthOptions
|
|
39
|
+
icons: IconType[]
|
|
40
|
+
iconsSrc: string
|
|
29
41
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const DEFAULT_COLUMNS = [2, 3, 4, 6] as const
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_RATIOS = [
|
|
4
|
+
{value: '4:3', label: '4:3'},
|
|
5
|
+
{value: '16:9', label: '16:9'},
|
|
6
|
+
{value: '3:2', label: '3:2'},
|
|
7
|
+
{value: '1:1', label: '1:1'},
|
|
8
|
+
{value: '2:1', label: '2:1'},
|
|
9
|
+
{value: '3:4', label: '3:4'},
|
|
10
|
+
] as const
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import {InspectorControls, MediaUpload} from '@wordpress/block-editor'
|
|
2
|
+
import {
|
|
3
|
+
PanelBody,
|
|
4
|
+
TextControl,
|
|
5
|
+
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
6
|
+
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
7
|
+
} from '@wordpress/components'
|
|
8
|
+
import {__} from '@wordpress/i18n'
|
|
9
|
+
import {useDispatch} from '@wordpress/data'
|
|
10
|
+
import {createBlock} from '@wordpress/blocks'
|
|
11
|
+
import clsx from 'clsx'
|
|
12
|
+
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
13
|
+
import {DEFAULT_COLUMNS, DEFAULT_RATIOS} from './constants'
|
|
14
|
+
import type {GalleryGroupAttributes, GalleryGroupOptions, GalleryRatio} from './types'
|
|
15
|
+
|
|
16
|
+
type Media = {
|
|
17
|
+
id: number
|
|
18
|
+
url: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function createGalleryGroupEdit(options: GalleryGroupOptions) {
|
|
22
|
+
const COLUMNS = options.columns ?? DEFAULT_COLUMNS
|
|
23
|
+
const RATIOS = options.ratios ?? DEFAULT_RATIOS
|
|
24
|
+
|
|
25
|
+
return function Edit({
|
|
26
|
+
attributes,
|
|
27
|
+
setAttributes,
|
|
28
|
+
clientId,
|
|
29
|
+
}: {
|
|
30
|
+
attributes: GalleryGroupAttributes
|
|
31
|
+
setAttributes: (a: Partial<GalleryGroupAttributes>) => void
|
|
32
|
+
clientId: string
|
|
33
|
+
}) {
|
|
34
|
+
const {columns, ratio, galleryId} = attributes
|
|
35
|
+
const {insertBlock} = useDispatch('core/block-editor')
|
|
36
|
+
|
|
37
|
+
const addNewBlock = (imageId: number) => {
|
|
38
|
+
const newBlock = createBlock(options.allowedBlocks[0], {
|
|
39
|
+
img: {
|
|
40
|
+
id: imageId,
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
insertBlock(newBlock, undefined, clientId)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const onSelectImages = (media: Media[]) => {
|
|
48
|
+
media.forEach((item) => addNewBlock(item.id))
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const CustomAppender = () => {
|
|
52
|
+
return (
|
|
53
|
+
<MediaUpload
|
|
54
|
+
onSelect={onSelectImages}
|
|
55
|
+
multiple="add"
|
|
56
|
+
allowedTypes={['image']}
|
|
57
|
+
render={({open}) => (
|
|
58
|
+
<div onClick={open} className="g-gallery__appender">
|
|
59
|
+
{__('Přidat obrázky', 'brilo-blocks')}
|
|
60
|
+
</div>
|
|
61
|
+
)}
|
|
62
|
+
/>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
67
|
+
blockClassName: clsx(options.blockClassName ?? 'g-gallery wp-block-section'),
|
|
68
|
+
containerClassName: [options.containerClassName ?? 'u-grid-responsive', `--cols-${columns}`],
|
|
69
|
+
containerStyle: {
|
|
70
|
+
'--grid-max-col-count': columns,
|
|
71
|
+
'--gallery-aspect-ratio': ratio.replace(':', '/'),
|
|
72
|
+
},
|
|
73
|
+
allowedBlocks: options.allowedBlocks,
|
|
74
|
+
renderAppender: CustomAppender,
|
|
75
|
+
template: options.template,
|
|
76
|
+
layout: {type: 'default'},
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<>
|
|
81
|
+
<InspectorControls>
|
|
82
|
+
<PanelBody title={__('Rozložení', 'brilo-blocks')}>
|
|
83
|
+
<ToggleGroupControl
|
|
84
|
+
isBlock
|
|
85
|
+
label={__('Počet sloupců', 'brilo-blocks')}
|
|
86
|
+
value={String(columns)}
|
|
87
|
+
onChange={(v) => setAttributes({columns: Number(v) as GalleryGroupAttributes['columns']})}
|
|
88
|
+
>
|
|
89
|
+
{COLUMNS.map((c) => (
|
|
90
|
+
<ToggleGroupControlOption key={c} value={String(c)} label={String(c)} />
|
|
91
|
+
))}
|
|
92
|
+
</ToggleGroupControl>
|
|
93
|
+
<ToggleGroupControl
|
|
94
|
+
isBlock
|
|
95
|
+
label={__('Poměr stran', 'brilo-blocks')}
|
|
96
|
+
value={ratio}
|
|
97
|
+
onChange={(v) => setAttributes({ratio: v as GalleryRatio})}
|
|
98
|
+
>
|
|
99
|
+
{RATIOS.map((r) => (
|
|
100
|
+
<ToggleGroupControlOption key={r.value} value={r.value} label={r.label} />
|
|
101
|
+
))}
|
|
102
|
+
</ToggleGroupControl>
|
|
103
|
+
<TextControl
|
|
104
|
+
label={__('Gallery ID', 'brilo-blocks')}
|
|
105
|
+
value={galleryId}
|
|
106
|
+
onChange={(v) => setAttributes({galleryId: v})}
|
|
107
|
+
help={__('ID pro oddělení/spojení galerií', 'brilo-blocks')}
|
|
108
|
+
/>
|
|
109
|
+
</PanelBody>
|
|
110
|
+
</InspectorControls>
|
|
111
|
+
<div {...blockProps}>
|
|
112
|
+
<div {...innerBlocksProps} />
|
|
113
|
+
</div>
|
|
114
|
+
</>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.g-gallery__appender {
|
|
2
|
+
padding: 16px;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
border: 2px dashed lightblue;
|
|
7
|
+
height: 100%;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
min-height: 256px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.g-gallery {
|
|
14
|
+
.block-list-appender {
|
|
15
|
+
width: 100%;
|
|
16
|
+
position: relative;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
2
|
+
import {__} from '@wordpress/i18n'
|
|
3
|
+
import {createGalleryGroupEdit} from './edit'
|
|
4
|
+
import {DEFAULT_COLUMNS, DEFAULT_RATIOS} from './constants'
|
|
5
|
+
import type {GalleryGroupAttributes, GalleryGroupOptions} from './types'
|
|
6
|
+
import {InnerBlocks} from '@wordpress/block-editor'
|
|
7
|
+
|
|
8
|
+
export type {GalleryGroupAttributes, GalleryGroupOptions}
|
|
9
|
+
|
|
10
|
+
export function createGalleryGroupBlock(options: GalleryGroupOptions): BlockConfiguration<GalleryGroupAttributes> {
|
|
11
|
+
return {
|
|
12
|
+
name: options.name,
|
|
13
|
+
title: options.title ?? __('Gallery Group', 'brilo-blocks'),
|
|
14
|
+
description: options.description,
|
|
15
|
+
category: options.category ?? 'layout',
|
|
16
|
+
...(options.parent && {parent: options.parent}),
|
|
17
|
+
icon: options.icon ?? 'format-gallery',
|
|
18
|
+
supports: {html: false, customClassName: false},
|
|
19
|
+
attributes: {
|
|
20
|
+
columns: {
|
|
21
|
+
type: 'number',
|
|
22
|
+
default: options.columns ? options.columns[0] : DEFAULT_COLUMNS[1], // Default to 3 if not specified
|
|
23
|
+
},
|
|
24
|
+
ratio: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
default: options.ratios ? options.ratios[0].value : DEFAULT_RATIOS[0].value,
|
|
27
|
+
},
|
|
28
|
+
galleryId: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
default: 'gallery',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
edit: createGalleryGroupEdit(options),
|
|
34
|
+
save: () => <InnerBlocks.Content />,
|
|
35
|
+
} as unknown as BlockConfiguration<GalleryGroupAttributes>
|
|
36
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type {GalleryGroupAttributes, GalleryGroupOptions} from './types'
|
|
2
|
+
export {createGalleryGroupBlock} from './factory'
|
|
3
|
+
|
|
4
|
+
import type {GalleryGroupOptions} from './types'
|
|
5
|
+
|
|
6
|
+
export const galleryGroupDefaults: GalleryGroupOptions = {
|
|
7
|
+
name: 'brilo/gallery-group',
|
|
8
|
+
parent: ['brilo/base-section'],
|
|
9
|
+
allowedBlocks: ['brilo/gallery-item'],
|
|
10
|
+
template: [],
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type {BriloBlockType, NumberArray, OptionArray} from '~/types'
|
|
2
|
+
import type {DEFAULT_COLUMNS, DEFAULT_RATIOS} from './constants'
|
|
3
|
+
|
|
4
|
+
export type GalleryColumns = (typeof DEFAULT_COLUMNS)[number]
|
|
5
|
+
export type GalleryRatio = (typeof DEFAULT_RATIOS)[number]['value']
|
|
6
|
+
|
|
7
|
+
export interface GalleryGroupAttributes<TColumn extends number = GalleryColumns, TRatio extends string = GalleryRatio>
|
|
8
|
+
extends Record<string, unknown> {
|
|
9
|
+
columns: TColumn
|
|
10
|
+
ratio: TRatio
|
|
11
|
+
galleryId: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface GalleryGroupOptions<
|
|
15
|
+
TColumns extends NumberArray = typeof DEFAULT_COLUMNS,
|
|
16
|
+
TRatios extends OptionArray = typeof DEFAULT_RATIOS,
|
|
17
|
+
> extends BriloBlockType {
|
|
18
|
+
allowedBlocks: string[]
|
|
19
|
+
columns?: TColumns
|
|
20
|
+
ratios?: TRatios
|
|
21
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {InspectorControls, useBlockProps} from '@wordpress/block-editor'
|
|
2
|
+
import {PanelBody} from '@wordpress/components'
|
|
3
|
+
import {__} from '@wordpress/i18n'
|
|
4
|
+
import clsx from 'clsx'
|
|
5
|
+
import type {GalleryItemAttributes, GalleryItemOptions} from './types'
|
|
6
|
+
import {ImagePickerControl} from '~/components/ImagePicker/ImagePicker'
|
|
7
|
+
|
|
8
|
+
export function createGalleryItemEdit(_options: GalleryItemOptions) {
|
|
9
|
+
return function Edit({
|
|
10
|
+
attributes,
|
|
11
|
+
setAttributes,
|
|
12
|
+
}: {
|
|
13
|
+
attributes: GalleryItemAttributes
|
|
14
|
+
setAttributes: (a: Partial<GalleryItemAttributes>) => void
|
|
15
|
+
}) {
|
|
16
|
+
const {img} = attributes
|
|
17
|
+
|
|
18
|
+
const blockProps = useBlockProps({className: clsx('i-gallery')})
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
<InspectorControls>
|
|
23
|
+
<PanelBody title={__('Obrázek', 'brilo-blocks')}>
|
|
24
|
+
<ImagePickerControl value={img} onChange={(val) => setAttributes({img: val})} />
|
|
25
|
+
</PanelBody>
|
|
26
|
+
</InspectorControls>
|
|
27
|
+
|
|
28
|
+
<div {...blockProps}>
|
|
29
|
+
<div className="i-gallery__image-wrapper">
|
|
30
|
+
{img.id ? (
|
|
31
|
+
<ImagePickerControl value={img} onChange={(val) => setAttributes({img: val})} />
|
|
32
|
+
) : (
|
|
33
|
+
<div className="i-gallery__image-placeholder">
|
|
34
|
+
<ImagePickerControl
|
|
35
|
+
labels={{select: __('Vybrat obrázek', 'brilo-blocks')}}
|
|
36
|
+
value={img}
|
|
37
|
+
onChange={(val) => setAttributes({img: val})}
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
)}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
2
|
+
import {__} from '@wordpress/i18n'
|
|
3
|
+
import {createGalleryItemEdit} from './edit'
|
|
4
|
+
import type {GalleryItemAttributes, GalleryItemOptions} from './types'
|
|
5
|
+
|
|
6
|
+
export type {GalleryItemAttributes, GalleryItemOptions}
|
|
7
|
+
|
|
8
|
+
export function createGalleryItemBlock(options: GalleryItemOptions): BlockConfiguration<GalleryItemAttributes> {
|
|
9
|
+
return {
|
|
10
|
+
name: options.name,
|
|
11
|
+
title: options.title ?? __('Gallery Item', 'brilo-blocks'),
|
|
12
|
+
description: options.description,
|
|
13
|
+
category: options.category ?? 'layout',
|
|
14
|
+
...(options.parent && {parent: options.parent}),
|
|
15
|
+
icon: options.icon ?? 'format-image',
|
|
16
|
+
supports: {html: false, customClassName: false},
|
|
17
|
+
attributes: {
|
|
18
|
+
img: {
|
|
19
|
+
type: 'object',
|
|
20
|
+
default: {id: 0, alt: ''},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
edit: createGalleryItemEdit(options),
|
|
24
|
+
save: () => null,
|
|
25
|
+
} as unknown as BlockConfiguration<GalleryItemAttributes>
|
|
26
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {GalleryItemOptions} from './types'
|
|
2
|
+
|
|
3
|
+
export type {GalleryItemAttributes, GalleryItemOptions} from './types'
|
|
4
|
+
export {createGalleryItemBlock} from './factory'
|
|
5
|
+
|
|
6
|
+
export const galleryItemDefaults: GalleryItemOptions = {
|
|
7
|
+
name: 'brilo/gallery-item',
|
|
8
|
+
parent: ['brilo/gallery-group'],
|
|
9
|
+
template: [],
|
|
10
|
+
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {InnerBlocks} from
|
|
2
|
-
import type {BlockConfiguration} from
|
|
3
|
-
import {__} from
|
|
4
|
-
import {createContentGroupEdit} from
|
|
5
|
-
import type {ContentGroupAttributes, ContentGroupOptions} from
|
|
6
|
-
import {icon as defaultIcon} from
|
|
1
|
+
import {InnerBlocks} from '@wordpress/block-editor'
|
|
2
|
+
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
3
|
+
import {__} from '@wordpress/i18n'
|
|
4
|
+
import {createContentGroupEdit} from './edit'
|
|
5
|
+
import type {ContentGroupAttributes, ContentGroupOptions} from './types'
|
|
6
|
+
import {icon as defaultIcon} from './icon'
|
|
7
7
|
|
|
8
8
|
export function createContentGroupBlock(options: ContentGroupOptions): BlockConfiguration<ContentGroupAttributes> {
|
|
9
9
|
return {
|
|
10
10
|
name: options.name,
|
|
11
|
-
title: options.title ?? __(
|
|
11
|
+
title: options.title ?? __('Obsahová skupina', 'brilo-blocks'),
|
|
12
12
|
description: options.description,
|
|
13
|
-
category: options.category ??
|
|
13
|
+
category: options.category ?? 'layout',
|
|
14
14
|
icon: options.icon ?? {src: defaultIcon},
|
|
15
15
|
...(options.parent && {parent: options.parent}),
|
|
16
16
|
supports: {html: false, customClassName: false},
|
|
17
17
|
attributes: {
|
|
18
18
|
size: {
|
|
19
|
-
type:
|
|
20
|
-
default:
|
|
19
|
+
type: 'string',
|
|
20
|
+
default: '8',
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
edit: createContentGroupEdit(options),
|
|
24
24
|
save: () => <InnerBlocks.Content />,
|
|
25
|
-
} as BlockConfiguration<ContentGroupAttributes
|
|
25
|
+
} as BlockConfiguration<ContentGroupAttributes>
|
|
26
26
|
}
|