@brilo/base-blocks 0.1.8 → 0.1.10

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 (158) hide show
  1. package/build/blocks/column/column-item/constants.d.ts +13 -0
  2. package/build/blocks/column/column-item/constants.d.ts.map +1 -1
  3. package/build/blocks/column/column-item/constants.js +19 -0
  4. package/build/blocks/column/column-item/edit.d.ts.map +1 -1
  5. package/build/blocks/column/column-item/edit.js +6 -6
  6. package/build/blocks/column/column-item/factory.d.ts.map +1 -1
  7. package/build/blocks/column/column-item/factory.js +5 -0
  8. package/build/blocks/column/column-item/index.d.ts.map +1 -1
  9. package/build/blocks/column/column-item/index.js +11 -1
  10. package/build/blocks/column/column-item/types.d.ts +1 -0
  11. package/build/blocks/column/column-item/types.d.ts.map +1 -1
  12. package/build/blocks/contact/contact-item/factory.d.ts +7 -2
  13. package/build/blocks/contact/contact-item/factory.d.ts.map +1 -1
  14. package/build/blocks/contact/contact-item/factory.js +2 -2
  15. package/build/blocks/core/basic-button/edit.d.ts.map +1 -1
  16. package/build/blocks/core/basic-button/edit.js +12 -5
  17. package/build/blocks/core/basic-button/factory.d.ts.map +1 -1
  18. package/build/blocks/core/basic-button/factory.js +4 -0
  19. package/build/blocks/core/basic-button/index.d.ts.map +1 -1
  20. package/build/blocks/core/basic-button/index.js +2 -0
  21. package/build/blocks/core/basic-button/types.d.ts +12 -1
  22. package/build/blocks/core/basic-button/types.d.ts.map +1 -1
  23. package/build/blocks/gallery/gallery-group/constants.d.ts +21 -0
  24. package/build/blocks/gallery/gallery-group/constants.d.ts.map +1 -0
  25. package/build/blocks/gallery/gallery-group/constants.js +9 -0
  26. package/build/blocks/gallery/gallery-group/edit.d.ts +7 -0
  27. package/build/blocks/gallery/gallery-group/edit.d.ts.map +1 -0
  28. package/build/blocks/gallery/gallery-group/edit.js +46 -0
  29. package/build/blocks/gallery/gallery-group/factory.d.ts +5 -0
  30. package/build/blocks/gallery/gallery-group/factory.d.ts.map +1 -0
  31. package/build/blocks/gallery/gallery-group/factory.js +33 -0
  32. package/build/blocks/gallery/gallery-group/index.d.ts +5 -0
  33. package/build/blocks/gallery/gallery-group/index.d.ts.map +1 -0
  34. package/build/blocks/gallery/gallery-group/index.js +7 -0
  35. package/build/blocks/gallery/gallery-group/types.d.ts +15 -0
  36. package/build/blocks/gallery/gallery-group/types.d.ts.map +1 -0
  37. package/build/blocks/gallery/gallery-group/types.js +1 -0
  38. package/build/blocks/gallery/gallery-item/edit.d.ts +6 -0
  39. package/build/blocks/gallery/gallery-item/edit.d.ts.map +1 -0
  40. package/build/blocks/gallery/gallery-item/edit.js +13 -0
  41. package/build/blocks/gallery/gallery-item/factory.d.ts +5 -0
  42. package/build/blocks/gallery/gallery-item/factory.d.ts.map +1 -0
  43. package/build/blocks/gallery/gallery-item/factory.js +22 -0
  44. package/build/blocks/gallery/gallery-item/index.d.ts +5 -0
  45. package/build/blocks/gallery/gallery-item/index.d.ts.map +1 -0
  46. package/build/blocks/gallery/gallery-item/index.js +6 -0
  47. package/build/blocks/gallery/gallery-item/types.d.ts +7 -0
  48. package/build/blocks/gallery/gallery-item/types.d.ts.map +1 -0
  49. package/build/blocks/gallery/gallery-item/types.js +1 -0
  50. package/build/blocks/link/link-item/edit.d.ts.map +1 -1
  51. package/build/blocks/link/link-item/edit.js +2 -2
  52. package/build/blocks/link/link-item/factory.d.ts.map +1 -1
  53. package/build/blocks/link/link-item/factory.js +1 -0
  54. package/build/blocks/link/link-item/types.d.ts +1 -0
  55. package/build/blocks/link/link-item/types.d.ts.map +1 -1
  56. package/build/blocks/map/map-group/constants.js +1 -1
  57. package/build/blocks/map/map-group/edit.d.ts.map +1 -1
  58. package/build/blocks/map/map-group/edit.js +4 -4
  59. package/build/blocks/map/map-group/factory.d.ts +2 -2
  60. package/build/blocks/map/map-group/factory.d.ts.map +1 -1
  61. package/build/blocks/map/map-group/factory.js +3 -3
  62. package/build/blocks/map/map-group/index.js +1 -1
  63. package/build/blocks/map/map-group/types.d.ts +1 -1
  64. package/build/blocks/map/map-group/types.d.ts.map +1 -1
  65. package/build/blocks/person/person-group/constants.d.ts +3 -0
  66. package/build/blocks/person/person-group/constants.d.ts.map +1 -0
  67. package/build/blocks/person/person-group/constants.js +2 -0
  68. package/build/blocks/person/person-group/edit.d.ts +6 -0
  69. package/build/blocks/person/person-group/edit.d.ts.map +1 -0
  70. package/build/blocks/person/person-group/edit.js +23 -0
  71. package/build/blocks/person/person-group/factory.d.ts +5 -0
  72. package/build/blocks/person/person-group/factory.d.ts.map +1 -0
  73. package/build/blocks/person/person-group/factory.js +32 -0
  74. package/build/blocks/person/person-group/icon.d.ts +2 -0
  75. package/build/blocks/person/person-group/icon.d.ts.map +1 -0
  76. package/build/blocks/person/person-group/icon.js +2 -0
  77. package/build/blocks/person/person-group/index.d.ts +5 -0
  78. package/build/blocks/person/person-group/index.d.ts.map +1 -0
  79. package/build/blocks/person/person-group/index.js +11 -0
  80. package/build/blocks/person/person-group/types.d.ts +8 -0
  81. package/build/blocks/person/person-group/types.d.ts.map +1 -0
  82. package/build/blocks/person/person-group/types.js +1 -0
  83. package/build/blocks/person/person-item/constants.d.ts +2 -0
  84. package/build/blocks/person/person-item/constants.d.ts.map +1 -0
  85. package/build/blocks/person/person-item/constants.js +1 -0
  86. package/build/blocks/person/person-item/edit.d.ts +6 -0
  87. package/build/blocks/person/person-item/edit.d.ts.map +1 -0
  88. package/build/blocks/person/person-item/edit.js +23 -0
  89. package/build/blocks/person/person-item/factory.d.ts +5 -0
  90. package/build/blocks/person/person-item/factory.d.ts.map +1 -0
  91. package/build/blocks/person/person-item/factory.js +26 -0
  92. package/build/blocks/person/person-item/icon.d.ts +2 -0
  93. package/build/blocks/person/person-item/icon.d.ts.map +1 -0
  94. package/build/blocks/person/person-item/icon.js +3 -0
  95. package/build/blocks/person/person-item/index.d.ts +5 -0
  96. package/build/blocks/person/person-item/index.d.ts.map +1 -0
  97. package/build/blocks/person/person-item/index.js +6 -0
  98. package/build/blocks/person/person-item/types.d.ts +12 -0
  99. package/build/blocks/person/person-item/types.d.ts.map +1 -0
  100. package/build/blocks/person/person-item/types.js +1 -0
  101. package/build/components/ImagePicker/ImagePicker.d.ts +5 -0
  102. package/build/components/ImagePicker/ImagePicker.d.ts.map +1 -1
  103. package/build/components/ImagePicker/ImagePicker.js +18 -11
  104. package/build/index.d.ts +10 -0
  105. package/build/index.d.ts.map +1 -1
  106. package/build/index.js +5 -0
  107. package/build/types.d.ts +2 -0
  108. package/build/types.d.ts.map +1 -1
  109. package/package.json +1 -1
  110. package/src/blocks/column/column-item/constants.ts +20 -0
  111. package/src/blocks/column/column-item/edit.tsx +20 -4
  112. package/src/blocks/column/column-item/factory.tsx +5 -0
  113. package/src/blocks/column/column-item/index.ts +11 -1
  114. package/src/blocks/column/column-item/types.ts +1 -0
  115. package/src/blocks/contact/contact-item/editor.scss +4 -0
  116. package/src/blocks/contact/contact-item/factory.tsx +13 -5
  117. package/src/blocks/core/basic-button/edit.tsx +50 -1
  118. package/src/blocks/core/basic-button/factory.tsx +4 -0
  119. package/src/blocks/core/basic-button/index.ts +2 -0
  120. package/src/blocks/core/basic-button/types.ts +13 -1
  121. package/src/blocks/gallery/gallery-group/constants.ts +10 -0
  122. package/src/blocks/gallery/gallery-group/edit.tsx +117 -0
  123. package/src/blocks/gallery/gallery-group/editor.scss +18 -0
  124. package/src/blocks/gallery/gallery-group/factory.tsx +36 -0
  125. package/src/blocks/gallery/gallery-group/index.ts +11 -0
  126. package/src/blocks/gallery/gallery-group/types.ts +21 -0
  127. package/src/blocks/gallery/gallery-item/edit.tsx +46 -0
  128. package/src/blocks/gallery/gallery-item/editor.scss +8 -0
  129. package/src/blocks/gallery/gallery-item/factory.tsx +26 -0
  130. package/src/blocks/gallery/gallery-item/index.ts +10 -0
  131. package/src/blocks/gallery/gallery-item/types.ts +7 -0
  132. package/src/blocks/link/link-item/edit.tsx +9 -1
  133. package/src/blocks/link/link-item/factory.tsx +1 -0
  134. package/src/blocks/link/link-item/types.ts +1 -0
  135. package/src/blocks/map/map-group/constants.ts +1 -1
  136. package/src/blocks/map/map-group/edit.tsx +14 -10
  137. package/src/blocks/map/map-group/factory.tsx +5 -5
  138. package/src/blocks/map/map-group/index.ts +1 -1
  139. package/src/blocks/map/map-group/types.ts +2 -4
  140. package/src/blocks/person/person-group/constants.ts +2 -0
  141. package/src/blocks/person/person-group/edit.tsx +65 -0
  142. package/src/blocks/person/person-group/editor.scss +0 -0
  143. package/src/blocks/person/person-group/factory.tsx +35 -0
  144. package/src/blocks/person/person-group/icon.tsx +14 -0
  145. package/src/blocks/person/person-group/index.ts +15 -0
  146. package/src/blocks/person/person-group/types.ts +8 -0
  147. package/src/blocks/person/person-item/constants.ts +4 -0
  148. package/src/blocks/person/person-item/edit.tsx +103 -0
  149. package/src/blocks/person/person-item/editor.scss +35 -0
  150. package/src/blocks/person/person-item/factory.tsx +29 -0
  151. package/src/blocks/person/person-item/icon.tsx +7 -0
  152. package/src/blocks/person/person-item/index.ts +10 -0
  153. package/src/blocks/person/person-item/types.ts +12 -0
  154. package/src/components/ImagePicker/ImagePicker.tsx +22 -10
  155. package/src/components/ImagePicker/editor.scss +2 -2
  156. package/src/editor.scss +4 -0
  157. package/src/index.ts +10 -0
  158. package/src/types.ts +3 -0
@@ -1,2 +1,15 @@
1
1
  export declare const SIZES: string[];
2
+ export declare const ALIGN: ({
3
+ value: string;
4
+ label: import("@wordpress/i18n").TransformedText<"Nahoru">;
5
+ icon: import("react").JSX.Element;
6
+ } | {
7
+ value: string;
8
+ label: import("@wordpress/i18n").TransformedText<"Uprostřed">;
9
+ icon: import("react").JSX.Element;
10
+ } | {
11
+ value: string;
12
+ label: import("@wordpress/i18n").TransformedText<"Dolu">;
13
+ icon: import("react").JSX.Element;
14
+ })[];
2
15
  //# 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":"AAAA,eAAO,MAAM,KAAK,UAA6C,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK,UAA6C,CAAA;AAC/D,eAAO,MAAM,KAAK;;;;;;;;;;;;IAgBjB,CAAA"}
@@ -1 +1,20 @@
1
+ import { __ } from '@wordpress/i18n';
2
+ import { justifyTop, justifyCenterVertical, justifyBottom } from '@wordpress/icons';
1
3
  export const SIZES = ['1/4', '1/3', '1/2', '2/3', '3/4', '1/1'];
4
+ export const ALIGN = [
5
+ {
6
+ value: 'top',
7
+ label: __('Nahoru', 'brilo-blocks'),
8
+ icon: justifyTop,
9
+ },
10
+ {
11
+ value: 'center',
12
+ label: __('Uprostřed', 'brilo-blocks'),
13
+ icon: justifyCenterVertical,
14
+ },
15
+ {
16
+ value: 'bottom',
17
+ label: __('Dolu', 'brilo-blocks'),
18
+ icon: justifyBottom,
19
+ },
20
+ ];
@@ -1 +1 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/column/column-item/edit.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAGpE,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,iCAgCF"}
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,iCA0CF"}
@@ -1,21 +1,21 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { InspectorControls } from '@wordpress/block-editor';
3
- import { PanelBody, RangeControl } from '@wordpress/components';
3
+ import { PanelBody, RangeControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon, } from '@wordpress/components';
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import clsx from 'clsx';
6
6
  import { useGroupBlock } from '../../../hooks/useGroupBlock';
7
- import { SIZES } from './constants';
7
+ import { ALIGN, SIZES } from './constants';
8
8
  export function createColumnItemEdit(options) {
9
9
  return function Edit({ attributes, setAttributes, }) {
10
10
  var _a, _b;
11
- const { size } = attributes;
11
+ const { size, align } = attributes;
12
12
  const { blockProps, innerBlocksProps } = useGroupBlock({
13
- blockClassName: clsx((_a = options.blockClassName) !== null && _a !== void 0 ? _a : 'i-column', `--size-${size}`),
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',
15
15
  allowedBlocks: options.allowedBlocks,
16
16
  template: options.template,
17
17
  });
18
18
  const sizeIndex = SIZES.indexOf(size);
19
- return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsx(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("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
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: __('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("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;AAEpE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,iBAAiB,GAAG,kBAAkB,CAAC,oBAAoB,CAAC,CAkB1G"}
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,CAsB1G"}
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { InnerBlocks } from '@wordpress/block-editor';
3
3
  import { __ } from '@wordpress/i18n';
4
4
  import { createColumnItemEdit } from './edit';
5
+ import { ALIGN } from './constants';
5
6
  export function createColumnItemBlock(options) {
6
7
  var _a, _b, _c;
7
8
  return {
@@ -17,6 +18,10 @@ export function createColumnItemBlock(options) {
17
18
  type: 'string',
18
19
  default: '1/2',
19
20
  },
21
+ align: {
22
+ type: 'string',
23
+ default: ALIGN[0],
24
+ },
20
25
  },
21
26
  edit: createColumnItemEdit(options),
22
27
  save: () => _jsx(InnerBlocks.Content, {}),
@@ -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,iBAIhC,CAAA"}
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,iBAchC,CAAA"}
@@ -2,5 +2,15 @@ export { createColumnItemBlock } from './factory';
2
2
  export const columnItemDefaults = {
3
3
  name: 'brilo/column-item',
4
4
  parent: ['brilo/column-group'],
5
- allowedBlocks: ['core/paragraph', 'core/list', 'core/image', 'core/heading', 'core/embed', 'core/quote', 'core/table', 'core/gallery'],
5
+ allowedBlocks: [
6
+ 'core/paragraph',
7
+ 'core/list',
8
+ 'core/image',
9
+ 'core/heading',
10
+ 'core/embed',
11
+ 'core/quote',
12
+ 'core/table',
13
+ 'core/gallery',
14
+ 'brilo/link-item',
15
+ ],
6
16
  };
@@ -1,6 +1,7 @@
1
1
  import type { BriloBlockType } from '../../../types';
2
2
  export interface ColumnItemAttributes extends Record<string, unknown> {
3
3
  size: string;
4
+ align: string;
4
5
  }
5
6
  export interface ColumnItemOptions extends BriloBlockType {
6
7
  }
@@ -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;CACb;AAED,MAAM,WAAW,iBAAkB,SAAQ,cAAc;CAAG"}
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;CACd;AAED,MAAM,WAAW,iBAAkB,SAAQ,cAAc;CAAG"}
@@ -1,5 +1,10 @@
1
- import type { BlockConfiguration } from '@wordpress/blocks';
1
+ import type { BlockConfiguration, BlockEditProps } from '@wordpress/blocks';
2
+ import type { IconType } from '../../../components/IconControl/IconControl';
2
3
  import type { ContactItemAttributes, ContactItemOptions } from './types';
3
4
  export type { ContactItemAttributes, ContactItemOptions };
4
- export declare function createContactItemBlock(options: ContactItemOptions): BlockConfiguration<ContactItemAttributes>;
5
+ export declare function createContactItemBlock<T extends ContactItemAttributes = ContactItemAttributes>(options: ContactItemOptions & {
6
+ icons: IconType[];
7
+ iconsSrc: string;
8
+ edit: (props: BlockEditProps<T>) => JSX.Element;
9
+ }): BlockConfiguration<T>;
5
10
  //# sourceMappingURL=factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/contact/contact-item/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAKzD,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAEtE,YAAY,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,CAAA;AAEvD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,CAwB7G"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/contact/contact-item/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAGzE,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,sCAAsC,CAAA;AAGlE,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAEtE,YAAY,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,CAAA;AAEvD,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,EAC5F,OAAO,EAAE,kBAAkB,GAAG;IAC5B,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,CAAA;CAChD,GACA,kBAAkB,CAAC,CAAC,CAAC,CAyBvB"}
@@ -3,7 +3,6 @@ import { InnerBlocks } from '@wordpress/block-editor';
3
3
  import { __ } from '@wordpress/i18n';
4
4
  import { CONTACT_COLUMNS_CONTEXT } from '../contact-group/constants';
5
5
  import { CONTACT_ICON_SIZE_DEFAULT, CONTACT_ICON_TYPES } from './constants';
6
- import { createContactItemEdit } from './edit';
7
6
  export function createContactItemBlock(options) {
8
7
  var _a, _b, _c;
9
8
  return {
@@ -16,6 +15,7 @@ export function createContactItemBlock(options) {
16
15
  supports: { html: false, customClassName: false },
17
16
  usesContext: [CONTACT_COLUMNS_CONTEXT],
18
17
  attributes: {
18
+ ...options.attributes,
19
19
  colSpan: { type: 'number', default: 1 },
20
20
  icon: {
21
21
  type: 'object',
@@ -26,7 +26,7 @@ export function createContactItemBlock(options) {
26
26
  default: { variant: 'md', custom: CONTACT_ICON_SIZE_DEFAULT },
27
27
  },
28
28
  },
29
- edit: createContactItemEdit(options),
29
+ edit: options.edit,
30
30
  save: () => _jsx(InnerBlocks.Content, {}),
31
31
  };
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/core/basic-button/edit.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAA6C,MAAM,SAAS,CAAA;AAElH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,kBAAkB,IAK1C,gCAGlB;IACD,UAAU,EAAE,qBAAqB,CAAA;IACjC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAAA;CAC3D,iCAkFF"}
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/core/basic-button/edit.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAA6C,MAAM,SAAS,CAAA;AAIlH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,kBAAkB,IAK1C,gCAGlB;IACD,UAAU,EAAE,qBAAqB,CAAA;IACjC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAAA;CAC3D,iCAgIF"}
@@ -1,20 +1,27 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { InspectorControls, RichText, useBlockProps } from '@wordpress/block-editor';
3
- import { PanelBody, TextControl, ToggleControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from '@wordpress/components';
3
+ import { PanelBody, TextControl, ToggleControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, RangeControl, } from '@wordpress/components';
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import clsx from 'clsx';
6
6
  import { DEFAULT_FULL_WIDTH_OPTIONS, DEFAULT_SIZES, DEFAULT_VARIANTS } from './constants';
7
+ import { ItemIconControl, ItemIconPreview } from '../../../components/ItemIconControl';
8
+ import { ICON_TYPES } from '../../../blocks/link/link-item/constants';
7
9
  export function createBasicButtonEdit(options) {
8
10
  var _a, _b, _c;
9
11
  const VARIANTS = (_a = options.variants) !== null && _a !== void 0 ? _a : DEFAULT_VARIANTS;
10
12
  const SIZES = (_b = options.sizes) !== null && _b !== void 0 ? _b : DEFAULT_SIZES;
11
13
  const FULL_WIDTH_OPTIONS = (_c = options.fullWidthOptions) !== null && _c !== void 0 ? _c : DEFAULT_FULL_WIDTH_OPTIONS;
12
14
  return function Edit({ attributes, setAttributes, }) {
13
- var _a;
14
- const { title, variant, outline, fullWidth, size, url } = attributes;
15
+ var _a, _b;
16
+ const { title, variant, outline, fullWidth, size, url, icon } = attributes;
17
+ const hasIcon = icon.type !== 'none' && (icon.src || ((_a = icon.media) === null || _a === void 0 ? void 0 : _a.id));
18
+ const setIconBase = (attrs) => {
19
+ setAttributes({ icon: { ...icon, ...attrs.icon } });
20
+ };
15
21
  const blockProps = useBlockProps({
16
- className: clsx((_a = options.blockClassName) !== null && _a !== void 0 ? _a : 'i-button', `--variant-${variant}`, `--size-${size}`, outline && '--outline', fullWidth !== 'false' && `--full-width-${fullWidth}`),
22
+ className: clsx((_b = options.blockClassName) !== null && _b !== void 0 ? _b : 'i-button', `--variant-${variant}`, `--size-${size}`, outline && '--outline', fullWidth !== 'false' && `--full-width-${fullWidth}`),
17
23
  });
18
- return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Tlačítko', 'brilo-blocks'), children: [_jsx(TextControl, { label: __('Text tlačítka', 'brilo-blocks'), value: title, onChange: (value) => setAttributes({ title: value }), placeholder: __('Text tlačítka...', 'brilo-blocks') }), _jsx(ToggleGroupControl, { label: __('Varianta', 'brilo-blocks'), value: variant, onChange: (value) => setAttributes({ variant: value }), isBlock: true, children: VARIANTS.map((v) => (_jsx(ToggleGroupControlOption, { value: v.value, label: v.label }, v.value))) }), _jsx(ToggleControl, { label: __('Outline', 'brilo-blocks'), checked: outline, onChange: (value) => setAttributes({ outline: value }) }), _jsx(ToggleGroupControl, { label: __('Velikost', 'brilo-blocks'), value: size, onChange: (value) => setAttributes({ size: value }), isBlock: true, children: SIZES.map((s) => (_jsx(ToggleGroupControlOption, { value: s.value, label: s.label }, s.value))) }), _jsx(ToggleGroupControl, { label: __('Celá šířka', 'brilo-blocks'), value: fullWidth, onChange: (value) => setAttributes({ fullWidth: value }), isBlock: true, children: FULL_WIDTH_OPTIONS.map((o) => (_jsx(ToggleGroupControlOption, { value: o.value, label: o.label }, o.value))) })] }), _jsxs(PanelBody, { title: __('Odkaz', 'brilo-blocks'), children: [_jsx(TextControl, { label: __('URL', 'brilo-blocks'), value: url.src, onChange: (value) => setAttributes({ url: { ...url, src: value } }) }), _jsx(ToggleControl, { label: __('Otevřít v nové záložce', 'brilo-blocks'), checked: url.blank, onChange: (value) => setAttributes({ url: { ...url, blank: value } }) })] })] }), _jsx("div", { ...blockProps, children: _jsx("div", { className: "i-button__inner", children: _jsx(RichText, { tagName: "span", className: "i-button__label", value: title, onChange: (value) => setAttributes({ title: value }), placeholder: __('Text tlačítka...', 'brilo-blocks'), allowedFormats: [] }) }) })] }));
24
+ const iconPreviewStyle = { maxWidth: icon.size, flex: `0 0 ${icon.size}px` };
25
+ return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Tlačítko', 'brilo-blocks'), children: [_jsx(TextControl, { label: __('Text tlačítka', 'brilo-blocks'), value: title, onChange: (value) => setAttributes({ title: value }), placeholder: __('Text tlačítka...', 'brilo-blocks') }), _jsx(ToggleGroupControl, { label: __('Varianta', 'brilo-blocks'), value: variant, onChange: (value) => setAttributes({ variant: value }), isBlock: true, children: VARIANTS.map((v) => (_jsx(ToggleGroupControlOption, { value: v.value, label: v.label }, v.value))) }), _jsx(ToggleControl, { label: __('Outline', 'brilo-blocks'), checked: outline, onChange: (value) => setAttributes({ outline: value }) }), _jsx(ToggleGroupControl, { label: __('Velikost', 'brilo-blocks'), value: size, onChange: (value) => setAttributes({ size: value }), isBlock: true, children: SIZES.map((s) => (_jsx(ToggleGroupControlOption, { value: s.value, label: s.label }, s.value))) }), _jsx(ToggleGroupControl, { label: __('Celá šířka', 'brilo-blocks'), value: fullWidth, onChange: (value) => setAttributes({ fullWidth: value }), isBlock: true, children: FULL_WIDTH_OPTIONS.map((o) => (_jsx(ToggleGroupControlOption, { value: o.value, label: o.label }, o.value))) })] }), _jsxs(PanelBody, { title: __('Odkaz', 'brilo-blocks'), children: [_jsx(TextControl, { label: __('URL', 'brilo-blocks'), value: url.src, onChange: (value) => setAttributes({ url: { ...url, src: value } }) }), _jsx(ToggleControl, { label: __('Otevřít v nové záložce', 'brilo-blocks'), checked: url.blank, onChange: (value) => setAttributes({ url: { ...url, blank: value } }) })] }), _jsxs(PanelBody, { title: __('Ikona', 'brilo-blocks'), initialOpen: false, children: [_jsx(ItemIconControl, { icon: icon, setAttributes: setIconBase, iconTypes: ICON_TYPES, options: options }), hasIcon && (_jsxs(_Fragment, { children: [_jsxs(ToggleGroupControl, { isBlock: true, label: __('Pozice', 'brilo-blocks'), value: icon.position, onChange: (v) => setAttributes({ icon: { ...icon, position: String(v) } }), children: [_jsx(ToggleGroupControlOption, { value: "before", label: __('Před', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "after", label: __('Za', 'brilo-blocks') })] }), _jsx(RangeControl, { label: __('Velikost (px)', 'brilo-blocks'), value: icon.size, onChange: (v) => setAttributes({ icon: { ...icon, size: v !== null && v !== void 0 ? v : 24 } }), min: 8, max: 80, step: 1 })] }))] })] }), _jsxs("div", { ...blockProps, children: [hasIcon && icon.position === 'before' && (_jsx("span", { className: "link-item__icon", style: iconPreviewStyle, children: _jsx(ItemIconPreview, { icon: icon, setAttributes: setIconBase, options: options }) })), _jsx("div", { className: "i-button__inner", children: _jsx(RichText, { tagName: "span", className: "i-button__label", value: title, onChange: (value) => setAttributes({ title: value }), placeholder: __('Text tlačítka...', 'brilo-blocks'), allowedFormats: [] }) }), hasIcon && icon.position === 'after' && (_jsx("span", { className: "link-item__icon", style: iconPreviewStyle, children: _jsx(ItemIconPreview, { icon: icon, setAttributes: setIconBase, options: options }) }))] })] }));
19
26
  };
20
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/core/basic-button/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAEzD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AACxC,OAAO,EAAC,0BAA0B,EAAE,aAAa,EAAE,gBAAgB,EAAC,MAAM,aAAa,CAAA;AAEvF,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAEtE,YAAY,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,CAAA;AAEvD,wBAAgB,sBAAsB,CACpC,SAAS,SAAS,WAAW,GAAG,OAAO,gBAAgB,EACvD,MAAM,SAAS,WAAW,GAAG,OAAO,aAAa,EACjD,iBAAiB,SAAS,WAAW,GAAG,OAAO,0BAA0B,EAEzE,OAAO,EAAE,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,iBAAiB,CAAC,GAChE,kBAAkB,CAAC,qBAAqB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAsCpI"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/core/basic-button/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAEzD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AACxC,OAAO,EAAC,0BAA0B,EAAE,aAAa,EAAE,gBAAgB,EAAC,MAAM,aAAa,CAAA;AAEvF,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAEtE,YAAY,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,CAAA;AAEvD,wBAAgB,sBAAsB,CACpC,SAAS,SAAS,WAAW,GAAG,OAAO,gBAAgB,EACvD,MAAM,SAAS,WAAW,GAAG,OAAO,aAAa,EACjD,iBAAiB,SAAS,WAAW,GAAG,OAAO,0BAA0B,EAEzE,OAAO,EAAE,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,iBAAiB,CAAC,GAChE,kBAAkB,CAAC,qBAAqB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CA0CpI"}
@@ -33,6 +33,10 @@ export function createBasicButtonBlock(options) {
33
33
  enum: sizes.map((s) => s.value),
34
34
  },
35
35
  url: { type: 'object', default: { src: '', blank: false } },
36
+ icon: {
37
+ type: 'object',
38
+ default: { type: 'none', src: '', media: {}, position: 'after', size: 24 },
39
+ },
36
40
  },
37
41
  edit: createBasicButtonEdit(options),
38
42
  save: () => null,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/core/basic-button/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,kBAEjC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/core/basic-button/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,4 +1,6 @@
1
1
  export { createBasicButtonBlock } from './factory';
2
2
  export const basicButtonDefaults = {
3
3
  name: 'brilo/basic-button',
4
+ icons: [],
5
+ iconsSrc: '',
4
6
  };
@@ -1,14 +1,23 @@
1
- import type { BriloBlockType, OptionArray } from '../../../types';
1
+ import type { BriloBlockType, Media, OptionArray } from '../../../types';
2
2
  import type { DEFAULT_FULL_WIDTH_OPTIONS, DEFAULT_SIZES, DEFAULT_VARIANTS } from './constants';
3
+ import type { IconType } from '../../../components/IconControl/IconControl';
3
4
  export type ButtonVariant = (typeof DEFAULT_VARIANTS)[number]['value'];
4
5
  export type ButtonSize = (typeof DEFAULT_SIZES)[number]['value'];
5
6
  export type ButtonFullWidth = (typeof DEFAULT_FULL_WIDTH_OPTIONS)[number]['value'];
7
+ export interface LinkItemIcon {
8
+ type: 'preselected' | 'media' | 'none';
9
+ src: string;
10
+ media: Media;
11
+ position: 'before' | 'after';
12
+ size: number;
13
+ }
6
14
  export interface BasicButtonAttributes<TVariant extends string = ButtonVariant, TSize extends string = ButtonSize, TFullWidth extends string = ButtonFullWidth> extends Record<string, unknown> {
7
15
  title: string;
8
16
  variant: TVariant;
9
17
  outline: boolean;
10
18
  fullWidth: TFullWidth;
11
19
  size: TSize;
20
+ icon: LinkItemIcon;
12
21
  url: {
13
22
  src: string;
14
23
  blank: boolean;
@@ -18,5 +27,7 @@ export interface BasicButtonOptions<TVariants extends OptionArray = typeof DEFAU
18
27
  variants?: TVariants;
19
28
  sizes?: TSizes;
20
29
  fullWidthOptions?: TFullWidthOptions;
30
+ icons: IconType[];
31
+ iconsSrc: string;
21
32
  }
22
33
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/core/basic-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AACxD,OAAO,KAAK,EAAC,0BAA0B,EAAE,aAAa,EAAE,gBAAgB,EAAC,MAAM,aAAa,CAAA;AAE5F,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AACtE,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAChE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAElF,MAAM,WAAW,qBAAqB,CACpC,QAAQ,SAAS,MAAM,GAAG,aAAa,EACvC,KAAK,SAAS,MAAM,GAAG,UAAU,EACjC,UAAU,SAAS,MAAM,GAAG,eAAe,CAC3C,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,QAAQ,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,UAAU,CAAA;IACrB,IAAI,EAAE,KAAK,CAAA;IACX,GAAG,EAAE;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAC,CAAA;CACnC;AAED,MAAM,WAAW,kBAAkB,CACjC,SAAS,SAAS,WAAW,GAAG,OAAO,gBAAgB,EACvD,MAAM,SAAS,WAAW,GAAG,OAAO,aAAa,EACjD,iBAAiB,SAAS,WAAW,GAAG,OAAO,0BAA0B,CACzE,SAAQ,cAAc;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gBAAgB,CAAC,EAAE,iBAAiB,CAAA;CACrC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/core/basic-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAE,KAAK,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AAC/D,OAAO,KAAK,EAAC,0BAA0B,EAAE,aAAa,EAAE,gBAAgB,EAAC,MAAM,aAAa,CAAA;AAC5F,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,sCAAsC,CAAA;AAElE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AACtE,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAChE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAElF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,aAAa,GAAG,OAAO,GAAG,MAAM,CAAA;IACtC,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,qBAAqB,CACpC,QAAQ,SAAS,MAAM,GAAG,aAAa,EACvC,KAAK,SAAS,MAAM,GAAG,UAAU,EACjC,UAAU,SAAS,MAAM,GAAG,eAAe,CAC3C,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,QAAQ,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,UAAU,CAAA;IACrB,IAAI,EAAE,KAAK,CAAA;IACX,IAAI,EAAE,YAAY,CAAA;IAClB,GAAG,EAAE;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAC,CAAA;CACnC;AAED,MAAM,WAAW,kBAAkB,CACjC,SAAS,SAAS,WAAW,GAAG,OAAO,gBAAgB,EACvD,MAAM,SAAS,WAAW,GAAG,OAAO,aAAa,EACjD,iBAAiB,SAAS,WAAW,GAAG,OAAO,0BAA0B,CACzE,SAAQ,cAAc;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gBAAgB,CAAC,EAAE,iBAAiB,CAAA;IACpC,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;CACjB"}
@@ -0,0 +1,21 @@
1
+ export declare const DEFAULT_COLUMNS: readonly [2, 3, 4, 6];
2
+ export declare const DEFAULT_RATIOS: readonly [{
3
+ readonly value: "4:3";
4
+ readonly label: "4:3";
5
+ }, {
6
+ readonly value: "16:9";
7
+ readonly label: "16:9";
8
+ }, {
9
+ readonly value: "3:2";
10
+ readonly label: "3:2";
11
+ }, {
12
+ readonly value: "1:1";
13
+ readonly label: "1:1";
14
+ }, {
15
+ readonly value: "2:1";
16
+ readonly label: "2:1";
17
+ }, {
18
+ readonly value: "3:4";
19
+ readonly label: "3:4";
20
+ }];
21
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-group/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,uBAAwB,CAAA;AAEpD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;EAOjB,CAAA"}
@@ -0,0 +1,9 @@
1
+ export const DEFAULT_COLUMNS = [2, 3, 4, 6];
2
+ export const DEFAULT_RATIOS = [
3
+ { value: '4:3', label: '4:3' },
4
+ { value: '16:9', label: '16:9' },
5
+ { value: '3:2', label: '3:2' },
6
+ { value: '1:1', label: '1:1' },
7
+ { value: '2:1', label: '2:1' },
8
+ { value: '3:4', label: '3:4' },
9
+ ];
@@ -0,0 +1,7 @@
1
+ import type { GalleryGroupAttributes, GalleryGroupOptions } from './types';
2
+ export declare function createGalleryGroupEdit(options: GalleryGroupOptions): ({ attributes, setAttributes, clientId, }: {
3
+ attributes: GalleryGroupAttributes;
4
+ setAttributes: (a: Partial<GalleryGroupAttributes>) => void;
5
+ clientId: string;
6
+ }) => import("react").JSX.Element;
7
+ //# sourceMappingURL=edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-group/edit.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAC,sBAAsB,EAAE,mBAAmB,EAAe,MAAM,SAAS,CAAA;AAOtF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,mBAAmB,IAI5C,0CAIlB;IACD,UAAU,EAAE,sBAAsB,CAAA;IAClC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAA;IAC3D,QAAQ,EAAE,MAAM,CAAA;CACjB,iCAoFF"}
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { InspectorControls, MediaUpload } from '@wordpress/block-editor';
3
+ import { PanelBody, TextControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from '@wordpress/components';
4
+ import { __ } from '@wordpress/i18n';
5
+ import { useDispatch } from '@wordpress/data';
6
+ import { createBlock } from '@wordpress/blocks';
7
+ import clsx from 'clsx';
8
+ import { useGroupBlock } from '../../../hooks/useGroupBlock';
9
+ import { DEFAULT_COLUMNS, DEFAULT_RATIOS } from './constants';
10
+ export function createGalleryGroupEdit(options) {
11
+ var _a, _b;
12
+ const COLUMNS = (_a = options.columns) !== null && _a !== void 0 ? _a : DEFAULT_COLUMNS;
13
+ const RATIOS = (_b = options.ratios) !== null && _b !== void 0 ? _b : DEFAULT_RATIOS;
14
+ return function Edit({ attributes, setAttributes, clientId, }) {
15
+ var _a, _b;
16
+ const { columns, ratio, galleryId } = attributes;
17
+ const { insertBlock } = useDispatch('core/block-editor');
18
+ const addNewBlock = (imageId) => {
19
+ const newBlock = createBlock(options.allowedBlocks[0], {
20
+ img: {
21
+ id: imageId,
22
+ },
23
+ });
24
+ insertBlock(newBlock, undefined, clientId);
25
+ };
26
+ const onSelectImages = (media) => {
27
+ media.forEach((item) => addNewBlock(item.id));
28
+ };
29
+ const CustomAppender = () => {
30
+ return (_jsx(MediaUpload, { onSelect: onSelectImages, multiple: "add", allowedTypes: ['image'], render: ({ open }) => (_jsx("div", { onClick: open, className: "g-gallery__appender", children: __('Přidat obrázky', 'brilo-blocks') })) }));
31
+ };
32
+ const { blockProps, innerBlocksProps } = useGroupBlock({
33
+ blockClassName: clsx((_a = options.blockClassName) !== null && _a !== void 0 ? _a : 'g-gallery wp-block-section'),
34
+ containerClassName: [(_b = options.containerClassName) !== null && _b !== void 0 ? _b : 'u-grid-responsive', `--cols-${columns}`],
35
+ containerStyle: {
36
+ '--grid-max-col-count': columns,
37
+ '--gallery-aspect-ratio': ratio.replace(':', '/'),
38
+ },
39
+ allowedBlocks: options.allowedBlocks,
40
+ renderAppender: CustomAppender,
41
+ template: options.template,
42
+ layout: { type: 'default' },
43
+ });
44
+ return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsxs(PanelBody, { title: __('Rozložení', 'brilo-blocks'), children: [_jsx(ToggleGroupControl, { isBlock: true, label: __('Počet sloupců', 'brilo-blocks'), value: String(columns), onChange: (v) => setAttributes({ columns: Number(v) }), children: COLUMNS.map((c) => (_jsx(ToggleGroupControlOption, { value: String(c), label: String(c) }, c))) }), _jsx(ToggleGroupControl, { isBlock: true, label: __('Poměr stran', 'brilo-blocks'), value: ratio, onChange: (v) => setAttributes({ ratio: v }), children: RATIOS.map((r) => (_jsx(ToggleGroupControlOption, { value: r.value, label: r.label }, r.value))) }), _jsx(TextControl, { label: __('Gallery ID', 'brilo-blocks'), value: galleryId, onChange: (v) => setAttributes({ galleryId: v }), help: __('ID pro oddělení/spojení galerií', 'brilo-blocks') })] }) }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
45
+ };
46
+ }
@@ -0,0 +1,5 @@
1
+ import type { BlockConfiguration } from '@wordpress/blocks';
2
+ import type { GalleryGroupAttributes, GalleryGroupOptions } from './types';
3
+ export type { GalleryGroupAttributes, GalleryGroupOptions };
4
+ export declare function createGalleryGroupBlock(options: GalleryGroupOptions): BlockConfiguration<GalleryGroupAttributes>;
5
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-group/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAIzD,OAAO,KAAK,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAA;AAGxE,YAAY,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,CAAA;AAEzD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,mBAAmB,GAAG,kBAAkB,CAAC,sBAAsB,CAAC,CA0BhH"}
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { __ } from '@wordpress/i18n';
3
+ import { createGalleryGroupEdit } from './edit';
4
+ import { DEFAULT_COLUMNS, DEFAULT_RATIOS } from './constants';
5
+ import { InnerBlocks } from '@wordpress/block-editor';
6
+ export function createGalleryGroupBlock(options) {
7
+ var _a, _b, _c;
8
+ return {
9
+ name: options.name,
10
+ title: (_a = options.title) !== null && _a !== void 0 ? _a : __('Gallery Group', 'brilo-blocks'),
11
+ description: options.description,
12
+ category: (_b = options.category) !== null && _b !== void 0 ? _b : 'layout',
13
+ ...(options.parent && { parent: options.parent }),
14
+ icon: (_c = options.icon) !== null && _c !== void 0 ? _c : 'format-gallery',
15
+ supports: { html: false, customClassName: false },
16
+ attributes: {
17
+ columns: {
18
+ type: 'number',
19
+ default: options.columns ? options.columns[0] : DEFAULT_COLUMNS[1], // Default to 3 if not specified
20
+ },
21
+ ratio: {
22
+ type: 'string',
23
+ default: options.ratios ? options.ratios[0].value : DEFAULT_RATIOS[0].value,
24
+ },
25
+ galleryId: {
26
+ type: 'string',
27
+ default: 'gallery',
28
+ },
29
+ },
30
+ edit: createGalleryGroupEdit(options),
31
+ save: () => _jsx(InnerBlocks.Content, {}),
32
+ };
33
+ }
@@ -0,0 +1,5 @@
1
+ export type { GalleryGroupAttributes, GalleryGroupOptions } from './types';
2
+ export { createGalleryGroupBlock } from './factory';
3
+ import type { GalleryGroupOptions } from './types';
4
+ export declare const galleryGroupDefaults: GalleryGroupOptions;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,sBAAsB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAA;AACxE,OAAO,EAAC,uBAAuB,EAAC,MAAM,WAAW,CAAA;AAEjD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAA;AAEhD,eAAO,MAAM,oBAAoB,EAAE,mBAKlC,CAAA"}
@@ -0,0 +1,7 @@
1
+ export { createGalleryGroupBlock } from './factory';
2
+ export const galleryGroupDefaults = {
3
+ name: 'brilo/gallery-group',
4
+ parent: ['brilo/base-section'],
5
+ allowedBlocks: ['brilo/gallery-item'],
6
+ template: [],
7
+ };
@@ -0,0 +1,15 @@
1
+ import type { BriloBlockType, NumberArray, OptionArray } from '../../../types';
2
+ import type { DEFAULT_COLUMNS, DEFAULT_RATIOS } from './constants';
3
+ export type GalleryColumns = (typeof DEFAULT_COLUMNS)[number];
4
+ export type GalleryRatio = (typeof DEFAULT_RATIOS)[number]['value'];
5
+ export interface GalleryGroupAttributes<TColumn extends number = GalleryColumns, TRatio extends string = GalleryRatio> extends Record<string, unknown> {
6
+ columns: TColumn;
7
+ ratio: TRatio;
8
+ galleryId: string;
9
+ }
10
+ export interface GalleryGroupOptions<TColumns extends NumberArray = typeof DEFAULT_COLUMNS, TRatios extends OptionArray = typeof DEFAULT_RATIOS> extends BriloBlockType {
11
+ allowedBlocks: string[];
12
+ columns?: TColumns;
13
+ ratios?: TRatios;
14
+ }
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AACrE,OAAO,KAAK,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,aAAa,CAAA;AAEhE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAC7D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAEnE,MAAM,WAAW,sBAAsB,CAAC,OAAO,SAAS,MAAM,GAAG,cAAc,EAAE,MAAM,SAAS,MAAM,GAAG,YAAY,CACnH,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,mBAAmB,CAClC,QAAQ,SAAS,WAAW,GAAG,OAAO,eAAe,EACrD,OAAO,SAAS,WAAW,GAAG,OAAO,cAAc,CACnD,SAAQ,cAAc;IACtB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,OAAO,CAAC,EAAE,QAAQ,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { GalleryItemAttributes, GalleryItemOptions } from './types';
2
+ export declare function createGalleryItemEdit(_options: GalleryItemOptions): ({ attributes, setAttributes, }: {
3
+ attributes: GalleryItemAttributes;
4
+ setAttributes: (a: Partial<GalleryItemAttributes>) => 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/gallery/gallery-item/edit.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAGtE,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,kBAAkB,IAC3C,gCAGlB;IACD,UAAU,EAAE,qBAAqB,CAAA;IACjC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAAA;CAC3D,iCA+BF"}
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
3
+ import { PanelBody } from '@wordpress/components';
4
+ import { __ } from '@wordpress/i18n';
5
+ import clsx from 'clsx';
6
+ import { ImagePickerControl } from '../../../components/ImagePicker/ImagePicker';
7
+ export function createGalleryItemEdit(_options) {
8
+ return function Edit({ attributes, setAttributes, }) {
9
+ const { img } = attributes;
10
+ const blockProps = useBlockProps({ className: clsx('i-gallery') });
11
+ return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsx(PanelBody, { title: __('Obrázek', 'brilo-blocks'), children: _jsx(ImagePickerControl, { value: img, onChange: (val) => setAttributes({ img: val }) }) }) }), _jsx("div", { ...blockProps, children: _jsx("div", { className: "i-gallery__image-wrapper", children: img.id ? (_jsx(ImagePickerControl, { value: img, onChange: (val) => setAttributes({ img: val }) })) : (_jsx("div", { className: "i-gallery__image-placeholder", children: _jsx(ImagePickerControl, { labels: { select: __('Vybrat obrázek', 'brilo-blocks') }, value: img, onChange: (val) => setAttributes({ img: val }) }) })) }) })] }));
12
+ };
13
+ }
@@ -0,0 +1,5 @@
1
+ import type { BlockConfiguration } from '@wordpress/blocks';
2
+ import type { GalleryItemAttributes, GalleryItemOptions } from './types';
3
+ export type { GalleryItemAttributes, GalleryItemOptions };
4
+ export declare function createGalleryItemBlock(options: GalleryItemOptions): BlockConfiguration<GalleryItemAttributes>;
5
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-item/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAGzD,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAEtE,YAAY,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,CAAA;AAEvD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,CAkB7G"}
@@ -0,0 +1,22 @@
1
+ import { __ } from '@wordpress/i18n';
2
+ import { createGalleryItemEdit } from './edit';
3
+ export function createGalleryItemBlock(options) {
4
+ var _a, _b, _c;
5
+ return {
6
+ name: options.name,
7
+ title: (_a = options.title) !== null && _a !== void 0 ? _a : __('Gallery Item', 'brilo-blocks'),
8
+ description: options.description,
9
+ category: (_b = options.category) !== null && _b !== void 0 ? _b : 'layout',
10
+ ...(options.parent && { parent: options.parent }),
11
+ icon: (_c = options.icon) !== null && _c !== void 0 ? _c : 'format-image',
12
+ supports: { html: false, customClassName: false },
13
+ attributes: {
14
+ img: {
15
+ type: 'object',
16
+ default: { id: 0, alt: '' },
17
+ },
18
+ },
19
+ edit: createGalleryItemEdit(options),
20
+ save: () => null,
21
+ };
22
+ }
@@ -0,0 +1,5 @@
1
+ import { GalleryItemOptions } from './types';
2
+ export type { GalleryItemAttributes, GalleryItemOptions } from './types';
3
+ export { createGalleryItemBlock } from './factory';
4
+ export declare const galleryItemDefaults: GalleryItemOptions;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-item/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAE1C,YAAY,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAA;AACtE,OAAO,EAAC,sBAAsB,EAAC,MAAM,WAAW,CAAA;AAEhD,eAAO,MAAM,mBAAmB,EAAE,kBAIjC,CAAA"}
@@ -0,0 +1,6 @@
1
+ export { createGalleryItemBlock } from './factory';
2
+ export const galleryItemDefaults = {
3
+ name: 'brilo/gallery-item',
4
+ parent: ['brilo/gallery-group'],
5
+ template: [],
6
+ };
@@ -0,0 +1,7 @@
1
+ import type { BriloBlockType, Media } from '../../../types';
2
+ export interface GalleryItemAttributes extends Record<string, unknown> {
3
+ img: Media;
4
+ }
5
+ export interface GalleryItemOptions extends BriloBlockType {
6
+ }
7
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-item/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAE,KAAK,EAAC,MAAM,SAAS,CAAA;AAElD,MAAM,WAAW,qBAAsB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACpE,GAAG,EAAE,KAAK,CAAA;CACX;AAED,MAAM,WAAW,kBAAmB,SAAQ,cAAc;CAAG"}
@@ -0,0 +1 @@
1
+ export {};