@brilo/base-blocks 0.1.49 → 0.1.50
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/person/person-group/constants.d.ts +17 -0
- package/build/blocks/person/person-group/constants.d.ts.map +1 -1
- package/build/blocks/person/person-group/constants.js +10 -0
- package/build/blocks/person/person-group/edit.d.ts.map +1 -1
- package/build/blocks/person/person-group/edit.js +6 -4
- package/build/blocks/person/person-group/factory.d.ts.map +1 -1
- package/build/blocks/person/person-group/factory.js +12 -1
- package/build/blocks/person/person-group/types.d.ts +11 -0
- package/build/blocks/person/person-group/types.d.ts.map +1 -1
- package/build/blocks/step/step-group/constants.d.ts +55 -0
- package/build/blocks/step/step-group/constants.d.ts.map +1 -1
- package/build/blocks/step/step-group/constants.js +29 -0
- package/build/blocks/step/step-group/edit.d.ts.map +1 -1
- package/build/blocks/step/step-group/edit.js +28 -3
- package/build/blocks/step/step-group/factory.d.ts.map +1 -1
- package/build/blocks/step/step-group/factory.js +16 -1
- package/build/blocks/step/step-group/types.d.ts +17 -1
- package/build/blocks/step/step-group/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/blocks/person/person-group/constants.ts +13 -0
- package/src/blocks/person/person-group/edit.tsx +63 -3
- package/src/blocks/person/person-group/factory.tsx +12 -1
- package/src/blocks/person/person-group/types.ts +13 -0
- package/src/blocks/step/step-group/constants.ts +35 -0
- package/src/blocks/step/step-group/edit.tsx +163 -5
- package/src/blocks/step/step-group/factory.tsx +16 -1
- package/src/blocks/step/step-group/types.ts +20 -1
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
export declare const COLUMNS: readonly [4, 3, 2];
|
|
2
2
|
export declare const HEADING_LEVELS: readonly [2, 3, 4];
|
|
3
|
+
export declare const DEFAULT_SHADOWS: readonly [{
|
|
4
|
+
readonly value: 'none';
|
|
5
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Žádný">;
|
|
6
|
+
}, {
|
|
7
|
+
readonly value: 'sm';
|
|
8
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Malý">;
|
|
9
|
+
}, {
|
|
10
|
+
readonly value: 'md';
|
|
11
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Střední">;
|
|
12
|
+
}];
|
|
13
|
+
export declare const TEXT_ALIGNS: readonly [{
|
|
14
|
+
readonly value: 'left';
|
|
15
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Vlevo">;
|
|
16
|
+
}, {
|
|
17
|
+
readonly value: 'center';
|
|
18
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Na střed">;
|
|
19
|
+
}];
|
|
3
20
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/person/person-group/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/person/person-group/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,YAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAU,CAAA;AACzC,eAAO,MAAM,cAAc,YAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAU,CAAA;AAEhD,eAAO,MAAM,eAAe;aACzB,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,IAAI;aAAE,KAAK;;aAClB,KAAK,EAAE,IAAI;aAAE,KAAK;EACX,CAAA;AAEV,eAAO,MAAM,WAAW;aACrB,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,QAAQ;aAAE,KAAK;EACf,CAAA"}
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
1
2
|
export const COLUMNS = [4, 3, 2];
|
|
2
3
|
export const HEADING_LEVELS = [2, 3, 4];
|
|
4
|
+
export const DEFAULT_SHADOWS = [
|
|
5
|
+
{ value: 'none', label: __('Žádný', 'brilo-blocks') },
|
|
6
|
+
{ value: 'sm', label: __('Malý', 'brilo-blocks') },
|
|
7
|
+
{ value: 'md', label: __('Střední', 'brilo-blocks') },
|
|
8
|
+
];
|
|
9
|
+
export const TEXT_ALIGNS = [
|
|
10
|
+
{ value: 'left', label: __('Vlevo', 'brilo-blocks') },
|
|
11
|
+
{ value: 'center', label: __('Na střed', 'brilo-blocks') },
|
|
12
|
+
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/person/person-group/edit.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/person/person-group/edit.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAgC,MAAM,SAAS,CAAA;AAErG,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,kBAAkB,oCAI5D;IACD,UAAU,EAAE,qBAAqB,CAAA;IACjC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAAA;CAC3D,iCAsGF"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { InspectorControls } from '@wordpress/block-editor';
|
|
3
|
-
import { PanelBody, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from '@wordpress/components';
|
|
3
|
+
import { BaseControl, ColorPalette, PanelBody, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from '@wordpress/components';
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { useGroupBlock } from '../../../hooks/useGroupBlock';
|
|
7
|
-
import {
|
|
7
|
+
import { useTenantColorPalette } from '../../../hooks/useTenantColorPalette';
|
|
8
|
+
import { COLUMNS, DEFAULT_SHADOWS, HEADING_LEVELS, TEXT_ALIGNS } from './constants';
|
|
8
9
|
export function createPersonGroupEdit(options) {
|
|
9
10
|
return function Edit({ attributes, setAttributes, }) {
|
|
10
11
|
var _a, _b;
|
|
11
|
-
const { columns, headingLevel } = attributes;
|
|
12
|
+
const { columns, headingLevel, style } = attributes;
|
|
13
|
+
const { paletteColors } = useTenantColorPalette();
|
|
12
14
|
const { blockProps, innerBlocksProps } = useGroupBlock({
|
|
13
15
|
blockClassName: clsx((_a = options.blockClassName) !== null && _a !== void 0 ? _a : 'g-person wp-block-section'),
|
|
14
16
|
containerClassName: [(_b = options.containerClassName) !== null && _b !== void 0 ? _b : 'u-grid-responsive', `--cols-${columns}`],
|
|
@@ -18,6 +20,6 @@ export function createPersonGroupEdit(options) {
|
|
|
18
20
|
template: options.template,
|
|
19
21
|
layout: { type: 'default' },
|
|
20
22
|
});
|
|
21
|
-
return (_jsxs(_Fragment, { children: [
|
|
23
|
+
return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Rozložení', 'brilo-blocks'), children: [_jsx(ToggleGroupControl, { isBlock: true, label: __('Počet sloupců', 'brilo-blocks'), value: String(columns), onChange: (v) => setAttributes({ columns: Number(v) }), children: COLUMNS.map((c) => (_jsx(ToggleGroupControlOption, { value: String(c), label: String(c) }, c))) }), _jsx(ToggleGroupControl, { isBlock: true, label: __('Úroveň nadpisu položek', 'brilo-blocks'), value: String(headingLevel), onChange: (v) => setAttributes({ headingLevel: Number(v) }), children: HEADING_LEVELS.map((l) => (_jsx(ToggleGroupControlOption, { value: String(l), label: `H${l}` }, l))) })] }), style && (_jsxs(PanelBody, { title: __('Styl', 'brilo-blocks'), children: [_jsx(ToggleGroupControl, { isBlock: true, label: __('Stín', 'brilo-blocks'), value: style.shadow, onChange: (v) => setAttributes({ style: { ...style, shadow: v } }), children: DEFAULT_SHADOWS.map((s) => (_jsx(ToggleGroupControlOption, { value: s.value, label: s.label }, s.value))) }), _jsx(BaseControl, { label: __('Barva okraje', 'brilo-blocks'), help: __('Bez vybrané barvy se okraj nevykreslí.', 'brilo-blocks'), id: "person-group-border-color", children: _jsx(ColorPalette, { colors: paletteColors, value: style.borderColor || undefined, onChange: (value) => setAttributes({ style: { ...style, borderColor: value !== null && value !== void 0 ? value : '' } }) }) }), _jsx(BaseControl, { label: __('Barva pozadí', 'brilo-blocks'), id: "person-group-background-color", children: _jsx(ColorPalette, { colors: paletteColors, value: style.backgroundColor || undefined, onChange: (value) => setAttributes({ style: { ...style, backgroundColor: value !== null && value !== void 0 ? value : '' } }) }) }), _jsx(BaseControl, { label: __('Barva textu', 'brilo-blocks'), id: "person-group-text-color", children: _jsx(ColorPalette, { colors: paletteColors, value: style.textColor || undefined, onChange: (value) => setAttributes({ style: { ...style, textColor: value !== null && value !== void 0 ? value : '' } }) }) }), _jsx(BaseControl, { label: __('Barva nadpisu', 'brilo-blocks'), id: "person-group-heading-color", children: _jsx(ColorPalette, { colors: paletteColors, value: style.headingColor || undefined, onChange: (value) => setAttributes({ style: { ...style, headingColor: value !== null && value !== void 0 ? value : '' } }) }) }), _jsx(ToggleGroupControl, { isBlock: true, label: __('Zarovnání textu', 'brilo-blocks'), value: style.textAlign, onChange: (v) => setAttributes({ style: { ...style, textAlign: v } }), children: TEXT_ALIGNS.map((a) => (_jsx(ToggleGroupControlOption, { value: a.value, label: a.label }, a.value))) })] }))] }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
|
|
22
24
|
};
|
|
23
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/person/person-group/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAKzD,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAEtE,YAAY,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,CAAA;AAEvD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/person/person-group/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAKzD,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAEtE,YAAY,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,CAAA;AAEvD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,CAmC7G"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { InnerBlocks } from '@wordpress/block-editor';
|
|
3
3
|
import { __ } from '@wordpress/i18n';
|
|
4
|
-
import { COLUMNS, HEADING_LEVELS } from './constants';
|
|
4
|
+
import { COLUMNS, DEFAULT_SHADOWS, HEADING_LEVELS } from './constants';
|
|
5
5
|
import { createPersonGroupEdit } from './edit';
|
|
6
6
|
import { icon as defaultIcon } from './icon';
|
|
7
7
|
export function createPersonGroupBlock(options) {
|
|
@@ -25,6 +25,17 @@ export function createPersonGroupBlock(options) {
|
|
|
25
25
|
default: HEADING_LEVELS[0],
|
|
26
26
|
enum: [...HEADING_LEVELS],
|
|
27
27
|
},
|
|
28
|
+
style: {
|
|
29
|
+
type: 'object',
|
|
30
|
+
default: {
|
|
31
|
+
shadow: DEFAULT_SHADOWS[0].value,
|
|
32
|
+
borderColor: '',
|
|
33
|
+
backgroundColor: '',
|
|
34
|
+
textColor: '',
|
|
35
|
+
headingColor: '',
|
|
36
|
+
textAlign: 'center',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
28
39
|
},
|
|
29
40
|
edit: createPersonGroupEdit(options),
|
|
30
41
|
save: () => _jsx(InnerBlocks.Content, {}),
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import type { BriloBlockType } from '../../../types';
|
|
2
|
+
import type { DEFAULT_SHADOWS, TEXT_ALIGNS } from './constants';
|
|
3
|
+
export type PersonShadow = (typeof DEFAULT_SHADOWS)[number]['value'];
|
|
4
|
+
export type PersonTextAlign = (typeof TEXT_ALIGNS)[number]['value'];
|
|
2
5
|
export interface PersonGroupAttributes extends Record<string, unknown> {
|
|
3
6
|
columns: number;
|
|
4
7
|
headingLevel: number;
|
|
8
|
+
style: {
|
|
9
|
+
shadow: PersonShadow;
|
|
10
|
+
borderColor: string;
|
|
11
|
+
backgroundColor: string;
|
|
12
|
+
textColor: string;
|
|
13
|
+
headingColor: string;
|
|
14
|
+
textAlign: PersonTextAlign;
|
|
15
|
+
};
|
|
5
16
|
}
|
|
6
17
|
export interface PersonGroupOptions extends BriloBlockType {
|
|
7
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/person/person-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/person/person-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAC3C,OAAO,KAAK,EAAC,eAAe,EAAE,WAAW,EAAC,MAAM,aAAa,CAAA;AAE7D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAEpE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAEnE,MAAM,WAAW,qBAAsB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACpE,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE;QACL,MAAM,EAAE,YAAY,CAAA;QACpB,WAAW,EAAE,MAAM,CAAA;QACnB,eAAe,EAAE,MAAM,CAAA;QACvB,SAAS,EAAE,MAAM,CAAA;QACjB,YAAY,EAAE,MAAM,CAAA;QACpB,SAAS,EAAE,eAAe,CAAA;KAC3B,CAAA;CACF;AAED,MAAM,WAAW,kBAAmB,SAAQ,cAAc;CAAG"}
|
|
@@ -5,4 +5,59 @@ export declare const DEFAULT_VARIANTS: readonly [{
|
|
|
5
5
|
readonly value: 'vertical';
|
|
6
6
|
readonly label: import("@wordpress/i18n").TransformedText<"Vertikální">;
|
|
7
7
|
}];
|
|
8
|
+
export declare const DEFAULT_SHADOWS: readonly [{
|
|
9
|
+
readonly value: 'none';
|
|
10
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Žádný">;
|
|
11
|
+
}, {
|
|
12
|
+
readonly value: 'sm';
|
|
13
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Malý">;
|
|
14
|
+
}, {
|
|
15
|
+
readonly value: 'md';
|
|
16
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Střední">;
|
|
17
|
+
}];
|
|
18
|
+
export declare const TEXT_ALIGNS: readonly [{
|
|
19
|
+
readonly value: 'left';
|
|
20
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Vlevo">;
|
|
21
|
+
}, {
|
|
22
|
+
readonly value: 'center';
|
|
23
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Na střed">;
|
|
24
|
+
}];
|
|
25
|
+
export declare const DEFAULT_ICON_SIZE = 48;
|
|
26
|
+
export declare const ICON_SIZE_MIN = 16;
|
|
27
|
+
export declare const ICON_SIZE_MAX = 96;
|
|
28
|
+
export declare const DEFAULT_ICON_SIZE_PRESETS: readonly [{
|
|
29
|
+
readonly value: 24;
|
|
30
|
+
readonly label: import("@wordpress/i18n").TransformedText<"SM">;
|
|
31
|
+
}, {
|
|
32
|
+
readonly value: 32;
|
|
33
|
+
readonly label: import("@wordpress/i18n").TransformedText<"MD">;
|
|
34
|
+
}, {
|
|
35
|
+
readonly value: 48;
|
|
36
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Výchozí">;
|
|
37
|
+
}, {
|
|
38
|
+
readonly value: 64;
|
|
39
|
+
readonly label: import("@wordpress/i18n").TransformedText<"LG">;
|
|
40
|
+
}, {
|
|
41
|
+
readonly value: 80;
|
|
42
|
+
readonly label: import("@wordpress/i18n").TransformedText<"XL">;
|
|
43
|
+
}];
|
|
44
|
+
export declare const DEFAULT_ICON_BACKGROUND_SIZE = 144;
|
|
45
|
+
export declare const ICON_BACKGROUND_SIZE_MIN = 56;
|
|
46
|
+
export declare const ICON_BACKGROUND_SIZE_MAX = 200;
|
|
47
|
+
export declare const DEFAULT_ICON_BACKGROUND_SIZE_PRESETS: readonly [{
|
|
48
|
+
readonly value: 88;
|
|
49
|
+
readonly label: import("@wordpress/i18n").TransformedText<"SM">;
|
|
50
|
+
}, {
|
|
51
|
+
readonly value: 112;
|
|
52
|
+
readonly label: import("@wordpress/i18n").TransformedText<"MD">;
|
|
53
|
+
}, {
|
|
54
|
+
readonly value: 144;
|
|
55
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Výchozí">;
|
|
56
|
+
}, {
|
|
57
|
+
readonly value: 168;
|
|
58
|
+
readonly label: import("@wordpress/i18n").TransformedText<"LG">;
|
|
59
|
+
}, {
|
|
60
|
+
readonly value: 200;
|
|
61
|
+
readonly label: import("@wordpress/i18n").TransformedText<"XL">;
|
|
62
|
+
}];
|
|
8
63
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/step/step-group/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;aAC1B,KAAK,EAAE,YAAY;aAAE,KAAK;;aAC1B,KAAK,EAAE,UAAU;aAAE,KAAK;EACjB,CAAA"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/step/step-group/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;aAC1B,KAAK,EAAE,YAAY;aAAE,KAAK;;aAC1B,KAAK,EAAE,UAAU;aAAE,KAAK;EACjB,CAAA;AAEV,eAAO,MAAM,eAAe;aACzB,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,IAAI;aAAE,KAAK;;aAClB,KAAK,EAAE,IAAI;aAAE,KAAK;EACX,CAAA;AAEV,eAAO,MAAM,WAAW;aACrB,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,QAAQ;aAAE,KAAK;EACf,CAAA;AAEV,eAAO,MAAM,iBAAiB,KAAK,CAAA;AACnC,eAAO,MAAM,aAAa,KAAK,CAAA;AAC/B,eAAO,MAAM,aAAa,KAAK,CAAA;AAE/B,eAAO,MAAM,yBAAyB;aACnC,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;EACT,CAAA;AAEV,eAAO,MAAM,4BAA4B,MAAM,CAAA;AAC/C,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAC1C,eAAO,MAAM,wBAAwB,MAAM,CAAA;AAE3C,eAAO,MAAM,oCAAoC;aAC9C,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,GAAG;aAAE,KAAK;;aACjB,KAAK,EAAE,GAAG;aAAE,KAAK;;aACjB,KAAK,EAAE,GAAG;aAAE,KAAK;;aACjB,KAAK,EAAE,GAAG;aAAE,KAAK;EACV,CAAA"}
|
|
@@ -3,3 +3,32 @@ export const DEFAULT_VARIANTS = [
|
|
|
3
3
|
{ value: 'horizontal', label: __('Horizontální', 'brilo-blocks') },
|
|
4
4
|
{ value: 'vertical', label: __('Vertikální', 'brilo-blocks') },
|
|
5
5
|
];
|
|
6
|
+
export const DEFAULT_SHADOWS = [
|
|
7
|
+
{ value: 'none', label: __('Žádný', 'brilo-blocks') },
|
|
8
|
+
{ value: 'sm', label: __('Malý', 'brilo-blocks') },
|
|
9
|
+
{ value: 'md', label: __('Střední', 'brilo-blocks') },
|
|
10
|
+
];
|
|
11
|
+
export const TEXT_ALIGNS = [
|
|
12
|
+
{ value: 'left', label: __('Vlevo', 'brilo-blocks') },
|
|
13
|
+
{ value: 'center', label: __('Na střed', 'brilo-blocks') },
|
|
14
|
+
];
|
|
15
|
+
export const DEFAULT_ICON_SIZE = 48;
|
|
16
|
+
export const ICON_SIZE_MIN = 16;
|
|
17
|
+
export const ICON_SIZE_MAX = 96;
|
|
18
|
+
export const DEFAULT_ICON_SIZE_PRESETS = [
|
|
19
|
+
{ value: 24, label: __('SM', 'brilo-blocks') },
|
|
20
|
+
{ value: 32, label: __('MD', 'brilo-blocks') },
|
|
21
|
+
{ value: 48, label: __('Výchozí', 'brilo-blocks') },
|
|
22
|
+
{ value: 64, label: __('LG', 'brilo-blocks') },
|
|
23
|
+
{ value: 80, label: __('XL', 'brilo-blocks') },
|
|
24
|
+
];
|
|
25
|
+
export const DEFAULT_ICON_BACKGROUND_SIZE = 144;
|
|
26
|
+
export const ICON_BACKGROUND_SIZE_MIN = 56;
|
|
27
|
+
export const ICON_BACKGROUND_SIZE_MAX = 200;
|
|
28
|
+
export const DEFAULT_ICON_BACKGROUND_SIZE_PRESETS = [
|
|
29
|
+
{ value: 88, label: __('SM', 'brilo-blocks') },
|
|
30
|
+
{ value: 112, label: __('MD', 'brilo-blocks') },
|
|
31
|
+
{ value: 144, label: __('Výchozí', 'brilo-blocks') },
|
|
32
|
+
{ value: 168, label: __('LG', 'brilo-blocks') },
|
|
33
|
+
{ value: 200, label: __('XL', 'brilo-blocks') },
|
|
34
|
+
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/step/step-group/edit.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/step/step-group/edit.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AACxC,OAAO,KAAK,EAAC,mBAAmB,EAAE,gBAAgB,EAA4B,MAAM,SAAS,CAAA;AAC7F,OAAO,EAML,gBAAgB,EAMjB,MAAM,aAAa,CAAA;AAqDpB,wBAAgB,mBAAmB,CAAC,SAAS,SAAS,WAAW,GAAG,OAAO,gBAAgB,EAAE,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,oCAMvG;IACtB,UAAU,EAAE,mBAAmB,CAAA;IAC/B,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAA;CACzD,iCAmIF"}
|
|
@@ -1,17 +1,42 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { InspectorControls } from '@wordpress/block-editor';
|
|
3
|
-
import { PanelBody, ToggleControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from '@wordpress/components';
|
|
3
|
+
import { BaseControl, Button, ColorPalette, PanelBody, RangeControl, ToggleControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from '@wordpress/components';
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { ItemSpacingPanel, itemSpacingStyle } from '../../../components/ItemSpacingControl';
|
|
7
7
|
import { useGroupBlock } from '../../../hooks/useGroupBlock';
|
|
8
|
-
import {
|
|
8
|
+
import { useTenantColorPalette } from '../../../hooks/useTenantColorPalette';
|
|
9
|
+
import { DEFAULT_ICON_BACKGROUND_SIZE, DEFAULT_ICON_BACKGROUND_SIZE_PRESETS, DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE_PRESETS, DEFAULT_SHADOWS, DEFAULT_VARIANTS, ICON_BACKGROUND_SIZE_MAX, ICON_BACKGROUND_SIZE_MIN, ICON_SIZE_MAX, ICON_SIZE_MIN, TEXT_ALIGNS, } from './constants';
|
|
10
|
+
// Older step-group blocks were saved before `style` / `style.icon` existed. WordPress does
|
|
11
|
+
// not deep-merge object-attribute defaults, so normalise here to stay backward compatible.
|
|
12
|
+
function normaliseStyle(saved) {
|
|
13
|
+
return {
|
|
14
|
+
shadow: 'none',
|
|
15
|
+
borderColor: '',
|
|
16
|
+
backgroundColor: '',
|
|
17
|
+
textColor: '',
|
|
18
|
+
headingColor: '',
|
|
19
|
+
textAlign: 'left',
|
|
20
|
+
...saved,
|
|
21
|
+
icon: {
|
|
22
|
+
size: DEFAULT_ICON_SIZE,
|
|
23
|
+
background: '',
|
|
24
|
+
backgroundSize: DEFAULT_ICON_BACKGROUND_SIZE,
|
|
25
|
+
...saved === null || saved === void 0 ? void 0 : saved.icon,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function PresetSizeControl({ label, id, value, presets, min, max, onChange, }) {
|
|
30
|
+
return (_jsxs(BaseControl, { label: label, id: id, children: [_jsx("div", { style: { display: 'flex', gap: 4, marginBottom: 8, flexWrap: 'wrap' }, children: presets.map((p) => (_jsx(Button, { variant: value === p.value ? 'primary' : 'secondary', size: "small", onClick: () => onChange(p.value), children: p.label }, p.label))) }), _jsx(RangeControl, { value: value, onChange: (v) => onChange(v !== null && v !== void 0 ? v : min), min: min, max: max, step: 1, withInputField: true })] }));
|
|
31
|
+
}
|
|
9
32
|
export function createStepGroupEdit(options) {
|
|
10
33
|
var _a;
|
|
11
34
|
const VARIANTS = (_a = options.variants) !== null && _a !== void 0 ? _a : DEFAULT_VARIANTS;
|
|
12
35
|
return function Edit({ attributes, setAttributes, }) {
|
|
13
36
|
var _a, _b;
|
|
14
37
|
const { variant, disableIcon, spacing } = attributes;
|
|
38
|
+
const style = normaliseStyle(attributes.style);
|
|
39
|
+
const { paletteColors } = useTenantColorPalette();
|
|
15
40
|
const { blockProps, innerBlocksProps } = useGroupBlock({
|
|
16
41
|
blockClassName: clsx((_a = options.blockClassName) !== null && _a !== void 0 ? _a : 'g-step wp-block-section', `--variant-${variant}`, disableIcon && '--disable-icon'),
|
|
17
42
|
containerClassName: [(_b = options.containerClassName) !== null && _b !== void 0 ? _b : 'g-step__container', 'u-grid-responsive', '--cols-3'],
|
|
@@ -21,6 +46,6 @@ export function createStepGroupEdit(options) {
|
|
|
21
46
|
template: options.template,
|
|
22
47
|
layout: { type: 'default' },
|
|
23
48
|
});
|
|
24
|
-
return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Nastavení', 'brilo-blocks'), children: [_jsx(ToggleGroupControl, { isBlock: true, label: __('Varianta', 'brilo-blocks'), value: variant, onChange: (v) => setAttributes({ variant: v }), children: VARIANTS.map((v) => (_jsx(ToggleGroupControlOption, { value: v.value, label: v.label }, v.value))) }), _jsx(ToggleControl, { label: __('Vypnout ikonu', 'brilo-blocks'), checked: disableIcon, onChange: (v) => setAttributes({ disableIcon: v }) })] }), _jsx(ItemSpacingPanel, { spacing: spacing, onChange: (v) => setAttributes({ spacing: v }) })] }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
|
|
49
|
+
return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Nastavení', 'brilo-blocks'), children: [_jsx(ToggleGroupControl, { isBlock: true, label: __('Varianta', 'brilo-blocks'), value: variant, onChange: (v) => setAttributes({ variant: v }), children: VARIANTS.map((v) => (_jsx(ToggleGroupControlOption, { value: v.value, label: v.label }, v.value))) }), _jsx(ToggleControl, { label: __('Vypnout ikonu', 'brilo-blocks'), checked: disableIcon, onChange: (v) => setAttributes({ disableIcon: v }) })] }), style && (_jsxs(PanelBody, { title: __('Styl', 'brilo-blocks'), children: [_jsx(ToggleGroupControl, { isBlock: true, label: __('Stín', 'brilo-blocks'), value: style.shadow, onChange: (v) => setAttributes({ style: { ...style, shadow: v } }), children: DEFAULT_SHADOWS.map((s) => (_jsx(ToggleGroupControlOption, { value: s.value, label: s.label }, s.value))) }), _jsx(BaseControl, { label: __('Barva okraje', 'brilo-blocks'), help: __('Bez vybrané barvy se okraj nevykreslí.', 'brilo-blocks'), id: "step-group-border-color", children: _jsx(ColorPalette, { colors: paletteColors, value: style.borderColor || undefined, onChange: (value) => setAttributes({ style: { ...style, borderColor: value !== null && value !== void 0 ? value : '' } }) }) }), _jsx(BaseControl, { label: __('Barva pozadí', 'brilo-blocks'), id: "step-group-background-color", children: _jsx(ColorPalette, { colors: paletteColors, value: style.backgroundColor || undefined, onChange: (value) => setAttributes({ style: { ...style, backgroundColor: value !== null && value !== void 0 ? value : '' } }) }) }), _jsx(BaseControl, { label: __('Barva textu', 'brilo-blocks'), id: "step-group-text-color", children: _jsx(ColorPalette, { colors: paletteColors, value: style.textColor || undefined, onChange: (value) => setAttributes({ style: { ...style, textColor: value !== null && value !== void 0 ? value : '' } }) }) }), _jsx(BaseControl, { label: __('Barva nadpisu', 'brilo-blocks'), id: "step-group-heading-color", children: _jsx(ColorPalette, { colors: paletteColors, value: style.headingColor || undefined, onChange: (value) => setAttributes({ style: { ...style, headingColor: value !== null && value !== void 0 ? value : '' } }) }) }), _jsx(ToggleGroupControl, { isBlock: true, label: __('Zarovnání textu', 'brilo-blocks'), value: style.textAlign, onChange: (v) => setAttributes({ style: { ...style, textAlign: v } }), children: TEXT_ALIGNS.map((a) => (_jsx(ToggleGroupControlOption, { value: a.value, label: a.label }, a.value))) })] })), _jsxs(PanelBody, { title: __('Ikona', 'brilo-blocks'), initialOpen: false, children: [_jsx(PresetSizeControl, { label: __('Velikost', 'brilo-blocks'), id: "step-group-icon-size", value: style.icon.size, presets: DEFAULT_ICON_SIZE_PRESETS, min: ICON_SIZE_MIN, max: ICON_SIZE_MAX, onChange: (v) => setAttributes({ style: { ...style, icon: { ...style.icon, size: v } } }) }), _jsx(BaseControl, { label: __('Barva pozadí', 'brilo-blocks'), help: __('Ovládá i barvu spojnice mezi kroky.', 'brilo-blocks'), id: "step-group-icon-background", children: _jsx(ColorPalette, { colors: paletteColors, value: style.icon.background || undefined, onChange: (value) => setAttributes({ style: { ...style, icon: { ...style.icon, background: value !== null && value !== void 0 ? value : '' } } }) }) }), _jsx(PresetSizeControl, { label: __('Velikost pozadí', 'brilo-blocks'), id: "step-group-icon-background-size", value: style.icon.backgroundSize, presets: DEFAULT_ICON_BACKGROUND_SIZE_PRESETS, min: ICON_BACKGROUND_SIZE_MIN, max: ICON_BACKGROUND_SIZE_MAX, onChange: (v) => setAttributes({ style: { ...style, icon: { ...style.icon, backgroundSize: v } } }) })] }), _jsx(ItemSpacingPanel, { spacing: spacing, onChange: (v) => setAttributes({ spacing: v }) })] }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
|
|
25
50
|
};
|
|
26
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/step/step-group/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAEzD,OAAO,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/step/step-group/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAEzD,OAAO,EAAmE,gBAAgB,EAAc,MAAM,aAAa,CAAA;AAE3H,OAAO,KAAK,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAA;AAGlE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AAExC,wBAAgB,oBAAoB,CAAC,SAAS,SAAS,WAAW,GAAG,OAAO,gBAAgB,EAC1F,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,GACnC,kBAAkB,CAAC,mBAAmB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAwCrE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { InnerBlocks } from '@wordpress/block-editor';
|
|
3
3
|
import { __ } from '@wordpress/i18n';
|
|
4
|
-
import { DEFAULT_VARIANTS } from './constants';
|
|
4
|
+
import { DEFAULT_ICON_BACKGROUND_SIZE, DEFAULT_SHADOWS, DEFAULT_VARIANTS, TEXT_ALIGNS } from './constants';
|
|
5
5
|
import { createStepGroupEdit } from './edit';
|
|
6
6
|
import { icon } from '../../../blocks/step/step-group/icon';
|
|
7
7
|
import { ITEM_SPACING_ATTRIBUTE } from '../../../components/ItemSpacingControl';
|
|
@@ -25,6 +25,21 @@ export function createStepGroupBlock(options) {
|
|
|
25
25
|
type: 'boolean',
|
|
26
26
|
default: false,
|
|
27
27
|
},
|
|
28
|
+
style: {
|
|
29
|
+
type: 'object',
|
|
30
|
+
default: {
|
|
31
|
+
shadow: DEFAULT_SHADOWS[0].value,
|
|
32
|
+
borderColor: '',
|
|
33
|
+
backgroundColor: '',
|
|
34
|
+
textColor: '',
|
|
35
|
+
headingColor: '',
|
|
36
|
+
textAlign: TEXT_ALIGNS[0].value,
|
|
37
|
+
icon: {
|
|
38
|
+
background: '',
|
|
39
|
+
backgroundSize: DEFAULT_ICON_BACKGROUND_SIZE,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
28
43
|
...ITEM_SPACING_ATTRIBUTE,
|
|
29
44
|
},
|
|
30
45
|
edit: createStepGroupEdit(options),
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import type { BriloBlockType, OptionArray } from '../../../types';
|
|
2
|
-
import type { DEFAULT_VARIANTS } from './constants';
|
|
2
|
+
import type { DEFAULT_SHADOWS, DEFAULT_VARIANTS, TEXT_ALIGNS } from './constants';
|
|
3
3
|
export type StepVariant = (typeof DEFAULT_VARIANTS)[number]['value'];
|
|
4
|
+
export type StepShadow = (typeof DEFAULT_SHADOWS)[number]['value'];
|
|
5
|
+
export type StepTextAlign = (typeof TEXT_ALIGNS)[number]['value'];
|
|
6
|
+
export interface StepIconStyle {
|
|
7
|
+
size: number;
|
|
8
|
+
background: string;
|
|
9
|
+
backgroundSize: number;
|
|
10
|
+
}
|
|
4
11
|
export interface StepGroupAttributes<TVariant extends string = StepVariant> extends Record<string, unknown> {
|
|
5
12
|
variant: TVariant;
|
|
6
13
|
disableIcon: boolean;
|
|
14
|
+
style: {
|
|
15
|
+
shadow: StepShadow;
|
|
16
|
+
borderColor: string;
|
|
17
|
+
backgroundColor: string;
|
|
18
|
+
textColor: string;
|
|
19
|
+
headingColor: string;
|
|
20
|
+
textAlign: StepTextAlign;
|
|
21
|
+
icon: StepIconStyle;
|
|
22
|
+
};
|
|
7
23
|
spacing?: number;
|
|
8
24
|
}
|
|
9
25
|
export interface StepGroupOptions<TVariants extends OptionArray = typeof DEFAULT_VARIANTS> extends BriloBlockType {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/step/step-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AACxD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/step/step-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AACxD,OAAO,KAAK,EAAC,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAC,MAAM,aAAa,CAAA;AAE/E,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAEpE,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAElE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAEjE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,mBAAmB,CAAC,QAAQ,SAAS,MAAM,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzG,OAAO,EAAE,QAAQ,CAAA;IACjB,WAAW,EAAE,OAAO,CAAA;IACpB,KAAK,EAAE;QACL,MAAM,EAAE,UAAU,CAAA;QAClB,WAAW,EAAE,MAAM,CAAA;QACnB,eAAe,EAAE,MAAM,CAAA;QACvB,SAAS,EAAE,MAAM,CAAA;QACjB,YAAY,EAAE,MAAM,CAAA;QACpB,SAAS,EAAE,aAAa,CAAA;QACxB,IAAI,EAAE,aAAa,CAAA;KACpB,CAAA;IACD,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,gBAAgB,CAAC,SAAS,SAAS,WAAW,GAAG,OAAO,gBAAgB,CAAE,SAAQ,cAAc;IAC/G,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB"}
|
package/package.json
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
import {__} from '@wordpress/i18n'
|
|
2
|
+
|
|
1
3
|
export const COLUMNS = [4, 3, 2] as const
|
|
2
4
|
export const HEADING_LEVELS = [2, 3, 4] as const
|
|
5
|
+
|
|
6
|
+
export const DEFAULT_SHADOWS = [
|
|
7
|
+
{value: 'none', label: __('Žádný', 'brilo-blocks')},
|
|
8
|
+
{value: 'sm', label: __('Malý', 'brilo-blocks')},
|
|
9
|
+
{value: 'md', label: __('Střední', 'brilo-blocks')},
|
|
10
|
+
] as const
|
|
11
|
+
|
|
12
|
+
export const TEXT_ALIGNS = [
|
|
13
|
+
{value: 'left', label: __('Vlevo', 'brilo-blocks')},
|
|
14
|
+
{value: 'center', label: __('Na střed', 'brilo-blocks')},
|
|
15
|
+
] 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 {COLUMNS, DEFAULT_SHADOWS, HEADING_LEVELS, TEXT_ALIGNS} from './constants'
|
|
14
|
+
import type {PersonGroupAttributes, PersonGroupOptions, PersonShadow, PersonTextAlign} from './types'
|
|
12
15
|
|
|
13
16
|
export function createPersonGroupEdit(options: PersonGroupOptions) {
|
|
14
17
|
return function Edit({
|
|
@@ -18,7 +21,8 @@ export function createPersonGroupEdit(options: PersonGroupOptions) {
|
|
|
18
21
|
attributes: PersonGroupAttributes
|
|
19
22
|
setAttributes: (a: Partial<PersonGroupAttributes>) => void
|
|
20
23
|
}) {
|
|
21
|
-
const {columns, headingLevel} = attributes
|
|
24
|
+
const {columns, headingLevel, style} = attributes
|
|
25
|
+
const {paletteColors} = useTenantColorPalette()
|
|
22
26
|
|
|
23
27
|
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
24
28
|
blockClassName: clsx(options.blockClassName ?? 'g-person wp-block-section'),
|
|
@@ -55,6 +59,62 @@ export function createPersonGroupEdit(options: PersonGroupOptions) {
|
|
|
55
59
|
))}
|
|
56
60
|
</ToggleGroupControl>
|
|
57
61
|
</PanelBody>
|
|
62
|
+
{style && (
|
|
63
|
+
<PanelBody title={__('Styl', 'brilo-blocks')}>
|
|
64
|
+
<ToggleGroupControl
|
|
65
|
+
isBlock
|
|
66
|
+
label={__('Stín', 'brilo-blocks')}
|
|
67
|
+
value={style.shadow}
|
|
68
|
+
onChange={(v) => setAttributes({style: {...style, shadow: v as PersonShadow}})}
|
|
69
|
+
>
|
|
70
|
+
{DEFAULT_SHADOWS.map((s) => (
|
|
71
|
+
<ToggleGroupControlOption key={s.value} value={s.value} label={s.label} />
|
|
72
|
+
))}
|
|
73
|
+
</ToggleGroupControl>
|
|
74
|
+
<BaseControl
|
|
75
|
+
label={__('Barva okraje', 'brilo-blocks')}
|
|
76
|
+
help={__('Bez vybrané barvy se okraj nevykreslí.', 'brilo-blocks')}
|
|
77
|
+
id="person-group-border-color"
|
|
78
|
+
>
|
|
79
|
+
<ColorPalette
|
|
80
|
+
colors={paletteColors}
|
|
81
|
+
value={style.borderColor || undefined}
|
|
82
|
+
onChange={(value) => setAttributes({style: {...style, borderColor: value ?? ''}})}
|
|
83
|
+
/>
|
|
84
|
+
</BaseControl>
|
|
85
|
+
<BaseControl label={__('Barva pozadí', 'brilo-blocks')} id="person-group-background-color">
|
|
86
|
+
<ColorPalette
|
|
87
|
+
colors={paletteColors}
|
|
88
|
+
value={style.backgroundColor || undefined}
|
|
89
|
+
onChange={(value) => setAttributes({style: {...style, backgroundColor: value ?? ''}})}
|
|
90
|
+
/>
|
|
91
|
+
</BaseControl>
|
|
92
|
+
<BaseControl label={__('Barva textu', 'brilo-blocks')} id="person-group-text-color">
|
|
93
|
+
<ColorPalette
|
|
94
|
+
colors={paletteColors}
|
|
95
|
+
value={style.textColor || undefined}
|
|
96
|
+
onChange={(value) => setAttributes({style: {...style, textColor: value ?? ''}})}
|
|
97
|
+
/>
|
|
98
|
+
</BaseControl>
|
|
99
|
+
<BaseControl label={__('Barva nadpisu', 'brilo-blocks')} id="person-group-heading-color">
|
|
100
|
+
<ColorPalette
|
|
101
|
+
colors={paletteColors}
|
|
102
|
+
value={style.headingColor || undefined}
|
|
103
|
+
onChange={(value) => setAttributes({style: {...style, headingColor: value ?? ''}})}
|
|
104
|
+
/>
|
|
105
|
+
</BaseControl>
|
|
106
|
+
<ToggleGroupControl
|
|
107
|
+
isBlock
|
|
108
|
+
label={__('Zarovnání textu', 'brilo-blocks')}
|
|
109
|
+
value={style.textAlign}
|
|
110
|
+
onChange={(v) => setAttributes({style: {...style, textAlign: v as PersonTextAlign}})}
|
|
111
|
+
>
|
|
112
|
+
{TEXT_ALIGNS.map((a) => (
|
|
113
|
+
<ToggleGroupControlOption key={a.value} value={a.value} label={a.label} />
|
|
114
|
+
))}
|
|
115
|
+
</ToggleGroupControl>
|
|
116
|
+
</PanelBody>
|
|
117
|
+
)}
|
|
58
118
|
</InspectorControls>
|
|
59
119
|
<div {...blockProps}>
|
|
60
120
|
<div {...innerBlocksProps} />
|
|
@@ -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} from './constants'
|
|
4
|
+
import {COLUMNS, DEFAULT_SHADOWS, HEADING_LEVELS} from './constants'
|
|
5
5
|
import {createPersonGroupEdit} from './edit'
|
|
6
6
|
import {icon as defaultIcon} from './icon'
|
|
7
7
|
import type {PersonGroupAttributes, PersonGroupOptions} from './types'
|
|
@@ -28,6 +28,17 @@ export function createPersonGroupBlock(options: PersonGroupOptions): BlockConfig
|
|
|
28
28
|
default: HEADING_LEVELS[0],
|
|
29
29
|
enum: [...HEADING_LEVELS],
|
|
30
30
|
},
|
|
31
|
+
style: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
default: {
|
|
34
|
+
shadow: DEFAULT_SHADOWS[0].value,
|
|
35
|
+
borderColor: '',
|
|
36
|
+
backgroundColor: '',
|
|
37
|
+
textColor: '',
|
|
38
|
+
headingColor: '',
|
|
39
|
+
textAlign: 'center',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
31
42
|
},
|
|
32
43
|
edit: createPersonGroupEdit(options),
|
|
33
44
|
save: () => <InnerBlocks.Content />,
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import type {BriloBlockType} from '~/types'
|
|
2
|
+
import type {DEFAULT_SHADOWS, TEXT_ALIGNS} from './constants'
|
|
3
|
+
|
|
4
|
+
export type PersonShadow = (typeof DEFAULT_SHADOWS)[number]['value']
|
|
5
|
+
|
|
6
|
+
export type PersonTextAlign = (typeof TEXT_ALIGNS)[number]['value']
|
|
2
7
|
|
|
3
8
|
export interface PersonGroupAttributes extends Record<string, unknown> {
|
|
4
9
|
columns: number
|
|
5
10
|
headingLevel: number
|
|
11
|
+
style: {
|
|
12
|
+
shadow: PersonShadow
|
|
13
|
+
borderColor: string
|
|
14
|
+
backgroundColor: string
|
|
15
|
+
textColor: string
|
|
16
|
+
headingColor: string
|
|
17
|
+
textAlign: PersonTextAlign
|
|
18
|
+
}
|
|
6
19
|
}
|
|
7
20
|
|
|
8
21
|
export interface PersonGroupOptions extends BriloBlockType {}
|
|
@@ -4,3 +4,38 @@ export const DEFAULT_VARIANTS = [
|
|
|
4
4
|
{value: 'horizontal', label: __('Horizontální', 'brilo-blocks')},
|
|
5
5
|
{value: 'vertical', label: __('Vertikální', 'brilo-blocks')},
|
|
6
6
|
] as const
|
|
7
|
+
|
|
8
|
+
export const DEFAULT_SHADOWS = [
|
|
9
|
+
{value: 'none', label: __('Žádný', 'brilo-blocks')},
|
|
10
|
+
{value: 'sm', label: __('Malý', 'brilo-blocks')},
|
|
11
|
+
{value: 'md', label: __('Střední', 'brilo-blocks')},
|
|
12
|
+
] as const
|
|
13
|
+
|
|
14
|
+
export const TEXT_ALIGNS = [
|
|
15
|
+
{value: 'left', label: __('Vlevo', 'brilo-blocks')},
|
|
16
|
+
{value: 'center', label: __('Na střed', 'brilo-blocks')},
|
|
17
|
+
] as const
|
|
18
|
+
|
|
19
|
+
export const DEFAULT_ICON_SIZE = 48
|
|
20
|
+
export const ICON_SIZE_MIN = 16
|
|
21
|
+
export const ICON_SIZE_MAX = 96
|
|
22
|
+
|
|
23
|
+
export const DEFAULT_ICON_SIZE_PRESETS = [
|
|
24
|
+
{value: 24, label: __('SM', 'brilo-blocks')},
|
|
25
|
+
{value: 32, label: __('MD', 'brilo-blocks')},
|
|
26
|
+
{value: 48, label: __('Výchozí', 'brilo-blocks')},
|
|
27
|
+
{value: 64, label: __('LG', 'brilo-blocks')},
|
|
28
|
+
{value: 80, label: __('XL', 'brilo-blocks')},
|
|
29
|
+
] as const
|
|
30
|
+
|
|
31
|
+
export const DEFAULT_ICON_BACKGROUND_SIZE = 144
|
|
32
|
+
export const ICON_BACKGROUND_SIZE_MIN = 56
|
|
33
|
+
export const ICON_BACKGROUND_SIZE_MAX = 200
|
|
34
|
+
|
|
35
|
+
export const DEFAULT_ICON_BACKGROUND_SIZE_PRESETS = [
|
|
36
|
+
{value: 88, label: __('SM', 'brilo-blocks')},
|
|
37
|
+
{value: 112, label: __('MD', 'brilo-blocks')},
|
|
38
|
+
{value: 144, label: __('Výchozí', 'brilo-blocks')},
|
|
39
|
+
{value: 168, label: __('LG', 'brilo-blocks')},
|
|
40
|
+
{value: 200, label: __('XL', 'brilo-blocks')},
|
|
41
|
+
] as const
|