@brilo/base-blocks 0.1.11 → 0.1.13
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 +17 -0
- package/build/blocks/column/column-item/constants.d.ts.map +1 -1
- package/build/blocks/column/column-item/constants.js +23 -1
- package/build/blocks/column/column-item/edit.d.ts.map +1 -1
- package/build/blocks/column/column-item/edit.js +3 -3
- package/build/blocks/column/column-item/factory.d.ts.map +1 -1
- package/build/blocks/column/column-item/factory.js +4 -0
- package/build/blocks/column/column-item/index.d.ts.map +1 -1
- package/build/blocks/column/column-item/index.js +2 -0
- package/build/blocks/column/column-item/types.d.ts +1 -0
- package/build/blocks/column/column-item/types.d.ts.map +1 -1
- package/build/blocks/contact/contact-item/index.d.ts.map +1 -1
- package/build/blocks/contact/contact-item/index.js +1 -0
- package/build/blocks/form/form-field/constants.d.ts +20 -0
- package/build/blocks/form/form-field/constants.d.ts.map +1 -1
- package/build/blocks/form/form-field/constants.js +9 -0
- package/build/blocks/form/form-field/edit.d.ts +1 -1
- package/build/blocks/form/form-field/edit.d.ts.map +1 -1
- package/build/blocks/form/form-field/edit.js +2 -2
- package/build/blocks/form/form-field/factory.d.ts.map +1 -1
- package/build/blocks/form/form-field/factory.js +1 -0
- package/build/blocks/form/form-field/types.d.ts +3 -1
- package/build/blocks/form/form-field/types.d.ts.map +1 -1
- package/build/blocks/groups/button-group/index.d.ts.map +1 -1
- package/build/blocks/groups/button-group/index.js +0 -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/package.json +1 -1
- package/src/blocks/column/column-item/constants.ts +24 -1
- package/src/blocks/column/column-item/edit.tsx +14 -3
- package/src/blocks/column/column-item/factory.tsx +4 -0
- package/src/blocks/column/column-item/index.ts +2 -0
- package/src/blocks/column/column-item/types.ts +1 -0
- package/src/blocks/contact/contact-item/index.ts +1 -0
- package/src/blocks/form/form-field/constants.ts +10 -0
- package/src/blocks/form/form-field/edit.tsx +13 -2
- package/src/blocks/form/form-field/factory.tsx +1 -0
- package/src/blocks/form/form-field/types.ts +3 -1
- package/src/blocks/groups/button-group/index.ts +0 -1
- 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
|
@@ -12,4 +12,21 @@ export declare const ALIGN: ({
|
|
|
12
12
|
label: import("@wordpress/i18n").TransformedText<"Dolu">;
|
|
13
13
|
icon: import("react").JSX.Element;
|
|
14
14
|
})[];
|
|
15
|
+
export declare const JUSTIFY: ({
|
|
16
|
+
value: string;
|
|
17
|
+
label: import("@wordpress/i18n").TransformedText<"Roztáhnout">;
|
|
18
|
+
icon: import("react").JSX.Element;
|
|
19
|
+
} | {
|
|
20
|
+
value: string;
|
|
21
|
+
label: import("@wordpress/i18n").TransformedText<"Vlevo">;
|
|
22
|
+
icon: import("react").JSX.Element;
|
|
23
|
+
} | {
|
|
24
|
+
value: string;
|
|
25
|
+
label: import("@wordpress/i18n").TransformedText<"Uprostřed">;
|
|
26
|
+
icon: import("react").JSX.Element;
|
|
27
|
+
} | {
|
|
28
|
+
value: string;
|
|
29
|
+
label: import("@wordpress/i18n").TransformedText<"Vpravo">;
|
|
30
|
+
icon: import("react").JSX.Element;
|
|
31
|
+
})[];
|
|
15
32
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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
|
+
{"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;AAED,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;IAqBnB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
|
-
import { justifyTop, justifyCenterVertical, justifyBottom } from '@wordpress/icons';
|
|
2
|
+
import { justifyTop, justifyCenterVertical, justifyBottom, justifyStretch, justifyLeft, justifyRight, justifyCenter } from '@wordpress/icons';
|
|
3
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
|
{
|
|
@@ -18,3 +18,25 @@ export const ALIGN = [
|
|
|
18
18
|
icon: justifyBottom,
|
|
19
19
|
},
|
|
20
20
|
];
|
|
21
|
+
export const JUSTIFY = [
|
|
22
|
+
{
|
|
23
|
+
value: 'stretch',
|
|
24
|
+
label: __('Roztáhnout', 'brilo-blocks'),
|
|
25
|
+
icon: justifyStretch,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
value: 'start',
|
|
29
|
+
label: __('Vlevo', 'brilo-blocks'),
|
|
30
|
+
icon: justifyLeft,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
value: 'center',
|
|
34
|
+
label: __('Uprostřed', 'brilo-blocks'),
|
|
35
|
+
icon: justifyCenter,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
value: 'end',
|
|
39
|
+
label: __('Vpravo', 'brilo-blocks'),
|
|
40
|
+
icon: justifyRight,
|
|
41
|
+
},
|
|
42
|
+
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/edit.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAIpE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,iBAAiB,IACxC,gCAGlB;IACD,UAAU,EAAE,oBAAoB,CAAA;IAChC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAA;CAC1D,
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/edit.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAIpE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,iBAAiB,IACxC,gCAGlB;IACD,UAAU,EAAE,oBAAoB,CAAA;IAChC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAA;CAC1D,iCAqDF"}
|
|
@@ -4,11 +4,11 @@ import { PanelBody, RangeControl, __experimentalToggleGroupControl as ToggleGrou
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { useGroupBlock } from '../../../hooks/useGroupBlock';
|
|
7
|
-
import { ALIGN, SIZES } from './constants';
|
|
7
|
+
import { ALIGN, JUSTIFY, SIZES } from './constants';
|
|
8
8
|
export function createColumnItemEdit(options) {
|
|
9
9
|
return function Edit({ attributes, setAttributes, }) {
|
|
10
10
|
var _a, _b;
|
|
11
|
-
const { size, align } = attributes;
|
|
11
|
+
const { size, align, justify } = attributes;
|
|
12
12
|
const { blockProps, innerBlocksProps } = useGroupBlock({
|
|
13
13
|
blockClassName: clsx((_a = options.blockClassName) !== null && _a !== void 0 ? _a : 'i-column', `--size-${size}`, align && `--align-${align}`),
|
|
14
14
|
containerClassName: (_b = options.containerClassName) !== null && _b !== void 0 ? _b : 'i-column__inner',
|
|
@@ -16,6 +16,6 @@ export function createColumnItemEdit(options) {
|
|
|
16
16
|
template: options.template,
|
|
17
17
|
});
|
|
18
18
|
const sizeIndex = SIZES.indexOf(size);
|
|
19
|
-
return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsxs(PanelBody, { title: __('Nastavení položky sloupce', 'brilo-blocks'), children: [_jsx(RangeControl, { label: __('Šířka sloupce', 'brilo-blocks'), value: sizeIndex, onChange: (v) => setAttributes({ size: SIZES[v] }), min: 0, max: SIZES.length - 1, withInputField: false, marks: SIZES.map((s, i) => ({ label: s, value: i })) }), _jsx(ToggleGroupControl, { label: __('
|
|
19
|
+
return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsxs(PanelBody, { title: __('Nastavení položky sloupce', 'brilo-blocks'), children: [_jsx(RangeControl, { label: __('Šířka sloupce', 'brilo-blocks'), value: sizeIndex, onChange: (v) => setAttributes({ size: SIZES[v] }), min: 0, max: SIZES.length - 1, withInputField: false, marks: SIZES.map((s, i) => ({ label: s, value: i })) }), _jsx(ToggleGroupControl, { label: __('Vertikální zarovnání', 'brilo-blocks'), value: align, onChange: (v) => setAttributes({ align: v }), isBlock: true, children: ALIGN.map((item) => (_jsx(ToggleGroupControlOptionIcon, { value: item.value, label: item.label, icon: item.icon }, item.value))) }), _jsx(ToggleGroupControl, { label: __('Horizontální zarovnání', 'brilo-blocks'), value: justify, onChange: (v) => setAttributes({ justify: v }), isBlock: true, children: JUSTIFY.map((item) => (_jsx(ToggleGroupControlOptionIcon, { value: item.value, label: item.label, icon: item.icon }, item.value))) })] }) }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
|
|
20
20
|
};
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAGzD,OAAO,KAAK,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAGpE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,iBAAiB,GAAG,kBAAkB,CAAC,oBAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAGzD,OAAO,KAAK,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAGpE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,iBAAiB,GAAG,kBAAkB,CAAC,oBAAoB,CAAC,CA0B1G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAA;AACpE,OAAO,EAAC,qBAAqB,EAAC,MAAM,WAAW,CAAA;AAE/C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAE9C,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAA;AACpE,OAAO,EAAC,qBAAqB,EAAC,MAAM,WAAW,CAAA;AAE/C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAE9C,eAAO,MAAM,kBAAkB,EAAE,iBAgBhC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,WAAW,oBAAqB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACnE,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,WAAW,oBAAqB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACnE,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,iBAAkB,SAAQ,cAAc;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/contact/contact-item/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,eAAe,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAC/G,OAAO,EAAC,sBAAsB,EAAC,MAAM,WAAW,CAAA;AAChD,OAAO,EAAC,uBAAuB,EAAE,kBAAkB,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAA;AAE3F,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAE/C,eAAO,MAAM,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/contact/contact-item/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,eAAe,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAC/G,OAAO,EAAC,sBAAsB,EAAC,MAAM,WAAW,CAAA;AAChD,OAAO,EAAC,uBAAuB,EAAE,kBAAkB,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAA;AAE3F,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAE/C,eAAO,MAAM,mBAAmB,EAAE,kBAiBjC,CAAA"}
|
|
@@ -12,6 +12,26 @@ export declare const FIELD_TYPES: readonly [{
|
|
|
12
12
|
readonly value: "hidden";
|
|
13
13
|
readonly label: import("@wordpress/i18n").TransformedText<"Hidden">;
|
|
14
14
|
}];
|
|
15
|
+
export declare const FIELD_TEXT_TYPE_VALUES: readonly ["text", "tel", "email", "number", "date", "time"];
|
|
16
|
+
export declare const FIELD_TEXT_TYPES: ({
|
|
17
|
+
value: "text";
|
|
18
|
+
label: import("@wordpress/i18n").TransformedText<"Text">;
|
|
19
|
+
} | {
|
|
20
|
+
value: "tel";
|
|
21
|
+
label: import("@wordpress/i18n").TransformedText<"Telefon">;
|
|
22
|
+
} | {
|
|
23
|
+
value: "email";
|
|
24
|
+
label: import("@wordpress/i18n").TransformedText<"Email">;
|
|
25
|
+
} | {
|
|
26
|
+
value: "number";
|
|
27
|
+
label: import("@wordpress/i18n").TransformedText<"Číslo">;
|
|
28
|
+
} | {
|
|
29
|
+
value: "date";
|
|
30
|
+
label: import("@wordpress/i18n").TransformedText<"Datum">;
|
|
31
|
+
} | {
|
|
32
|
+
value: "time";
|
|
33
|
+
label: import("@wordpress/i18n").TransformedText<"Čas">;
|
|
34
|
+
})[];
|
|
15
35
|
export declare const FIELD_COLUMNS_RANGE: {
|
|
16
36
|
readonly min: 1;
|
|
17
37
|
readonly max: 12;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,mDAAoD,CAAA;AAElF,eAAO,MAAM,WAAW;;;;;;;;;;;;EAKd,CAAA;AAEV,eAAO,MAAM,mBAAmB;;;CAA6B,CAAA;AAE7D,eAAO,MAAM,qBAAqB,IAAI,CAAA"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,mDAAoD,CAAA;AAElF,eAAO,MAAM,WAAW;;;;;;;;;;;;EAKd,CAAA;AAEV,eAAO,MAAM,sBAAsB,6DAA8D,CAAA;AACjG,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;IAO5B,CAAA;AAED,eAAO,MAAM,mBAAmB;;;CAA6B,CAAA;AAE7D,eAAO,MAAM,qBAAqB,IAAI,CAAA"}
|
|
@@ -6,5 +6,14 @@ export const FIELD_TYPES = [
|
|
|
6
6
|
{ value: FIELD_TYPE_VALUES[2], label: __('Select', 'brilo-blocks') },
|
|
7
7
|
{ value: FIELD_TYPE_VALUES[3], label: __('Hidden', 'brilo-blocks') },
|
|
8
8
|
];
|
|
9
|
+
export const FIELD_TEXT_TYPE_VALUES = ['text', 'tel', 'email', 'number', 'date', 'time'];
|
|
10
|
+
export const FIELD_TEXT_TYPES = [
|
|
11
|
+
{ value: FIELD_TEXT_TYPE_VALUES[0], label: __('Text', 'brilo-blocks') },
|
|
12
|
+
{ value: FIELD_TEXT_TYPE_VALUES[1], label: __('Telefon', 'brilo-blocks') },
|
|
13
|
+
{ value: FIELD_TEXT_TYPE_VALUES[2], label: __('Email', 'brilo-blocks') },
|
|
14
|
+
{ value: FIELD_TEXT_TYPE_VALUES[3], label: __('Číslo', 'brilo-blocks') },
|
|
15
|
+
{ value: FIELD_TEXT_TYPE_VALUES[4], label: __('Datum', 'brilo-blocks') },
|
|
16
|
+
{ value: FIELD_TEXT_TYPE_VALUES[5], label: __('Čas', 'brilo-blocks') },
|
|
17
|
+
];
|
|
9
18
|
export const FIELD_COLUMNS_RANGE = { min: 1, max: 12 };
|
|
10
19
|
export const FIELD_COLUMNS_DEFAULT = 6;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FormFieldAttributes, FormFieldOptions } from './types';
|
|
2
2
|
export declare function createFormFieldEdit(_options: FormFieldOptions): ({ attributes, setAttributes, }: {
|
|
3
3
|
attributes: FormFieldAttributes;
|
|
4
4
|
setAttributes: (a: Partial<FormFieldAttributes>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/edit.tsx"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/edit.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAC,mBAAmB,EAAE,gBAAgB,EAAmC,MAAM,SAAS,CAAA;AAe/F,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,IACvC,gCAGlB;IACD,UAAU,EAAE,mBAAmB,CAAA;IAC/B,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAA;CACzD,iCAiKF"}
|
|
@@ -3,7 +3,7 @@ import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
|
|
|
3
3
|
import { Button, FormTokenField, PanelBody, RangeControl, SelectControl, TextControl, ToggleControl } from '@wordpress/components';
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import { FIELD_COLUMNS_DEFAULT, FIELD_COLUMNS_RANGE, FIELD_TYPES } from './constants';
|
|
6
|
+
import { FIELD_COLUMNS_DEFAULT, FIELD_COLUMNS_RANGE, FIELD_TEXT_TYPES, FIELD_TYPES } from './constants';
|
|
7
7
|
const { min: MIN_COLUMNS, max: MAX_COLUMNS } = FIELD_COLUMNS_RANGE;
|
|
8
8
|
function sanitizeHtmlName(raw) {
|
|
9
9
|
return (raw !== null && raw !== void 0 ? raw : '')
|
|
@@ -24,7 +24,7 @@ export function createFormFieldEdit(_options) {
|
|
|
24
24
|
});
|
|
25
25
|
const options = Array.isArray(attributes.options) ? attributes.options.filter((opt) => typeof opt === 'string') : [];
|
|
26
26
|
const selectOptions = [{ label: __('Žádná', 'brilo-blocks'), value: '' }, ...options.map((opt) => ({ label: opt, value: opt }))];
|
|
27
|
-
return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsxs(PanelBody, { title: __('Pole formuláře', 'brilo-blocks'), children: [_jsx(SelectControl, { label: __('Typ inputu', 'brilo-blocks'), value: attributes.type, options: FIELD_TYPES.map((t) => ({ label: t.label, value: t.value })), onChange: (type) => setAttributes({ type: type }) }), attributes.type !== 'hidden' && (_jsxs(_Fragment, { children: [_jsx(TextControl, { label: __('Popisek', 'brilo-blocks'), value: attributes.label, onChange: (label) => setAttributes({ label }) }), _jsx(ToggleControl, { label: __('Povinné', 'brilo-blocks'), checked: attributes.required, onChange: (required) => setAttributes({ required }) }), _jsx(TextControl, { label: __('Název html atributu', 'brilo-blocks'), value: attributes.name, help: __('Použijte pouze bezpečné znaky: a-z, 0-9, pomlčka a podtržítko. Např. city-born-to. Mezery a diakritika se automaticky odstraní.', 'brilo-blocks'), onChange: (name) => setAttributes({ name: sanitizeHtmlName(name) }) }), _jsx(TextControl, { label: __('Placeholder', 'brilo-blocks'), value: attributes.placeholder, onChange: (placeholder) => setAttributes({ placeholder }) })] })), attributes.type === 'select' && (_jsxs(_Fragment, { children: [_jsx(FormTokenField, { label: __('Možnosti', 'brilo-blocks'), value: options, onChange: (nextOptions) => setAttributes({
|
|
27
|
+
return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsxs(PanelBody, { title: __('Pole formuláře', 'brilo-blocks'), children: [_jsx(SelectControl, { label: __('Typ inputu', 'brilo-blocks'), value: attributes.type, options: FIELD_TYPES.map((t) => ({ label: t.label, value: t.value })), onChange: (type) => setAttributes({ type: type }) }), attributes.type === 'text' && (_jsx(_Fragment, { children: _jsx(SelectControl, { label: __('Typ textovho inputu', 'brilo-blocks'), value: attributes.textType, options: FIELD_TEXT_TYPES.map((t) => ({ label: t.label, value: t.value })), onChange: (fieldType) => setAttributes({ textType: fieldType }) }) })), attributes.type !== 'hidden' && (_jsxs(_Fragment, { children: [_jsx(TextControl, { label: __('Popisek', 'brilo-blocks'), value: attributes.label, onChange: (label) => setAttributes({ label }) }), _jsx(ToggleControl, { label: __('Povinné', 'brilo-blocks'), checked: attributes.required, onChange: (required) => setAttributes({ required }) }), _jsx(TextControl, { label: __('Název html atributu', 'brilo-blocks'), value: attributes.name, help: __('Použijte pouze bezpečné znaky: a-z, 0-9, pomlčka a podtržítko. Např. city-born-to. Mezery a diakritika se automaticky odstraní.', 'brilo-blocks'), onChange: (name) => setAttributes({ name: sanitizeHtmlName(name) }) }), _jsx(TextControl, { label: __('Placeholder', 'brilo-blocks'), value: attributes.placeholder, onChange: (placeholder) => setAttributes({ placeholder }) })] })), attributes.type === 'select' && (_jsxs(_Fragment, { children: [_jsx(FormTokenField, { label: __('Možnosti', 'brilo-blocks'), value: options, onChange: (nextOptions) => setAttributes({
|
|
28
28
|
options: (nextOptions !== null && nextOptions !== void 0 ? nextOptions : [])
|
|
29
29
|
.map((opt) => (typeof opt === 'string' ? opt : opt.value))
|
|
30
30
|
.filter((opt) => typeof opt === 'string' && opt.length > 0),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAIzD,OAAO,KAAK,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAA;AAElE,YAAY,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,CAAA;AAEnD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAIzD,OAAO,KAAK,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAA;AAElE,YAAY,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,CAAA;AAEnD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CAwBvG"}
|
|
@@ -13,6 +13,7 @@ export function createFormFieldBlock(options) {
|
|
|
13
13
|
supports: { html: false, customClassName: false, reusable: false },
|
|
14
14
|
attributes: {
|
|
15
15
|
type: { type: 'string', default: 'text' },
|
|
16
|
+
textType: { type: 'string', default: 'text' },
|
|
16
17
|
columns: { type: 'number', default: FIELD_COLUMNS_DEFAULT },
|
|
17
18
|
label: { type: 'string', default: '' },
|
|
18
19
|
name: { type: 'string', default: '' },
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { FIELD_TYPE_VALUES } from './constants';
|
|
1
|
+
import { FIELD_TEXT_TYPE_VALUES, FIELD_TYPE_VALUES } from './constants';
|
|
2
2
|
import type { BriloBlockType } from '../../../types';
|
|
3
3
|
export type FormFieldType = (typeof FIELD_TYPE_VALUES)[number];
|
|
4
|
+
export type FormFieldTextType = (typeof FIELD_TEXT_TYPE_VALUES)[number];
|
|
4
5
|
export interface FormFieldAttributes extends Record<string, unknown> {
|
|
5
6
|
type: FormFieldType;
|
|
7
|
+
textType: FormFieldTextType;
|
|
6
8
|
columns: number;
|
|
7
9
|
label: string;
|
|
8
10
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/types.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,sBAAsB,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAA;AACvF,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvE,MAAM,WAAW,mBAAoB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAClE,IAAI,EAAE,aAAa,CAAA;IACnB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/groups/button-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AACtE,OAAO,EAAC,sBAAsB,EAAC,MAAM,WAAW,CAAA;AAEhD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAE/C,eAAO,MAAM,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/groups/button-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AACtE,OAAO,EAAC,sBAAsB,EAAC,MAAM,WAAW,CAAA;AAEhD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAE/C,eAAO,MAAM,mBAAmB,EAAE,kBAIjC,CAAA"}
|
|
@@ -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.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AACxD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,aAAa,CAAA;AAElD,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AACxD,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAEtD,MAAM,WAAW,mBAAmB,CAAC,QAAQ,SAAS,MAAM,GAAG,OAAO,EAAE,OAAO,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACtI,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,OAAO,EAAE,QAAQ,CAAA;IACjB,QAAQ,EAAE,OAAO,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,gBAAgB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/hero/hero-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAA;AACpC,OAAO,KAAK,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AACxD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,aAAa,CAAA;AAElD,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AACxD,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAEtD,MAAM,WAAW,mBAAmB,CAAC,QAAQ,SAAS,MAAM,GAAG,OAAO,EAAE,OAAO,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACtI,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,OAAO,EAAE,QAAQ,CAAA;IACjB,QAAQ,EAAE,OAAO,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,gBAAgB,CAC/B,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,CAC9D,SAAQ,cAAc;IACtB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,OAAO,CAAC,EAAE,QAAQ,CAAA;IAClB,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,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,SAAS,CAAA;CAC1I"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {__} from '@wordpress/i18n'
|
|
2
|
-
import {justifyTop, justifyCenterVertical, justifyBottom} from '@wordpress/icons'
|
|
2
|
+
import {justifyTop, justifyCenterVertical, justifyBottom, justifyStretch, justifyLeft, justifyRight, justifyCenter} from '@wordpress/icons'
|
|
3
3
|
|
|
4
4
|
export const SIZES = ['1/6', '1/4', '1/3', '1/2', '2/3', '3/4', '1/1']
|
|
5
5
|
export const ALIGN = [
|
|
@@ -19,3 +19,26 @@ export const ALIGN = [
|
|
|
19
19
|
icon: justifyBottom,
|
|
20
20
|
},
|
|
21
21
|
]
|
|
22
|
+
|
|
23
|
+
export const JUSTIFY = [
|
|
24
|
+
{
|
|
25
|
+
value: 'stretch',
|
|
26
|
+
label: __('Roztáhnout', 'brilo-blocks'),
|
|
27
|
+
icon: justifyStretch,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: 'start',
|
|
31
|
+
label: __('Vlevo', 'brilo-blocks'),
|
|
32
|
+
icon: justifyLeft,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: 'center',
|
|
36
|
+
label: __('Uprostřed', 'brilo-blocks'),
|
|
37
|
+
icon: justifyCenter,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
value: 'end',
|
|
41
|
+
label: __('Vpravo', 'brilo-blocks'),
|
|
42
|
+
icon: justifyRight,
|
|
43
|
+
},
|
|
44
|
+
]
|
|
@@ -9,7 +9,7 @@ import {__} from '@wordpress/i18n'
|
|
|
9
9
|
import clsx from 'clsx'
|
|
10
10
|
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
11
11
|
import type {ColumnItemAttributes, ColumnItemOptions} from './types'
|
|
12
|
-
import {ALIGN, SIZES} from './constants'
|
|
12
|
+
import {ALIGN, JUSTIFY, SIZES} from './constants'
|
|
13
13
|
import {Icon} from '@wordpress/icons'
|
|
14
14
|
|
|
15
15
|
export function createColumnItemEdit(options: ColumnItemOptions) {
|
|
@@ -20,7 +20,7 @@ export function createColumnItemEdit(options: ColumnItemOptions) {
|
|
|
20
20
|
attributes: ColumnItemAttributes
|
|
21
21
|
setAttributes: (a: Partial<ColumnItemAttributes>) => void
|
|
22
22
|
}) {
|
|
23
|
-
const {size, align} = attributes
|
|
23
|
+
const {size, align, justify} = attributes
|
|
24
24
|
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
25
25
|
blockClassName: clsx(options.blockClassName ?? 'i-column', `--size-${size}`, align && `--align-${align}`),
|
|
26
26
|
containerClassName: options.containerClassName ?? 'i-column__inner',
|
|
@@ -44,7 +44,7 @@ export function createColumnItemEdit(options: ColumnItemOptions) {
|
|
|
44
44
|
marks={SIZES.map((s, i) => ({label: s, value: i}))}
|
|
45
45
|
/>
|
|
46
46
|
<ToggleGroupControl
|
|
47
|
-
label={__('
|
|
47
|
+
label={__('Vertikální zarovnání', 'brilo-blocks')}
|
|
48
48
|
value={align}
|
|
49
49
|
onChange={(v) => setAttributes({align: v as string})}
|
|
50
50
|
isBlock
|
|
@@ -53,6 +53,17 @@ export function createColumnItemEdit(options: ColumnItemOptions) {
|
|
|
53
53
|
<ToggleGroupControlOptionIcon key={item.value} value={item.value} label={item.label} icon={item.icon} />
|
|
54
54
|
))}
|
|
55
55
|
</ToggleGroupControl>
|
|
56
|
+
|
|
57
|
+
<ToggleGroupControl
|
|
58
|
+
label={__('Horizontální zarovnání', 'brilo-blocks')}
|
|
59
|
+
value={justify}
|
|
60
|
+
onChange={(v) => setAttributes({justify: v as string})}
|
|
61
|
+
isBlock
|
|
62
|
+
>
|
|
63
|
+
{JUSTIFY.map((item) => (
|
|
64
|
+
<ToggleGroupControlOptionIcon key={item.value} value={item.value} label={item.label} icon={item.icon} />
|
|
65
|
+
))}
|
|
66
|
+
</ToggleGroupControl>
|
|
56
67
|
</PanelBody>
|
|
57
68
|
</InspectorControls>
|
|
58
69
|
<div {...blockProps}>
|
|
@@ -23,6 +23,10 @@ export function createColumnItemBlock(options: ColumnItemOptions): BlockConfigur
|
|
|
23
23
|
type: 'string',
|
|
24
24
|
default: ALIGN[0],
|
|
25
25
|
},
|
|
26
|
+
justify: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
default: 'stretch',
|
|
29
|
+
}
|
|
26
30
|
},
|
|
27
31
|
edit: createColumnItemEdit(options),
|
|
28
32
|
save: () => <InnerBlocks.Content />,
|
|
@@ -9,6 +9,16 @@ export const FIELD_TYPES = [
|
|
|
9
9
|
{value: FIELD_TYPE_VALUES[3], label: __('Hidden', 'brilo-blocks')},
|
|
10
10
|
] as const
|
|
11
11
|
|
|
12
|
+
export const FIELD_TEXT_TYPE_VALUES = ['text', 'tel', 'email', 'number', 'date', 'time'] as const
|
|
13
|
+
export const FIELD_TEXT_TYPES = [
|
|
14
|
+
{value: FIELD_TEXT_TYPE_VALUES[0], label: __('Text', 'brilo-blocks')},
|
|
15
|
+
{value: FIELD_TEXT_TYPE_VALUES[1], label: __('Telefon', 'brilo-blocks')},
|
|
16
|
+
{value: FIELD_TEXT_TYPE_VALUES[2], label: __('Email', 'brilo-blocks')},
|
|
17
|
+
{value: FIELD_TEXT_TYPE_VALUES[3], label: __('Číslo', 'brilo-blocks')},
|
|
18
|
+
{value: FIELD_TEXT_TYPE_VALUES[4], label: __('Datum', 'brilo-blocks')},
|
|
19
|
+
{value: FIELD_TEXT_TYPE_VALUES[5], label: __('Čas', 'brilo-blocks')},
|
|
20
|
+
]
|
|
21
|
+
|
|
12
22
|
export const FIELD_COLUMNS_RANGE = {min: 1, max: 12} as const
|
|
13
23
|
|
|
14
24
|
export const FIELD_COLUMNS_DEFAULT = 6
|
|
@@ -2,8 +2,8 @@ import {InspectorControls, useBlockProps} from '@wordpress/block-editor'
|
|
|
2
2
|
import {Button, FormTokenField, PanelBody, RangeControl, SelectControl, TextControl, ToggleControl} from '@wordpress/components'
|
|
3
3
|
import {__} from '@wordpress/i18n'
|
|
4
4
|
import clsx from 'clsx'
|
|
5
|
-
import {FIELD_COLUMNS_DEFAULT, FIELD_COLUMNS_RANGE, FIELD_TYPES} from './constants'
|
|
6
|
-
import
|
|
5
|
+
import {FIELD_COLUMNS_DEFAULT, FIELD_COLUMNS_RANGE, FIELD_TEXT_TYPES, FIELD_TYPES} from './constants'
|
|
6
|
+
import {FormFieldAttributes, FormFieldOptions, FormFieldTextType, FormFieldType} from './types'
|
|
7
7
|
|
|
8
8
|
const {min: MIN_COLUMNS, max: MAX_COLUMNS} = FIELD_COLUMNS_RANGE
|
|
9
9
|
|
|
@@ -47,6 +47,17 @@ export function createFormFieldEdit(_options: FormFieldOptions) {
|
|
|
47
47
|
onChange={(type) => setAttributes({type: type as FormFieldType})}
|
|
48
48
|
/>
|
|
49
49
|
|
|
50
|
+
{attributes.type === 'text' && (
|
|
51
|
+
<>
|
|
52
|
+
<SelectControl
|
|
53
|
+
label={__('Typ textovho inputu', 'brilo-blocks')}
|
|
54
|
+
value={attributes.textType}
|
|
55
|
+
options={FIELD_TEXT_TYPES.map((t) => ({label: t.label, value: t.value}))}
|
|
56
|
+
onChange={(fieldType) => setAttributes({textType: fieldType as FormFieldTextType})}
|
|
57
|
+
/>
|
|
58
|
+
</>
|
|
59
|
+
)}
|
|
60
|
+
|
|
50
61
|
{attributes.type !== 'hidden' && (
|
|
51
62
|
<>
|
|
52
63
|
<TextControl label={__('Popisek', 'brilo-blocks')} value={attributes.label} onChange={(label) => setAttributes({label})} />
|
|
@@ -17,6 +17,7 @@ export function createFormFieldBlock(options: FormFieldOptions): BlockConfigurat
|
|
|
17
17
|
supports: {html: false, customClassName: false, reusable: false},
|
|
18
18
|
attributes: {
|
|
19
19
|
type: {type: 'string', default: 'text'},
|
|
20
|
+
textType: {type: 'string', default: 'text'},
|
|
20
21
|
columns: {type: 'number', default: FIELD_COLUMNS_DEFAULT},
|
|
21
22
|
label: {type: 'string', default: ''},
|
|
22
23
|
name: {type: 'string', default: ''},
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {FIELD_TYPE_VALUES} from './constants'
|
|
1
|
+
import {FIELD_TEXT_TYPES, FIELD_TEXT_TYPE_VALUES, FIELD_TYPE_VALUES} from './constants'
|
|
2
2
|
import type {BriloBlockType} from '~/types'
|
|
3
3
|
|
|
4
4
|
export type FormFieldType = (typeof FIELD_TYPE_VALUES)[number]
|
|
5
|
+
export type FormFieldTextType = (typeof FIELD_TEXT_TYPE_VALUES)[number]
|
|
5
6
|
|
|
6
7
|
export interface FormFieldAttributes extends Record<string, unknown> {
|
|
7
8
|
type: FormFieldType
|
|
9
|
+
textType: FormFieldTextType
|
|
8
10
|
columns: number
|
|
9
11
|
label: string
|
|
10
12
|
name: string
|
|
@@ -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
|
}
|