@brilo/base-blocks 0.1.39 → 0.1.41

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 (80) hide show
  1. package/build/.tsbuildinfo +1 -1
  2. package/build/blocks/career/career-benefits/constants.d.ts +17 -0
  3. package/build/blocks/career/career-benefits/constants.d.ts.map +1 -0
  4. package/build/blocks/career/career-benefits/constants.js +7 -0
  5. package/build/blocks/career/career-benefits/edit.d.ts +6 -0
  6. package/build/blocks/career/career-benefits/edit.d.ts.map +1 -0
  7. package/build/blocks/career/career-benefits/edit.js +14 -0
  8. package/build/blocks/career/career-benefits/factory.d.ts +5 -0
  9. package/build/blocks/career/career-benefits/factory.d.ts.map +1 -0
  10. package/build/blocks/career/career-benefits/factory.js +22 -0
  11. package/build/blocks/career/career-benefits/icon.d.ts +2 -0
  12. package/build/blocks/career/career-benefits/icon.d.ts.map +1 -0
  13. package/build/blocks/career/career-benefits/icon.js +2 -0
  14. package/build/blocks/career/career-benefits/index.d.ts +5 -0
  15. package/build/blocks/career/career-benefits/index.d.ts.map +1 -0
  16. package/build/blocks/career/career-benefits/index.js +5 -0
  17. package/build/blocks/career/career-benefits/types.d.ts +8 -0
  18. package/build/blocks/career/career-benefits/types.d.ts.map +1 -0
  19. package/build/blocks/career/career-benefits/types.js +1 -0
  20. package/build/blocks/career/career-header/constants.d.ts +16 -0
  21. package/build/blocks/career/career-header/constants.d.ts.map +1 -1
  22. package/build/blocks/career/career-header/constants.js +7 -0
  23. package/build/blocks/career/career-header/edit.d.ts.map +1 -1
  24. package/build/blocks/career/career-header/edit.js +7 -5
  25. package/build/blocks/career/career-header/factory.d.ts.map +1 -1
  26. package/build/blocks/career/career-header/factory.js +2 -0
  27. package/build/blocks/career/career-header/types.d.ts +2 -0
  28. package/build/blocks/career/career-header/types.d.ts.map +1 -1
  29. package/build/blocks/form/form-field/constants.d.ts +33 -1
  30. package/build/blocks/form/form-field/constants.d.ts.map +1 -1
  31. package/build/blocks/form/form-field/constants.js +17 -1
  32. package/build/blocks/form/form-field/edit.d.ts.map +1 -1
  33. package/build/blocks/form/form-field/edit.js +10 -4
  34. package/build/blocks/form/form-field/factory.d.ts.map +1 -1
  35. package/build/blocks/form/form-field/factory.js +7 -1
  36. package/build/blocks/form/form-field/types.d.ts +8 -1
  37. package/build/blocks/form/form-field/types.d.ts.map +1 -1
  38. package/build/blocks/layout/box/controls.d.ts +8 -0
  39. package/build/blocks/layout/box/controls.d.ts.map +1 -0
  40. package/build/blocks/layout/box/controls.js +13 -0
  41. package/build/blocks/layout/box/edit.d.ts +4 -0
  42. package/build/blocks/layout/box/edit.d.ts.map +1 -0
  43. package/build/blocks/layout/box/edit.js +35 -0
  44. package/build/blocks/layout/box/factory.d.ts +4 -0
  45. package/build/blocks/layout/box/factory.d.ts.map +1 -0
  46. package/build/blocks/layout/box/factory.js +28 -0
  47. package/build/blocks/layout/box/icon.d.ts +2 -0
  48. package/build/blocks/layout/box/icon.d.ts.map +1 -0
  49. package/build/blocks/layout/box/icon.js +2 -0
  50. package/build/blocks/layout/box/index.d.ts +5 -0
  51. package/build/blocks/layout/box/index.d.ts.map +1 -0
  52. package/build/blocks/layout/box/index.js +6 -0
  53. package/build/blocks/layout/box/types.d.ts +25 -0
  54. package/build/blocks/layout/box/types.d.ts.map +1 -0
  55. package/build/blocks/layout/box/types.js +1 -0
  56. package/build/index.d.ts +4 -0
  57. package/build/index.d.ts.map +1 -1
  58. package/build/index.js +2 -0
  59. package/package.json +1 -1
  60. package/src/blocks/career/career-benefits/constants.ts +7 -0
  61. package/src/blocks/career/career-benefits/edit.tsx +55 -0
  62. package/src/blocks/career/career-benefits/factory.tsx +26 -0
  63. package/src/blocks/career/career-benefits/icon.tsx +10 -0
  64. package/src/blocks/career/career-benefits/index.ts +9 -0
  65. package/src/blocks/career/career-benefits/types.ts +9 -0
  66. package/src/blocks/career/career-header/constants.ts +8 -0
  67. package/src/blocks/career/career-header/edit.tsx +21 -4
  68. package/src/blocks/career/career-header/factory.tsx +2 -0
  69. package/src/blocks/career/career-header/types.ts +2 -0
  70. package/src/blocks/form/form-field/constants.ts +22 -1
  71. package/src/blocks/form/form-field/edit.tsx +80 -13
  72. package/src/blocks/form/form-field/factory.tsx +7 -1
  73. package/src/blocks/form/form-field/types.ts +14 -1
  74. package/src/blocks/layout/box/controls.tsx +64 -0
  75. package/src/blocks/layout/box/edit.tsx +52 -0
  76. package/src/blocks/layout/box/factory.tsx +31 -0
  77. package/src/blocks/layout/box/icon.tsx +5 -0
  78. package/src/blocks/layout/box/index.ts +10 -0
  79. package/src/blocks/layout/box/types.ts +27 -0
  80. package/src/index.ts +4 -0
@@ -0,0 +1,17 @@
1
+ export declare const TITLE_STYLES: readonly [{
2
+ readonly value: 'h1';
3
+ readonly label: 'H1';
4
+ }, {
5
+ readonly value: 'h2';
6
+ readonly label: 'H2';
7
+ }, {
8
+ readonly value: 'h3';
9
+ readonly label: 'H3';
10
+ }, {
11
+ readonly value: 'h4';
12
+ readonly label: 'H4';
13
+ }, {
14
+ readonly value: 'h5';
15
+ readonly label: 'H5';
16
+ }];
17
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-benefits/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;aACtB,KAAK,EAAE,IAAI;aAAE,KAAK,EAAE,IAAI;;aACxB,KAAK,EAAE,IAAI;aAAE,KAAK,EAAE,IAAI;;aACxB,KAAK,EAAE,IAAI;aAAE,KAAK,EAAE,IAAI;;aACxB,KAAK,EAAE,IAAI;aAAE,KAAK,EAAE,IAAI;;aACxB,KAAK,EAAE,IAAI;aAAE,KAAK,EAAE,IAAI;EACjB,CAAA"}
@@ -0,0 +1,7 @@
1
+ export const TITLE_STYLES = [
2
+ { value: 'h1', label: 'H1' },
3
+ { value: 'h2', label: 'H2' },
4
+ { value: 'h3', label: 'H3' },
5
+ { value: 'h4', label: 'H4' },
6
+ { value: 'h5', label: 'H5' },
7
+ ];
@@ -0,0 +1,6 @@
1
+ import type { CareerBenefitsAttributes, CareerBenefitsOptions } from './types';
2
+ export declare function createCareerBenefitsEdit(_options: CareerBenefitsOptions): ({ attributes, setAttributes, }: {
3
+ attributes: CareerBenefitsAttributes;
4
+ setAttributes: (a: Partial<CareerBenefitsAttributes>) => void;
5
+ }) => import("react").JSX.Element;
6
+ //# sourceMappingURL=edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-benefits/edit.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,wBAAwB,EAAE,qBAAqB,EAAC,MAAM,SAAS,CAAA;AAE5E,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,qBAAqB,oCAInE;IACD,UAAU,EAAE,wBAAwB,CAAA;IACpC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,KAAK,IAAI,CAAA;CAC9D,iCAwCF"}
@@ -0,0 +1,14 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ColorPalette, InspectorControls, useBlockProps } from '@wordpress/block-editor';
3
+ import { PanelBody, SelectControl, TextControl } from '@wordpress/components';
4
+ import { __ } from '@wordpress/i18n';
5
+ import { useTenantColorPalette } from '../../../hooks/useTenantColorPalette';
6
+ import { TITLE_STYLES } from './constants';
7
+ export function createCareerBenefitsEdit(_options) {
8
+ return function Edit({ attributes, setAttributes, }) {
9
+ const { title, titleColor, titleStyle } = attributes;
10
+ const { paletteColors } = useTenantColorPalette();
11
+ const blockProps = useBlockProps({ className: 'wp-block-section' });
12
+ return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Nastavení', 'brilo-blocks'), initialOpen: true, children: [_jsx(TextControl, { label: __('Titulek', 'brilo-blocks'), value: title, onChange: (value) => setAttributes({ title: value }) }), _jsx(SelectControl, { label: __('Styl titulku', 'brilo-blocks'), value: titleStyle, options: TITLE_STYLES.map((s) => ({ value: s.value, label: s.label })), onChange: (value) => setAttributes({ titleStyle: value }) })] }), _jsxs(PanelBody, { title: __('Barvy', 'brilo-blocks'), children: [_jsx("p", { children: __('Barva titulku', 'brilo-blocks') }), _jsx(ColorPalette, { colors: paletteColors, value: titleColor || undefined, onChange: (value) => setAttributes({ titleColor: value !== null && value !== void 0 ? value : '' }) })] })] }), _jsx("div", { ...blockProps, children: _jsxs("div", { className: "components-placeholder", children: [_jsx("div", { className: "components-placeholder__label", children: __('Benefity kariéry', 'brilo-blocks') }), _jsx("div", { className: "components-placeholder__instructions", children: __('Zobrazí výpis benefitů aktuální pozice (taxonomie benefity).', 'brilo-blocks') })] }) })] }));
13
+ };
14
+ }
@@ -0,0 +1,5 @@
1
+ import type { BlockConfiguration } from '@wordpress/blocks';
2
+ import type { CareerBenefitsAttributes, CareerBenefitsOptions } from './types';
3
+ export type { CareerBenefitsAttributes, CareerBenefitsOptions };
4
+ export declare function createCareerBenefitsBlock(options: CareerBenefitsOptions): BlockConfiguration<CareerBenefitsAttributes>;
5
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-benefits/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAIzD,OAAO,KAAK,EAAC,wBAAwB,EAAE,qBAAqB,EAAC,MAAM,SAAS,CAAA;AAE5E,YAAY,EAAC,wBAAwB,EAAE,qBAAqB,EAAC,CAAA;AAE7D,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,qBAAqB,GAAG,kBAAkB,CAAC,wBAAwB,CAAC,CAiBtH"}
@@ -0,0 +1,22 @@
1
+ import { __ } from '@wordpress/i18n';
2
+ import { createCareerBenefitsEdit } from './edit';
3
+ import { icon as defaultIcon } from './icon';
4
+ export function createCareerBenefitsBlock(options) {
5
+ var _a, _b, _c;
6
+ return {
7
+ name: options.name,
8
+ title: (_a = options.title) !== null && _a !== void 0 ? _a : __('Benefity kariéry', 'brilo-blocks'),
9
+ description: options.description,
10
+ category: (_b = options.category) !== null && _b !== void 0 ? _b : 'widgets',
11
+ ...(options.parent && { parent: options.parent }),
12
+ icon: (_c = options.icon) !== null && _c !== void 0 ? _c : { src: defaultIcon },
13
+ supports: { html: false, customClassName: false },
14
+ attributes: {
15
+ title: { type: 'string', default: '' },
16
+ titleColor: { type: 'string', default: '' },
17
+ titleStyle: { type: 'string', default: 'h2' },
18
+ },
19
+ edit: createCareerBenefitsEdit(options),
20
+ save: () => null,
21
+ };
22
+ }
@@ -0,0 +1,2 @@
1
+ export declare const icon: import("react").JSX.Element;
2
+ //# sourceMappingURL=icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-benefits/icon.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,6BAShB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export const icon = (_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M3 5.5L5 7.5L9 3.5", stroke: "black", strokeWidth: "1.2", fill: "none" }), _jsx("path", { d: "M3 10.5L5 12.5L9 8.5", stroke: "black", strokeWidth: "1.2", fill: "none" }), _jsx("path", { d: "M3 15.5L5 17.5L9 13.5", stroke: "black", strokeWidth: "1.2", fill: "none" }), _jsx("line", { x1: "11", y1: "5", x2: "18", y2: "5", stroke: "black" }), _jsx("line", { x1: "11", y1: "10", x2: "18", y2: "10", stroke: "black" }), _jsx("line", { x1: "11", y1: "15", x2: "18", y2: "15", stroke: "black" })] }));
@@ -0,0 +1,5 @@
1
+ export type { CareerBenefitsAttributes, CareerBenefitsOptions } from './types';
2
+ export { createCareerBenefitsBlock } from './factory';
3
+ import type { CareerBenefitsOptions } from './types';
4
+ export declare const careerBenefitsDefaults: CareerBenefitsOptions;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-benefits/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,wBAAwB,EAAE,qBAAqB,EAAC,MAAM,SAAS,CAAA;AAC5E,OAAO,EAAC,yBAAyB,EAAC,MAAM,WAAW,CAAA;AAEnD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAA;AAElD,eAAO,MAAM,sBAAsB,EAAE,qBAGpC,CAAA"}
@@ -0,0 +1,5 @@
1
+ export { createCareerBenefitsBlock } from './factory';
2
+ export const careerBenefitsDefaults = {
3
+ name: 'brilo/career-benefits',
4
+ parent: ['brilo/base-section'],
5
+ };
@@ -0,0 +1,8 @@
1
+ import type { BriloBlockType } from '../../../types';
2
+ export interface CareerBenefitsAttributes extends Record<string, unknown> {
3
+ title: string;
4
+ titleColor: string;
5
+ titleStyle: string;
6
+ }
7
+ export type CareerBenefitsOptions = BriloBlockType;
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-benefits/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,WAAW,wBAAyB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvE,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAA"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,18 @@
1
1
  export declare const DEFAULT_ALLOWED_BLOCKS: string[];
2
+ export declare const TITLE_STYLES: readonly [{
3
+ readonly value: 'h1';
4
+ readonly label: 'H1';
5
+ }, {
6
+ readonly value: 'h2';
7
+ readonly label: 'H2';
8
+ }, {
9
+ readonly value: 'h3';
10
+ readonly label: 'H3';
11
+ }, {
12
+ readonly value: 'h4';
13
+ readonly label: 'H4';
14
+ }, {
15
+ readonly value: 'h5';
16
+ readonly label: 'H5';
17
+ }];
2
18
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-header/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,EAAE,MAAM,EAA2B,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-header/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,EAAE,MAAM,EAA2B,CAAA;AAEtE,eAAO,MAAM,YAAY;aACtB,KAAK,EAAE,IAAI;aAAE,KAAK,EAAE,IAAI;;aACxB,KAAK,EAAE,IAAI;aAAE,KAAK,EAAE,IAAI;;aACxB,KAAK,EAAE,IAAI;aAAE,KAAK,EAAE,IAAI;;aACxB,KAAK,EAAE,IAAI;aAAE,KAAK,EAAE,IAAI;;aACxB,KAAK,EAAE,IAAI;aAAE,KAAK,EAAE,IAAI;EACjB,CAAA"}
@@ -1 +1,8 @@
1
1
  export const DEFAULT_ALLOWED_BLOCKS = ['brilo/button-group'];
2
+ export const TITLE_STYLES = [
3
+ { value: 'h1', label: 'H1' },
4
+ { value: 'h2', label: 'H2' },
5
+ { value: 'h3', label: 'H3' },
6
+ { value: 'h4', label: 'H4' },
7
+ { value: 'h5', label: 'H5' },
8
+ ];
@@ -1 +1 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-header/edit.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAA;AAExE,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,mBAAmB,oCAI9D;IACD,UAAU,EAAE,sBAAsB,CAAA;IAClC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAA;CAC5D,iCAkDF"}
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-header/edit.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAA;AAExE,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,mBAAmB,oCAI9D;IACD,UAAU,EAAE,sBAAsB,CAAA;IAClC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAA;CAC5D,iCAkEF"}
@@ -1,14 +1,16 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { InspectorControls, useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
3
- import { PanelBody, ToggleControl } from '@wordpress/components';
2
+ import { ColorPalette, InspectorControls, useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
3
+ import { PanelBody, SelectControl, ToggleControl } from '@wordpress/components';
4
4
  import { __ } from '@wordpress/i18n';
5
- import { DEFAULT_ALLOWED_BLOCKS } from './constants';
5
+ import { useTenantColorPalette } from '../../../hooks/useTenantColorPalette';
6
+ import { DEFAULT_ALLOWED_BLOCKS, TITLE_STYLES } from './constants';
6
7
  export function createCareerHeaderEdit(options) {
7
8
  return function Edit({ attributes, setAttributes, }) {
8
9
  var _a;
9
- const { showExcerpt, showLocation, showSalary, showBenefits, showEmploymentType } = attributes;
10
+ const { showExcerpt, showLocation, showSalary, showBenefits, showEmploymentType, titleColor, titleStyle } = attributes;
11
+ const { paletteColors } = useTenantColorPalette();
10
12
  const blockProps = useBlockProps({ className: 'wp-block-section' });
11
13
  const innerBlocksProps = useInnerBlocksProps({}, { allowedBlocks: (_a = options.allowedBlocks) !== null && _a !== void 0 ? _a : DEFAULT_ALLOWED_BLOCKS });
12
- return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsxs(PanelBody, { title: __('Zobrazené údaje', 'brilo-blocks'), initialOpen: true, children: [_jsx(ToggleControl, { label: __('Zobrazit perex', 'brilo-blocks'), checked: showExcerpt, onChange: (value) => setAttributes({ showExcerpt: value }) }), _jsx(ToggleControl, { label: __('Zobrazit lokalitu', 'brilo-blocks'), checked: showLocation, onChange: (value) => setAttributes({ showLocation: value }) }), _jsx(ToggleControl, { label: __('Zobrazit plat', 'brilo-blocks'), checked: showSalary, onChange: (value) => setAttributes({ showSalary: value }) }), _jsx(ToggleControl, { label: __('Zobrazit benefity', 'brilo-blocks'), checked: showBenefits, onChange: (value) => setAttributes({ showBenefits: value }) }), _jsx(ToggleControl, { label: __('Zobrazit typ úvazku', 'brilo-blocks'), checked: showEmploymentType, onChange: (value) => setAttributes({ showEmploymentType: value }) })] }) }), _jsxs("div", { ...blockProps, children: [_jsxs("div", { className: "components-placeholder", children: [_jsx("div", { className: "components-placeholder__label", children: __('Hlavička kariéry', 'brilo-blocks') }), _jsx("div", { className: "components-placeholder__instructions", children: __('Zobrazí data aktuální pozice — název, perex, lokalitu, plat, benefity a typ úvazku.', 'brilo-blocks') })] }), _jsx("div", { ...innerBlocksProps })] })] }));
14
+ return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Zobrazené údaje', 'brilo-blocks'), initialOpen: true, children: [_jsx(ToggleControl, { label: __('Zobrazit perex', 'brilo-blocks'), checked: showExcerpt, onChange: (value) => setAttributes({ showExcerpt: value }) }), _jsx(ToggleControl, { label: __('Zobrazit lokalitu', 'brilo-blocks'), checked: showLocation, onChange: (value) => setAttributes({ showLocation: value }) }), _jsx(ToggleControl, { label: __('Zobrazit plat', 'brilo-blocks'), checked: showSalary, onChange: (value) => setAttributes({ showSalary: value }) }), _jsx(ToggleControl, { label: __('Zobrazit benefity', 'brilo-blocks'), checked: showBenefits, onChange: (value) => setAttributes({ showBenefits: value }) }), _jsx(ToggleControl, { label: __('Zobrazit typ úvazku', 'brilo-blocks'), checked: showEmploymentType, onChange: (value) => setAttributes({ showEmploymentType: value }) })] }), _jsxs(PanelBody, { title: __('Titulek', 'brilo-blocks'), children: [_jsx(SelectControl, { label: __('Styl titulku', 'brilo-blocks'), value: titleStyle, options: TITLE_STYLES.map((s) => ({ value: s.value, label: s.label })), onChange: (value) => setAttributes({ titleStyle: value }) }), _jsx("p", { children: __('Barva titulku', 'brilo-blocks') }), _jsx(ColorPalette, { colors: paletteColors, value: titleColor || undefined, onChange: (value) => setAttributes({ titleColor: value !== null && value !== void 0 ? value : '' }) })] })] }), _jsxs("div", { ...blockProps, children: [_jsxs("div", { className: "components-placeholder", children: [_jsx("div", { className: "components-placeholder__label", children: __('Hlavička kariéry', 'brilo-blocks') }), _jsx("div", { className: "components-placeholder__instructions", children: __('Zobrazí data aktuální pozice — název, perex, lokalitu, plat, benefity a typ úvazku.', 'brilo-blocks') })] }), _jsx("div", { ...innerBlocksProps })] })] }));
13
15
  };
14
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-header/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAIzD,OAAO,KAAK,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAA;AAExE,YAAY,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,CAAA;AAEzD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,mBAAmB,GAAG,kBAAkB,CAAC,sBAAsB,CAAC,CAmBhH"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-header/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAIzD,OAAO,KAAK,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAA;AAExE,YAAY,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,CAAA;AAEzD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,mBAAmB,GAAG,kBAAkB,CAAC,sBAAsB,CAAC,CAqBhH"}
@@ -19,6 +19,8 @@ export function createCareerHeaderBlock(options) {
19
19
  showSalary: { type: 'boolean', default: true },
20
20
  showBenefits: { type: 'boolean', default: true },
21
21
  showEmploymentType: { type: 'boolean', default: true },
22
+ titleColor: { type: 'string', default: '' },
23
+ titleStyle: { type: 'string', default: 'h2' },
22
24
  },
23
25
  edit: createCareerHeaderEdit(options),
24
26
  save: () => _jsx(InnerBlocks.Content, {}),
@@ -5,6 +5,8 @@ export interface CareerHeaderAttributes extends Record<string, unknown> {
5
5
  showSalary: boolean;
6
6
  showBenefits: boolean;
7
7
  showEmploymentType: boolean;
8
+ titleColor: string;
9
+ titleStyle: string;
8
10
  }
9
11
  export type CareerHeaderOptions = BriloBlockType;
10
12
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-header/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,WAAW,sBAAuB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrE,WAAW,EAAE,OAAO,CAAA;IACpB,YAAY,EAAE,OAAO,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;IACnB,YAAY,EAAE,OAAO,CAAA;IACrB,kBAAkB,EAAE,OAAO,CAAA;CAC5B;AAED,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/career-header/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,WAAW,sBAAuB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrE,WAAW,EAAE,OAAO,CAAA;IACpB,YAAY,EAAE,OAAO,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;IACnB,YAAY,EAAE,OAAO,CAAA;IACrB,kBAAkB,EAAE,OAAO,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAA"}
@@ -1,4 +1,4 @@
1
- export declare const FIELD_TYPE_VALUES: readonly ['text', 'textarea', 'select', 'hidden'];
1
+ export declare const FIELD_TYPE_VALUES: readonly ['text', 'textarea', 'select', 'hidden', 'file'];
2
2
  export declare const FIELD_TYPES: readonly [{
3
3
  readonly value: "text";
4
4
  readonly label: import("@wordpress/i18n").TransformedText<"Text">;
@@ -11,6 +11,9 @@ export declare const FIELD_TYPES: readonly [{
11
11
  }, {
12
12
  readonly value: "hidden";
13
13
  readonly label: import("@wordpress/i18n").TransformedText<"Hidden">;
14
+ }, {
15
+ readonly value: "file";
16
+ readonly label: import("@wordpress/i18n").TransformedText<"Soubor">;
14
17
  }];
15
18
  export declare const FIELD_TEXT_TYPE_VALUES: readonly ['text', 'tel', 'email', 'number', 'date', 'time'];
16
19
  export declare const FIELD_TEXT_TYPES: ({
@@ -45,4 +48,33 @@ export declare const FIELD_SELECT_MODES: readonly [{
45
48
  readonly value: "email";
46
49
  readonly label: import("@wordpress/i18n").TransformedText<"Výběr s routováním e-mailu">;
47
50
  }];
51
+ export declare const FILE_EXTENSION_PRESETS: readonly [{
52
+ readonly value: 'jpg,jpeg,png,webp';
53
+ readonly label: import("@wordpress/i18n").TransformedText<"Obrázky">;
54
+ }, {
55
+ readonly value: 'pdf';
56
+ readonly label: import("@wordpress/i18n").TransformedText<"PDF">;
57
+ }, {
58
+ readonly value: 'doc,docx';
59
+ readonly label: import("@wordpress/i18n").TransformedText<"Word">;
60
+ }, {
61
+ readonly value: 'xls,xlsx';
62
+ readonly label: import("@wordpress/i18n").TransformedText<"Excel">;
63
+ }];
64
+ export declare const FILE_BUTTON_VARIANT_VALUES: readonly ['primary', 'secondary', 'neutral', 'ghost'];
65
+ export declare const FILE_BUTTON_VARIANTS: readonly [{
66
+ readonly value: "primary";
67
+ readonly label: import("@wordpress/i18n").TransformedText<"Primary">;
68
+ }, {
69
+ readonly value: "secondary";
70
+ readonly label: import("@wordpress/i18n").TransformedText<"Secondary">;
71
+ }, {
72
+ readonly value: "neutral";
73
+ readonly label: import("@wordpress/i18n").TransformedText<"Neutral">;
74
+ }, {
75
+ readonly value: "ghost";
76
+ readonly label: import("@wordpress/i18n").TransformedText<"Ghost">;
77
+ }];
78
+ export declare const FIELD_FILE_BUTTON_VARIANT_DEFAULT = "secondary";
79
+ export declare const FIELD_FILE_BUTTON_LABEL_DEFAULT: import("@wordpress/i18n").TransformedText<"Nahrát soubor">;
48
80
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,YAAI,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAA;AAElF,eAAO,MAAM,WAAW;aACrB,KAAK;aAAwB,KAAK;;aAClC,KAAK;aAAwB,KAAK;;aAClC,KAAK;aAAwB,KAAK;;aAClC,KAAK;aAAwB,KAAK;EAC3B,CAAA;AAEV,eAAO,MAAM,sBAAsB,YAAI,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAU,CAAA;AACjG,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;IAO5B,CAAA;AAED,eAAO,MAAM,mBAAmB;aAAI,GAAG,EAAE,CAAC;aAAE,GAAG,EAAE,EAAE;CAAU,CAAA;AAE7D,eAAO,MAAM,qBAAqB,IAAI,CAAA;AAEtC,eAAO,MAAM,wBAAwB,YAAI,SAAS,EAAE,OAAO,CAAU,CAAA;AAErE,eAAO,MAAM,kBAAkB;aAC5B,KAAK;aAA+B,KAAK;;aACzC,KAAK;aAA+B,KAAK;EAClC,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,YAAI,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAA;AAE1F,eAAO,MAAM,WAAW;aACrB,KAAK;aAAwB,KAAK;;aAClC,KAAK;aAAwB,KAAK;;aAClC,KAAK;aAAwB,KAAK;;aAClC,KAAK;aAAwB,KAAK;;aAClC,KAAK;aAAwB,KAAK;EAC3B,CAAA;AAEV,eAAO,MAAM,sBAAsB,YAAI,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAU,CAAA;AACjG,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;IAO5B,CAAA;AAED,eAAO,MAAM,mBAAmB;aAAI,GAAG,EAAE,CAAC;aAAE,GAAG,EAAE,EAAE;CAAU,CAAA;AAE7D,eAAO,MAAM,qBAAqB,IAAI,CAAA;AAEtC,eAAO,MAAM,wBAAwB,YAAI,SAAS,EAAE,OAAO,CAAU,CAAA;AAErE,eAAO,MAAM,kBAAkB;aAC5B,KAAK;aAA+B,KAAK;;aACzC,KAAK;aAA+B,KAAK;EAClC,CAAA;AAEV,eAAO,MAAM,sBAAsB;aAChC,KAAK,EAAE,mBAAmB;aAAE,KAAK;;aACjC,KAAK,EAAE,KAAK;aAAE,KAAK;;aACnB,KAAK,EAAE,UAAU;aAAE,KAAK;;aACxB,KAAK,EAAE,UAAU;aAAE,KAAK;EACjB,CAAA;AAEV,eAAO,MAAM,0BAA0B,YAAI,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,CAAU,CAAA;AAE/F,eAAO,MAAM,oBAAoB;aAC9B,KAAK;aAAiC,KAAK;;aAC3C,KAAK;aAAiC,KAAK;;aAC3C,KAAK;aAAiC,KAAK;;aAC3C,KAAK;aAAiC,KAAK;EACpC,CAAA;AAEV,eAAO,MAAM,iCAAiC,cAAc,CAAA;AAE5D,eAAO,MAAM,+BAA+B,4DAAsC,CAAA"}
@@ -1,10 +1,11 @@
1
1
  import { __ } from '@wordpress/i18n';
2
- export const FIELD_TYPE_VALUES = ['text', 'textarea', 'select', 'hidden'];
2
+ export const FIELD_TYPE_VALUES = ['text', 'textarea', 'select', 'hidden', 'file'];
3
3
  export const FIELD_TYPES = [
4
4
  { value: FIELD_TYPE_VALUES[0], label: __('Text', 'brilo-blocks') },
5
5
  { value: FIELD_TYPE_VALUES[1], label: __('Textarea', 'brilo-blocks') },
6
6
  { value: FIELD_TYPE_VALUES[2], label: __('Select', 'brilo-blocks') },
7
7
  { value: FIELD_TYPE_VALUES[3], label: __('Hidden', 'brilo-blocks') },
8
+ { value: FIELD_TYPE_VALUES[4], label: __('Soubor', 'brilo-blocks') },
8
9
  ];
9
10
  export const FIELD_TEXT_TYPE_VALUES = ['text', 'tel', 'email', 'number', 'date', 'time'];
10
11
  export const FIELD_TEXT_TYPES = [
@@ -22,3 +23,18 @@ export const FIELD_SELECT_MODES = [
22
23
  { value: FIELD_SELECT_MODE_VALUES[0], label: __('Klasický', 'brilo-blocks') },
23
24
  { value: FIELD_SELECT_MODE_VALUES[1], label: __('Výběr s routováním e-mailu', 'brilo-blocks') },
24
25
  ];
26
+ export const FILE_EXTENSION_PRESETS = [
27
+ { value: 'jpg,jpeg,png,webp', label: __('Obrázky', 'brilo-blocks') },
28
+ { value: 'pdf', label: __('PDF', 'brilo-blocks') },
29
+ { value: 'doc,docx', label: __('Word', 'brilo-blocks') },
30
+ { value: 'xls,xlsx', label: __('Excel', 'brilo-blocks') },
31
+ ];
32
+ export const FILE_BUTTON_VARIANT_VALUES = ['primary', 'secondary', 'neutral', 'ghost'];
33
+ export const FILE_BUTTON_VARIANTS = [
34
+ { value: FILE_BUTTON_VARIANT_VALUES[0], label: __('Primary', 'brilo-blocks') },
35
+ { value: FILE_BUTTON_VARIANT_VALUES[1], label: __('Secondary', 'brilo-blocks') },
36
+ { value: FILE_BUTTON_VARIANT_VALUES[2], label: __('Neutral', 'brilo-blocks') },
37
+ { value: FILE_BUTTON_VARIANT_VALUES[3], label: __('Ghost', 'brilo-blocks') },
38
+ ];
39
+ export const FIELD_FILE_BUTTON_VARIANT_DEFAULT = 'secondary';
40
+ export const FIELD_FILE_BUTTON_LABEL_DEFAULT = __('Nahrát soubor', 'brilo-blocks');
@@ -1 +1 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/edit.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAC,mBAAmB,EAAE,gBAAgB,EAAwD,MAAM,SAAS,CAAA;AAepH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,oCAIzD;IACD,UAAU,EAAE,mBAAmB,CAAA;IAC/B,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAA;CACzD,iCAiNF"}
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/edit.tsx"],"names":[],"mappings":"AAgBA,OAAO,EACL,mBAAmB,EAEnB,gBAAgB,EAIjB,MAAM,SAAS,CAAA;AAehB,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,oCAIzD;IACD,UAAU,EAAE,mBAAmB,CAAA;IAC/B,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAA;CACzD,iCAqQF"}
@@ -1,10 +1,10 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
3
- import { Button, Modal, PanelBody, RangeControl, SelectControl, TextControl, ToggleControl } from '@wordpress/components';
3
+ import { CheckboxControl, Button, Modal, PanelBody, RangeControl, SelectControl, TextControl, ToggleControl } from '@wordpress/components';
4
4
  import { __, sprintf } from '@wordpress/i18n';
5
5
  import clsx from 'clsx';
6
6
  import { useState } from 'react';
7
- import { FIELD_COLUMNS_DEFAULT, FIELD_COLUMNS_RANGE, FIELD_SELECT_MODES, FIELD_TEXT_TYPES, FIELD_TYPES } from './constants';
7
+ import { FIELD_COLUMNS_DEFAULT, FIELD_COLUMNS_RANGE, FIELD_SELECT_MODES, FIELD_TEXT_TYPES, FIELD_TYPES, FILE_BUTTON_VARIANTS, FILE_EXTENSION_PRESETS, } from './constants';
8
8
  import { normalizeOptions, serializeOptions } from './normalizeOptions';
9
9
  import { SelectOptionsRepeater } from './SelectOptionsRepeater';
10
10
  const { min: MIN_COLUMNS, max: MAX_COLUMNS } = FIELD_COLUMNS_RANGE;
@@ -20,7 +20,7 @@ function sanitizeHtmlName(raw) {
20
20
  }
21
21
  export function createFormFieldEdit(_options) {
22
22
  return function Edit({ attributes, setAttributes, }) {
23
- var _a, _b, _c, _d, _e, _f, _g, _h;
23
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
24
24
  const currentColumns = Math.max(MIN_COLUMNS, Math.min(MAX_COLUMNS, attributes.columns || MIN_COLUMNS));
25
25
  const blockProps = useBlockProps({
26
26
  className: clsx('i-form-field', `--type-${attributes.type}`, `--cols-${currentColumns}`, attributes.required && '--required'),
@@ -39,6 +39,12 @@ export function createFormFieldEdit(_options) {
39
39
  ];
40
40
  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' && (_jsxs(_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: (textType) => setAttributes(textType === 'email'
41
41
  ? { textType: textType }
42
- : { textType: textType, isReplyTo: false }) }), attributes.textType === 'email' && (_jsx(ToggleControl, { label: __('Použít jako Reply-To pole', 'brilo-blocks'), help: __('Hodnota tohoto pole se použije jako Reply-To adresa notifikačního e-mailu.', 'brilo-blocks'), checked: (_a = attributes.isReplyTo) !== null && _a !== void 0 ? _a : false, onChange: (isReplyTo) => setAttributes({ isReplyTo }) }))] })), 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 }) }), _jsx(ToggleControl, { label: __('Odesílat do GTM (dataLayer)', 'brilo-blocks'), help: __('Po úspěšném odeslání formuláře se do dataLayer pushne klíč podle názvu html atributu s vyplněnou/vybranou hodnotou tohoto pole.', 'brilo-blocks'), checked: (_b = attributes.gtmEnabled) !== null && _b !== void 0 ? _b : false, onChange: (gtmEnabled) => setAttributes({ gtmEnabled }) })] })), attributes.type === 'select' && (_jsxs(_Fragment, { children: [_jsx(SelectControl, { label: __('Režim selectu', 'brilo-blocks'), value: (_c = attributes.selectMode) !== null && _c !== void 0 ? _c : 'classic', options: FIELD_SELECT_MODES.map((m) => ({ label: m.label, value: m.value })), onChange: (selectMode) => setAttributes({ selectMode: selectMode }) }), _jsx("div", { className: "i-form-field__options-trigger", children: _jsx(Button, { variant: "secondary", onClick: () => setIsOptionsModalOpen(true), children: sprintf(__('Upravit možnosti (%d)', 'brilo-blocks'), optionRows.length) }) }), isOptionsModalOpen && (_jsx(Modal, { title: __('Možnosti pole', 'brilo-blocks'), onRequestClose: () => setIsOptionsModalOpen(false), size: "large", children: _jsx(SelectOptionsRepeater, { rows: optionRows, onChange: updateOptionRows, showEmail: ((_d = attributes.selectMode) !== null && _d !== void 0 ? _d : 'classic') === 'email', onClose: () => setIsOptionsModalOpen(false) }) })), _jsx(SelectControl, { label: __('Výchozí hodnota', 'brilo-blocks'), value: (_e = attributes.defaultValue) !== null && _e !== void 0 ? _e : '', options: selectOptions, onChange: (defaultValue) => setAttributes({ defaultValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : '' }) })] })), attributes.type === 'hidden' && (_jsxs(_Fragment, { children: [_jsx(TextControl, { label: __('Hodnota', 'brilo-blocks'), value: (_f = attributes.value) !== null && _f !== void 0 ? _f : '', onChange: (value) => setAttributes({ value }), help: __('Hodnota, která bude odeslána s formulářem.', 'brilo-blocks') }), _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. Mezery a diakritika se automaticky odstraní.', 'brilo-blocks'), onChange: (name) => setAttributes({ name: sanitizeHtmlName(name) }) })] })), attributes.type !== 'hidden' && (_jsx(RangeControl, { label: __('Počet sloupců', 'brilo-blocks'), value: currentColumns, min: MIN_COLUMNS, max: MAX_COLUMNS, onChange: (columns) => setAttributes({ columns: Math.max(MIN_COLUMNS, Math.min(MAX_COLUMNS, columns !== null && columns !== void 0 ? columns : FIELD_COLUMNS_DEFAULT)) }) }))] }) }), _jsx("div", { ...blockProps, children: _jsx("div", { className: "i-form-field__wrapper", children: attributes.type === 'hidden' ? (_jsxs(_Fragment, { children: [_jsx("strong", { children: __('Skryté pole', 'brilo-blocks') }), _jsxs("div", { children: [__('Hodnota', 'brilo-blocks'), ": ", (_g = attributes.value) !== null && _g !== void 0 ? _g : ''] }), _jsxs("div", { children: [__('Název', 'brilo-blocks'), ": ", (_h = attributes.name) !== null && _h !== void 0 ? _h : ''] })] })) : (_jsxs(_Fragment, { children: [_jsx("strong", { children: attributes.label || __('Pole', 'brilo-blocks') }), _jsx("div", { children: attributes.type }), _jsxs("div", { className: "i-form-field__columns-control", children: [_jsx(Button, { size: "small", variant: "secondary", onClick: () => setAttributes({ columns: Math.max(MIN_COLUMNS, currentColumns - 1) }), disabled: currentColumns <= MIN_COLUMNS, "aria-label": __('Snížit počet sloupců', 'brilo-blocks'), children: "-" }), _jsx("div", { className: "i-form-field__columns-value", children: `${currentColumns}/${MAX_COLUMNS}` }), _jsx(Button, { size: "small", variant: "secondary", onClick: () => setAttributes({ columns: Math.min(MAX_COLUMNS, currentColumns + 1) }), disabled: currentColumns >= MAX_COLUMNS, "aria-label": __('Zvýšit počet sloupců', 'brilo-blocks'), children: "+" })] })] })) }) })] }));
42
+ : { textType: textType, isReplyTo: false }) }), attributes.textType === 'email' && (_jsx(ToggleControl, { label: __('Použít jako Reply-To pole', 'brilo-blocks'), help: __('Hodnota tohoto pole se použije jako Reply-To adresa notifikačního e-mailu.', 'brilo-blocks'), checked: (_a = attributes.isReplyTo) !== null && _a !== void 0 ? _a : false, onChange: (isReplyTo) => setAttributes({ isReplyTo }) }))] })), 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) }) }), attributes.type !== 'file' && (_jsx(TextControl, { label: __('Placeholder', 'brilo-blocks'), value: attributes.placeholder, onChange: (placeholder) => setAttributes({ placeholder }) })), attributes.type !== 'file' && (_jsx(ToggleControl, { label: __('Odesílat do GTM (dataLayer)', 'brilo-blocks'), help: __('Po úspěšném odeslání formuláře se do dataLayer pushne klíč podle názvu html atributu s vyplněnou/vybranou hodnotou tohoto pole.', 'brilo-blocks'), checked: (_b = attributes.gtmEnabled) !== null && _b !== void 0 ? _b : false, onChange: (gtmEnabled) => setAttributes({ gtmEnabled }) }))] })), attributes.type === 'file' && (_jsxs(_Fragment, { children: [_jsx(ToggleControl, { label: __('Povolit více souborů', 'brilo-blocks'), checked: (_c = attributes.multiple) !== null && _c !== void 0 ? _c : false, onChange: (multiple) => setAttributes({ multiple }) }), _jsx("p", { className: "i-form-field__file-extensions-label", children: __('Povolené přípony', 'brilo-blocks') }), FILE_EXTENSION_PRESETS.map((preset) => { var _a; return (_jsx(CheckboxControl, { label: preset.label, checked: ((_a = attributes.extensionsPreset) !== null && _a !== void 0 ? _a : []).includes(preset.value), onChange: (checked) => {
43
+ var _a;
44
+ const current = (_a = attributes.extensionsPreset) !== null && _a !== void 0 ? _a : [];
45
+ setAttributes({
46
+ extensionsPreset: checked ? [...current, preset.value] : current.filter((value) => value !== preset.value),
47
+ });
48
+ } }, preset.value)); }), _jsx(TextControl, { label: __('Vlastní přípony', 'brilo-blocks'), help: __('Oddělené čárkou, bez tečky. Např. heic,zip', 'brilo-blocks'), value: (_d = attributes.extensionsCustom) !== null && _d !== void 0 ? _d : '', onChange: (extensionsCustom) => setAttributes({ extensionsCustom }) }), _jsx(SelectControl, { label: __('Vzhled tlačítka', 'brilo-blocks'), value: (_e = attributes.buttonVariant) !== null && _e !== void 0 ? _e : 'secondary', options: FILE_BUTTON_VARIANTS.map((v) => ({ label: v.label, value: v.value })), onChange: (buttonVariant) => setAttributes({ buttonVariant: buttonVariant }) }), _jsx(ToggleControl, { label: __('Outline styl tlačítka', 'brilo-blocks'), checked: (_f = attributes.buttonOutline) !== null && _f !== void 0 ? _f : true, onChange: (buttonOutline) => setAttributes({ buttonOutline }) }), _jsx(TextControl, { label: __('Text tlačítka', 'brilo-blocks'), value: (_g = attributes.buttonLabel) !== null && _g !== void 0 ? _g : '', onChange: (buttonLabel) => setAttributes({ buttonLabel }) })] })), attributes.type === 'select' && (_jsxs(_Fragment, { children: [_jsx(SelectControl, { label: __('Režim selectu', 'brilo-blocks'), value: (_h = attributes.selectMode) !== null && _h !== void 0 ? _h : 'classic', options: FIELD_SELECT_MODES.map((m) => ({ label: m.label, value: m.value })), onChange: (selectMode) => setAttributes({ selectMode: selectMode }) }), _jsx("div", { className: "i-form-field__options-trigger", children: _jsx(Button, { variant: "secondary", onClick: () => setIsOptionsModalOpen(true), children: sprintf(__('Upravit možnosti (%d)', 'brilo-blocks'), optionRows.length) }) }), isOptionsModalOpen && (_jsx(Modal, { title: __('Možnosti pole', 'brilo-blocks'), onRequestClose: () => setIsOptionsModalOpen(false), size: "large", children: _jsx(SelectOptionsRepeater, { rows: optionRows, onChange: updateOptionRows, showEmail: ((_j = attributes.selectMode) !== null && _j !== void 0 ? _j : 'classic') === 'email', onClose: () => setIsOptionsModalOpen(false) }) })), _jsx(SelectControl, { label: __('Výchozí hodnota', 'brilo-blocks'), value: (_k = attributes.defaultValue) !== null && _k !== void 0 ? _k : '', options: selectOptions, onChange: (defaultValue) => setAttributes({ defaultValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : '' }) })] })), attributes.type === 'hidden' && (_jsxs(_Fragment, { children: [_jsx(TextControl, { label: __('Hodnota', 'brilo-blocks'), value: (_l = attributes.value) !== null && _l !== void 0 ? _l : '', onChange: (value) => setAttributes({ value }), help: __('Hodnota, která bude odeslána s formulářem.', 'brilo-blocks') }), _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. Mezery a diakritika se automaticky odstraní.', 'brilo-blocks'), onChange: (name) => setAttributes({ name: sanitizeHtmlName(name) }) })] })), attributes.type !== 'hidden' && (_jsx(RangeControl, { label: __('Počet sloupců', 'brilo-blocks'), value: currentColumns, min: MIN_COLUMNS, max: MAX_COLUMNS, onChange: (columns) => setAttributes({ columns: Math.max(MIN_COLUMNS, Math.min(MAX_COLUMNS, columns !== null && columns !== void 0 ? columns : FIELD_COLUMNS_DEFAULT)) }) }))] }) }), _jsx("div", { ...blockProps, children: _jsx("div", { className: "i-form-field__wrapper", children: attributes.type === 'hidden' ? (_jsxs(_Fragment, { children: [_jsx("strong", { children: __('Skryté pole', 'brilo-blocks') }), _jsxs("div", { children: [__('Hodnota', 'brilo-blocks'), ": ", (_m = attributes.value) !== null && _m !== void 0 ? _m : ''] }), _jsxs("div", { children: [__('Název', 'brilo-blocks'), ": ", (_o = attributes.name) !== null && _o !== void 0 ? _o : ''] })] })) : (_jsxs(_Fragment, { children: [_jsx("strong", { children: attributes.label || __('Pole', 'brilo-blocks') }), _jsx("div", { children: attributes.type }), _jsxs("div", { className: "i-form-field__columns-control", children: [_jsx(Button, { size: "small", variant: "secondary", onClick: () => setAttributes({ columns: Math.max(MIN_COLUMNS, currentColumns - 1) }), disabled: currentColumns <= MIN_COLUMNS, "aria-label": __('Snížit počet sloupců', 'brilo-blocks'), children: "-" }), _jsx("div", { className: "i-form-field__columns-value", children: `${currentColumns}/${MAX_COLUMNS}` }), _jsx(Button, { size: "small", variant: "secondary", onClick: () => setAttributes({ columns: Math.min(MAX_COLUMNS, currentColumns + 1) }), disabled: currentColumns >= MAX_COLUMNS, "aria-label": __('Zvýšit počet sloupců', 'brilo-blocks'), children: "+" })] })] })) }) })] }));
43
49
  };
44
50
  }
@@ -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,CA2BvG"}
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,CAiCvG"}
@@ -1,5 +1,5 @@
1
1
  import { __ } from '@wordpress/i18n';
2
- import { FIELD_COLUMNS_DEFAULT } from './constants';
2
+ import { FIELD_COLUMNS_DEFAULT, FIELD_FILE_BUTTON_LABEL_DEFAULT, FIELD_FILE_BUTTON_VARIANT_DEFAULT } from './constants';
3
3
  import { createFormFieldEdit } from './edit';
4
4
  export function createFormFieldBlock(options) {
5
5
  var _a, _b, _c;
@@ -25,6 +25,12 @@ export function createFormFieldBlock(options) {
25
25
  value: { type: 'string', default: '' },
26
26
  isReplyTo: { type: 'boolean', default: false },
27
27
  gtmEnabled: { type: 'boolean', default: false },
28
+ multiple: { type: 'boolean', default: false },
29
+ extensionsPreset: { type: 'array', default: [] },
30
+ extensionsCustom: { type: 'string', default: '' },
31
+ buttonVariant: { type: 'string', default: FIELD_FILE_BUTTON_VARIANT_DEFAULT },
32
+ buttonOutline: { type: 'boolean', default: true },
33
+ buttonLabel: { type: 'string', default: FIELD_FILE_BUTTON_LABEL_DEFAULT },
28
34
  },
29
35
  edit: createFormFieldEdit(options),
30
36
  save: () => null,
@@ -1,8 +1,9 @@
1
- import { FIELD_SELECT_MODE_VALUES, FIELD_TEXT_TYPE_VALUES, FIELD_TYPE_VALUES } from './constants';
1
+ import { FIELD_SELECT_MODE_VALUES, FIELD_TEXT_TYPE_VALUES, FIELD_TYPE_VALUES, FILE_BUTTON_VARIANT_VALUES } from './constants';
2
2
  import type { BriloBlockType } from '../../../types';
3
3
  export type FormFieldType = (typeof FIELD_TYPE_VALUES)[number];
4
4
  export type FormFieldTextType = (typeof FIELD_TEXT_TYPE_VALUES)[number];
5
5
  export type FormFieldSelectMode = (typeof FIELD_SELECT_MODE_VALUES)[number];
6
+ export type FormFieldFileButtonVariant = (typeof FILE_BUTTON_VARIANT_VALUES)[number];
6
7
  export type FormFieldOption = string | {
7
8
  label?: string;
8
9
  value?: string;
@@ -22,6 +23,12 @@ export interface FormFieldAttributes extends Record<string, unknown> {
22
23
  value: string;
23
24
  isReplyTo: boolean;
24
25
  gtmEnabled: boolean;
26
+ multiple: boolean;
27
+ extensionsPreset: string[];
28
+ extensionsCustom: string;
29
+ buttonVariant: FormFieldFileButtonVariant;
30
+ buttonOutline: boolean;
31
+ buttonLabel: string;
25
32
  }
26
33
  export interface FormFieldOptions extends BriloBlockType {
27
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,wBAAwB,EAAoB,sBAAsB,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAA;AACjH,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;AACvE,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3E,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAC,CAAA;AAEvF,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,eAAe,EAAE,CAAA;IAC1B,UAAU,EAAE,mBAAmB,CAAA;IAC/B,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/form/form-field/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAExB,sBAAsB,EACtB,iBAAiB,EACjB,0BAA0B,EAC3B,MAAM,aAAa,CAAA;AACpB,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;AACvE,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAA;AAC3E,MAAM,MAAM,0BAA0B,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpF,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAC,CAAA;AAEvF,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,eAAe,EAAE,CAAA;IAC1B,UAAU,EAAE,mBAAmB,CAAA;IAC/B,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,0BAA0B,CAAA;IACzC,aAAa,EAAE,OAAO,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG"}
@@ -0,0 +1,8 @@
1
+ import type { BoxAttributes } from './types';
2
+ interface BoxControlsProps {
3
+ attributes: BoxAttributes;
4
+ setAttributes: (attrs: Partial<BoxAttributes>) => void;
5
+ }
6
+ export declare function BoxControls({ attributes, setAttributes }: BoxControlsProps): import("react").JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=controls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../../src/blocks/layout/box/controls.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,aAAa,EAAkB,MAAM,SAAS,CAAA;AAY3D,UAAU,gBAAgB;IACxB,UAAU,EAAE,aAAa,CAAA;IACzB,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK,IAAI,CAAA;CACvD;AAED,wBAAgB,WAAW,CAAC,EAAC,UAAU,EAAE,aAAa,EAAC,EAAE,gBAAgB,+BAwCxE"}
@@ -0,0 +1,13 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as blockEditor from '@wordpress/block-editor';
3
+ import { ColorPalette, ContrastChecker } from '@wordpress/block-editor';
4
+ import { BoxControl, PanelBody, __experimentalUnitControl as UnitControl } from '@wordpress/components';
5
+ import { __ } from '@wordpress/i18n';
6
+ import { useTenantColorPalette } from '../../../hooks/useTenantColorPalette';
7
+ const BorderRadiusControl = blockEditor
8
+ .__experimentalBorderRadiusControl;
9
+ export function BoxControls({ attributes, setAttributes }) {
10
+ const { padding, margin, borderRadius, borderWidth, borderColor, background, textColor } = attributes;
11
+ const { paletteColors, resolveHex } = useTenantColorPalette();
12
+ return (_jsxs(_Fragment, { children: [_jsxs(PanelBody, { title: __('Rozestupy', 'brilo-blocks'), children: [_jsx(BoxControl, { label: __('Padding', 'brilo-blocks'), values: padding, onChange: (next) => setAttributes({ padding: next }) }), _jsx(BoxControl, { label: __('Margin', 'brilo-blocks'), values: margin, onChange: (next) => setAttributes({ margin: next }) })] }), _jsxs(PanelBody, { title: __('Ohraničení', 'brilo-blocks'), children: [_jsx(UnitControl, { label: __('Šířka okraje', 'brilo-blocks'), value: borderWidth, min: 0, onChange: (next) => { var _a; return setAttributes({ borderWidth: (_a = next) !== null && _a !== void 0 ? _a : '' }); } }), _jsx("p", { children: __('Barva okraje', 'brilo-blocks') }), _jsx(ColorPalette, { colors: paletteColors, value: borderColor || undefined, onChange: (value) => setAttributes({ borderColor: value !== null && value !== void 0 ? value : '' }) }), _jsx(BorderRadiusControl, { values: borderRadius, onChange: (next) => setAttributes({ borderRadius: next !== null && next !== void 0 ? next : '' }) })] }), _jsxs(PanelBody, { title: __('Barvy', 'brilo-blocks'), children: [_jsx("p", { children: __('Pozadí', 'brilo-blocks') }), _jsx(ColorPalette, { colors: paletteColors, value: background || undefined, onChange: (value) => setAttributes({ background: value !== null && value !== void 0 ? value : '' }) }), _jsx("p", { children: __('Barva textu', 'brilo-blocks') }), _jsx(ColorPalette, { colors: paletteColors, value: textColor || undefined, onChange: (value) => setAttributes({ textColor: value !== null && value !== void 0 ? value : '' }) }), !!background && !!textColor && _jsx(ContrastChecker, { backgroundColor: resolveHex(background), textColor: resolveHex(textColor) })] })] }));
13
+ }
@@ -0,0 +1,4 @@
1
+ import type { BlockEditProps } from '@wordpress/blocks';
2
+ import type { BoxAttributes, BoxOptions } from './types';
3
+ export declare function createBoxEdit(options: BoxOptions): ({ attributes, setAttributes }: BlockEditProps<BoxAttributes>) => import("react").JSX.Element;
4
+ //# sourceMappingURL=edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/layout/box/edit.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAGrD,OAAO,KAAK,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,SAAS,CAAA;AAEtD,wBAAgB,aAAa,CAAC,OAAO,EAAE,UAAU,mCACG,cAAc,CAAC,aAAa,CAAC,iCA4ChF"}
@@ -0,0 +1,35 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { InspectorControls, useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
3
+ import { BoxControls } from './controls';
4
+ export function createBoxEdit(options) {
5
+ return function Edit({ attributes, setAttributes }) {
6
+ var _a, _b;
7
+ const { padding, margin, borderRadius, borderWidth, borderColor, background, textColor } = attributes;
8
+ const style = {
9
+ ...((padding === null || padding === void 0 ? void 0 : padding.top) && { paddingTop: padding.top }),
10
+ ...((padding === null || padding === void 0 ? void 0 : padding.right) && { paddingRight: padding.right }),
11
+ ...((padding === null || padding === void 0 ? void 0 : padding.bottom) && { paddingBottom: padding.bottom }),
12
+ ...((padding === null || padding === void 0 ? void 0 : padding.left) && { paddingLeft: padding.left }),
13
+ ...((margin === null || margin === void 0 ? void 0 : margin.top) && { marginTop: margin.top }),
14
+ ...((margin === null || margin === void 0 ? void 0 : margin.right) && { marginRight: margin.right }),
15
+ ...((margin === null || margin === void 0 ? void 0 : margin.bottom) && { marginBottom: margin.bottom }),
16
+ ...((margin === null || margin === void 0 ? void 0 : margin.left) && { marginLeft: margin.left }),
17
+ ...(typeof borderRadius === 'string' && borderRadius && { borderRadius }),
18
+ ...(typeof borderRadius === 'object' && borderRadius !== null
19
+ ? {
20
+ ...(borderRadius.topLeft && { borderTopLeftRadius: borderRadius.topLeft }),
21
+ ...(borderRadius.topRight && { borderTopRightRadius: borderRadius.topRight }),
22
+ ...(borderRadius.bottomLeft && { borderBottomLeftRadius: borderRadius.bottomLeft }),
23
+ ...(borderRadius.bottomRight && { borderBottomRightRadius: borderRadius.bottomRight }),
24
+ }
25
+ : {}),
26
+ ...(borderWidth && { borderWidth, borderStyle: 'solid' }),
27
+ ...(borderColor && { borderColor }),
28
+ ...(background && { backgroundColor: background }),
29
+ ...(textColor && { color: textColor }),
30
+ };
31
+ const blockProps = useBlockProps({ className: (_a = options.blockClassName) !== null && _a !== void 0 ? _a : 'g-box', style });
32
+ const innerBlocksProps = useInnerBlocksProps({ className: (_b = options.containerClassName) !== null && _b !== void 0 ? _b : 'g-box__inner' }, { allowedBlocks: options.allowedBlocks, template: options.template, templateLock: false });
33
+ return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsx(BoxControls, { attributes: attributes, setAttributes: setAttributes }) }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
34
+ };
35
+ }
@@ -0,0 +1,4 @@
1
+ import type { BlockConfiguration } from '@wordpress/blocks';
2
+ import type { BoxAttributes, BoxOptions } from './types';
3
+ export declare function createBoxBlock(options: BoxOptions): BlockConfiguration<BoxAttributes>;
4
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/layout/box/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAIzD,OAAO,KAAK,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,SAAS,CAAA;AAEtD,wBAAgB,cAAc,CAAC,OAAO,EAAE,UAAU,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAuBrF"}
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { InnerBlocks } from '@wordpress/block-editor';
3
+ import { __ } from '@wordpress/i18n';
4
+ import { createBoxEdit } from './edit';
5
+ import { icon as defaultIcon } from './icon';
6
+ export function createBoxBlock(options) {
7
+ var _a, _b, _c, _d;
8
+ return {
9
+ name: options.name,
10
+ title: (_a = options.title) !== null && _a !== void 0 ? _a : __('Box', 'brilo-blocks'),
11
+ description: (_b = options.description) !== null && _b !== void 0 ? _b : __('Obecné pouzdro pro libovolný obsah s vlastním paddingem, marginem, ohraničením a barvami.', 'brilo-blocks'),
12
+ category: (_c = options.category) !== null && _c !== void 0 ? _c : 'layout',
13
+ icon: (_d = options.icon) !== null && _d !== void 0 ? _d : { src: defaultIcon },
14
+ ...(options.parent && { parent: options.parent }),
15
+ supports: { html: false, customClassName: false },
16
+ attributes: {
17
+ padding: { type: 'object', default: {} },
18
+ margin: { type: 'object', default: {} },
19
+ borderRadius: { type: ['string', 'object'], default: '' },
20
+ borderWidth: { type: 'string', default: '' },
21
+ borderColor: { type: 'string', default: '' },
22
+ background: { type: 'string', default: '' },
23
+ textColor: { type: 'string', default: '' },
24
+ },
25
+ edit: createBoxEdit(options),
26
+ save: () => _jsx(InnerBlocks.Content, {}),
27
+ };
28
+ }
@@ -0,0 +1,2 @@
1
+ export declare const icon: import("react").JSX.Element;
2
+ //# sourceMappingURL=icon.d.ts.map