@brilo/base-blocks 0.1.12 → 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/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
|
@@ -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"}
|
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
|