@brilo/base-blocks 0.1.54 → 0.1.55

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.
Files changed (28) hide show
  1. package/build/.tsbuildinfo +1 -1
  2. package/build/blocks/accordion/accordion-item/edit.d.ts.map +1 -1
  3. package/build/blocks/accordion/accordion-item/edit.js +4 -4
  4. package/build/blocks/accordion/accordion-item/factory.d.ts.map +1 -1
  5. package/build/blocks/accordion/accordion-item/factory.js +1 -0
  6. package/build/blocks/accordion/accordion-item/types.d.ts +1 -0
  7. package/build/blocks/accordion/accordion-item/types.d.ts.map +1 -1
  8. package/build/blocks/groups/content-group/index.js +1 -1
  9. package/build/blocks/hero/hero-item/edit.d.ts +2 -4
  10. package/build/blocks/hero/hero-item/edit.d.ts.map +1 -1
  11. package/build/blocks/hero/hero-item/edit.js +7 -6
  12. package/build/blocks/hero/hero-item/factory.d.ts +1 -1
  13. package/build/blocks/hero/hero-item/factory.d.ts.map +1 -1
  14. package/build/blocks/hero/hero-item/factory.js +1 -0
  15. package/build/blocks/hero/hero-item/types.d.ts +10 -1
  16. package/build/blocks/hero/hero-item/types.d.ts.map +1 -1
  17. package/build/blocks/testimonial/testimonial-item/factory.d.ts.map +1 -1
  18. package/build/blocks/testimonial/testimonial-item/factory.js +2 -1
  19. package/package.json +1 -1
  20. package/src/blocks/accordion/accordion-item/edit.tsx +12 -3
  21. package/src/blocks/accordion/accordion-item/factory.tsx +1 -0
  22. package/src/blocks/accordion/accordion-item/types.ts +1 -0
  23. package/src/blocks/core/basic-button/editor.scss +11 -0
  24. package/src/blocks/groups/content-group/index.ts +1 -1
  25. package/src/blocks/hero/hero-item/edit.tsx +4 -7
  26. package/src/blocks/hero/hero-item/factory.tsx +6 -3
  27. package/src/blocks/hero/hero-item/types.ts +10 -1
  28. package/src/blocks/testimonial/testimonial-item/factory.tsx +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-item/edit.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAE1E,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,oBAAoB,oCAIjE;IACD,UAAU,EAAE,uBAAuB,CAAA;IACnC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,KAAK,IAAI,CAAA;CAC7D,iCAgCF"}
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-item/edit.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAE1E,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,oBAAoB,oCAIjE;IACD,UAAU,EAAE,uBAAuB,CAAA;IACnC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,KAAK,IAAI,CAAA;CAC7D,iCAyCF"}
@@ -1,14 +1,14 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { RichText, useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
3
- import { BaseControl } from '@wordpress/components';
2
+ import { InspectorControls, RichText, useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
3
+ import { BaseControl, PanelBody, ToggleControl } from '@wordpress/components';
4
4
  import { Icon, chevronDown } from '@wordpress/icons';
5
5
  import { __ } from '@wordpress/i18n';
6
6
  import clsx from 'clsx';
7
7
  export function createAccordionItemEdit(_options) {
8
8
  return function Edit({ attributes, setAttributes, }) {
9
- const { title } = attributes;
9
+ const { title, open } = attributes;
10
10
  const blockProps = useBlockProps({ className: clsx('accordion-item') });
11
11
  const innerBlocksProps = useInnerBlocksProps({});
12
- return (_jsx(_Fragment, { children: _jsxs("div", { ...blockProps, children: [_jsxs("header", { className: "accordion-item__header flex gap-2", children: [_jsx(RichText, { identifier: "title", className: "title u-text-editable grow", tagName: "h3", value: title, allowedFormats: [], onChange: (value) => setAttributes({ title: value }), placeholder: __('Nadpis prvku', 'brilo-blocks'), "data-custom-placeholder": true }), _jsxs("label", { className: "accordion-item__dropdown flex items-center justify-center cursor-pointer", children: [_jsx(Icon, { icon: chevronDown, size: 32, className: "accordion-item__dropdown-icon", color: "white" }), _jsx("input", { type: "checkbox", defaultChecked: true })] })] }), _jsx(BaseControl, { label: __('Obsah:', 'brilo-blocks'), className: "accordion-item__content", children: _jsx("div", { ...innerBlocksProps }) })] }) }));
12
+ return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsx(PanelBody, { title: __('Nastavení', 'brilo-blocks'), children: _jsx(ToggleControl, { label: __('Otevřeno ve výchozím stavu', 'brilo-blocks'), checked: open, onChange: (v) => setAttributes({ open: v }) }) }) }), _jsxs("div", { ...blockProps, children: [_jsxs("header", { className: "accordion-item__header flex gap-2", children: [_jsx(RichText, { identifier: "title", className: "title u-text-editable grow", tagName: "h3", value: title, allowedFormats: [], onChange: (value) => setAttributes({ title: value }), placeholder: __('Nadpis prvku', 'brilo-blocks'), "data-custom-placeholder": true }), _jsxs("label", { className: "accordion-item__dropdown flex items-center justify-center cursor-pointer", children: [_jsx(Icon, { icon: chevronDown, size: 32, className: "accordion-item__dropdown-icon", color: "white" }), _jsx("input", { type: "checkbox", defaultChecked: true })] })] }), _jsx(BaseControl, { label: __('Obsah:', 'brilo-blocks'), className: "accordion-item__content", children: _jsx("div", { ...innerBlocksProps }) })] })] }));
13
13
  };
14
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-item/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAGzD,OAAO,KAAK,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAE1E,YAAY,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,CAAA;AAE3D,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,oBAAoB,GAAG,kBAAkB,CAAC,uBAAuB,CAAC,CAenH"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-item/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAGzD,OAAO,KAAK,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAE1E,YAAY,EAAC,uBAAuB,EAAE,oBAAoB,EAAC,CAAA;AAE3D,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,oBAAoB,GAAG,kBAAkB,CAAC,uBAAuB,CAAC,CAgBnH"}
@@ -14,6 +14,7 @@ export function createAccordionItemBlock(options) {
14
14
  supports: { html: false, customClassName: false },
15
15
  attributes: {
16
16
  title: { type: 'string', default: '' },
17
+ open: { type: 'boolean', default: false },
17
18
  },
18
19
  edit: createAccordionItemEdit(options),
19
20
  save: () => _jsx(InnerBlocks.Content, {}),
@@ -1,6 +1,7 @@
1
1
  import type { BriloBlockType } from '../../../types';
2
2
  export interface AccordionItemAttributes extends Record<string, unknown> {
3
3
  title: string;
4
+ open: boolean;
4
5
  }
5
6
  export interface AccordionItemOptions extends BriloBlockType {
6
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-item/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,WAAW,uBAAwB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACtE,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,oBAAqB,SAAQ,cAAc;CAAG"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-item/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,WAAW,uBAAwB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACtE,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,CAAA;CACd;AAED,MAAM,WAAW,oBAAqB,SAAQ,cAAc;CAAG"}
@@ -16,6 +16,6 @@ export const contentGroupDefaults = {
16
16
  'core/embed',
17
17
  'core/video',
18
18
  'core/file',
19
- 'brilo/link',
19
+ 'brilo/link-item',
20
20
  ],
21
21
  };
@@ -1,6 +1,4 @@
1
+ import type { BlockEditProps } from '@wordpress/blocks';
1
2
  import type { HeroItemAttributes, HeroItemOptions } from './types';
2
- export declare function createHeroItemEdit(options: HeroItemOptions): ({ attributes, setAttributes, }: {
3
- attributes: HeroItemAttributes;
4
- setAttributes: (a: Partial<HeroItemAttributes>) => void;
5
- }) => import("react").JSX.Element;
3
+ export declare function createHeroItemEdit(options: HeroItemOptions): (props: BlockEditProps<HeroItemAttributes>) => 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-item/edit.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAkB,kBAAkB,EAAE,eAAe,EAAC,MAAM,SAAS,CAAA;AAKjF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,oCAItD;IACD,UAAU,EAAE,kBAAkB,CAAA;IAC9B,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAA;CACxD,iCAgIF"}
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/hero/hero-item/edit.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAcrD,OAAO,KAAK,EAAkB,kBAAkB,EAAE,eAAe,EAAC,MAAM,SAAS,CAAA;AAKjF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,WAC7B,cAAc,CAAC,kBAAkB,CAAC,iCAkI/D"}
@@ -8,20 +8,21 @@ import { useGroupBlock } from '../../../hooks/useGroupBlock';
8
8
  import { useTenantColorPalette } from '../../../hooks/useTenantColorPalette';
9
9
  import clsx from 'clsx';
10
10
  export function createHeroItemEdit(options) {
11
- return function Edit({ attributes, setAttributes, }) {
12
- var _a;
13
- var _b, _c, _d;
11
+ return function Edit(props) {
12
+ var _a, _b;
13
+ var _c, _d, _e;
14
+ const { attributes, setAttributes } = props;
14
15
  const { title, titleColor, img, headingLevel, contentPosition, url, focalPoint, overline } = attributes;
15
16
  const { paletteColors } = useTenantColorPalette();
16
17
  const { blockProps, innerBlocksProps } = useGroupBlock({
17
- blockClassName: clsx((_b = options.blockClassName) !== null && _b !== void 0 ? _b : 'i-hero'),
18
- containerClassName: [(_c = options.containerClassName) !== null && _c !== void 0 ? _c : 'i-hero__content wp-block-inner-content'],
18
+ blockClassName: clsx((_c = options.blockClassName) !== null && _c !== void 0 ? _c : 'i-hero'),
19
+ containerClassName: [(_d = options.containerClassName) !== null && _d !== void 0 ? _d : 'i-hero__content wp-block-inner-content'],
19
20
  allowedBlocks: options.allowedBlocks,
20
21
  orientation: 'vertical',
21
22
  template: options.template,
22
23
  layout: { type: 'default' },
23
24
  });
24
- return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Obrázek', 'brilo-blocks'), children: [_jsx(ImagePickerControl, { value: { id: img.id, alt: img.alt }, onChange: (v) => setAttributes({ img: { ...img, ...v } }) }), _jsx(BaseControl, { label: __('Focal point (desktop)', 'brilo-blocks'), children: _jsx(AlignmentMatrixControl, { value: focalPoint.point, onChange: (v) => setAttributes({ focalPoint: { ...focalPoint, point: (v !== null && v !== void 0 ? v : 'center center') } }) }) }), _jsx(BaseControl, { label: __('Focal point (mobil)', 'brilo-blocks'), children: _jsx(AlignmentMatrixControl, { value: ((_d = (_a = focalPoint.sm) === null || _a === void 0 ? void 0 : _a.point) !== null && _d !== void 0 ? _d : 'center center'), onChange: (v) => setAttributes({ focalPoint: { ...focalPoint, sm: { point: (v !== null && v !== void 0 ? v : 'center center') } } }) }) })] }), _jsxs(PanelBody, { title: __('Overline', 'brilo-blocks'), children: [_jsx(BaseControl, { label: __('Barva overline pozadí', 'brilo-blocks'), children: _jsx(ColorPalette, { colors: paletteColors, value: overline.background || undefined, onChange: (value) => setAttributes({ overline: { ...overline, background: value !== null && value !== void 0 ? value : '' } }) }) }), _jsx(BaseControl, { label: __('Barva overline textu', 'brilo-blocks'), children: _jsx(ColorPalette, { colors: paletteColors, value: overline.color || undefined, onChange: (value) => setAttributes({ overline: { ...overline, color: value !== null && value !== void 0 ? value : '' } }) }) })] }), _jsxs(PanelBody, { title: __('Nadpis', 'brilo-blocks'), children: [_jsx(BaseControl, { label: __('Barva nadpisu', 'brilo-blocks'), children: _jsx(ColorPalette, { colors: paletteColors, value: titleColor || undefined, onChange: (v) => setAttributes({ titleColor: v !== null && v !== void 0 ? v : '' }) }) }), _jsx(ToggleGroupControl, { isBlock: true, label: __('Úroveň nadpisu položek', 'brilo-blocks'), value: String(headingLevel), onChange: (v) => setAttributes({ headingLevel: Number(v !== null && v !== void 0 ? v : HEADING_LEVELS[1]) }), children: HEADING_LEVELS.map((l) => (_jsx(ToggleGroupControlOption, { value: String(l), label: `H${l}` }, l))) })] }), _jsx(PanelBody, { title: __('Rozložení', 'brilo-blocks'), children: _jsx(BaseControl, { label: __('Pozice obsahu', 'brilo-blocks'), children: _jsx(AlignmentMatrixControl, { value: contentPosition, onChange: (v) => setAttributes({ contentPosition: v }) }) }) }), _jsxs(PanelBody, { title: __('Odkaz', 'brilo-blocks'), children: [_jsx(TextControl, { label: __('URL odkazu', 'brilo-blocks'), value: url.src, onChange: (v) => setAttributes({ url: { ...url, src: v } }) }), _jsx(ToggleControl, { label: __('Otevřít v novém okně', 'brilo-blocks'), checked: url.blank, onChange: (v) => setAttributes({ url: { ...url, blank: v } }) })] })] }), _jsxs("div", { ...blockProps, children: [_jsx("div", { className: "i-hero__image-wrap", children: _jsx(ImagePickerBody, { value: { id: img.id, alt: img.alt }, onChange: (v) => setAttributes({ img: { ...img, ...v } }), placeholder: __('Vyberte obrázek', 'brilo-blocks') }) }), _jsxs("div", { className: `i-hero__overlay --${contentPosition.replace(' ', '-')}`, children: [_jsx(RichText, { tagName: "span", className: "i-hero__overline u-text-editable", style: overline.color || overline.background
25
+ return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Obrázek', 'brilo-blocks'), children: [_jsx(ImagePickerControl, { value: { id: img.id, alt: img.alt }, onChange: (v) => setAttributes({ img: { ...img, ...v } }) }), _jsx(BaseControl, { label: __('Focal point (desktop)', 'brilo-blocks'), children: _jsx(AlignmentMatrixControl, { value: focalPoint.point, onChange: (v) => setAttributes({ focalPoint: { ...focalPoint, point: (v !== null && v !== void 0 ? v : 'center center') } }) }) }), _jsx(BaseControl, { label: __('Focal point (mobil)', 'brilo-blocks'), children: _jsx(AlignmentMatrixControl, { value: ((_e = (_a = focalPoint.sm) === null || _a === void 0 ? void 0 : _a.point) !== null && _e !== void 0 ? _e : 'center center'), onChange: (v) => setAttributes({ focalPoint: { ...focalPoint, sm: { point: (v !== null && v !== void 0 ? v : 'center center') } } }) }) })] }), _jsxs(PanelBody, { title: __('Overline', 'brilo-blocks'), children: [_jsx(BaseControl, { label: __('Barva overline pozadí', 'brilo-blocks'), children: _jsx(ColorPalette, { colors: paletteColors, value: overline.background || undefined, onChange: (value) => setAttributes({ overline: { ...overline, background: value !== null && value !== void 0 ? value : '' } }) }) }), _jsx(BaseControl, { label: __('Barva overline textu', 'brilo-blocks'), children: _jsx(ColorPalette, { colors: paletteColors, value: overline.color || undefined, onChange: (value) => setAttributes({ overline: { ...overline, color: value !== null && value !== void 0 ? value : '' } }) }) })] }), _jsxs(PanelBody, { title: __('Nadpis', 'brilo-blocks'), children: [_jsx(BaseControl, { label: __('Barva nadpisu', 'brilo-blocks'), children: _jsx(ColorPalette, { colors: paletteColors, value: titleColor || undefined, onChange: (v) => setAttributes({ titleColor: v !== null && v !== void 0 ? v : '' }) }) }), _jsx(ToggleGroupControl, { isBlock: true, label: __('Úroveň nadpisu položek', 'brilo-blocks'), value: String(headingLevel), onChange: (v) => setAttributes({ headingLevel: Number(v !== null && v !== void 0 ? v : HEADING_LEVELS[1]) }), children: HEADING_LEVELS.map((l) => (_jsx(ToggleGroupControlOption, { value: String(l), label: `H${l}` }, l))) })] }), _jsx(PanelBody, { title: __('Rozložení', 'brilo-blocks'), children: _jsx(BaseControl, { label: __('Pozice obsahu', 'brilo-blocks'), children: _jsx(AlignmentMatrixControl, { value: contentPosition, onChange: (v) => setAttributes({ contentPosition: v }) }) }) }), _jsxs(PanelBody, { title: __('Odkaz', 'brilo-blocks'), children: [_jsx(TextControl, { label: __('URL odkazu', 'brilo-blocks'), value: url.src, onChange: (v) => setAttributes({ url: { ...url, src: v } }) }), _jsx(ToggleControl, { label: __('Otevřít v novém okně', 'brilo-blocks'), checked: url.blank, onChange: (v) => setAttributes({ url: { ...url, blank: v } }) })] }), (_b = options.extraControls) === null || _b === void 0 ? void 0 : _b.call(options, props)] }), _jsxs("div", { ...blockProps, children: [_jsx("div", { className: "i-hero__image-wrap", children: _jsx(ImagePickerBody, { value: { id: img.id, alt: img.alt }, onChange: (v) => setAttributes({ img: { ...img, ...v } }), placeholder: __('Vyberte obrázek', 'brilo-blocks') }) }), _jsxs("div", { className: `i-hero__overlay --${contentPosition.replace(' ', '-')}`, children: [_jsx(RichText, { tagName: "span", className: "i-hero__overline u-text-editable", style: overline.color || overline.background
25
26
  ? {
26
27
  ...(overline.color ? { color: overline.color } : {}),
27
28
  ...(overline.background ? { backgroundColor: overline.background } : {}),
@@ -1,5 +1,5 @@
1
1
  import type { BlockConfiguration } from '@wordpress/blocks';
2
2
  import type { HeroItemAttributes, HeroItemOptions } from './types';
3
3
  export type { HeroItemAttributes, HeroItemOptions };
4
- export declare function createHeroItemBlock(options: HeroItemOptions): BlockConfiguration<HeroItemAttributes>;
4
+ export declare function createHeroItemBlock<TExtra extends Record<string, unknown> = Record<string, never>>(options: HeroItemOptions<TExtra>): BlockConfiguration<HeroItemAttributes & TExtra>;
5
5
  //# sourceMappingURL=factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/hero/hero-item/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAIzD,OAAO,KAAK,EAAC,kBAAkB,EAAE,eAAe,EAAC,MAAM,SAAS,CAAA;AAGhE,YAAY,EAAC,kBAAkB,EAAE,eAAe,EAAC,CAAA;AAEjD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,eAAe,GAAG,kBAAkB,CAAC,kBAAkB,CAAC,CAyCpG"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/hero/hero-item/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAIzD,OAAO,KAAK,EAAC,kBAAkB,EAAE,eAAe,EAAC,MAAM,SAAS,CAAA;AAGhE,YAAY,EAAC,kBAAkB,EAAE,eAAe,EAAC,CAAA;AAEjD,wBAAgB,mBAAmB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAChG,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC,GAC/B,kBAAkB,CAAC,kBAAkB,GAAG,MAAM,CAAC,CA0CjD"}
@@ -40,6 +40,7 @@ export function createHeroItemBlock(options) {
40
40
  type: 'object',
41
41
  default: { point: 'center center', sm: { point: 'center center' } },
42
42
  },
43
+ ...options.extraAttributes,
43
44
  },
44
45
  edit: createHeroItemEdit(options),
45
46
  save: () => _jsx(InnerBlocks.Content, {}),
@@ -1,3 +1,5 @@
1
+ import type { BlockEditProps } from '@wordpress/blocks';
2
+ import type { ReactNode } from 'react';
1
3
  import type { BriloBlockType, Media, OptionArray } from '../../../types';
2
4
  import type { CONTENT_POSITIONS, HEADING_LEVELS } from './constants';
3
5
  export type ContentPosition = (typeof CONTENT_POSITIONS)[number]['value'];
@@ -38,7 +40,14 @@ export interface HeroItemAttributes extends Record<string, unknown> {
38
40
  url: HeroItemUrl;
39
41
  focalPoint: HeroItemFocalPoint;
40
42
  }
41
- export interface HeroItemOptions extends BriloBlockType {
43
+ export interface HeroItemOptions<TExtra extends Record<string, unknown> = Record<string, never>> extends BriloBlockType {
42
44
  contentPositions?: OptionArray;
45
+ extraAttributes?: {
46
+ [K in keyof TExtra]: {
47
+ type: string;
48
+ default: TExtra[K];
49
+ };
50
+ };
51
+ extraControls?: (props: BlockEditProps<HeroItemAttributes & TExtra>) => ReactNode;
43
52
  }
44
53
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/hero/hero-item/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAE,KAAK,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AAC/D,OAAO,KAAK,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,aAAa,CAAA;AAElE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AACzE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;AAE1D,MAAM,MAAM,WAAW,GAAG;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,OAAO,CAAA;CACf,C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,CAAA;CAC/B;AAED,MAAM,WAAW,eAAe,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAE,SAAQ,cAAc;IACrH,gBAAgB,CAAC,EAAE,WAAW,CAAA;IAC9B,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,kBAAkB,GAAG,MAAM,CAAC,KAAK,SAAS,CAAA;CAClF"}
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/testimonial/testimonial-item/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAGzD,OAAO,KAAK,EAAC,yBAAyB,EAAE,sBAAsB,EAAC,MAAM,SAAS,CAAA;AAE9E,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,sBAAsB,GAAG;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAC,GACpD,kBAAkB,CAAC,yBAAyB,CAAC,CA2B/C"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/testimonial/testimonial-item/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAGzD,OAAO,KAAK,EAAC,yBAAyB,EAAE,sBAAsB,EAAC,MAAM,SAAS,CAAA;AAE9E,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,sBAAsB,GAAG;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAC,GACpD,kBAAkB,CAAC,yBAAyB,CAAC,CA4B/C"}
@@ -5,7 +5,8 @@ export function createTestimonialItemBlock(options) {
5
5
  return {
6
6
  name: options.name,
7
7
  title: (_a = options.title) !== null && _a !== void 0 ? _a : __('Reference - položka', 'brilo-blocks'),
8
- category: (_b = options.category) !== null && _b !== void 0 ? _b : 'brilo',
8
+ category: (_b = options.category) !== null && _b !== void 0 ? _b : 'layout',
9
+ ...(options.parent && { parent: options.parent }),
9
10
  supports: { html: false, customClassName: false },
10
11
  attributes: {
11
12
  title: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brilo/base-blocks",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "author": "Brilo",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -1,5 +1,5 @@
1
- import {RichText, useBlockProps, useInnerBlocksProps} from '@wordpress/block-editor'
2
- import {BaseControl} from '@wordpress/components'
1
+ import {InspectorControls, RichText, useBlockProps, useInnerBlocksProps} from '@wordpress/block-editor'
2
+ import {BaseControl, PanelBody, ToggleControl} from '@wordpress/components'
3
3
  import {Icon, chevronDown} from '@wordpress/icons'
4
4
  import {__} from '@wordpress/i18n'
5
5
  import clsx from 'clsx'
@@ -13,13 +13,22 @@ export function createAccordionItemEdit(_options: AccordionItemOptions) {
13
13
  attributes: AccordionItemAttributes
14
14
  setAttributes: (a: Partial<AccordionItemAttributes>) => void
15
15
  }) {
16
- const {title} = attributes
16
+ const {title, open} = attributes
17
17
 
18
18
  const blockProps = useBlockProps({className: clsx('accordion-item')})
19
19
  const innerBlocksProps = useInnerBlocksProps({})
20
20
 
21
21
  return (
22
22
  <>
23
+ <InspectorControls>
24
+ <PanelBody title={__('Nastavení', 'brilo-blocks')}>
25
+ <ToggleControl
26
+ label={__('Otevřeno ve výchozím stavu', 'brilo-blocks')}
27
+ checked={open}
28
+ onChange={(v) => setAttributes({open: v})}
29
+ />
30
+ </PanelBody>
31
+ </InspectorControls>
23
32
  <div {...blockProps}>
24
33
  <header className="accordion-item__header flex gap-2">
25
34
  <RichText
@@ -17,6 +17,7 @@ export function createAccordionItemBlock(options: AccordionItemOptions): BlockCo
17
17
  supports: {html: false, customClassName: false},
18
18
  attributes: {
19
19
  title: {type: 'string', default: ''},
20
+ open: {type: 'boolean', default: false},
20
21
  },
21
22
  edit: createAccordionItemEdit(options),
22
23
  save: () => <InnerBlocks.Content />,
@@ -2,6 +2,7 @@ import type {BriloBlockType} from '~/types'
2
2
 
3
3
  export interface AccordionItemAttributes extends Record<string, unknown> {
4
4
  title: string
5
+ open: boolean
5
6
  }
6
7
 
7
8
  export interface AccordionItemOptions extends BriloBlockType {}
@@ -77,4 +77,15 @@
77
77
  .i-button__label {
78
78
  pointer-events: auto;
79
79
  }
80
+
81
+ .i-button__icon .i-item-icon {
82
+ width: 100%;
83
+ height: auto;
84
+ background: none;
85
+
86
+ img {
87
+ width: 100%;
88
+ height: auto;
89
+ }
90
+ }
80
91
  }
@@ -20,6 +20,6 @@ export const contentGroupDefaults: ContentGroupOptions = {
20
20
  'core/embed',
21
21
  'core/video',
22
22
  'core/file',
23
- 'brilo/link',
23
+ 'brilo/link-item',
24
24
  ],
25
25
  }
@@ -1,4 +1,5 @@
1
1
  import {InspectorControls, RichText, useBlockProps, useInnerBlocksProps} from '@wordpress/block-editor'
2
+ import type {BlockEditProps} from '@wordpress/blocks'
2
3
  import {
3
4
  PanelBody,
4
5
  __experimentalToggleGroupControlOption as ToggleGroupControlOption,
@@ -18,13 +19,8 @@ import {useTenantColorPalette} from '~/hooks/useTenantColorPalette'
18
19
  import clsx from 'clsx'
19
20
 
20
21
  export function createHeroItemEdit(options: HeroItemOptions) {
21
- return function Edit({
22
- attributes,
23
- setAttributes,
24
- }: {
25
- attributes: HeroItemAttributes
26
- setAttributes: (a: Partial<HeroItemAttributes>) => void
27
- }) {
22
+ return function Edit(props: BlockEditProps<HeroItemAttributes>) {
23
+ const {attributes, setAttributes} = props
28
24
  const {title, titleColor, img, headingLevel, contentPosition, url, focalPoint, overline} = attributes
29
25
  const {paletteColors} = useTenantColorPalette()
30
26
 
@@ -110,6 +106,7 @@ export function createHeroItemEdit(options: HeroItemOptions) {
110
106
  onChange={(v) => setAttributes({url: {...url, blank: v}})}
111
107
  />
112
108
  </PanelBody>
109
+ {options.extraControls?.(props as unknown as Parameters<NonNullable<typeof options.extraControls>>[0])}
113
110
  </InspectorControls>
114
111
 
115
112
  <div {...blockProps}>
@@ -7,7 +7,9 @@ import {InnerBlocks} from '@wordpress/block-editor'
7
7
 
8
8
  export type {HeroItemAttributes, HeroItemOptions}
9
9
 
10
- export function createHeroItemBlock(options: HeroItemOptions): BlockConfiguration<HeroItemAttributes> {
10
+ export function createHeroItemBlock<TExtra extends Record<string, unknown> = Record<string, never>>(
11
+ options: HeroItemOptions<TExtra>,
12
+ ): BlockConfiguration<HeroItemAttributes & TExtra> {
11
13
  const contentPositions = options.contentPositions ?? CONTENT_POSITIONS
12
14
 
13
15
  return {
@@ -44,8 +46,9 @@ export function createHeroItemBlock(options: HeroItemOptions): BlockConfiguratio
44
46
  type: 'object',
45
47
  default: {point: 'center center', sm: {point: 'center center'}},
46
48
  },
49
+ ...options.extraAttributes,
47
50
  },
48
- edit: createHeroItemEdit(options),
51
+ edit: createHeroItemEdit(options as unknown as HeroItemOptions),
49
52
  save: () => <InnerBlocks.Content />,
50
- } as unknown as BlockConfiguration<HeroItemAttributes>
53
+ } as unknown as BlockConfiguration<HeroItemAttributes & TExtra>
51
54
  }
@@ -1,3 +1,5 @@
1
+ import type {BlockEditProps} from '@wordpress/blocks'
2
+ import type {ReactNode} from 'react'
1
3
  import type {BriloBlockType, Media, OptionArray} from '~/types'
2
4
  import type {CONTENT_POSITIONS, HEADING_LEVELS} from './constants'
3
5
 
@@ -36,6 +38,13 @@ export interface HeroItemAttributes extends Record<string, unknown> {
36
38
  focalPoint: HeroItemFocalPoint
37
39
  }
38
40
 
39
- export interface HeroItemOptions extends BriloBlockType {
41
+ export interface HeroItemOptions<TExtra extends Record<string, unknown> = Record<string, never>> extends BriloBlockType {
40
42
  contentPositions?: OptionArray
43
+ extraAttributes?: {
44
+ [K in keyof TExtra]: {
45
+ type: string
46
+ default: TExtra[K]
47
+ }
48
+ }
49
+ extraControls?: (props: BlockEditProps<HeroItemAttributes & TExtra>) => ReactNode
41
50
  }
@@ -9,7 +9,8 @@ export function createTestimonialItemBlock(
9
9
  return {
10
10
  name: options.name,
11
11
  title: options.title ?? __('Reference - položka', 'brilo-blocks'),
12
- category: options.category ?? 'brilo',
12
+ category: options.category ?? 'layout',
13
+ ...(options.parent && {parent: options.parent}),
13
14
  supports: {html: false, customClassName: false},
14
15
  attributes: {
15
16
  title: {