@brilo/base-blocks 0.1.15 → 0.1.17
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/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 +6 -4
- 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/index.d.ts.map +1 -1
- package/build/blocks/contact/contact-item/index.js +1 -0
- package/build/blocks/signpost/signpost-item/index.js +1 -1
- package/build/blocks/usp/usp-group/constants.d.ts +48 -35
- package/build/blocks/usp/usp-group/constants.d.ts.map +1 -1
- package/build/blocks/usp/usp-group/constants.js +27 -17
- package/build/blocks/usp/usp-group/edit.d.ts.map +1 -1
- package/build/blocks/usp/usp-group/edit.js +10 -7
- package/build/blocks/usp/usp-group/factory.d.ts +2 -2
- package/build/blocks/usp/usp-group/factory.d.ts.map +1 -1
- package/build/blocks/usp/usp-group/factory.js +27 -19
- package/build/blocks/usp/usp-group/types.d.ts +19 -13
- package/build/blocks/usp/usp-group/types.d.ts.map +1 -1
- package/build/blocks/usp/usp-item/buildPreviewStyle.d.ts +25 -0
- package/build/blocks/usp/usp-item/buildPreviewStyle.d.ts.map +1 -0
- package/build/blocks/usp/usp-item/buildPreviewStyle.js +30 -0
- package/build/blocks/usp/usp-item/edit.d.ts +5 -1
- package/build/blocks/usp/usp-item/edit.d.ts.map +1 -1
- package/build/blocks/usp/usp-item/edit.js +7 -3
- package/build/blocks/usp/usp-item/factory.d.ts.map +1 -1
- package/build/blocks/usp/usp-item/factory.js +1 -0
- package/build/components/ItemIconControl/ItemIconPreview.d.ts +1 -1
- package/build/components/ItemIconControl/ItemIconPreview.d.ts.map +1 -1
- package/build/components/ItemIconControl/ItemIconPreview.js +4 -4
- package/package.json +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/groups/text-and-media-group/editor.scss +14 -0
- package/src/blocks/signpost/signpost-item/index.ts +1 -1
- package/src/blocks/usp/usp-group/constants.ts +29 -17
- package/src/blocks/usp/usp-group/edit.tsx +109 -34
- package/src/blocks/usp/usp-group/factory.tsx +19 -27
- package/src/blocks/usp/usp-group/types.ts +22 -16
- package/src/blocks/usp/usp-item/buildPreviewStyle.ts +66 -0
- package/src/blocks/usp/usp-item/edit.tsx +15 -2
- package/src/blocks/usp/usp-item/editor.scss +140 -1
- package/src/blocks/usp/usp-item/factory.tsx +1 -0
- package/src/components/ItemIconControl/ItemIconPreview.tsx +4 -4
- package/src/components/ItemIconControl/types.d.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/usp/usp-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AACrE,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/usp/usp-group/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface UspSharedStyle {
|
|
2
|
+
direction?: string;
|
|
3
|
+
align?: string;
|
|
4
|
+
textAlign?: string;
|
|
5
|
+
shadow?: string;
|
|
6
|
+
borderColor?: string;
|
|
7
|
+
backgroundColor?: string;
|
|
8
|
+
textColor?: string;
|
|
9
|
+
icon?: {
|
|
10
|
+
size?: number;
|
|
11
|
+
color?: string;
|
|
12
|
+
background?: string;
|
|
13
|
+
backgroundSize?: number;
|
|
14
|
+
backgroundShape?: string;
|
|
15
|
+
borderColor?: string;
|
|
16
|
+
borderWidth?: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface UspPreviewStyle {
|
|
20
|
+
rootClassName: string;
|
|
21
|
+
iconClassName: string;
|
|
22
|
+
cssVars: Record<string, string>;
|
|
23
|
+
}
|
|
24
|
+
export declare function buildUspPreviewStyle(shared?: UspSharedStyle, resolveHex?: (value: string) => string): UspPreviewStyle;
|
|
25
|
+
//# sourceMappingURL=buildPreviewStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildPreviewStyle.d.ts","sourceRoot":"","sources":["../../../../src/blocks/usp/usp-item/buildPreviewStyle.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE;QACL,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,eAAe,CAAC,EAAE,MAAM,CAAA;QACxB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;CACF;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC;AAED,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,UAAU,GAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAyB,GAAG,eAAe,CAsCvI"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
export function buildUspPreviewStyle(shared, resolveHex = (value) => value) {
|
|
3
|
+
var _a;
|
|
4
|
+
if (!shared) {
|
|
5
|
+
return { rootClassName: '', iconClassName: '', cssVars: {} };
|
|
6
|
+
}
|
|
7
|
+
const icon = (_a = shared.icon) !== null && _a !== void 0 ? _a : {};
|
|
8
|
+
const rootClassName = clsx(shared.direction && `--direction-${shared.direction}`, shared.align && `--align-${shared.align}`, shared.textAlign && `--body-align-${shared.textAlign}`, shared.shadow && shared.shadow !== 'none' && `--shadow --shadow-${shared.shadow}`, icon.background && '--icon-background', icon.color && '--icon-color', icon.borderColor && '--icon-bordered', shared.backgroundColor && '--background-color', shared.borderColor && '--border', shared.textColor && '--text-color');
|
|
9
|
+
const iconClassName = clsx(icon.backgroundShape && icon.backgroundShape !== 'none' && `--background-shape --background-shape-${icon.backgroundShape}`);
|
|
10
|
+
const cssVars = {};
|
|
11
|
+
if (shared.borderColor)
|
|
12
|
+
cssVars['--border-color'] = resolveHex(shared.borderColor);
|
|
13
|
+
if (shared.backgroundColor)
|
|
14
|
+
cssVars['--background-color'] = resolveHex(shared.backgroundColor);
|
|
15
|
+
if (shared.textColor)
|
|
16
|
+
cssVars['--text-color'] = resolveHex(shared.textColor);
|
|
17
|
+
if (icon.background)
|
|
18
|
+
cssVars['--icon-background-color'] = resolveHex(icon.background);
|
|
19
|
+
if (icon.color)
|
|
20
|
+
cssVars['--icon-color'] = resolveHex(icon.color);
|
|
21
|
+
if (icon.size)
|
|
22
|
+
cssVars['--icon-size'] = `${icon.size}px`;
|
|
23
|
+
if (icon.backgroundSize)
|
|
24
|
+
cssVars['--icon-background-size'] = `${icon.backgroundSize}px`;
|
|
25
|
+
if (icon.borderColor) {
|
|
26
|
+
cssVars['--icon-outline-color'] = resolveHex(icon.borderColor);
|
|
27
|
+
cssVars['--icon-outline-width'] = `${icon.borderWidth || 1}px`;
|
|
28
|
+
}
|
|
29
|
+
return { rootClassName, iconClassName, cssVars };
|
|
30
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { type UspSharedStyle } from './buildPreviewStyle';
|
|
1
2
|
import type { UspItemAttributes, UspItemOptions } from './types';
|
|
2
|
-
export declare function createUspItemEdit(options: UspItemOptions): ({ attributes, setAttributes, }: {
|
|
3
|
+
export declare function createUspItemEdit(options: UspItemOptions): ({ attributes, setAttributes, context, }: {
|
|
3
4
|
attributes: UspItemAttributes;
|
|
4
5
|
setAttributes: (a: Partial<UspItemAttributes>) => void;
|
|
6
|
+
context?: {
|
|
7
|
+
'brilo/usp-style'?: UspSharedStyle;
|
|
8
|
+
};
|
|
5
9
|
}) => import("react").JSX.Element;
|
|
6
10
|
//# sourceMappingURL=edit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/usp/usp-item/edit.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,SAAS,CAAA;AAE9D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/usp/usp-item/edit.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAuB,KAAK,cAAc,EAAC,MAAM,qBAAqB,CAAA;AAE7E,OAAO,KAAK,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,SAAS,CAAA;AAE9D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,6CAKpD;IACD,UAAU,EAAE,iBAAiB,CAAA;IAC7B,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IACtD,OAAO,CAAC,EAAE;QAAC,iBAAiB,CAAC,EAAE,cAAc,CAAA;KAAC,CAAA;CAC/C,iCAwDF"}
|
|
@@ -4,11 +4,15 @@ import { PanelBody, ToggleControl, TextControl } from '@wordpress/components';
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { ItemIconControl, ItemIconPreview } from '../../../components/ItemIconControl';
|
|
7
|
+
import { useTenantColorPalette } from '../../../hooks/useTenantColorPalette';
|
|
8
|
+
import { buildUspPreviewStyle } from './buildPreviewStyle';
|
|
7
9
|
import { ICON_TYPES } from './constants';
|
|
8
10
|
export function createUspItemEdit(options) {
|
|
9
|
-
return function Edit({ attributes, setAttributes, }) {
|
|
11
|
+
return function Edit({ attributes, setAttributes, context, }) {
|
|
10
12
|
const { title, content, url, icon } = attributes;
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
+
const { resolveHex } = useTenantColorPalette();
|
|
14
|
+
const { rootClassName, iconClassName, cssVars } = buildUspPreviewStyle(context === null || context === void 0 ? void 0 : context['brilo/usp-style'], resolveHex);
|
|
15
|
+
const blockProps = useBlockProps({ className: clsx('i-usp', rootClassName), style: cssVars });
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsx(PanelBody, { title: __('Ikona', 'brilo-blocks'), children: _jsx(ItemIconControl, { icon: icon, setAttributes: setAttributes, iconTypes: ICON_TYPES, options: options }) }), _jsxs(PanelBody, { title: __('Odkaz', 'brilo-blocks'), initialOpen: false, children: [_jsx(TextControl, { label: __('URL', 'brilo-blocks'), value: url.src, onChange: (v) => setAttributes({ url: { ...url, src: v } }) }), _jsx(ToggleControl, { label: __('Otevřít v nové záložce', 'brilo-blocks'), checked: url.blank, onChange: (v) => setAttributes({ url: { ...url, blank: v } }) })] })] }), _jsx("div", { ...blockProps, children: _jsxs("div", { className: "i-usp__inner wp-block-inner", children: [_jsx(ItemIconPreview, { icon: icon, className: "i-usp__icon", modifierClassName: iconClassName, style: cssVars, setAttributes: setAttributes, options: options }), _jsxs("div", { className: clsx('i-usp__body', 'grow'), children: [_jsx(RichText, { tagName: "h3", className: "i-usp__title u-text-editable", value: title, onChange: (v) => setAttributes({ title: v }), placeholder: __('Nadpis...', 'brilo-blocks'), allowedFormats: ['core/bold', 'core/italic'] }), _jsx(RichText, { tagName: "p", className: "i-usp__content u-text-editable", value: content, onChange: (v) => setAttributes({ content: v }), placeholder: __('Popis...', 'brilo-blocks') })] })] }) })] }));
|
|
13
17
|
};
|
|
14
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/usp/usp-item/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAIzD,OAAO,KAAK,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,SAAS,CAAA;AAE9D,YAAY,EAAC,iBAAiB,EAAE,cAAc,EAAC,CAAA;AAE/C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/usp/usp-item/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAIzD,OAAO,KAAK,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,SAAS,CAAA;AAE9D,YAAY,EAAC,iBAAiB,EAAE,cAAc,EAAC,CAAA;AAE/C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAsBjG"}
|
|
@@ -11,6 +11,7 @@ export function createUspItemBlock(options) {
|
|
|
11
11
|
...(options.parent && { parent: options.parent }),
|
|
12
12
|
icon: (_c = options.icon) !== null && _c !== void 0 ? _c : 'star-filled',
|
|
13
13
|
supports: { html: false, customClassName: false },
|
|
14
|
+
usesContext: ['brilo/usp-style'],
|
|
14
15
|
attributes: {
|
|
15
16
|
title: { type: 'string', default: '' },
|
|
16
17
|
content: { type: 'string', default: '' },
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ItemIconPreviewProps } from './types';
|
|
2
|
-
export declare function ItemIconPreview({ icon, className, options, setAttributes }: ItemIconPreviewProps): import("react").JSX.Element;
|
|
2
|
+
export declare function ItemIconPreview({ icon, className, modifierClassName, style, options, setAttributes }: ItemIconPreviewProps): import("react").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=ItemIconPreview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemIconPreview.d.ts","sourceRoot":"","sources":["../../../src/components/ItemIconControl/ItemIconPreview.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAGjD,wBAAgB,eAAe,CAAC,EAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAC,EAAE,oBAAoB,+
|
|
1
|
+
{"version":3,"file":"ItemIconPreview.d.ts","sourceRoot":"","sources":["../../../src/components/ItemIconControl/ItemIconPreview.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAGjD,wBAAgB,eAAe,CAAC,EAAC,IAAI,EAAE,SAAS,EAAE,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAC,EAAE,oBAAoB,+BAsFxH"}
|
|
@@ -3,7 +3,7 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { useState } from '@wordpress/element';
|
|
4
4
|
import { useMediaUrl } from '../../components/ImagePicker';
|
|
5
5
|
import { ItemIconModal } from './ItemIconModal';
|
|
6
|
-
export function ItemIconPreview({ icon, className, options, setAttributes }) {
|
|
6
|
+
export function ItemIconPreview({ icon, className, modifierClassName, style, options, setAttributes }) {
|
|
7
7
|
var _a;
|
|
8
8
|
var _b;
|
|
9
9
|
const [isModalOpen, setModalOpen] = useState(false);
|
|
@@ -13,19 +13,19 @@ export function ItemIconPreview({ icon, className, options, setAttributes }) {
|
|
|
13
13
|
var _a;
|
|
14
14
|
if (icon.type === 'preselected') {
|
|
15
15
|
if (preselectedIconUrl) {
|
|
16
|
-
return (_jsx("div", { className: clsx('i-item-icon', className), children: _jsx("img", { src: preselectedIconUrl, alt: "", className: clsx(className ? `${className}-img` : 'i-item-icon__img'), width: 40, height: 40 }) }));
|
|
16
|
+
return (_jsx("div", { className: clsx('i-item-icon', className, modifierClassName), style: style, children: _jsx("img", { src: preselectedIconUrl, alt: "", className: clsx(className ? `${className}-img` : 'i-item-icon__img'), width: 40, height: 40 }) }));
|
|
17
17
|
}
|
|
18
18
|
return (_jsx("button", { type: "button", className: clsx('i-item-icon', className ? `${className}-placeholder` : null, 'i-item-icon__placeholder', !isModalOpen && '--clickable'), onClick: () => setModalOpen(true), children: _jsx("span", { children: "\u2606" }) }));
|
|
19
19
|
}
|
|
20
20
|
if (icon.type === 'media') {
|
|
21
21
|
if (((_a = icon.media) === null || _a === void 0 ? void 0 : _a.id) && mediaIconUrl) {
|
|
22
|
-
return (_jsx("div", { className: clsx('i-item-icon', className), children: _jsx("img", { src: mediaIconUrl, alt: icon.media.alt, className: clsx(className ? `${className}-img` : null, 'i-item-icon__img') }) }));
|
|
22
|
+
return (_jsx("div", { className: clsx('i-item-icon', className, modifierClassName), style: style, children: _jsx("img", { src: mediaIconUrl, alt: icon.media.alt, className: clsx(className ? `${className}-img` : null, 'i-item-icon__img') }) }));
|
|
23
23
|
}
|
|
24
24
|
return (_jsx("div", { className: clsx('i-item-icon', className ? `${className}-placeholder` : 'i-item-icon__placeholder'), children: _jsx("span", { children: "\u2606" }) }));
|
|
25
25
|
}
|
|
26
26
|
if (icon.type === 'number') {
|
|
27
27
|
if (icon.src) {
|
|
28
|
-
return (_jsx("div", { className: clsx('i-item-icon', className), children: _jsx("span", { className: clsx(className ? `${className}-number` : 'i-item-icon__number'), children: icon.src }) }));
|
|
28
|
+
return (_jsx("div", { className: clsx('i-item-icon', className, modifierClassName), style: style, children: _jsx("span", { className: clsx(className ? `${className}-number` : 'i-item-icon__number'), children: icon.src }) }));
|
|
29
29
|
}
|
|
30
30
|
return (_jsx("div", { className: clsx('i-item-icon', className ? `${className}-placeholder` : 'i-item-icon__placeholder'), children: _jsx("span", { children: "\u2606" }) }));
|
|
31
31
|
}
|
package/package.json
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import {__} from '@wordpress/i18n'
|
|
2
|
+
|
|
1
3
|
export const CONTACT_COLUMNS = [2, 3] as const
|
|
2
4
|
|
|
3
5
|
export const CONTACT_COLUMNS_CONTEXT = 'brilo/contact-columns'
|
|
6
|
+
|
|
7
|
+
export const DEFAULT_SHADOWS = [
|
|
8
|
+
{value: 'none', label: __('Žádný', 'brilo-blocks')},
|
|
9
|
+
{value: 'sm', label: __('Malý', 'brilo-blocks')},
|
|
10
|
+
{value: 'md', label: __('Střední', 'brilo-blocks')},
|
|
11
|
+
] as const
|
|
12
|
+
|
|
13
|
+
export const TEXT_ALIGNS = [
|
|
14
|
+
{value: 'left', label: __('Vlevo', 'brilo-blocks')},
|
|
15
|
+
{value: 'center', label: __('Na střed', 'brilo-blocks')},
|
|
16
|
+
] as const
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {InspectorControls} from '@wordpress/block-editor'
|
|
2
2
|
import {
|
|
3
|
+
BaseControl,
|
|
4
|
+
ColorPalette,
|
|
3
5
|
PanelBody,
|
|
4
6
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
5
7
|
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
@@ -7,8 +9,9 @@ import {
|
|
|
7
9
|
import {__} from '@wordpress/i18n'
|
|
8
10
|
import clsx from 'clsx'
|
|
9
11
|
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
+
import {useTenantColorPalette} from '~/hooks/useTenantColorPalette'
|
|
13
|
+
import {CONTACT_COLUMNS, DEFAULT_SHADOWS, TEXT_ALIGNS} from './constants'
|
|
14
|
+
import type {ContactColumns, ContactGroupAttributes, ContactGroupOptions, ContactShadow, ContactTextAlign} from './types'
|
|
12
15
|
|
|
13
16
|
export function createContactGroupEdit(options: ContactGroupOptions) {
|
|
14
17
|
const COLUMNS = options.columns ?? CONTACT_COLUMNS
|
|
@@ -20,7 +23,8 @@ export function createContactGroupEdit(options: ContactGroupOptions) {
|
|
|
20
23
|
attributes: ContactGroupAttributes
|
|
21
24
|
setAttributes: (a: Partial<ContactGroupAttributes>) => void
|
|
22
25
|
}) {
|
|
23
|
-
const {columns} = attributes
|
|
26
|
+
const {columns, style} = attributes
|
|
27
|
+
const {paletteColors} = useTenantColorPalette()
|
|
24
28
|
|
|
25
29
|
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
26
30
|
blockClassName: clsx(options.blockClassName ?? 'g-contact wp-block-section'),
|
|
@@ -47,6 +51,53 @@ export function createContactGroupEdit(options: ContactGroupOptions) {
|
|
|
47
51
|
))}
|
|
48
52
|
</ToggleGroupControl>
|
|
49
53
|
</PanelBody>
|
|
54
|
+
<PanelBody title={__('Styl', 'brilo-blocks')}>
|
|
55
|
+
<ToggleGroupControl
|
|
56
|
+
isBlock
|
|
57
|
+
label={__('Stín', 'brilo-blocks')}
|
|
58
|
+
value={style.shadow}
|
|
59
|
+
onChange={(v) => setAttributes({style: {...style, shadow: v as ContactShadow}})}
|
|
60
|
+
>
|
|
61
|
+
{DEFAULT_SHADOWS.map((s) => (
|
|
62
|
+
<ToggleGroupControlOption key={s.value} value={s.value} label={s.label} />
|
|
63
|
+
))}
|
|
64
|
+
</ToggleGroupControl>
|
|
65
|
+
<BaseControl
|
|
66
|
+
label={__('Barva okraje', 'brilo-blocks')}
|
|
67
|
+
help={__('Bez vybrané barvy se okraj nevykreslí.', 'brilo-blocks')}
|
|
68
|
+
id="contact-group-border-color"
|
|
69
|
+
>
|
|
70
|
+
<ColorPalette
|
|
71
|
+
colors={paletteColors}
|
|
72
|
+
value={style.borderColor || undefined}
|
|
73
|
+
onChange={(value) => setAttributes({style: {...style, borderColor: value ?? ''}})}
|
|
74
|
+
/>
|
|
75
|
+
</BaseControl>
|
|
76
|
+
<BaseControl label={__('Barva pozadí', 'brilo-blocks')} id="contact-group-background-color">
|
|
77
|
+
<ColorPalette
|
|
78
|
+
colors={paletteColors}
|
|
79
|
+
value={style.backgroundColor || undefined}
|
|
80
|
+
onChange={(value) => setAttributes({style: {...style, backgroundColor: value ?? ''}})}
|
|
81
|
+
/>
|
|
82
|
+
</BaseControl>
|
|
83
|
+
<BaseControl label={__('Barva textu', 'brilo-blocks')} id="contact-group-text-color">
|
|
84
|
+
<ColorPalette
|
|
85
|
+
colors={paletteColors}
|
|
86
|
+
value={style.textColor || undefined}
|
|
87
|
+
onChange={(value) => setAttributes({style: {...style, textColor: value ?? ''}})}
|
|
88
|
+
/>
|
|
89
|
+
</BaseControl>
|
|
90
|
+
<ToggleGroupControl
|
|
91
|
+
isBlock
|
|
92
|
+
label={__('Zarovnání textu', 'brilo-blocks')}
|
|
93
|
+
value={style.textAlign}
|
|
94
|
+
onChange={(v) => setAttributes({style: {...style, textAlign: v as ContactTextAlign}})}
|
|
95
|
+
>
|
|
96
|
+
{TEXT_ALIGNS.map((a) => (
|
|
97
|
+
<ToggleGroupControlOption key={a.value} value={a.value} label={a.label} />
|
|
98
|
+
))}
|
|
99
|
+
</ToggleGroupControl>
|
|
100
|
+
</PanelBody>
|
|
50
101
|
</InspectorControls>
|
|
51
102
|
<div {...blockProps}>
|
|
52
103
|
<div {...innerBlocksProps} />
|
|
@@ -2,7 +2,7 @@ import {InnerBlocks} from '@wordpress/block-editor'
|
|
|
2
2
|
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
3
3
|
import {__} from '@wordpress/i18n'
|
|
4
4
|
import type {NumberArray} from '~/types'
|
|
5
|
-
import {CONTACT_COLUMNS, CONTACT_COLUMNS_CONTEXT} from './constants'
|
|
5
|
+
import {CONTACT_COLUMNS, CONTACT_COLUMNS_CONTEXT, DEFAULT_SHADOWS} from './constants'
|
|
6
6
|
import {createContactGroupEdit} from './edit'
|
|
7
7
|
import type {ContactGroupAttributes, ContactGroupOptions} from './types'
|
|
8
8
|
|
|
@@ -28,6 +28,10 @@ export function createContactGroupBlock<TColumns extends NumberArray = typeof CO
|
|
|
28
28
|
default: columns[1] ?? columns[0],
|
|
29
29
|
enum: [...columns],
|
|
30
30
|
},
|
|
31
|
+
style: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
default: {shadow: DEFAULT_SHADOWS[0].value, borderColor: '', backgroundColor: '', textColor: '', textAlign: 'left'},
|
|
34
|
+
},
|
|
31
35
|
},
|
|
32
36
|
edit: createContactGroupEdit(options as unknown as ContactGroupOptions),
|
|
33
37
|
save: () => <InnerBlocks.Content />,
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import type {BriloBlockType, NumberArray} from '~/types'
|
|
2
|
-
import type {CONTACT_COLUMNS} from './constants'
|
|
2
|
+
import type {CONTACT_COLUMNS, DEFAULT_SHADOWS, TEXT_ALIGNS} from './constants'
|
|
3
3
|
|
|
4
4
|
export type ContactColumns = (typeof CONTACT_COLUMNS)[number]
|
|
5
5
|
|
|
6
|
+
export type ContactShadow = (typeof DEFAULT_SHADOWS)[number]['value']
|
|
7
|
+
|
|
8
|
+
export type ContactTextAlign = (typeof TEXT_ALIGNS)[number]['value']
|
|
9
|
+
|
|
6
10
|
export interface ContactGroupAttributes<TColumns extends number = ContactColumns> extends Record<string, unknown> {
|
|
7
11
|
columns: TColumns
|
|
12
|
+
style: {
|
|
13
|
+
shadow: ContactShadow
|
|
14
|
+
borderColor: string
|
|
15
|
+
backgroundColor: string
|
|
16
|
+
textColor: string
|
|
17
|
+
textAlign: ContactTextAlign
|
|
18
|
+
}
|
|
8
19
|
}
|
|
9
20
|
|
|
10
21
|
export interface ContactGroupOptions<TColumns extends NumberArray = typeof CONTACT_COLUMNS> extends BriloBlockType {
|
|
@@ -82,6 +82,12 @@
|
|
|
82
82
|
.g-text-and-media__inner-blocks {
|
|
83
83
|
margin-top: 8px;
|
|
84
84
|
min-height: 40px;
|
|
85
|
+
|
|
86
|
+
p,
|
|
87
|
+
ul,
|
|
88
|
+
ol {
|
|
89
|
+
margin-block: 8px;
|
|
90
|
+
}
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
.g-text-and-media__chip {
|
|
@@ -121,3 +127,11 @@
|
|
|
121
127
|
}
|
|
122
128
|
}
|
|
123
129
|
}
|
|
130
|
+
|
|
131
|
+
.g-text-and-media__inner-blocks {
|
|
132
|
+
p,
|
|
133
|
+
ul,
|
|
134
|
+
ol {
|
|
135
|
+
margin-block: 8px;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -6,5 +6,5 @@ import type {SignpostItemOptions} from './types'
|
|
|
6
6
|
export const signpostItemDefaults: SignpostItemOptions = {
|
|
7
7
|
name: 'brilo/signpost-item',
|
|
8
8
|
parent: ['brilo/signpost-group'],
|
|
9
|
-
allowedBlocks: ['core/paragraph', 'core/list', 'core/heading'],
|
|
9
|
+
allowedBlocks: ['core/paragraph', 'core/list', 'core/heading', 'core/group', 'brilo/responsive-grid-group', 'brilo/link-item'],
|
|
10
10
|
}
|
|
@@ -25,27 +25,39 @@ export const DEFAULT_SHADOWS = [
|
|
|
25
25
|
{value: 'md', label: __('Střední', 'brilo-blocks')},
|
|
26
26
|
] as const
|
|
27
27
|
|
|
28
|
-
export const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
{value:
|
|
28
|
+
export const DEFAULT_ICON_SIZE = 88
|
|
29
|
+
export const ICON_SIZE_MIN = 4
|
|
30
|
+
export const ICON_SIZE_MAX = 128
|
|
31
|
+
|
|
32
|
+
export const DEFAULT_ICON_SIZE_PRESETS = [
|
|
33
|
+
{value: 8, label: __('XS', 'brilo-blocks')},
|
|
34
|
+
{value: 16, label: __('SM', 'brilo-blocks')},
|
|
35
|
+
{value: 24, label: __('MD', 'brilo-blocks')},
|
|
36
|
+
{value: 32, label: __('LG', 'brilo-blocks')},
|
|
37
|
+
{value: 48, label: __('XL', 'brilo-blocks')},
|
|
34
38
|
] as const
|
|
35
39
|
|
|
36
|
-
export const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{value:
|
|
40
|
+
export const DEFAULT_ICON_BACKGROUND_SIZE = 88
|
|
41
|
+
export const ICON_BACKGROUND_SIZE_MIN = 16
|
|
42
|
+
export const ICON_BACKGROUND_SIZE_MAX = 240
|
|
43
|
+
|
|
44
|
+
export const DEFAULT_ICON_BACKGROUND_SIZE_PRESETS = [
|
|
45
|
+
{value: 48, label: __('XS', 'brilo-blocks')},
|
|
46
|
+
{value: 64, label: __('SM', 'brilo-blocks')},
|
|
47
|
+
{value: 88, label: __('Výchozí', 'brilo-blocks')},
|
|
48
|
+
{value: 104, label: __('LG', 'brilo-blocks')},
|
|
49
|
+
{value: 128, label: __('XL', 'brilo-blocks')},
|
|
42
50
|
] as const
|
|
43
51
|
|
|
44
|
-
export const
|
|
45
|
-
{value: 'none', label: __('
|
|
46
|
-
{value: '
|
|
47
|
-
{value: '
|
|
48
|
-
{value: '
|
|
52
|
+
export const DEFAULT_ICON_BACKGROUND_SHAPES = [
|
|
53
|
+
{value: 'none', label: __('Žádný', 'brilo-blocks')},
|
|
54
|
+
{value: 'circle', label: __('Kruh', 'brilo-blocks')},
|
|
55
|
+
{value: 'triangle', label: __('Trojúhelník', 'brilo-blocks')},
|
|
56
|
+
{value: 'rhombus', label: __('Kosočtverec', 'brilo-blocks')},
|
|
57
|
+
{value: 'octagon', label: __('Osmiúhelník', 'brilo-blocks')},
|
|
58
|
+
{value: 'bevel', label: __('Zkosený', 'brilo-blocks')},
|
|
59
|
+
{value: 'rabbet', label: __('Drážkovaný', 'brilo-blocks')},
|
|
60
|
+
{value: 'parallelogram', label: __('Rovnoběžník', 'brilo-blocks')},
|
|
49
61
|
] as const
|
|
50
62
|
|
|
51
63
|
export const DEFAULT_ALIGNMENTS = [
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {InspectorControls} from '@wordpress/block-editor'
|
|
2
2
|
import {
|
|
3
3
|
PanelBody,
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
Button,
|
|
5
|
+
RangeControl,
|
|
6
6
|
BaseControl,
|
|
7
7
|
ColorPalette,
|
|
8
|
+
SelectControl,
|
|
8
9
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
9
10
|
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
10
11
|
} from '@wordpress/components'
|
|
@@ -18,11 +19,15 @@ import {
|
|
|
18
19
|
DEFAULT_CONTENT_SIZES,
|
|
19
20
|
DEFAULT_DIRECTIONS,
|
|
20
21
|
DEFAULT_HEADING_STYLES,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
DEFAULT_ICON_BACKGROUND_SHAPES,
|
|
23
|
+
DEFAULT_ICON_BACKGROUND_SIZE_PRESETS,
|
|
24
|
+
DEFAULT_ICON_SIZE_PRESETS,
|
|
24
25
|
DEFAULT_SHADOWS,
|
|
25
26
|
HEADING_LEVELS,
|
|
27
|
+
ICON_BACKGROUND_SIZE_MAX,
|
|
28
|
+
ICON_BACKGROUND_SIZE_MIN,
|
|
29
|
+
ICON_SIZE_MAX,
|
|
30
|
+
ICON_SIZE_MIN,
|
|
26
31
|
} from './constants'
|
|
27
32
|
import type {
|
|
28
33
|
UspAlignment,
|
|
@@ -32,20 +37,48 @@ import type {
|
|
|
32
37
|
UspGroupOptions,
|
|
33
38
|
UspHeadingLevel,
|
|
34
39
|
UspHeadingStyle,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
UspIconSize,
|
|
40
|
+
UspIconBackgroundShape,
|
|
41
|
+
UspSizePreset,
|
|
38
42
|
UspShadow,
|
|
39
43
|
} from './types'
|
|
40
44
|
|
|
45
|
+
function PresetSizeControl({
|
|
46
|
+
label,
|
|
47
|
+
value,
|
|
48
|
+
presets,
|
|
49
|
+
min,
|
|
50
|
+
max,
|
|
51
|
+
onChange,
|
|
52
|
+
}: {
|
|
53
|
+
label: string
|
|
54
|
+
value: number
|
|
55
|
+
presets: readonly UspSizePreset[]
|
|
56
|
+
min: number
|
|
57
|
+
max: number
|
|
58
|
+
onChange: (v: number) => void
|
|
59
|
+
}) {
|
|
60
|
+
return (
|
|
61
|
+
<BaseControl label={label} id={`usp-group-size-${label}`}>
|
|
62
|
+
<div style={{display: 'flex', gap: 4, marginBottom: 8, flexWrap: 'wrap'}}>
|
|
63
|
+
{presets.map((p) => (
|
|
64
|
+
<Button key={p.label} variant={value === p.value ? 'primary' : 'secondary'} size="small" onClick={() => onChange(p.value)}>
|
|
65
|
+
{p.label}
|
|
66
|
+
</Button>
|
|
67
|
+
))}
|
|
68
|
+
</div>
|
|
69
|
+
<RangeControl value={value} onChange={(v) => onChange(v ?? min)} min={min} max={max} step={1} withInputField />
|
|
70
|
+
</BaseControl>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
41
74
|
export function createUspGroupEdit(options: UspGroupOptions) {
|
|
42
75
|
const COLUMNS = options.columns ?? DEFAULT_COLUMNS
|
|
43
76
|
const DIRECTIONS = options.directions ?? DEFAULT_DIRECTIONS
|
|
44
77
|
const HEADING_STYLES = options.headingStyles ?? DEFAULT_HEADING_STYLES
|
|
45
78
|
const SHADOWS = options.shadows ?? DEFAULT_SHADOWS
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
79
|
+
const ICON_SIZE_PRESETS = options.iconSizePresets ?? DEFAULT_ICON_SIZE_PRESETS
|
|
80
|
+
const ICON_BACKGROUND_SIZE_PRESETS = options.iconBackgroundSizePresets ?? DEFAULT_ICON_BACKGROUND_SIZE_PRESETS
|
|
81
|
+
const ICON_BACKGROUND_SHAPES = options.iconBackgroundShapes ?? DEFAULT_ICON_BACKGROUND_SHAPES
|
|
49
82
|
const ALIGNMENTS = options.alignments ?? DEFAULT_ALIGNMENTS
|
|
50
83
|
const CONTENT_SIZES = options.contentSizes ?? DEFAULT_CONTENT_SIZES
|
|
51
84
|
|
|
@@ -110,6 +143,18 @@ export function createUspGroupEdit(options: UspGroupOptions) {
|
|
|
110
143
|
))}
|
|
111
144
|
</ToggleGroupControl>
|
|
112
145
|
)}
|
|
146
|
+
{style.direction === 'vertical' && (
|
|
147
|
+
<ToggleGroupControl
|
|
148
|
+
isBlock
|
|
149
|
+
label={__('Zarovnání textu', 'brilo-blocks')}
|
|
150
|
+
value={style.textAlign}
|
|
151
|
+
onChange={(v) => setAttributes({style: {...style, textAlign: (v as string) ?? ''}})}
|
|
152
|
+
>
|
|
153
|
+
{ALIGNMENTS.map((a) => (
|
|
154
|
+
<ToggleGroupControlOption key={a.value} value={a.value} label={a.label} />
|
|
155
|
+
))}
|
|
156
|
+
</ToggleGroupControl>
|
|
157
|
+
)}
|
|
113
158
|
<ToggleGroupControl
|
|
114
159
|
isBlock
|
|
115
160
|
label={__('Úroveň nadpisu položek', 'brilo-blocks')}
|
|
@@ -180,33 +225,63 @@ export function createUspGroupEdit(options: UspGroupOptions) {
|
|
|
180
225
|
</BaseControl>
|
|
181
226
|
</PanelBody>
|
|
182
227
|
<PanelBody title={__('Ikona', 'brilo-blocks')} initialOpen={false}>
|
|
183
|
-
<
|
|
184
|
-
isBlock
|
|
228
|
+
<PresetSizeControl
|
|
185
229
|
label={__('Velikost', 'brilo-blocks')}
|
|
186
230
|
value={style.icon.size}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
{
|
|
190
|
-
|
|
191
|
-
))}
|
|
192
|
-
</ToggleGroupControl>
|
|
193
|
-
<SelectControl<string>
|
|
194
|
-
label={__('Barva', 'brilo-blocks')}
|
|
195
|
-
value={style.icon.color}
|
|
196
|
-
options={[...ICON_COLORS]}
|
|
197
|
-
onChange={(v) => setAttributes({style: {...style, icon: {...style.icon, color: v as UspIconColor}}})}
|
|
231
|
+
presets={ICON_SIZE_PRESETS}
|
|
232
|
+
min={ICON_SIZE_MIN}
|
|
233
|
+
max={ICON_SIZE_MAX}
|
|
234
|
+
onChange={(v) => setAttributes({style: {...style, icon: {...style.icon, size: v}}})}
|
|
198
235
|
/>
|
|
199
|
-
<
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
236
|
+
<BaseControl label={__('Barva', 'brilo-blocks')} id="usp-group-icon-color">
|
|
237
|
+
<ColorPalette
|
|
238
|
+
colors={paletteColors}
|
|
239
|
+
value={style.icon.color || undefined}
|
|
240
|
+
onChange={(value) => setAttributes({style: {...style, icon: {...style.icon, color: value ?? ''}}})}
|
|
241
|
+
/>
|
|
242
|
+
</BaseControl>
|
|
243
|
+
<BaseControl label={__('Pozadí', 'brilo-blocks')} id="usp-group-icon-background-color">
|
|
244
|
+
<ColorPalette
|
|
245
|
+
colors={paletteColors}
|
|
246
|
+
value={style.icon.background || undefined}
|
|
247
|
+
onChange={(value) => setAttributes({style: {...style, icon: {...style.icon, background: value ?? ''}}})}
|
|
248
|
+
/>
|
|
249
|
+
</BaseControl>
|
|
250
|
+
<PresetSizeControl
|
|
251
|
+
label={__('Velikost pozadí', 'brilo-blocks')}
|
|
252
|
+
value={style.icon.backgroundSize}
|
|
253
|
+
presets={ICON_BACKGROUND_SIZE_PRESETS}
|
|
254
|
+
min={ICON_BACKGROUND_SIZE_MIN}
|
|
255
|
+
max={ICON_BACKGROUND_SIZE_MAX}
|
|
256
|
+
onChange={(v) => setAttributes({style: {...style, icon: {...style.icon, backgroundSize: v}}})}
|
|
204
257
|
/>
|
|
205
|
-
{style.icon.background
|
|
206
|
-
<
|
|
207
|
-
label={__('
|
|
208
|
-
|
|
209
|
-
|
|
258
|
+
{style.icon.background && (
|
|
259
|
+
<SelectControl<string>
|
|
260
|
+
label={__('Tvar pozadí', 'brilo-blocks')}
|
|
261
|
+
value={style.icon.backgroundShape}
|
|
262
|
+
options={[...ICON_BACKGROUND_SHAPES]}
|
|
263
|
+
onChange={(v) => setAttributes({style: {...style, icon: {...style.icon, backgroundShape: v as UspIconBackgroundShape}}})}
|
|
264
|
+
/>
|
|
265
|
+
)}
|
|
266
|
+
<BaseControl
|
|
267
|
+
label={__('Barva ohraničení', 'brilo-blocks')}
|
|
268
|
+
help={__('Bez vybrané barvy se okraj nevykreslí.', 'brilo-blocks')}
|
|
269
|
+
id="usp-group-icon-border-color"
|
|
270
|
+
>
|
|
271
|
+
<ColorPalette
|
|
272
|
+
colors={paletteColors}
|
|
273
|
+
value={style.icon.borderColor || undefined}
|
|
274
|
+
onChange={(value) => setAttributes({style: {...style, icon: {...style.icon, borderColor: value ?? ''}}})}
|
|
275
|
+
/>
|
|
276
|
+
</BaseControl>
|
|
277
|
+
{style.icon.borderColor && (
|
|
278
|
+
<RangeControl
|
|
279
|
+
label={__('Šířka ohraničení (px)', 'brilo-blocks')}
|
|
280
|
+
value={style.icon.borderWidth}
|
|
281
|
+
onChange={(v) => setAttributes({style: {...style, icon: {...style.icon, borderWidth: v ?? 0}}})}
|
|
282
|
+
min={0}
|
|
283
|
+
max={10}
|
|
284
|
+
step={1}
|
|
210
285
|
/>
|
|
211
286
|
)}
|
|
212
287
|
</PanelBody>
|