@brilo/base-blocks 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/blocks/column/column-item/constants.d.ts.map +1 -1
- package/build/blocks/column/column-item/constants.js +1 -1
- package/build/blocks/core/basic-button/edit.js +1 -1
- package/build/blocks/hero/hero-group/edit.d.ts +2 -4
- package/build/blocks/hero/hero-group/edit.d.ts.map +1 -1
- package/build/blocks/hero/hero-group/edit.js +4 -3
- package/build/blocks/hero/hero-group/factory.d.ts +1 -1
- package/build/blocks/hero/hero-group/factory.d.ts.map +1 -1
- package/build/blocks/hero/hero-group/factory.js +1 -0
- package/build/blocks/hero/hero-group/types.d.ts +10 -1
- package/build/blocks/hero/hero-group/types.d.ts.map +1 -1
- package/build/blocks/sections/base-section/edit.d.ts.map +1 -1
- package/build/blocks/sections/base-section/edit.js +2 -1
- package/build/blocks/signpost/signpost-group/constants.d.ts +1 -1
- package/build/blocks/signpost/signpost-group/constants.d.ts.map +1 -1
- package/build/blocks/signpost/signpost-group/constants.js +1 -1
- package/package.json +1 -1
- package/src/blocks/column/column-item/constants.ts +1 -1
- package/src/blocks/column/column-item/editor.scss +4 -0
- package/src/blocks/core/basic-button/edit.tsx +8 -8
- package/src/blocks/hero/hero-group/edit.tsx +4 -7
- package/src/blocks/hero/hero-group/factory.tsx +9 -4
- package/src/blocks/hero/hero-group/types.ts +14 -2
- package/src/blocks/sections/base-section/edit.tsx +2 -1
- package/src/blocks/signpost/signpost-group/constants.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK,UAAoD,CAAA;AACtE,eAAO,MAAM,KAAK;;;;;;;;;;;;IAgBjB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
2
|
import { justifyTop, justifyCenterVertical, justifyBottom } from '@wordpress/icons';
|
|
3
|
-
export const SIZES = ['1/4', '1/3', '1/2', '2/3', '3/4', '1/1'];
|
|
3
|
+
export const SIZES = ['1/6', '1/4', '1/3', '1/2', '2/3', '3/4', '1/1'];
|
|
4
4
|
export const ALIGN = [
|
|
5
5
|
{
|
|
6
6
|
value: 'top',
|
|
@@ -22,6 +22,6 @@ export function createBasicButtonEdit(options) {
|
|
|
22
22
|
className: clsx((_b = options.blockClassName) !== null && _b !== void 0 ? _b : 'i-button', `--variant-${variant}`, `--size-${size}`, outline && '--outline', fullWidth !== 'false' && `--full-width-${fullWidth}`),
|
|
23
23
|
});
|
|
24
24
|
const iconPreviewStyle = { maxWidth: icon.size, flex: `0 0 ${icon.size}px` };
|
|
25
|
-
return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Tlačítko', 'brilo-blocks'), children: [_jsx(TextControl, { label: __('Text tlačítka', 'brilo-blocks'), value: title, onChange: (value) => setAttributes({ title: value }), placeholder: __('Text tlačítka...', 'brilo-blocks') }), _jsx(ToggleGroupControl, { label: __('Varianta', 'brilo-blocks'), value: variant, onChange: (value) => setAttributes({ variant: value }), isBlock: true, children: VARIANTS.map((v) => (_jsx(ToggleGroupControlOption, { value: v.value, label: v.label }, v.value))) }), _jsx(ToggleControl, { label: __('Outline', 'brilo-blocks'), checked: outline, onChange: (value) => setAttributes({ outline: value }) }), _jsx(ToggleGroupControl, { label: __('Velikost', 'brilo-blocks'), value: size, onChange: (value) => setAttributes({ size: value }), isBlock: true, children: SIZES.map((s) => (_jsx(ToggleGroupControlOption, { value: s.value, label: s.label }, s.value))) }), _jsx(ToggleGroupControl, { label: __('Celá šířka', 'brilo-blocks'), value: fullWidth, onChange: (value) => setAttributes({ fullWidth: value }), isBlock: true, children: FULL_WIDTH_OPTIONS.map((o) => (_jsx(ToggleGroupControlOption, { value: o.value, label: o.label }, o.value))) })] }), _jsxs(PanelBody, { title: __('Odkaz', 'brilo-blocks'), children: [_jsx(TextControl, { label: __('URL', 'brilo-blocks'), value: url.src, onChange: (value) => setAttributes({ url: { ...url, src: value } }) }), _jsx(ToggleControl, { label: __('Otevřít v nové záložce', 'brilo-blocks'), checked: url.blank, onChange: (value) => setAttributes({ url: { ...url, blank: value } }) })] }), _jsxs(PanelBody, { title: __('Ikona', 'brilo-blocks'), initialOpen: false, children: [_jsx(ItemIconControl, { icon: icon, setAttributes: setIconBase, iconTypes: ICON_TYPES, options: options }), hasIcon && (_jsxs(_Fragment, { children: [_jsxs(ToggleGroupControl, { isBlock: true, label: __('Pozice', 'brilo-blocks'), value: icon.position, onChange: (v) => setAttributes({ icon: { ...icon, position: String(v) } }), children: [_jsx(ToggleGroupControlOption, { value: "before", label: __('Před', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "after", label: __('Za', 'brilo-blocks') })] }), _jsx(RangeControl, { label: __('Velikost (px)', 'brilo-blocks'), value: icon.size, onChange: (v) => setAttributes({ icon: { ...icon, size: v !== null && v !== void 0 ? v : 24 } }), min: 8, max: 80, step: 1 })] }))] })] }),
|
|
25
|
+
return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Tlačítko', 'brilo-blocks'), children: [_jsx(TextControl, { label: __('Text tlačítka', 'brilo-blocks'), value: title, onChange: (value) => setAttributes({ title: value }), placeholder: __('Text tlačítka...', 'brilo-blocks') }), _jsx(ToggleGroupControl, { label: __('Varianta', 'brilo-blocks'), value: variant, onChange: (value) => setAttributes({ variant: value }), isBlock: true, children: VARIANTS.map((v) => (_jsx(ToggleGroupControlOption, { value: v.value, label: v.label }, v.value))) }), _jsx(ToggleControl, { label: __('Outline', 'brilo-blocks'), checked: outline, onChange: (value) => setAttributes({ outline: value }) }), _jsx(ToggleGroupControl, { label: __('Velikost', 'brilo-blocks'), value: size, onChange: (value) => setAttributes({ size: value }), isBlock: true, children: SIZES.map((s) => (_jsx(ToggleGroupControlOption, { value: s.value, label: s.label }, s.value))) }), _jsx(ToggleGroupControl, { label: __('Celá šířka', 'brilo-blocks'), value: fullWidth, onChange: (value) => setAttributes({ fullWidth: value }), isBlock: true, children: FULL_WIDTH_OPTIONS.map((o) => (_jsx(ToggleGroupControlOption, { value: o.value, label: o.label }, o.value))) })] }), _jsxs(PanelBody, { title: __('Odkaz', 'brilo-blocks'), children: [_jsx(TextControl, { label: __('URL', 'brilo-blocks'), value: url.src, onChange: (value) => setAttributes({ url: { ...url, src: value } }) }), _jsx(ToggleControl, { label: __('Otevřít v nové záložce', 'brilo-blocks'), checked: url.blank, onChange: (value) => setAttributes({ url: { ...url, blank: value } }) })] }), _jsxs(PanelBody, { title: __('Ikona', 'brilo-blocks'), initialOpen: false, children: [_jsx(ItemIconControl, { icon: icon, setAttributes: setIconBase, iconTypes: ICON_TYPES, options: options }), hasIcon && (_jsxs(_Fragment, { children: [_jsxs(ToggleGroupControl, { isBlock: true, label: __('Pozice', 'brilo-blocks'), value: icon.position, onChange: (v) => setAttributes({ icon: { ...icon, position: String(v) } }), children: [_jsx(ToggleGroupControlOption, { value: "before", label: __('Před', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "after", label: __('Za', 'brilo-blocks') })] }), _jsx(RangeControl, { label: __('Velikost (px)', 'brilo-blocks'), value: icon.size, onChange: (v) => setAttributes({ icon: { ...icon, size: v !== null && v !== void 0 ? v : 24 } }), min: 8, max: 80, step: 1 })] }))] })] }), _jsx("div", { ...blockProps, children: _jsxs("div", { className: "i-button__inner", children: [hasIcon && icon.position === 'before' && (_jsx("span", { className: "i-button__icon", style: iconPreviewStyle, children: _jsx(ItemIconPreview, { icon: icon, setAttributes: setIconBase, options: options }) })), _jsx(RichText, { tagName: "span", className: "i-button__label", value: title, onChange: (value) => setAttributes({ title: value }), placeholder: __('Text tlačítka...', 'brilo-blocks'), allowedFormats: [] }), hasIcon && icon.position === 'after' && (_jsx("span", { className: "i-button__icon", style: iconPreviewStyle, children: _jsx(ItemIconPreview, { icon: icon, setAttributes: setIconBase, options: options }) }))] }) })] }));
|
|
26
26
|
};
|
|
27
27
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
+
import type { BlockEditProps } from '@wordpress/blocks';
|
|
1
2
|
import type { HeroGroupAttributes, HeroGroupOptions } from './types';
|
|
2
|
-
export declare function createHeroGroupEdit(options: HeroGroupOptions): (
|
|
3
|
-
attributes: HeroGroupAttributes;
|
|
4
|
-
setAttributes: (a: Partial<HeroGroupAttributes>) => void;
|
|
5
|
-
}) => import("react").JSX.Element;
|
|
3
|
+
export declare function createHeroGroupEdit(options: HeroGroupOptions): (props: BlockEditProps<HeroGroupAttributes>) => import("react").JSX.Element;
|
|
6
4
|
//# sourceMappingURL=edit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/hero/hero-group/edit.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/hero/hero-group/edit.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAarD,OAAO,KAAK,EAAS,mBAAmB,EAAE,gBAAgB,EAAU,MAAM,SAAS,CAAA;AAEnF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,IAItC,OAAO,cAAc,CAAC,mBAAmB,CAAC,iCA6DhE"}
|
|
@@ -9,8 +9,9 @@ export function createHeroGroupEdit(options) {
|
|
|
9
9
|
var _a, _b;
|
|
10
10
|
const VARIANTS_OPTIONS = (_a = options.variants) !== null && _a !== void 0 ? _a : VARIANTS;
|
|
11
11
|
const EFFECTS_OPTIONS = (_b = options.effects) !== null && _b !== void 0 ? _b : EFFECTS;
|
|
12
|
-
return function Edit(
|
|
13
|
-
var _a, _b;
|
|
12
|
+
return function Edit(props) {
|
|
13
|
+
var _a, _b, _c;
|
|
14
|
+
const { attributes, setAttributes } = props;
|
|
14
15
|
const { variant, effect, autoplay, autoplaySpeed, pauseOnHover } = attributes;
|
|
15
16
|
const { blockProps, innerBlocksProps } = useGroupBlock({
|
|
16
17
|
blockClassName: clsx((_a = options.blockClassName) !== null && _a !== void 0 ? _a : 'g-hero wp-block-section', `--variant-${variant}`, `--effect-${effect}`),
|
|
@@ -20,6 +21,6 @@ export function createHeroGroupEdit(options) {
|
|
|
20
21
|
template: options.template,
|
|
21
22
|
layout: { type: 'default' },
|
|
22
23
|
});
|
|
23
|
-
return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Rozložení a efekty', 'brilo-blocks'), children: [_jsx(ToggleGroupControl, { isBlock: true, label: __('Varianta', 'brilo-blocks'), value: variant, onChange: (v) => setAttributes({ variant: v }), children: VARIANTS_OPTIONS.map((v) => (_jsx(ToggleGroupControlOption, { value: v.value, label: v.label }, v.value))) }), _jsx(SelectControl, { label: __('Efekt přechodu', 'brilo-blocks'), value: effect, options: EFFECTS_OPTIONS, onChange: (v) => setAttributes({ effect: v }) })] }), _jsxs(PanelBody, { title: __('Nastavení slideru', 'brilo-blocks'), children: [_jsx(ToggleControl, { label: __('Automatické přehrávání', 'brilo-blocks'), checked: autoplay, onChange: (v) => setAttributes({ autoplay: v }) }), autoplay && (_jsx(NumberControl, { label: __('Rychlost přehrávání (ms)', 'brilo-blocks'), value: autoplaySpeed, onChange: (v) => setAttributes({ autoplaySpeed: parseInt(v !== null && v !== void 0 ? v : '3000') }) })), _jsx(ToggleControl, { label: __('Pozastavit při najetí myší', 'brilo-blocks'), checked: pauseOnHover, onChange: (v) => setAttributes({ pauseOnHover: v }) })] })] }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
|
|
24
|
+
return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Rozložení a efekty', 'brilo-blocks'), children: [_jsx(ToggleGroupControl, { isBlock: true, label: __('Varianta', 'brilo-blocks'), value: variant, onChange: (v) => setAttributes({ variant: v }), children: VARIANTS_OPTIONS.map((v) => (_jsx(ToggleGroupControlOption, { value: v.value, label: v.label }, v.value))) }), _jsx(SelectControl, { label: __('Efekt přechodu', 'brilo-blocks'), value: effect, options: EFFECTS_OPTIONS, onChange: (v) => setAttributes({ effect: v }) })] }), _jsxs(PanelBody, { title: __('Nastavení slideru', 'brilo-blocks'), children: [_jsx(ToggleControl, { label: __('Automatické přehrávání', 'brilo-blocks'), checked: autoplay, onChange: (v) => setAttributes({ autoplay: v }) }), autoplay && (_jsx(NumberControl, { label: __('Rychlost přehrávání (ms)', 'brilo-blocks'), value: autoplaySpeed, onChange: (v) => setAttributes({ autoplaySpeed: parseInt(v !== null && v !== void 0 ? v : '3000') }) })), _jsx(ToggleControl, { label: __('Pozastavit při najetí myší', 'brilo-blocks'), checked: pauseOnHover, onChange: (v) => setAttributes({ pauseOnHover: v }) })] }), (_c = options.extraControls) === null || _c === void 0 ? void 0 : _c.call(options, props)] }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
|
|
24
25
|
};
|
|
25
26
|
}
|
|
@@ -3,5 +3,5 @@ import type { OptionArray } from '../../../types';
|
|
|
3
3
|
import { EFFECTS, VARIANTS } from './constants';
|
|
4
4
|
import type { HeroGroupAttributes, HeroGroupOptions } from './types';
|
|
5
5
|
export type { HeroGroupAttributes, HeroGroupOptions };
|
|
6
|
-
export declare function createHeroGroupBlock<TVariants extends OptionArray = typeof VARIANTS, TEffects extends OptionArray = typeof EFFECTS>(options: HeroGroupOptions<TVariants, TEffects>): BlockConfiguration<HeroGroupAttributes<TVariants[number]['value'], TEffects[number]['value']
|
|
6
|
+
export declare function createHeroGroupBlock<TVariants extends OptionArray = typeof VARIANTS, TEffects extends OptionArray = typeof EFFECTS, TExtra extends Record<string, unknown> = Record<string, never>>(options: HeroGroupOptions<TVariants, TEffects, TExtra>): BlockConfiguration<HeroGroupAttributes<TVariants[number]['value'], TEffects[number]['value']> & TExtra>;
|
|
7
7
|
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/hero/hero-group/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAEzD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AACxC,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,aAAa,CAAA;AAE7C,OAAO,KAAK,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAA;AAGlE,YAAY,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,CAAA;AAEnD,wBAAgB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/hero/hero-group/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAEzD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AACxC,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,aAAa,CAAA;AAE7C,OAAO,KAAK,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAA;AAGlE,YAAY,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,CAAA;AAEnD,wBAAgB,oBAAoB,CAClC,SAAS,SAAS,WAAW,GAAG,OAAO,QAAQ,EAC/C,QAAQ,SAAS,WAAW,GAAG,OAAO,OAAO,EAC7C,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAE9D,OAAO,EAAE,gBAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,GACrD,kBAAkB,CAAC,mBAAmB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,CAgCzG"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { BlockEditProps } from '@wordpress/blocks';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
1
3
|
import type { BriloBlockType, OptionArray } from '../../../types';
|
|
2
4
|
import type { HeroSliderItem } from '../hero-item/types';
|
|
3
5
|
import type { EFFECTS, VARIANTS } from './constants';
|
|
@@ -11,9 +13,16 @@ export interface HeroGroupAttributes<TVariant extends string = Variant, TEffect
|
|
|
11
13
|
pauseOnHover: boolean;
|
|
12
14
|
effect: TEffect;
|
|
13
15
|
}
|
|
14
|
-
export interface HeroGroupOptions<TVariants extends OptionArray = typeof VARIANTS, TEffects extends OptionArray = typeof EFFECTS> extends BriloBlockType {
|
|
16
|
+
export interface HeroGroupOptions<TVariants extends OptionArray = typeof VARIANTS, TEffects extends OptionArray = typeof EFFECTS, TExtra extends Record<string, unknown> = Record<string, never>> extends BriloBlockType {
|
|
15
17
|
allowedBlocks: string[];
|
|
16
18
|
variants?: TVariants;
|
|
17
19
|
effects?: TEffects;
|
|
20
|
+
extraAttributes?: {
|
|
21
|
+
[K in keyof TExtra]: {
|
|
22
|
+
type: string;
|
|
23
|
+
default: TExtra[K];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
extraControls?: (props: BlockEditProps<HeroGroupAttributes<TVariants[number]['value'], TEffects[number]['value']> & TExtra>) => ReactNode;
|
|
18
27
|
}
|
|
19
28
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/hero/hero-group/types.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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,IAGlH,OAAO,cAAc,CAAC,mBAAmB,GAAG,MAAM,CAAC,
|
|
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,IAGlH,OAAO,cAAc,CAAC,mBAAmB,GAAG,MAAM,CAAC,iCAiCzE"}
|
|
@@ -7,11 +7,12 @@ export function createBaseSectionEdit(options) {
|
|
|
7
7
|
return function Edit(props) {
|
|
8
8
|
var _a;
|
|
9
9
|
const { attributes, setAttributes } = props;
|
|
10
|
-
const { background, textColor } = attributes;
|
|
10
|
+
const { background, textColor, gradient } = attributes;
|
|
11
11
|
const blockProps = useBlockProps({
|
|
12
12
|
className: options.blockClassName,
|
|
13
13
|
style: {
|
|
14
14
|
...(background ? { backgroundColor: background, padding: '16px' } : {}),
|
|
15
|
+
...(gradient ? { background: gradient, padding: '16px' } : {}),
|
|
15
16
|
...(textColor ? { color: textColor } : {}),
|
|
16
17
|
},
|
|
17
18
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const COLUMNS: readonly [4, 3, 2];
|
|
1
|
+
export declare const COLUMNS: readonly [5, 4, 3, 2];
|
|
2
2
|
export declare const RATIOS: readonly ["4:3", "3:2", "16:9", "1:1", "2:1", "3:4"];
|
|
3
3
|
export declare const HEADING_LEVELS: readonly [2, 3, 4];
|
|
4
4
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/signpost/signpost-group/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/signpost/signpost-group/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,uBAAwB,CAAA;AAC5C,eAAO,MAAM,MAAM,sDAAuD,CAAA;AAC1E,eAAO,MAAM,cAAc,oBAAqB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {__} from '@wordpress/i18n'
|
|
2
2
|
import {justifyTop, justifyCenterVertical, justifyBottom} from '@wordpress/icons'
|
|
3
3
|
|
|
4
|
-
export const SIZES = ['1/4', '1/3', '1/2', '2/3', '3/4', '1/1']
|
|
4
|
+
export const SIZES = ['1/6', '1/4', '1/3', '1/2', '2/3', '3/4', '1/1']
|
|
5
5
|
export const ALIGN = [
|
|
6
6
|
{
|
|
7
7
|
value: 'top',
|
|
@@ -129,12 +129,12 @@ export function createBasicButtonEdit(options: BasicButtonOptions) {
|
|
|
129
129
|
</PanelBody>
|
|
130
130
|
</InspectorControls>
|
|
131
131
|
<div {...blockProps}>
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
<div className="i-button__inner">
|
|
133
|
+
{hasIcon && icon.position === 'before' && (
|
|
134
|
+
<span className="i-button__icon" style={iconPreviewStyle}>
|
|
134
135
|
<ItemIconPreview icon={icon as unknown as import('~/types').Icon} setAttributes={setIconBase} options={options} />
|
|
135
136
|
</span>
|
|
136
|
-
|
|
137
|
-
<div className="i-button__inner">
|
|
137
|
+
)}
|
|
138
138
|
<RichText
|
|
139
139
|
tagName="span"
|
|
140
140
|
className="i-button__label"
|
|
@@ -143,12 +143,12 @@ export function createBasicButtonEdit(options: BasicButtonOptions) {
|
|
|
143
143
|
placeholder={__('Text tlačítka...', 'brilo-blocks')}
|
|
144
144
|
allowedFormats={[]}
|
|
145
145
|
/>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
<span className="link-item__icon" style={iconPreviewStyle}>
|
|
146
|
+
{hasIcon && icon.position === 'after' && (
|
|
147
|
+
<span className="i-button__icon" style={iconPreviewStyle}>
|
|
149
148
|
<ItemIconPreview icon={icon as unknown as import('~/types').Icon} setAttributes={setIconBase} options={options} />
|
|
150
149
|
</span>
|
|
151
|
-
|
|
150
|
+
)}
|
|
151
|
+
</div>
|
|
152
152
|
</div>
|
|
153
153
|
</>
|
|
154
154
|
)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {InspectorControls} from '@wordpress/block-editor'
|
|
2
|
+
import type {BlockEditProps} from '@wordpress/blocks'
|
|
2
3
|
import {
|
|
3
4
|
PanelBody,
|
|
4
5
|
SelectControl,
|
|
@@ -17,13 +18,8 @@ export function createHeroGroupEdit(options: HeroGroupOptions) {
|
|
|
17
18
|
const VARIANTS_OPTIONS = options.variants ?? VARIANTS
|
|
18
19
|
const EFFECTS_OPTIONS = options.effects ?? EFFECTS
|
|
19
20
|
|
|
20
|
-
return function Edit({
|
|
21
|
-
attributes,
|
|
22
|
-
setAttributes,
|
|
23
|
-
}: {
|
|
24
|
-
attributes: HeroGroupAttributes
|
|
25
|
-
setAttributes: (a: Partial<HeroGroupAttributes>) => void
|
|
26
|
-
}) {
|
|
21
|
+
return function Edit(props: BlockEditProps<HeroGroupAttributes>) {
|
|
22
|
+
const {attributes, setAttributes} = props
|
|
27
23
|
const {variant, effect, autoplay, autoplaySpeed, pauseOnHover} = attributes
|
|
28
24
|
|
|
29
25
|
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
@@ -75,6 +71,7 @@ export function createHeroGroupEdit(options: HeroGroupOptions) {
|
|
|
75
71
|
onChange={(v) => setAttributes({pauseOnHover: v})}
|
|
76
72
|
/>
|
|
77
73
|
</PanelBody>
|
|
74
|
+
{options.extraControls?.(props as unknown as Parameters<NonNullable<typeof options.extraControls>>[0])}
|
|
78
75
|
</InspectorControls>
|
|
79
76
|
<div {...blockProps}>
|
|
80
77
|
<div {...innerBlocksProps} />
|
|
@@ -9,9 +9,13 @@ import {icon} from './icon'
|
|
|
9
9
|
|
|
10
10
|
export type {HeroGroupAttributes, HeroGroupOptions}
|
|
11
11
|
|
|
12
|
-
export function createHeroGroupBlock<
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
export function createHeroGroupBlock<
|
|
13
|
+
TVariants extends OptionArray = typeof VARIANTS,
|
|
14
|
+
TEffects extends OptionArray = typeof EFFECTS,
|
|
15
|
+
TExtra extends Record<string, unknown> = Record<string, never>,
|
|
16
|
+
>(
|
|
17
|
+
options: HeroGroupOptions<TVariants, TEffects, TExtra>,
|
|
18
|
+
): BlockConfiguration<HeroGroupAttributes<TVariants[number]['value'], TEffects[number]['value']> & TExtra> {
|
|
15
19
|
const variants = options.variants ?? VARIANTS
|
|
16
20
|
const effects = options.effects ?? EFFECTS
|
|
17
21
|
|
|
@@ -38,8 +42,9 @@ export function createHeroGroupBlock<TVariants extends OptionArray = typeof VARI
|
|
|
38
42
|
default: effects[0].value,
|
|
39
43
|
enum: effects.map((e) => e.value),
|
|
40
44
|
},
|
|
45
|
+
...options.extraAttributes,
|
|
41
46
|
},
|
|
42
47
|
edit: createHeroGroupEdit(options as unknown as HeroGroupOptions),
|
|
43
48
|
save: () => <InnerBlocks.Content />,
|
|
44
|
-
} as unknown as BlockConfiguration<HeroGroupAttributes<TVariants[number]['value'], TEffects[number]['value']
|
|
49
|
+
} as unknown as BlockConfiguration<HeroGroupAttributes<TVariants[number]['value'], TEffects[number]['value']> & TExtra>
|
|
45
50
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type {BlockEditProps} from '@wordpress/blocks'
|
|
2
|
+
import type {ReactNode} from 'react'
|
|
1
3
|
import type {BriloBlockType, OptionArray} from '~/types'
|
|
2
4
|
import type {HeroSliderItem} from '../hero-item/types'
|
|
3
5
|
import type {EFFECTS, VARIANTS} from './constants'
|
|
@@ -14,9 +16,19 @@ export interface HeroGroupAttributes<TVariant extends string = Variant, TEffect
|
|
|
14
16
|
effect: TEffect
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
export interface HeroGroupOptions<
|
|
18
|
-
extends
|
|
19
|
+
export interface HeroGroupOptions<
|
|
20
|
+
TVariants extends OptionArray = typeof VARIANTS,
|
|
21
|
+
TEffects extends OptionArray = typeof EFFECTS,
|
|
22
|
+
TExtra extends Record<string, unknown> = Record<string, never>,
|
|
23
|
+
> extends BriloBlockType {
|
|
19
24
|
allowedBlocks: string[]
|
|
20
25
|
variants?: TVariants
|
|
21
26
|
effects?: TEffects
|
|
27
|
+
extraAttributes?: {
|
|
28
|
+
[K in keyof TExtra]: {
|
|
29
|
+
type: string
|
|
30
|
+
default: TExtra[K]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
extraControls?: (props: BlockEditProps<HeroGroupAttributes<TVariants[number]['value'], TEffects[number]['value']> & TExtra>) => ReactNode
|
|
22
34
|
}
|
|
@@ -8,11 +8,12 @@ export function createBaseSectionEdit<TExtra extends Record<string, unknown> = R
|
|
|
8
8
|
|
|
9
9
|
return function Edit(props: BlockEditProps<BaseBlockAttributes & TExtra>) {
|
|
10
10
|
const {attributes, setAttributes} = props
|
|
11
|
-
const {background, textColor} = attributes as BaseBlockAttributes
|
|
11
|
+
const {background, textColor, gradient} = attributes as BaseBlockAttributes & {gradient?: string}
|
|
12
12
|
const blockProps = useBlockProps({
|
|
13
13
|
className: options.blockClassName,
|
|
14
14
|
style: {
|
|
15
15
|
...(background ? {backgroundColor: background, padding: '16px'} : {}),
|
|
16
|
+
...(gradient ? {background: gradient, padding: '16px'} : {}),
|
|
16
17
|
...(textColor ? {color: textColor} : {}),
|
|
17
18
|
},
|
|
18
19
|
})
|