@brilo/base-blocks 0.1.34 → 0.1.36

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.
@@ -18,9 +18,20 @@ export declare const baseAttributes: {
18
18
  readonly type: 'string';
19
19
  readonly default: '';
20
20
  };
21
+ readonly decoration: {
22
+ readonly type: 'object';
23
+ readonly default: {};
24
+ };
21
25
  readonly decorations: {
22
26
  readonly type: 'object';
23
27
  readonly default: {};
24
28
  };
29
+ readonly backgroundImage: {
30
+ readonly type: 'object';
31
+ readonly default: {
32
+ readonly fit: 'cover';
33
+ readonly position: 'center center';
34
+ };
35
+ };
25
36
  };
26
37
  //# sourceMappingURL=attributes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../../src/blocks/sections/base-section/attributes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;aACzB,EAAE;iBACA,IAAI,EAAE,QAAQ;iBACd,OAAO,EAAE,EAAE;;aAEb,OAAO;iBACL,IAAI,EAAE,QAAQ;iBACd,OAAO;qBACL,QAAQ,EAAE,SAAS;qBACnB,IAAI,EAAE,SAAS;;;aAGnB,UAAU;iBACR,IAAI,EAAE,QAAQ;iBACd,OAAO,EAAE,EAAE;;aAEb,SAAS;iBACP,IAAI,EAAE,QAAQ;iBACd,OAAO,EAAE,EAAE;;aAEb,WAAW;iBACT,IAAI,EAAE,QAAQ;iBACd,OAAO;;CAED,CAAA"}
1
+ {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../../src/blocks/sections/base-section/attributes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;aACzB,EAAE;iBACA,IAAI,EAAE,QAAQ;iBACd,OAAO,EAAE,EAAE;;aAEb,OAAO;iBACL,IAAI,EAAE,QAAQ;iBACd,OAAO;qBACL,QAAQ,EAAE,SAAS;qBACnB,IAAI,EAAE,SAAS;;;aAGnB,UAAU;iBACR,IAAI,EAAE,QAAQ;iBACd,OAAO,EAAE,EAAE;;aAEb,SAAS;iBACP,IAAI,EAAE,QAAQ;iBACd,OAAO,EAAE,EAAE;;aAEb,UAAU;iBACR,IAAI,EAAE,QAAQ;iBACd,OAAO;;aAET,WAAW;iBACT,IAAI,EAAE,QAAQ;iBACd,OAAO;;aAET,eAAe;iBACb,IAAI,EAAE,QAAQ;iBACd,OAAO;qBACL,GAAG,EAAE,OAAO;qBACZ,QAAQ,EAAE,eAAe;;;CAGrB,CAAA"}
@@ -18,8 +18,19 @@ export const baseAttributes = {
18
18
  type: 'string',
19
19
  default: '',
20
20
  },
21
+ decoration: {
22
+ type: 'object',
23
+ default: {},
24
+ },
21
25
  decorations: {
22
26
  type: 'object',
23
27
  default: {},
24
28
  },
29
+ backgroundImage: {
30
+ type: 'object',
31
+ default: {
32
+ fit: 'cover',
33
+ position: 'center center',
34
+ },
35
+ },
25
36
  };
@@ -19,4 +19,88 @@ export declare const FLUID_DECORATION_UNITS: {
19
19
  label: string;
20
20
  default: number;
21
21
  }[];
22
+ export declare const DECORATION_POSITIONS: readonly [{
23
+ readonly value: 'top-left';
24
+ readonly label: import("@wordpress/i18n").TransformedText<"Nahoře vlevo">;
25
+ }, {
26
+ readonly value: 'top-right';
27
+ readonly label: import("@wordpress/i18n").TransformedText<"Nahoře vpravo">;
28
+ }, {
29
+ readonly value: 'center-left';
30
+ readonly label: import("@wordpress/i18n").TransformedText<"Uprostřed vlevo">;
31
+ }, {
32
+ readonly value: 'center-right';
33
+ readonly label: import("@wordpress/i18n").TransformedText<"Uprostřed vpravo">;
34
+ }, {
35
+ readonly value: 'bottom-left';
36
+ readonly label: import("@wordpress/i18n").TransformedText<"Dole vlevo">;
37
+ }, {
38
+ readonly value: 'bottom-right';
39
+ readonly label: import("@wordpress/i18n").TransformedText<"Dole vpravo">;
40
+ }];
41
+ export declare const DECORATION_DEPTHS: readonly [{
42
+ readonly value: 'front';
43
+ readonly label: import("@wordpress/i18n").TransformedText<"Před obsahem">;
44
+ }, {
45
+ readonly value: 'under';
46
+ readonly label: import("@wordpress/i18n").TransformedText<"Pod obsahem">;
47
+ }];
48
+ export declare const DECORATION_TRANSLATES: readonly [{
49
+ readonly value: 'in';
50
+ readonly label: import("@wordpress/i18n").TransformedText<"Uvnitř">;
51
+ }, {
52
+ readonly value: 'center';
53
+ readonly label: import("@wordpress/i18n").TransformedText<"Na okraji">;
54
+ }, {
55
+ readonly value: 'out';
56
+ readonly label: import("@wordpress/i18n").TransformedText<"Venku">;
57
+ }];
58
+ export declare const DECORATION_MAX_WIDTH_DEFAULT = "120px";
59
+ export declare const DECORATION_MAX_WIDTH_UNITS: {
60
+ value: string;
61
+ label: string;
62
+ default: number;
63
+ }[];
64
+ export declare const DECORATION_OFFSET_DEFAULT = "0px";
65
+ export declare const DECORATION_OFFSET_UNITS: {
66
+ value: string;
67
+ label: string;
68
+ default: number;
69
+ }[];
70
+ export declare const BACKGROUND_IMAGE_FITS: readonly [{
71
+ readonly value: 'cover';
72
+ readonly label: import("@wordpress/i18n").TransformedText<"Vyplnit (cover)">;
73
+ }, {
74
+ readonly value: 'contain';
75
+ readonly label: import("@wordpress/i18n").TransformedText<"Celý obrázek (contain)">;
76
+ }];
77
+ export declare const BACKGROUND_IMAGE_POSITIONS: readonly [{
78
+ readonly value: 'left top';
79
+ readonly label: import("@wordpress/i18n").TransformedText<"Vlevo nahoře">;
80
+ }, {
81
+ readonly value: 'center top';
82
+ readonly label: import("@wordpress/i18n").TransformedText<"Nahoře">;
83
+ }, {
84
+ readonly value: 'right top';
85
+ readonly label: import("@wordpress/i18n").TransformedText<"Vpravo nahoře">;
86
+ }, {
87
+ readonly value: 'left center';
88
+ readonly label: import("@wordpress/i18n").TransformedText<"Vlevo">;
89
+ }, {
90
+ readonly value: 'center center';
91
+ readonly label: import("@wordpress/i18n").TransformedText<"Uprostřed">;
92
+ }, {
93
+ readonly value: 'right center';
94
+ readonly label: import("@wordpress/i18n").TransformedText<"Vpravo">;
95
+ }, {
96
+ readonly value: 'left bottom';
97
+ readonly label: import("@wordpress/i18n").TransformedText<"Vlevo dole">;
98
+ }, {
99
+ readonly value: 'center bottom';
100
+ readonly label: import("@wordpress/i18n").TransformedText<"Dole">;
101
+ }, {
102
+ readonly value: 'right bottom';
103
+ readonly label: import("@wordpress/i18n").TransformedText<"Vpravo dole">;
104
+ }];
105
+ export declare const BACKGROUND_IMAGE_OVERLAY_OPACITY_DEFAULT = 40;
22
106
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/sections/base-section/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB;aAC3B,KAAK,EAAE,SAAS;aAAE,KAAK;;aACvB,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,UAAU;aAAE,KAAK;;aACxB,KAAK,EAAE,OAAO;aAAE,KAAK;EACd,CAAA;AAEV,eAAO,MAAM,aAAa,YAAI,SAAS,EAAE,IAAI,EAAE,IAAI,CAAU,CAAA;AAE7D,eAAO,MAAM,+BAA+B,YAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAU,CAAA;AAEzE,eAAO,MAAM,+BAA+B,SAAS,CAAA;AAErD,eAAO,MAAM,sBAAsB;;;;GAIlC,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/sections/base-section/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB;aAC3B,KAAK,EAAE,SAAS;aAAE,KAAK;;aACvB,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,UAAU;aAAE,KAAK;;aACxB,KAAK,EAAE,OAAO;aAAE,KAAK;EACd,CAAA;AAEV,eAAO,MAAM,aAAa,YAAI,SAAS,EAAE,IAAI,EAAE,IAAI,CAAU,CAAA;AAE7D,eAAO,MAAM,+BAA+B,YAAI,EAAE,EAAE,EAAE,EAAE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Ae;aAAE,KAAK;;aAC7B,KAAK,EAAE,cAAc;aAAE,KAAK;EACrB,CAAA;AAEV,eAAO,MAAM,wCAAwC,KAAK,CAAA"}
@@ -13,3 +13,48 @@ export const FLUID_DECORATION_UNITS = [
13
13
  { value: 'rem', label: 'rem', default: 3.5 },
14
14
  { value: '%', label: '%', default: 10 },
15
15
  ];
16
+ export const DECORATION_POSITIONS = [
17
+ { value: 'top-left', label: __('Nahoře vlevo', 'brilo-blocks') },
18
+ { value: 'top-right', label: __('Nahoře vpravo', 'brilo-blocks') },
19
+ { value: 'center-left', label: __('Uprostřed vlevo', 'brilo-blocks') },
20
+ { value: 'center-right', label: __('Uprostřed vpravo', 'brilo-blocks') },
21
+ { value: 'bottom-left', label: __('Dole vlevo', 'brilo-blocks') },
22
+ { value: 'bottom-right', label: __('Dole vpravo', 'brilo-blocks') },
23
+ ];
24
+ export const DECORATION_DEPTHS = [
25
+ { value: 'front', label: __('Před obsahem', 'brilo-blocks') },
26
+ { value: 'under', label: __('Pod obsahem', 'brilo-blocks') },
27
+ ];
28
+ export const DECORATION_TRANSLATES = [
29
+ { value: 'in', label: __('Uvnitř', 'brilo-blocks') },
30
+ { value: 'center', label: __('Na okraji', 'brilo-blocks') },
31
+ { value: 'out', label: __('Venku', 'brilo-blocks') },
32
+ ];
33
+ export const DECORATION_MAX_WIDTH_DEFAULT = '120px';
34
+ export const DECORATION_MAX_WIDTH_UNITS = [
35
+ { value: 'px', label: 'px', default: 120 },
36
+ { value: 'rem', label: 'rem', default: 7.5 },
37
+ { value: '%', label: '%', default: 50 },
38
+ ];
39
+ export const DECORATION_OFFSET_DEFAULT = '0px';
40
+ export const DECORATION_OFFSET_UNITS = [
41
+ { value: 'px', label: 'px', default: 0 },
42
+ { value: 'rem', label: 'rem', default: 0 },
43
+ { value: '%', label: '%', default: 0 },
44
+ ];
45
+ export const BACKGROUND_IMAGE_FITS = [
46
+ { value: 'cover', label: __('Vyplnit (cover)', 'brilo-blocks') },
47
+ { value: 'contain', label: __('Celý obrázek (contain)', 'brilo-blocks') },
48
+ ];
49
+ export const BACKGROUND_IMAGE_POSITIONS = [
50
+ { value: 'left top', label: __('Vlevo nahoře', 'brilo-blocks') },
51
+ { value: 'center top', label: __('Nahoře', 'brilo-blocks') },
52
+ { value: 'right top', label: __('Vpravo nahoře', 'brilo-blocks') },
53
+ { value: 'left center', label: __('Vlevo', 'brilo-blocks') },
54
+ { value: 'center center', label: __('Uprostřed', 'brilo-blocks') },
55
+ { value: 'right center', label: __('Vpravo', 'brilo-blocks') },
56
+ { value: 'left bottom', label: __('Vlevo dole', 'brilo-blocks') },
57
+ { value: 'center bottom', label: __('Dole', 'brilo-blocks') },
58
+ { value: 'right bottom', label: __('Vpravo dole', 'brilo-blocks') },
59
+ ];
60
+ export const BACKGROUND_IMAGE_OVERLAY_OPACITY_DEFAULT = 40;
@@ -1 +1 @@
1
- {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../../src/blocks/sections/base-section/controls.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAC,mBAAmB,EAAE,kBAAkB,EAAwC,MAAM,SAAS,CAAA;AAyE3G,UAAU,iBAAiB;IACzB,UAAU,EAAE,mBAAmB,CAAA;IAC/B,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAA;IAC5D,OAAO,EAAE,kBAAkB,EAAE,CAAA;CAC9B;AAED,wBAAgB,YAAY,CAAC,EAAC,UAAU,EAAE,aAAa,EAAE,OAAO,EAAC,EAAE,iBAAiB,+BAsEnF"}
1
+ {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../../src/blocks/sections/base-section/controls.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAIV,mBAAmB,EAMnB,kBAAkB,EAGnB,MAAM,SAAS,CAAA;AA+RhB,UAAU,iBAAiB;IACzB,UAAU,EAAE,mBAAmB,CAAA;IAC/B,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAA;IAC5D,OAAO,EAAE,kBAAkB,EAAE,CAAA;CAC9B;AAED,wBAAgB,YAAY,CAAC,EAAC,UAAU,EAAE,aAAa,EAAE,OAAO,EAAC,EAAE,iBAAiB,+BAkFnF"}
@@ -1,9 +1,9 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ColorPalette, ContrastChecker, MediaUpload, MediaUploadCheck } from '@wordpress/block-editor';
3
- import { BaseControl, Button, ButtonGroup, PanelBody, PanelRow, SelectControl, TextControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, __experimentalUnitControl as UnitControl, } from '@wordpress/components';
3
+ import { BaseControl, Button, ButtonGroup, PanelBody, PanelRow, RangeControl, SelectControl, TextControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, __experimentalUnitControl as UnitControl, } from '@wordpress/components';
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import { useTenantColorPalette } from '../../../hooks/useTenantColorPalette';
6
- import { FLUID_DECORATION_DEFAULT_HEIGHT, FLUID_DECORATION_HEIGHT_PRESETS, FLUID_DECORATION_UNITS, SPACING_POSITIONS, SPACING_SIZES, } from './constants';
6
+ import { BACKGROUND_IMAGE_FITS, BACKGROUND_IMAGE_OVERLAY_OPACITY_DEFAULT, BACKGROUND_IMAGE_POSITIONS, DECORATION_DEPTHS, DECORATION_MAX_WIDTH_DEFAULT, DECORATION_MAX_WIDTH_UNITS, DECORATION_OFFSET_DEFAULT, DECORATION_OFFSET_UNITS, DECORATION_POSITIONS, DECORATION_TRANSLATES, FLUID_DECORATION_DEFAULT_HEIGHT, FLUID_DECORATION_HEIGHT_PRESETS, FLUID_DECORATION_UNITS, SPACING_POSITIONS, SPACING_SIZES, } from './constants';
7
7
  function FluidDecorationControl({ label, value, onChange }) {
8
8
  var _a;
9
9
  const img = value === null || value === void 0 ? void 0 : value.img;
@@ -16,14 +16,50 @@ function FluidDecorationControl({ label, value, onChange }) {
16
16
  const handleRemove = () => onChange(undefined);
17
17
  return (_jsxs(BaseControl, { label: label, __nextHasNoMarginBottom: true, children: [_jsx(MediaUploadCheck, { children: _jsx(MediaUpload, { onSelect: handleSelect, allowedTypes: ['image'], value: (img === null || img === void 0 ? void 0 : img.id) || 0, render: ({ open }) => (_jsxs(PanelRow, { children: [(img === null || img === void 0 ? void 0 : img.src) && _jsx("img", { src: img.src, alt: img.alt, style: { maxWidth: 48, maxHeight: 48, objectFit: 'contain' } }), _jsx(Button, { onClick: open, variant: "secondary", size: "small", children: (img === null || img === void 0 ? void 0 : img.src) ? __('Změnit', 'brilo-blocks') : __('Vybrat obrázek', 'brilo-blocks') }), !!(img === null || img === void 0 ? void 0 : img.src) && (_jsx(Button, { onClick: handleRemove, variant: "tertiary", size: "small", isDestructive: true, children: __('Odebrat', 'brilo-blocks') }))] })) }) }), !!(img === null || img === void 0 ? void 0 : img.src) && (_jsxs(_Fragment, { children: [_jsx(UnitControl, { label: __('Výška', 'brilo-blocks'), value: height, units: FLUID_DECORATION_UNITS, onChange: (next) => { var _a; return onChange({ img, height: (_a = next) !== null && _a !== void 0 ? _a : FLUID_DECORATION_DEFAULT_HEIGHT }); } }), _jsx(ButtonGroup, { children: FLUID_DECORATION_HEIGHT_PRESETS.map((preset) => (_jsx(Button, { variant: "secondary", size: "small", onClick: () => onChange({ img, height: `${preset}px` }), children: preset }, preset))) })] }))] }));
18
18
  }
19
+ function DecorationControl({ value, onChange }) {
20
+ var _a, _b, _c, _d, _e, _f;
21
+ const img = value === null || value === void 0 ? void 0 : value.img;
22
+ const position = (_a = value === null || value === void 0 ? void 0 : value.position) !== null && _a !== void 0 ? _a : 'top-right';
23
+ const depth = (_b = value === null || value === void 0 ? void 0 : value.depth) !== null && _b !== void 0 ? _b : 'front';
24
+ const translate = (_c = value === null || value === void 0 ? void 0 : value.translate) !== null && _c !== void 0 ? _c : 'center';
25
+ const maxWidth = (_d = value === null || value === void 0 ? void 0 : value.maxWidth) !== null && _d !== void 0 ? _d : DECORATION_MAX_WIDTH_DEFAULT;
26
+ const offsetX = (_e = value === null || value === void 0 ? void 0 : value.offsetX) !== null && _e !== void 0 ? _e : DECORATION_OFFSET_DEFAULT;
27
+ const offsetY = (_f = value === null || value === void 0 ? void 0 : value.offsetY) !== null && _f !== void 0 ? _f : DECORATION_OFFSET_DEFAULT;
28
+ const update = (patch) => onChange({ img, position, depth, translate, maxWidth, offsetX, offsetY, ...value, ...patch });
29
+ const handleSelect = (media) => {
30
+ var _a;
31
+ const nextImg = { id: media.id, src: media.url, alt: (_a = media.alt) !== null && _a !== void 0 ? _a : '', width: media.width, height: media.height };
32
+ update({ img: nextImg });
33
+ };
34
+ const handleRemove = () => onChange(undefined);
35
+ return (_jsxs(BaseControl, { label: __('Obrázek', 'brilo-blocks'), __nextHasNoMarginBottom: true, children: [_jsx(MediaUploadCheck, { children: _jsx(MediaUpload, { onSelect: handleSelect, allowedTypes: ['image'], value: (img === null || img === void 0 ? void 0 : img.id) || 0, render: ({ open }) => (_jsxs(PanelRow, { children: [(img === null || img === void 0 ? void 0 : img.src) && _jsx("img", { src: img.src, alt: img.alt, style: { maxWidth: 48, maxHeight: 48, objectFit: 'contain' } }), _jsx(Button, { onClick: open, variant: "secondary", size: "small", children: (img === null || img === void 0 ? void 0 : img.src) ? __('Změnit', 'brilo-blocks') : __('Vybrat obrázek', 'brilo-blocks') }), !!(img === null || img === void 0 ? void 0 : img.src) && (_jsx(Button, { onClick: handleRemove, variant: "tertiary", size: "small", isDestructive: true, children: __('Odebrat', 'brilo-blocks') }))] })) }) }), !!(img === null || img === void 0 ? void 0 : img.src) && (_jsxs(_Fragment, { children: [_jsx(BaseControl, { label: __('Pozice', 'brilo-blocks'), __nextHasNoMarginBottom: true, children: _jsx("div", { style: { display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 4 }, children: DECORATION_POSITIONS.map((p) => (_jsx(Button, { variant: "secondary", size: "small", isPressed: position === p.value, onClick: () => update({ position: p.value }), children: p.label }, p.value))) }) }), _jsx(ToggleGroupControl, { label: __('Vrstva', 'brilo-blocks'), value: depth, onChange: (next) => update({ depth: next }), isBlock: true, children: DECORATION_DEPTHS.map((d) => (_jsx(ToggleGroupControlOption, { value: d.value, label: d.label }, d.value))) }), _jsx(ToggleGroupControl, { label: __('Přesah', 'brilo-blocks'), value: translate, onChange: (next) => update({ translate: next }), isBlock: true, children: DECORATION_TRANSLATES.map((t) => (_jsx(ToggleGroupControlOption, { value: t.value, label: t.label }, t.value))) }), _jsx(UnitControl, { label: __('Max. šířka obrázku', 'brilo-blocks'), value: maxWidth, units: DECORATION_MAX_WIDTH_UNITS, onChange: (next) => { var _a; return update({ maxWidth: (_a = next) !== null && _a !== void 0 ? _a : DECORATION_MAX_WIDTH_DEFAULT }); } }), _jsxs(BaseControl, { label: __('Doladění pozice', 'brilo-blocks'), __nextHasNoMarginBottom: true, help: __('Ruční posun obrázku navíc k vybrané pozici.', 'brilo-blocks'), children: [_jsx(UnitControl, { label: __('Posun X', 'brilo-blocks'), value: offsetX, units: DECORATION_OFFSET_UNITS, onChange: (next) => { var _a; return update({ offsetX: (_a = next) !== null && _a !== void 0 ? _a : DECORATION_OFFSET_DEFAULT }); } }), _jsx(UnitControl, { label: __('Posun Y', 'brilo-blocks'), value: offsetY, units: DECORATION_OFFSET_UNITS, onChange: (next) => { var _a; return update({ offsetY: (_a = next) !== null && _a !== void 0 ? _a : DECORATION_OFFSET_DEFAULT }); } })] })] }))] }));
36
+ }
37
+ function BackgroundImageControl({ value, onChange }) {
38
+ var _a, _b;
39
+ var _c, _d, _e;
40
+ const { paletteColors } = useTenantColorPalette();
41
+ const img = value === null || value === void 0 ? void 0 : value.img;
42
+ const fit = (_c = value === null || value === void 0 ? void 0 : value.fit) !== null && _c !== void 0 ? _c : 'cover';
43
+ const position = (_d = value === null || value === void 0 ? void 0 : value.position) !== null && _d !== void 0 ? _d : 'center center';
44
+ const overlayColor = (_a = value === null || value === void 0 ? void 0 : value.overlay) === null || _a === void 0 ? void 0 : _a.color;
45
+ const overlayOpacity = (_e = (_b = value === null || value === void 0 ? void 0 : value.overlay) === null || _b === void 0 ? void 0 : _b.opacity) !== null && _e !== void 0 ? _e : BACKGROUND_IMAGE_OVERLAY_OPACITY_DEFAULT;
46
+ const update = (patch) => onChange({ img, fit, position, overlay: value === null || value === void 0 ? void 0 : value.overlay, ...value, ...patch });
47
+ const handleSelect = (media) => {
48
+ var _a;
49
+ const nextImg = { id: media.id, src: media.url, alt: (_a = media.alt) !== null && _a !== void 0 ? _a : '', width: media.width, height: media.height };
50
+ update({ img: nextImg });
51
+ };
52
+ const handleRemove = () => onChange(undefined);
53
+ return (_jsxs(BaseControl, { label: __('Obrázek pozadí', 'brilo-blocks'), __nextHasNoMarginBottom: true, children: [_jsx(MediaUploadCheck, { children: _jsx(MediaUpload, { onSelect: handleSelect, allowedTypes: ['image'], value: (img === null || img === void 0 ? void 0 : img.id) || 0, render: ({ open }) => (_jsxs(PanelRow, { children: [(img === null || img === void 0 ? void 0 : img.src) && _jsx("img", { src: img.src, alt: img.alt, style: { maxWidth: 48, maxHeight: 48, objectFit: 'contain' } }), _jsx(Button, { onClick: open, variant: "secondary", size: "small", children: (img === null || img === void 0 ? void 0 : img.src) ? __('Změnit', 'brilo-blocks') : __('Vybrat obrázek', 'brilo-blocks') }), !!(img === null || img === void 0 ? void 0 : img.src) && (_jsx(Button, { onClick: handleRemove, variant: "tertiary", size: "small", isDestructive: true, children: __('Odebrat', 'brilo-blocks') }))] })) }) }), !!(img === null || img === void 0 ? void 0 : img.src) && (_jsxs(_Fragment, { children: [_jsx(ToggleGroupControl, { label: __('Přizpůsobení', 'brilo-blocks'), value: fit, onChange: (next) => update({ fit: next }), isBlock: true, children: BACKGROUND_IMAGE_FITS.map((f) => (_jsx(ToggleGroupControlOption, { value: f.value, label: f.label }, f.value))) }), _jsx(SelectControl, { label: __('Pozice', 'brilo-blocks'), value: position, options: [...BACKGROUND_IMAGE_POSITIONS], onChange: (next) => update({ position: next }) }), _jsxs(BaseControl, { label: __('Překryv barvou', 'brilo-blocks'), __nextHasNoMarginBottom: true, help: __('Ztmavení/zabarvení obrázku pro lepší čitelnost textu.', 'brilo-blocks'), children: [_jsx(ColorPalette, { colors: paletteColors, value: overlayColor || undefined, onChange: (next) => update({ overlay: { color: next !== null && next !== void 0 ? next : undefined, opacity: overlayOpacity } }) }), !!overlayColor && (_jsx(RangeControl, { label: __('Krytí překryvu', 'brilo-blocks'), value: overlayOpacity, min: 0, max: 100, onChange: (next) => update({ overlay: { color: overlayColor, opacity: next !== null && next !== void 0 ? next : BACKGROUND_IMAGE_OVERLAY_OPACITY_DEFAULT } }) }))] })] }))] }));
54
+ }
19
55
  export function BaseControls({ attributes, setAttributes, exclude }) {
20
56
  var _a;
21
- const { id, spacing, background, textColor, decorations } = attributes;
57
+ const { id, spacing, background, textColor, decoration, decorations, backgroundImage } = attributes;
22
58
  const { paletteColors, resolveHex } = useTenantColorPalette();
23
59
  const fluid = (_a = decorations === null || decorations === void 0 ? void 0 : decorations.fluid) !== null && _a !== void 0 ? _a : {};
24
60
  const setFluid = (position, value) => {
25
61
  const nextFluid = { ...fluid, [position]: value };
26
62
  setAttributes({ decorations: { ...decorations, fluid: nextFluid } });
27
63
  };
28
- return (_jsxs(_Fragment, { children: [!exclude.includes('spacing') && (_jsxs(PanelBody, { title: __('Rozestupy', 'brilo-blocks'), children: [_jsx(SelectControl, { label: __('Pozice', 'brilo-blocks'), value: spacing.position, options: [...SPACING_POSITIONS], onChange: (value) => setAttributes({ spacing: { ...spacing, position: value } }) }), _jsx(ToggleGroupControl, { label: __('Velikost', 'brilo-blocks'), value: spacing.size, onChange: (value) => setAttributes({ spacing: { ...spacing, size: value } }), isBlock: true, children: SPACING_SIZES.map((s) => (_jsx(ToggleGroupControlOption, { value: s, label: s === 'default' ? __('Výchozí', 'brilo-blocks') : s.toUpperCase() }, s))) })] })), !exclude.includes('background') && (_jsxs(PanelBody, { title: __('Barvy', 'brilo-blocks'), children: [_jsx("p", { children: __('Pozadí', 'brilo-blocks') }), _jsx(ColorPalette, { colors: paletteColors, value: background || undefined, onChange: (value) => setAttributes({ background: value !== null && value !== void 0 ? value : '' }) }), _jsx("p", { children: __('Barva textu', 'brilo-blocks') }), _jsx(ColorPalette, { colors: paletteColors, value: textColor || undefined, onChange: (value) => setAttributes({ textColor: value !== null && value !== void 0 ? value : '' }) }), !!background && !!textColor && _jsx(ContrastChecker, { backgroundColor: resolveHex(background), textColor: resolveHex(textColor) })] })), !exclude.includes('decorations') && (_jsxs(PanelBody, { title: __('Fluidní dekorace', 'brilo-blocks'), initialOpen: false, children: [_jsx(FluidDecorationControl, { label: __('Nahoře', 'brilo-blocks'), value: fluid.top, onChange: (value) => setFluid('top', value) }), _jsx(FluidDecorationControl, { label: __('Dole', 'brilo-blocks'), value: fluid.bottom, onChange: (value) => setFluid('bottom', value) })] })), !exclude.includes('id') && (_jsx(PanelBody, { title: __('Kotva', 'brilo-blocks'), initialOpen: false, children: _jsx(TextControl, { label: __('ID sekce', 'brilo-blocks'), value: id !== null && id !== void 0 ? id : '', onChange: (value) => setAttributes({ id: value }), help: __('Použije se jako HTML atribut id pro kotevní odkaz.', 'brilo-blocks') }) }))] }));
64
+ return (_jsxs(_Fragment, { children: [!exclude.includes('spacing') && (_jsxs(PanelBody, { title: __('Rozestupy', 'brilo-blocks'), children: [_jsx(SelectControl, { label: __('Pozice', 'brilo-blocks'), value: spacing.position, options: [...SPACING_POSITIONS], onChange: (value) => setAttributes({ spacing: { ...spacing, position: value } }) }), _jsx(ToggleGroupControl, { label: __('Velikost', 'brilo-blocks'), value: spacing.size, onChange: (value) => setAttributes({ spacing: { ...spacing, size: value } }), isBlock: true, children: SPACING_SIZES.map((s) => (_jsx(ToggleGroupControlOption, { value: s, label: s === 'default' ? __('Výchozí', 'brilo-blocks') : s.toUpperCase() }, s))) })] })), !exclude.includes('background') && (_jsxs(PanelBody, { title: __('Barvy', 'brilo-blocks'), children: [_jsx("p", { children: __('Pozadí', 'brilo-blocks') }), _jsx(ColorPalette, { colors: paletteColors, value: background || undefined, onChange: (value) => setAttributes({ background: value !== null && value !== void 0 ? value : '' }) }), _jsx("p", { children: __('Barva textu', 'brilo-blocks') }), _jsx(ColorPalette, { colors: paletteColors, value: textColor || undefined, onChange: (value) => setAttributes({ textColor: value !== null && value !== void 0 ? value : '' }) }), !!background && !!textColor && _jsx(ContrastChecker, { backgroundColor: resolveHex(background), textColor: resolveHex(textColor) })] })), !exclude.includes('backgroundImage') && (_jsx(PanelBody, { title: __('Obrázek pozadí', 'brilo-blocks'), initialOpen: false, children: _jsx(BackgroundImageControl, { value: backgroundImage, onChange: (value) => setAttributes({ backgroundImage: value !== null && value !== void 0 ? value : {} }) }) })), !exclude.includes('decoration') && (_jsx(PanelBody, { title: __('Dekorace', 'brilo-blocks'), initialOpen: false, children: _jsx(DecorationControl, { value: decoration, onChange: (value) => setAttributes({ decoration: value !== null && value !== void 0 ? value : {} }) }) })), !exclude.includes('decorations') && (_jsxs(PanelBody, { title: __('Fluidní dekorace', 'brilo-blocks'), initialOpen: false, children: [_jsx(FluidDecorationControl, { label: __('Nahoře', 'brilo-blocks'), value: fluid.top, onChange: (value) => setFluid('top', value) }), _jsx(FluidDecorationControl, { label: __('Dole', 'brilo-blocks'), value: fluid.bottom, onChange: (value) => setFluid('bottom', value) })] })), !exclude.includes('id') && (_jsx(PanelBody, { title: __('Kotva', 'brilo-blocks'), initialOpen: false, children: _jsx(TextControl, { label: __('ID sekce', 'brilo-blocks'), value: id !== null && id !== void 0 ? id : '', onChange: (value) => setAttributes({ id: value }), help: __('Použije se jako HTML atribut id pro kotevní odkaz.', 'brilo-blocks') }) }))] }));
29
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/sections/base-section/edit.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAGpE,wBAAgB,qBAAqB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,WAG3G,cAAc,CAAC,mBAAmB,GAAG,MAAM,CAAC,iCAiCzE"}
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/sections/base-section/edit.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAErD,OAAO,KAAK,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAGpE,wBAAgB,qBAAqB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,WAG3G,cAAc,CAAC,mBAAmB,GAAG,MAAM,CAAC,iCAgDzE"}
@@ -5,15 +5,31 @@ export function createBaseSectionEdit(options) {
5
5
  var _a;
6
6
  const EXCLUDE = (_a = options.exclude) !== null && _a !== void 0 ? _a : [];
7
7
  return function Edit(props) {
8
- var _a;
8
+ var _a, _b;
9
+ var _c, _d;
9
10
  const { attributes, setAttributes } = props;
10
- const { background, textColor, gradient } = attributes;
11
+ const { background, textColor, gradient, backgroundImage } = attributes;
12
+ const bgImageSrc = (_a = backgroundImage === null || backgroundImage === void 0 ? void 0 : backgroundImage.img) === null || _a === void 0 ? void 0 : _a.src;
13
+ // A plain background-color/gradient always paints behind an image, so it can never tint it. To preview a
14
+ // translucent color/gradient sitting on top of the image (matching frontend), stack it as its own layer
15
+ // in front of the `url(...)` layer instead of setting backgroundColor separately.
16
+ const tintLayer = background ? `linear-gradient(${background}, ${background})` : gradient;
11
17
  const blockProps = useBlockProps({
12
18
  className: options.blockClassName,
13
19
  style: {
14
- ...(background ? { backgroundColor: background, padding: '16px' } : {}),
15
- ...(gradient ? { background: gradient, padding: '16px' } : {}),
20
+ position: 'relative',
21
+ ...(background && !bgImageSrc ? { backgroundColor: background, padding: '16px' } : {}),
22
+ ...(gradient && !bgImageSrc ? { background: gradient, padding: '16px' } : {}),
16
23
  ...(textColor ? { color: textColor } : {}),
24
+ ...(bgImageSrc
25
+ ? {
26
+ backgroundImage: [tintLayer, `url(${bgImageSrc})`].filter(Boolean).join(', '),
27
+ backgroundSize: [tintLayer ? '100% 100%' : null, (_c = backgroundImage === null || backgroundImage === void 0 ? void 0 : backgroundImage.fit) !== null && _c !== void 0 ? _c : 'cover'].filter(Boolean).join(', '),
28
+ backgroundPosition: [tintLayer ? 'center center' : null, (_d = backgroundImage === null || backgroundImage === void 0 ? void 0 : backgroundImage.position) !== null && _d !== void 0 ? _d : 'center center'].filter(Boolean).join(', '),
29
+ backgroundRepeat: 'no-repeat',
30
+ padding: '16px',
31
+ }
32
+ : {}),
17
33
  },
18
34
  });
19
35
  const innerBlocksProps = useInnerBlocksProps({ className: options.containerClassName }, {
@@ -21,6 +37,6 @@ export function createBaseSectionEdit(options) {
21
37
  orientation: 'vertical',
22
38
  layout: { type: 'default' },
23
39
  });
24
- return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsx(BaseControls, { attributes: attributes, setAttributes: setAttributes, exclude: EXCLUDE }), (_a = options.extraControls) === null || _a === void 0 ? void 0 : _a.call(options, props)] }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
40
+ return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsx(BaseControls, { attributes: attributes, setAttributes: setAttributes, exclude: EXCLUDE }), (_b = options.extraControls) === null || _b === void 0 ? void 0 : _b.call(options, props)] }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
25
41
  };
26
42
  }
@@ -12,6 +12,31 @@ export interface FluidDecoration {
12
12
  img?: FluidDecorationImage;
13
13
  height: string;
14
14
  }
15
+ export type DecorationImage = FluidDecorationImage;
16
+ export type DecorationPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center-left' | 'center-right';
17
+ export type DecorationDepth = 'front' | 'under';
18
+ export type DecorationTranslate = 'in' | 'center' | 'out';
19
+ export interface Decoration {
20
+ img?: DecorationImage;
21
+ position?: DecorationPosition;
22
+ depth?: DecorationDepth;
23
+ translate?: DecorationTranslate;
24
+ maxWidth?: string;
25
+ offsetX?: string;
26
+ offsetY?: string;
27
+ }
28
+ export type BackgroundImageFit = 'cover' | 'contain';
29
+ export type BackgroundImagePosition = 'left top' | 'center top' | 'right top' | 'left center' | 'center center' | 'right center' | 'left bottom' | 'center bottom' | 'right bottom';
30
+ export interface BackgroundImageOverlay {
31
+ color?: string;
32
+ opacity?: number;
33
+ }
34
+ export interface BackgroundImage {
35
+ img?: FluidDecorationImage;
36
+ fit?: BackgroundImageFit;
37
+ position?: BackgroundImagePosition;
38
+ overlay?: BackgroundImageOverlay;
39
+ }
15
40
  export interface BaseBlockAttributes extends Record<string, unknown> {
16
41
  id: string;
17
42
  spacing: {
@@ -20,14 +45,16 @@ export interface BaseBlockAttributes extends Record<string, unknown> {
20
45
  };
21
46
  background: string;
22
47
  textColor: string;
48
+ decoration: Decoration;
23
49
  decorations: {
24
50
  fluid?: {
25
51
  top?: FluidDecoration;
26
52
  bottom?: FluidDecoration;
27
53
  };
28
54
  };
55
+ backgroundImage: BackgroundImage;
29
56
  }
30
- export type ExcludableBaseAttr = 'spacing' | 'background' | 'id' | 'decorations';
57
+ export type ExcludableBaseAttr = 'spacing' | 'background' | 'id' | 'decorations' | 'decoration' | 'backgroundImage';
31
58
  export interface BaseSectionOptions<TExtra extends Record<string, unknown> = Record<string, never>> extends BriloBlockType {
32
59
  supports?: BlockConfiguration['supports'];
33
60
  extraAttributes?: {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/sections/base-section/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAA;AACzE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAA;AACpC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,oBAAoB,CAAA;IAC1B,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,mBAAoB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAClE,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAA;QAChB,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE;QACX,KAAK,CAAC,EAAE;YACN,GAAG,CAAC,EAAE,eAAe,CAAA;YACrB,MAAM,CAAC,EAAE,eAAe,CAAA;SACzB,CAAA;KACF,CAAA;CACF;AAED,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,YAAY,GAAG,IAAI,GAAG,aAAa,CAAA;AAEhF,MAAM,WAAW,kBAAkB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAE,SAAQ,cAAc;IACxH,QAAQ,C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GAAG,aAAa,GAAG,YAAY,GAAG,iBAAiB,CAAA;AAEnH,MAAM,WAAW,kBAAkB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAE,SAAQ,cAAc;IACxH,QAAQ,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAA;IACzC,eAAe,CAAC,EAAE;SACf,CAAC,IAAI,MAAM,MAAM,GAAG;YACnB,IAAI,EAAE,MAAM,CAAA;YACZ,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAA;SACnB;KACF,CAAA;IACD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,mBAAmB,GAAG,MAAM,CAAC,KAAK,SAAS,CAAA;IAClF,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAA;CAC/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brilo/base-blocks",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "author": "Brilo",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -18,8 +18,19 @@ export const baseAttributes = {
18
18
  type: 'string',
19
19
  default: '',
20
20
  },
21
+ decoration: {
22
+ type: 'object',
23
+ default: {},
24
+ },
21
25
  decorations: {
22
26
  type: 'object',
23
27
  default: {},
24
28
  },
29
+ backgroundImage: {
30
+ type: 'object',
31
+ default: {
32
+ fit: 'cover',
33
+ position: 'center center',
34
+ },
35
+ },
25
36
  } as const
@@ -18,3 +18,58 @@ export const FLUID_DECORATION_UNITS = [
18
18
  {value: 'rem', label: 'rem', default: 3.5},
19
19
  {value: '%', label: '%', default: 10},
20
20
  ]
21
+
22
+ export const DECORATION_POSITIONS = [
23
+ {value: 'top-left', label: __('Nahoře vlevo', 'brilo-blocks')},
24
+ {value: 'top-right', label: __('Nahoře vpravo', 'brilo-blocks')},
25
+ {value: 'center-left', label: __('Uprostřed vlevo', 'brilo-blocks')},
26
+ {value: 'center-right', label: __('Uprostřed vpravo', 'brilo-blocks')},
27
+ {value: 'bottom-left', label: __('Dole vlevo', 'brilo-blocks')},
28
+ {value: 'bottom-right', label: __('Dole vpravo', 'brilo-blocks')},
29
+ ] as const
30
+
31
+ export const DECORATION_DEPTHS = [
32
+ {value: 'front', label: __('Před obsahem', 'brilo-blocks')},
33
+ {value: 'under', label: __('Pod obsahem', 'brilo-blocks')},
34
+ ] as const
35
+
36
+ export const DECORATION_TRANSLATES = [
37
+ {value: 'in', label: __('Uvnitř', 'brilo-blocks')},
38
+ {value: 'center', label: __('Na okraji', 'brilo-blocks')},
39
+ {value: 'out', label: __('Venku', 'brilo-blocks')},
40
+ ] as const
41
+
42
+ export const DECORATION_MAX_WIDTH_DEFAULT = '120px'
43
+
44
+ export const DECORATION_MAX_WIDTH_UNITS = [
45
+ {value: 'px', label: 'px', default: 120},
46
+ {value: 'rem', label: 'rem', default: 7.5},
47
+ {value: '%', label: '%', default: 50},
48
+ ]
49
+
50
+ export const DECORATION_OFFSET_DEFAULT = '0px'
51
+
52
+ export const DECORATION_OFFSET_UNITS = [
53
+ {value: 'px', label: 'px', default: 0},
54
+ {value: 'rem', label: 'rem', default: 0},
55
+ {value: '%', label: '%', default: 0},
56
+ ]
57
+
58
+ export const BACKGROUND_IMAGE_FITS = [
59
+ {value: 'cover', label: __('Vyplnit (cover)', 'brilo-blocks')},
60
+ {value: 'contain', label: __('Celý obrázek (contain)', 'brilo-blocks')},
61
+ ] as const
62
+
63
+ export const BACKGROUND_IMAGE_POSITIONS = [
64
+ {value: 'left top', label: __('Vlevo nahoře', 'brilo-blocks')},
65
+ {value: 'center top', label: __('Nahoře', 'brilo-blocks')},
66
+ {value: 'right top', label: __('Vpravo nahoře', 'brilo-blocks')},
67
+ {value: 'left center', label: __('Vlevo', 'brilo-blocks')},
68
+ {value: 'center center', label: __('Uprostřed', 'brilo-blocks')},
69
+ {value: 'right center', label: __('Vpravo', 'brilo-blocks')},
70
+ {value: 'left bottom', label: __('Vlevo dole', 'brilo-blocks')},
71
+ {value: 'center bottom', label: __('Dole', 'brilo-blocks')},
72
+ {value: 'right bottom', label: __('Vpravo dole', 'brilo-blocks')},
73
+ ] as const
74
+
75
+ export const BACKGROUND_IMAGE_OVERLAY_OPACITY_DEFAULT = 40