@brilo/base-blocks 0.1.14 → 0.1.16
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 -0
- package/build/blocks/column/column-group/edit.d.ts.map +1 -1
- package/build/blocks/column/column-group/edit.js +1 -1
- package/build/blocks/column/column-item/edit.d.ts.map +1 -1
- package/build/blocks/column/column-item/edit.js +1 -1
- package/build/blocks/column/column-item/factory.js +1 -1
- package/build/blocks/compare/compare-group/constants.d.ts.map +1 -1
- package/build/blocks/compare/compare-group/edit.d.ts.map +1 -1
- package/build/blocks/compare/compare-group/edit.js +1 -1
- package/build/blocks/compare/compare-item/edit.d.ts.map +1 -1
- package/build/blocks/compare/compare-option/constants.d.ts +3 -3
- package/build/blocks/compare/compare-option/constants.d.ts.map +1 -1
- package/build/blocks/compare/compare-option/edit.d.ts.map +1 -1
- package/build/blocks/compare/compare-option/edit.js +1 -1
- package/build/blocks/contact/contact-group/constants.d.ts +17 -0
- package/build/blocks/contact/contact-group/constants.d.ts.map +1 -1
- package/build/blocks/contact/contact-group/constants.js +10 -0
- package/build/blocks/contact/contact-group/edit.d.ts.map +1 -1
- package/build/blocks/contact/contact-group/edit.js +7 -5
- package/build/blocks/contact/contact-group/factory.d.ts.map +1 -1
- package/build/blocks/contact/contact-group/factory.js +5 -1
- package/build/blocks/contact/contact-group/types.d.ts +10 -1
- package/build/blocks/contact/contact-group/types.d.ts.map +1 -1
- package/build/blocks/contact/contact-item/constants.d.ts +6 -6
- package/build/blocks/contact/contact-item/constants.d.ts.map +1 -1
- package/build/blocks/contact/contact-item/edit.d.ts.map +1 -1
- package/build/blocks/contact/contact-item/edit.js +1 -1
- package/build/blocks/contact/contact-item/index.d.ts.map +1 -1
- package/build/blocks/contact/contact-item/index.js +1 -0
- package/build/blocks/core/basic-button/constants.d.ts +7 -7
- package/build/blocks/core/basic-button/constants.d.ts.map +1 -1
- package/build/blocks/core/basic-button/edit.d.ts.map +1 -1
- package/build/blocks/core/basic-button/edit.js +3 -2
- package/build/blocks/core/basic-heading/edit.d.ts.map +1 -1
- package/build/blocks/core/basic-heading/edit.js +1 -1
- package/build/blocks/core/basic-overline/edit.d.ts.map +1 -1
- package/build/blocks/faq/faq-group/constants.d.ts +6 -6
- package/build/blocks/faq/faq-group/constants.d.ts.map +1 -1
- package/build/blocks/faq/faq-group/edit.d.ts.map +1 -1
- package/build/blocks/faq/faq-group/edit.js +1 -1
- package/build/blocks/faq/faq-group/factory.js +7 -6
- package/build/blocks/faq/faq-item/edit.d.ts.map +1 -1
- package/build/blocks/faq/faq-item/edit.js +1 -1
- package/build/blocks/form/form-field/constants.d.ts +2 -2
- package/build/blocks/form/form-field/constants.d.ts.map +1 -1
- package/build/blocks/form/form-field/edit.d.ts.map +1 -1
- package/build/blocks/form/form-field/edit.js +1 -1
- package/build/blocks/form/form-group/constants.d.ts +8 -8
- package/build/blocks/form/form-group/constants.d.ts.map +1 -1
- package/build/blocks/form/form-group/edit.d.ts.map +1 -1
- package/build/blocks/form/form-group/edit.js +10 -9
- package/build/blocks/gallery/gallery-group/constants.d.ts +12 -12
- package/build/blocks/gallery/gallery-group/constants.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 +1 -1
- package/build/blocks/gallery/gallery-item/edit.d.ts.map +1 -1
- package/build/blocks/gallery/gallery-item/edit.js +1 -1
- package/build/blocks/groups/banner-group/constants.d.ts +2 -2
- package/build/blocks/groups/banner-group/constants.d.ts.map +1 -1
- package/build/blocks/groups/banner-group/edit.d.ts.map +1 -1
- package/build/blocks/groups/banner-group/edit.js +1 -1
- package/build/blocks/groups/banner-group/icon.d.ts.map +1 -1
- package/build/blocks/groups/basic-header-group/constants.d.ts +3 -3
- package/build/blocks/groups/basic-header-group/constants.d.ts.map +1 -1
- package/build/blocks/groups/basic-header-group/edit.d.ts.map +1 -1
- package/build/blocks/groups/basic-header-group/edit.js +1 -1
- package/build/blocks/groups/basic-header-group/factory.js +10 -9
- package/build/blocks/groups/button-group/constants.d.ts +6 -6
- package/build/blocks/groups/button-group/constants.d.ts.map +1 -1
- package/build/blocks/groups/button-group/edit.d.ts.map +1 -1
- package/build/blocks/groups/button-group/edit.js +1 -1
- package/build/blocks/groups/button-group/factory.js +7 -6
- package/build/blocks/groups/content-group/constants.d.ts +1 -1
- package/build/blocks/groups/content-group/constants.d.ts.map +1 -1
- package/build/blocks/groups/content-group/edit.d.ts.map +1 -1
- package/build/blocks/groups/content-group/edit.js +1 -1
- package/build/blocks/groups/text-and-media-group/constants.d.ts +33 -33
- package/build/blocks/groups/text-and-media-group/constants.d.ts.map +1 -1
- package/build/blocks/groups/text-and-media-group/edit.d.ts.map +1 -1
- package/build/blocks/groups/text-and-media-group/edit.js +1 -1
- package/build/blocks/groups/text-and-media-group/factory.js +15 -14
- package/build/blocks/hero/hero-group/constants.d.ts +4 -4
- package/build/blocks/hero/hero-group/constants.d.ts.map +1 -1
- package/build/blocks/hero/hero-group/edit.d.ts.map +1 -1
- package/build/blocks/hero/hero-group/edit.js +6 -5
- package/build/blocks/hero/hero-group/icon.d.ts.map +1 -1
- package/build/blocks/hero/hero-item/constants.d.ts +9 -9
- package/build/blocks/hero/hero-item/constants.d.ts.map +1 -1
- package/build/blocks/hero/hero-item/edit.d.ts.map +1 -1
- package/build/blocks/hero/hero-item/edit.js +6 -5
- package/build/blocks/link/link-item/constants.d.ts +3 -3
- package/build/blocks/link/link-item/constants.d.ts.map +1 -1
- package/build/blocks/link/link-item/edit.d.ts.map +1 -1
- package/build/blocks/link/link-item/edit.js +1 -1
- package/build/blocks/map/map-group/constants.d.ts +4 -4
- package/build/blocks/map/map-group/constants.d.ts.map +1 -1
- package/build/blocks/map/map-group/edit.d.ts.map +1 -1
- package/build/blocks/map/map-group/edit.js +1 -1
- package/build/blocks/newsletter/newsletter-form/constants.d.ts.map +1 -1
- package/build/blocks/newsletter/newsletter-form/edit.d.ts.map +1 -1
- package/build/blocks/newsletter/newsletter-form/edit.js +1 -1
- package/build/blocks/person/person-group/constants.d.ts.map +1 -1
- package/build/blocks/person/person-group/edit.d.ts.map +1 -1
- package/build/blocks/person/person-group/edit.js +1 -1
- package/build/blocks/person/person-group/icon.d.ts.map +1 -1
- package/build/blocks/person/person-item/edit.d.ts.map +1 -1
- package/build/blocks/person/person-item/edit.js +1 -1
- package/build/blocks/post/post-slider-group/edit.d.ts.map +1 -1
- package/build/blocks/post/post-slider-group/edit.js +1 -1
- package/build/blocks/responsive-grid/responsive-grid-group/edit.d.ts.map +1 -1
- package/build/blocks/responsive-grid/responsive-grid-group/edit.js +1 -1
- package/build/blocks/responsive-grid/responsive-grid-item/edit.d.ts.map +1 -1
- package/build/blocks/sections/base-section/attributes.d.ts +9 -9
- package/build/blocks/sections/base-section/attributes.d.ts.map +1 -1
- package/build/blocks/sections/base-section/constants.d.ts +5 -5
- package/build/blocks/sections/base-section/constants.d.ts.map +1 -1
- package/build/blocks/sections/base-section/controls.js +1 -1
- package/build/blocks/sections/base-section/edit.d.ts.map +1 -1
- package/build/blocks/sections/base-section/edit.js +1 -1
- package/build/blocks/signpost/signpost-group/constants.d.ts +27 -1
- package/build/blocks/signpost/signpost-group/constants.d.ts.map +1 -1
- package/build/blocks/signpost/signpost-group/constants.js +13 -0
- package/build/blocks/signpost/signpost-group/edit.d.ts.map +1 -1
- package/build/blocks/signpost/signpost-group/edit.js +9 -5
- package/build/blocks/signpost/signpost-group/factory.d.ts.map +1 -1
- package/build/blocks/signpost/signpost-group/factory.js +36 -22
- package/build/blocks/signpost/signpost-group/index.d.ts +1 -1
- package/build/blocks/signpost/signpost-group/index.d.ts.map +1 -1
- package/build/blocks/signpost/signpost-group/types.d.ts +14 -1
- package/build/blocks/signpost/signpost-group/types.d.ts.map +1 -1
- package/build/blocks/signpost/signpost-item/constants.d.ts +2 -1
- package/build/blocks/signpost/signpost-item/constants.d.ts.map +1 -1
- package/build/blocks/signpost/signpost-item/constants.js +2 -1
- package/build/blocks/signpost/signpost-item/edit.d.ts.map +1 -1
- package/build/blocks/signpost/signpost-item/edit.js +16 -8
- package/build/blocks/signpost/signpost-item/factory.d.ts.map +1 -1
- package/build/blocks/signpost/signpost-item/factory.js +2 -1
- package/build/blocks/signpost/signpost-item/types.d.ts +9 -2
- package/build/blocks/signpost/signpost-item/types.d.ts.map +1 -1
- package/build/blocks/step/step-group/constants.d.ts +2 -2
- package/build/blocks/step/step-group/constants.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 +1 -1
- package/build/blocks/step/step-item/constants.d.ts +2 -2
- package/build/blocks/step/step-item/constants.d.ts.map +1 -1
- package/build/blocks/step/step-item/edit.d.ts.map +1 -1
- package/build/blocks/step/step-item/edit.js +1 -1
- package/build/blocks/testimonial/testimonial-group/constants.d.ts +5 -5
- package/build/blocks/testimonial/testimonial-group/constants.d.ts.map +1 -1
- package/build/blocks/testimonial/testimonial-group/edit.d.ts.map +1 -1
- package/build/blocks/testimonial/testimonial-group/edit.js +1 -1
- package/build/blocks/testimonial/testimonial-item/edit.d.ts.map +1 -1
- package/build/blocks/testimonial/testimonial-item/edit.js +1 -1
- package/build/blocks/text-and-form/text-and-form-group/constants.d.ts +2 -2
- package/build/blocks/text-and-form/text-and-form-group/constants.d.ts.map +1 -1
- package/build/blocks/text-and-form/text-and-form-group/edit.d.ts.map +1 -1
- package/build/blocks/text-and-form/text-and-form-group/edit.js +3 -2
- package/build/blocks/text-and-form/text-and-form-text-column/constants.d.ts +4 -4
- package/build/blocks/text-and-form/text-and-form-text-column/constants.d.ts.map +1 -1
- package/build/blocks/text-and-form/text-and-form-text-column/edit.d.ts.map +1 -1
- package/build/blocks/text-and-form/text-and-form-text-column/edit.js +1 -1
- package/build/blocks/text-and-form/text-and-form-text-column/factory.js +9 -8
- package/build/blocks/usp/usp-group/constants.d.ts +31 -31
- package/build/blocks/usp/usp-group/constants.d.ts.map +1 -1
- package/build/blocks/usp/usp-group/edit.d.ts.map +1 -1
- package/build/blocks/usp/usp-group/edit.js +5 -3
- package/build/blocks/usp/usp-group/factory.d.ts.map +1 -1
- package/build/blocks/usp/usp-group/factory.js +21 -17
- package/build/blocks/usp/usp-group/types.d.ts +3 -0
- package/build/blocks/usp/usp-group/types.d.ts.map +1 -1
- package/build/blocks/usp/usp-item/constants.d.ts +3 -3
- package/build/blocks/usp/usp-item/constants.d.ts.map +1 -1
- package/build/blocks/usp/usp-item/edit.d.ts.map +1 -1
- package/build/blocks/usp/usp-item/edit.js +1 -1
- package/build/components/ItemIconControl/ItemIconControl.js +3 -2
- package/build/components/ItemIconControl/ItemIconPreview.js +6 -3
- package/build/constants.d.ts +12 -12
- package/build/constants.d.ts.map +1 -1
- package/build/hooks/useTenantColorPalette.d.ts +1 -1
- package/build/hooks/useTenantColorPalette.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/blocks/column/column-item/factory.tsx +1 -1
- package/src/blocks/contact/contact-group/constants.ts +13 -0
- package/src/blocks/contact/contact-group/edit.tsx +54 -3
- package/src/blocks/contact/contact-group/factory.tsx +5 -1
- package/src/blocks/contact/contact-group/types.ts +12 -1
- package/src/blocks/contact/contact-item/index.ts +1 -0
- package/src/blocks/core/basic-button/edit.tsx +4 -4
- package/src/blocks/groups/banner-group/icon.tsx +1 -1
- package/src/blocks/hero/hero-group/icon.tsx +1 -1
- package/src/blocks/person/person-group/icon.tsx +1 -1
- package/src/blocks/signpost/signpost-group/constants.ts +16 -0
- package/src/blocks/signpost/signpost-group/edit.tsx +62 -3
- package/src/blocks/signpost/signpost-group/factory.tsx +36 -18
- package/src/blocks/signpost/signpost-group/index.ts +1 -1
- package/src/blocks/signpost/signpost-group/types.ts +16 -2
- package/src/blocks/signpost/signpost-item/constants.ts +2 -4
- package/src/blocks/signpost/signpost-item/edit.tsx +57 -4
- package/src/blocks/signpost/signpost-item/factory.tsx +2 -1
- package/src/blocks/signpost/signpost-item/types.ts +13 -3
- package/src/blocks/usp/usp-group/edit.tsx +40 -17
- package/src/blocks/usp/usp-group/factory.tsx +3 -0
- package/src/blocks/usp/usp-group/types.ts +3 -0
- package/src/components/ItemIconControl/ItemIconControl.tsx +1 -1
- package/src/components/ItemIconControl/ItemIconPreview.tsx +2 -2
|
@@ -1,7 +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 {COLUMNS, HEADING_LEVELS, RATIOS} from './constants'
|
|
4
|
+
import {COLUMNS, DEFAULT_SHADOWS, HEADING_LEVELS, RATIOS} from './constants'
|
|
5
5
|
import {createSignpostGroupEdit} from './edit'
|
|
6
6
|
import {icon as defaultIcon} from './icon'
|
|
7
7
|
import type {SignpostGroupAttributes, SignpostGroupOptions} from './types'
|
|
@@ -9,6 +9,40 @@ import type {SignpostGroupAttributes, SignpostGroupOptions} from './types'
|
|
|
9
9
|
export type {SignpostGroupAttributes, SignpostGroupOptions}
|
|
10
10
|
|
|
11
11
|
export function createSignpostGroupBlock(options: SignpostGroupOptions): BlockConfiguration<SignpostGroupAttributes> {
|
|
12
|
+
const exclude = options.exclude ?? []
|
|
13
|
+
|
|
14
|
+
const attributes: Record<string, unknown> = {
|
|
15
|
+
columns: {
|
|
16
|
+
type: 'number',
|
|
17
|
+
default: COLUMNS[1],
|
|
18
|
+
enum: [...COLUMNS],
|
|
19
|
+
},
|
|
20
|
+
ratio: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
default: RATIOS[0],
|
|
23
|
+
enum: [...RATIOS],
|
|
24
|
+
},
|
|
25
|
+
headingLevel: {
|
|
26
|
+
type: 'number',
|
|
27
|
+
default: HEADING_LEVELS[0],
|
|
28
|
+
enum: [...HEADING_LEVELS],
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (!exclude.includes('colors')) {
|
|
33
|
+
attributes.style = {
|
|
34
|
+
type: 'object',
|
|
35
|
+
default: {shadow: DEFAULT_SHADOWS[0].value, borderColor: '', backgroundColor: '', textColor: ''},
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!exclude.includes('padding')) {
|
|
40
|
+
attributes.padding = {
|
|
41
|
+
type: 'object',
|
|
42
|
+
default: {value: 1},
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
12
46
|
return {
|
|
13
47
|
name: options.name,
|
|
14
48
|
title: options.title ?? __('Rozcestník', 'brilo-blocks'),
|
|
@@ -17,23 +51,7 @@ export function createSignpostGroupBlock(options: SignpostGroupOptions): BlockCo
|
|
|
17
51
|
...(options.parent && {parent: options.parent}),
|
|
18
52
|
icon: options.icon ?? {src: defaultIcon},
|
|
19
53
|
supports: {html: false, customClassName: false},
|
|
20
|
-
attributes
|
|
21
|
-
columns: {
|
|
22
|
-
type: 'number',
|
|
23
|
-
default: COLUMNS[1],
|
|
24
|
-
enum: [...COLUMNS],
|
|
25
|
-
},
|
|
26
|
-
ratio: {
|
|
27
|
-
type: 'string',
|
|
28
|
-
default: RATIOS[0],
|
|
29
|
-
enum: [...RATIOS],
|
|
30
|
-
},
|
|
31
|
-
headingLevel: {
|
|
32
|
-
type: 'number',
|
|
33
|
-
default: HEADING_LEVELS[0],
|
|
34
|
-
enum: [...HEADING_LEVELS],
|
|
35
|
-
},
|
|
36
|
-
},
|
|
54
|
+
attributes,
|
|
37
55
|
edit: createSignpostGroupEdit(options),
|
|
38
56
|
save: () => <InnerBlocks.Content />,
|
|
39
57
|
} as unknown as BlockConfiguration<SignpostGroupAttributes>
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import {BriloBlockType} from '~/types'
|
|
1
|
+
import type {BriloBlockType} from '~/types'
|
|
2
|
+
import type {DEFAULT_SHADOWS} from './constants'
|
|
3
|
+
|
|
4
|
+
export type SignpostShadow = (typeof DEFAULT_SHADOWS)[number]['value']
|
|
5
|
+
|
|
6
|
+
export type ExcludableSignpostAttr = 'colors' | 'padding'
|
|
2
7
|
|
|
3
8
|
export interface SignpostGroupAttributes extends Record<string, unknown> {
|
|
4
9
|
columns: number
|
|
5
10
|
headingLevel: number
|
|
6
11
|
ratio: string
|
|
12
|
+
style: {
|
|
13
|
+
shadow: SignpostShadow
|
|
14
|
+
borderColor: string
|
|
15
|
+
backgroundColor: string
|
|
16
|
+
textColor: string
|
|
17
|
+
}
|
|
18
|
+
padding: {value: number}
|
|
7
19
|
}
|
|
8
20
|
|
|
9
|
-
export interface SignpostGroupOptions extends BriloBlockType {
|
|
21
|
+
export interface SignpostGroupOptions extends BriloBlockType {
|
|
22
|
+
exclude?: ExcludableSignpostAttr[]
|
|
23
|
+
}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import {InspectorControls, RichText
|
|
2
|
-
import {
|
|
1
|
+
import {ColorPalette, InspectorControls, RichText} from '@wordpress/block-editor'
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
PanelBody,
|
|
5
|
+
TextControl,
|
|
6
|
+
ToggleControl,
|
|
7
|
+
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
8
|
+
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
9
|
+
} from '@wordpress/components'
|
|
3
10
|
import {__} from '@wordpress/i18n'
|
|
4
11
|
import {ImagePickerControl} from '~/components/ImagePicker'
|
|
5
|
-
import type {SignpostItemAttributes, SignpostItemOptions} from './types'
|
|
12
|
+
import type {SignpostItemAttributes, SignpostItemOptions, ButtonType, ButtonVariant} from './types'
|
|
13
|
+
import {BUTTON_TYPES, BUTTON_VARIANTS} from './constants'
|
|
6
14
|
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
15
|
+
import {useTenantColorPalette} from '~/hooks/useTenantColorPalette'
|
|
7
16
|
import clsx from 'clsx'
|
|
8
17
|
|
|
9
18
|
export function createSignpostItemEdit(options: SignpostItemOptions) {
|
|
@@ -14,7 +23,13 @@ export function createSignpostItemEdit(options: SignpostItemOptions) {
|
|
|
14
23
|
attributes: SignpostItemAttributes
|
|
15
24
|
setAttributes: (a: Partial<SignpostItemAttributes>) => void
|
|
16
25
|
}) {
|
|
17
|
-
const {title, img,
|
|
26
|
+
const {title, img, url} = attributes
|
|
27
|
+
const button = {
|
|
28
|
+
...attributes.button,
|
|
29
|
+
type: attributes.button.type ?? BUTTON_TYPES[0],
|
|
30
|
+
variant: attributes.button.variant ?? BUTTON_VARIANTS[0],
|
|
31
|
+
}
|
|
32
|
+
const {paletteColors} = useTenantColorPalette()
|
|
18
33
|
|
|
19
34
|
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
20
35
|
blockClassName: clsx(options.blockClassName ?? 'i-signpost'),
|
|
@@ -37,6 +52,44 @@ export function createSignpostItemEdit(options: SignpostItemOptions) {
|
|
|
37
52
|
value={button.title}
|
|
38
53
|
onChange={(v) => setAttributes({button: {...button, title: v}})}
|
|
39
54
|
/>
|
|
55
|
+
<ToggleGroupControl
|
|
56
|
+
label={__('Typ tlačítka', 'brilo-blocks')}
|
|
57
|
+
value={button.type}
|
|
58
|
+
onChange={(v) => setAttributes({button: {...button, type: v as ButtonType}})}
|
|
59
|
+
isBlock
|
|
60
|
+
>
|
|
61
|
+
{BUTTON_TYPES.map((type) => (
|
|
62
|
+
<ToggleGroupControlOption key={type} value={type} label={type} />
|
|
63
|
+
))}
|
|
64
|
+
</ToggleGroupControl>
|
|
65
|
+
{button.type === 'button' ? (
|
|
66
|
+
<>
|
|
67
|
+
<ToggleGroupControl
|
|
68
|
+
label={__('Varianta', 'brilo-blocks')}
|
|
69
|
+
value={button.variant}
|
|
70
|
+
onChange={(v) => setAttributes({button: {...button, variant: v as ButtonVariant}})}
|
|
71
|
+
isBlock
|
|
72
|
+
>
|
|
73
|
+
{BUTTON_VARIANTS.map((variant) => (
|
|
74
|
+
<ToggleGroupControlOption key={variant} value={variant} label={variant} />
|
|
75
|
+
))}
|
|
76
|
+
</ToggleGroupControl>
|
|
77
|
+
<ToggleControl
|
|
78
|
+
label={__('Outline', 'brilo-blocks')}
|
|
79
|
+
checked={button.outline}
|
|
80
|
+
onChange={(v) => setAttributes({button: {...button, outline: v}})}
|
|
81
|
+
/>
|
|
82
|
+
</>
|
|
83
|
+
) : (
|
|
84
|
+
<>
|
|
85
|
+
<p>{__('Barva textu', 'brilo-blocks')}</p>
|
|
86
|
+
<ColorPalette
|
|
87
|
+
colors={paletteColors}
|
|
88
|
+
value={button.color || undefined}
|
|
89
|
+
onChange={(v) => setAttributes({button: {...button, color: v ?? ''}})}
|
|
90
|
+
/>
|
|
91
|
+
</>
|
|
92
|
+
)}
|
|
40
93
|
</PanelBody>
|
|
41
94
|
<PanelBody title={__('Odkaz', 'brilo-blocks')} initialOpen={false}>
|
|
42
95
|
<TextControl label={__('URL', 'brilo-blocks')} value={url.src} onChange={(v) => setAttributes({url: {...url, src: v}})} />
|
|
@@ -3,6 +3,7 @@ import {__} from '@wordpress/i18n'
|
|
|
3
3
|
import {createSignpostItemEdit} from './edit'
|
|
4
4
|
import {icon as defaultIcon} from './icon'
|
|
5
5
|
import type {SignpostItemAttributes, SignpostItemOptions} from './types'
|
|
6
|
+
import {BUTTON_TYPES} from './constants'
|
|
6
7
|
import {InnerBlocks} from '@wordpress/block-editor'
|
|
7
8
|
|
|
8
9
|
export type {SignpostItemAttributes, SignpostItemOptions}
|
|
@@ -19,7 +20,7 @@ export function createSignpostItemBlock(options: SignpostItemOptions): BlockConf
|
|
|
19
20
|
attributes: {
|
|
20
21
|
title: {type: 'string', default: ''},
|
|
21
22
|
img: {type: 'object', default: {id: 0, alt: ''}},
|
|
22
|
-
button: {type: 'object', default: {title: ''}},
|
|
23
|
+
button: {type: 'object', default: {title: '', type: BUTTON_TYPES[0], variant: 'primary', outline: false, color: ''}},
|
|
23
24
|
url: {type: 'object', default: {src: '', blank: false}},
|
|
24
25
|
},
|
|
25
26
|
edit: createSignpostItemEdit(options),
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type {ImageValue} from '~/components/ImagePicker/ImagePicker'
|
|
2
|
+
import type {BriloBlockType} from '~/types'
|
|
3
|
+
import type {BUTTON_TYPES, BUTTON_VARIANTS} from './constants'
|
|
4
|
+
|
|
5
|
+
export type ButtonType = (typeof BUTTON_TYPES)[number]
|
|
6
|
+
export type ButtonVariant = (typeof BUTTON_VARIANTS)[number]
|
|
3
7
|
|
|
4
8
|
export interface SignpostItemAttributes extends Record<string, unknown> {
|
|
5
9
|
title: string
|
|
6
10
|
img: ImageValue
|
|
7
|
-
button: {
|
|
11
|
+
button: {
|
|
12
|
+
title: string
|
|
13
|
+
type: ButtonType
|
|
14
|
+
variant: ButtonVariant
|
|
15
|
+
outline: boolean
|
|
16
|
+
color: string
|
|
17
|
+
}
|
|
8
18
|
url: {src: string; blank: boolean}
|
|
9
19
|
}
|
|
10
20
|
|
|
@@ -3,12 +3,15 @@ import {
|
|
|
3
3
|
PanelBody,
|
|
4
4
|
SelectControl,
|
|
5
5
|
ToggleControl,
|
|
6
|
+
BaseControl,
|
|
7
|
+
ColorPalette,
|
|
6
8
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
7
9
|
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
8
10
|
} from '@wordpress/components'
|
|
9
11
|
import {__} from '@wordpress/i18n'
|
|
10
12
|
import clsx from 'clsx'
|
|
11
13
|
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
14
|
+
import {useTenantColorPalette} from '~/hooks/useTenantColorPalette'
|
|
12
15
|
import {
|
|
13
16
|
DEFAULT_ALIGNMENTS,
|
|
14
17
|
DEFAULT_COLUMNS,
|
|
@@ -54,6 +57,7 @@ export function createUspGroupEdit(options: UspGroupOptions) {
|
|
|
54
57
|
setAttributes: (a: Partial<UspGroupAttributes>) => void
|
|
55
58
|
}) {
|
|
56
59
|
const {columns, headingSettings, content, style} = attributes
|
|
60
|
+
const {paletteColors} = useTenantColorPalette()
|
|
57
61
|
|
|
58
62
|
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
59
63
|
blockClassName: clsx(
|
|
@@ -138,23 +142,42 @@ export function createUspGroupEdit(options: UspGroupOptions) {
|
|
|
138
142
|
</ToggleGroupControl>
|
|
139
143
|
</PanelBody>
|
|
140
144
|
<PanelBody title={__('Styl', 'brilo-blocks')}>
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
145
|
+
<ToggleGroupControl
|
|
146
|
+
isBlock
|
|
147
|
+
label={__('Stín', 'brilo-blocks')}
|
|
148
|
+
value={style.shadow}
|
|
149
|
+
onChange={(v) => setAttributes({style: {...style, shadow: v as UspShadow}})}
|
|
150
|
+
>
|
|
151
|
+
{SHADOWS.map((s) => (
|
|
152
|
+
<ToggleGroupControlOption key={s.value} value={s.value} label={s.label} />
|
|
153
|
+
))}
|
|
154
|
+
</ToggleGroupControl>
|
|
155
|
+
|
|
156
|
+
<BaseControl
|
|
157
|
+
label={__('Barva okraje', 'brilo-blocks')}
|
|
158
|
+
help={__('Bez vybrané barvy se okraj nevykreslí.', 'brilo-blocks')}
|
|
159
|
+
id="usp-group-border-color"
|
|
160
|
+
>
|
|
161
|
+
<ColorPalette
|
|
162
|
+
colors={paletteColors}
|
|
163
|
+
value={style.borderColor || undefined}
|
|
164
|
+
onChange={(value) => setAttributes({style: {...style, borderColor: value ?? ''}})}
|
|
165
|
+
/>
|
|
166
|
+
</BaseControl>
|
|
167
|
+
<BaseControl label={__('Barva pozadí', 'brilo-blocks')} id="usp-group-background-color">
|
|
168
|
+
<ColorPalette
|
|
169
|
+
colors={paletteColors}
|
|
170
|
+
value={style.backgroundColor || undefined}
|
|
171
|
+
onChange={(value) => setAttributes({style: {...style, backgroundColor: value ?? ''}})}
|
|
172
|
+
/>
|
|
173
|
+
</BaseControl>
|
|
174
|
+
<BaseControl label={__('Barva textu', 'brilo-blocks')} id="usp-group-text-color">
|
|
175
|
+
<ColorPalette
|
|
176
|
+
colors={paletteColors}
|
|
177
|
+
value={style.textColor || undefined}
|
|
178
|
+
onChange={(value) => setAttributes({style: {...style, textColor: value ?? ''}})}
|
|
179
|
+
/>
|
|
180
|
+
</BaseControl>
|
|
158
181
|
</PanelBody>
|
|
159
182
|
<PanelBody title={__('Ikona', 'brilo-blocks')} initialOpen={false}>
|
|
160
183
|
<ToggleGroupControl
|
|
@@ -91,6 +91,9 @@ export function createUspGroupBlock<
|
|
|
91
91
|
card: false,
|
|
92
92
|
direction: directions[0].value,
|
|
93
93
|
align: alignments[0].value,
|
|
94
|
+
borderColor: '',
|
|
95
|
+
backgroundColor: '',
|
|
96
|
+
textColor: '',
|
|
94
97
|
icon: {size: iconSizes[2]?.value ?? iconSizes[0].value, color: iconColors[0].value, background: iconBackgrounds[0].value},
|
|
95
98
|
},
|
|
96
99
|
},
|
|
@@ -42,6 +42,9 @@ export interface UspGroupAttributes<
|
|
|
42
42
|
card: boolean
|
|
43
43
|
direction: TDirection
|
|
44
44
|
align: TAlignment
|
|
45
|
+
borderColor: string
|
|
46
|
+
backgroundColor: string
|
|
47
|
+
textColor: string
|
|
45
48
|
icon: {size: TIconSize; color: TIconColor; background: TIconBackground; bordered?: boolean}
|
|
46
49
|
}
|
|
47
50
|
}
|
|
@@ -42,7 +42,7 @@ export function ItemIconControl({icon, setAttributes, options, iconTypes}: ItemI
|
|
|
42
42
|
|
|
43
43
|
{icon.type === 'media' && (
|
|
44
44
|
<ImagePickerControl
|
|
45
|
-
value={icon.media}
|
|
45
|
+
value={icon.media ?? {id: 0, alt: ''}}
|
|
46
46
|
onChange={(val) => setAttributes({icon: {...icon, media: val}})}
|
|
47
47
|
labels={{
|
|
48
48
|
select: __('Vybrat ikonu', 'brilo-blocks'),
|
|
@@ -6,7 +6,7 @@ import {ItemIconModal} from './ItemIconModal'
|
|
|
6
6
|
|
|
7
7
|
export function ItemIconPreview({icon, className, options, setAttributes}: ItemIconPreviewProps) {
|
|
8
8
|
const [isModalOpen, setModalOpen] = useState(false)
|
|
9
|
-
const mediaIconUrl = useMediaUrl(icon.media
|
|
9
|
+
const mediaIconUrl = useMediaUrl(icon.media?.id ?? 0)
|
|
10
10
|
const preselectedIconUrl = icon.type === 'preselected' && icon.src ? `${options.iconsSrc}${icon.src}.svg` : ''
|
|
11
11
|
|
|
12
12
|
const renderContent = () => {
|
|
@@ -41,7 +41,7 @@ export function ItemIconPreview({icon, className, options, setAttributes}: ItemI
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
if (icon.type === 'media') {
|
|
44
|
-
if (icon.media
|
|
44
|
+
if (icon.media?.id && mediaIconUrl) {
|
|
45
45
|
return (
|
|
46
46
|
<div className={clsx('i-item-icon', className)}>
|
|
47
47
|
<img src={mediaIconUrl} alt={icon.media.alt} className={clsx(className ? `${className}-img` : null, 'i-item-icon__img')} />
|