@brilo/base-blocks 0.1.51 → 0.1.54

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 (73) hide show
  1. package/build/.tsbuildinfo +1 -1
  2. package/build/blocks/accordion/accordion-group/edit.d.ts.map +1 -1
  3. package/build/blocks/accordion/accordion-group/edit.js +8 -2
  4. package/build/blocks/accordion/accordion-group/factory.d.ts.map +1 -1
  5. package/build/blocks/accordion/accordion-group/factory.js +20 -11
  6. package/build/blocks/accordion/accordion-group/index.d.ts +2 -1
  7. package/build/blocks/accordion/accordion-group/index.d.ts.map +1 -1
  8. package/build/blocks/accordion/accordion-group/index.js +1 -0
  9. package/build/blocks/accordion/accordion-group/types.d.ts +8 -0
  10. package/build/blocks/accordion/accordion-group/types.d.ts.map +1 -1
  11. package/build/blocks/career/job-position-group/JobPositionsSelectModal.d.ts.map +1 -1
  12. package/build/blocks/career/job-position-group/JobPositionsSelectModal.js +1 -1
  13. package/build/blocks/document/documents-grid/DocumentsSelectModal.d.ts.map +1 -1
  14. package/build/blocks/document/documents-grid/DocumentsSelectModal.js +1 -1
  15. package/build/blocks/faq/faq-group/constants.d.ts +0 -10
  16. package/build/blocks/faq/faq-group/constants.d.ts.map +1 -1
  17. package/build/blocks/faq/faq-group/constants.js +0 -5
  18. package/build/blocks/faq/faq-group/edit.d.ts.map +1 -1
  19. package/build/blocks/faq/faq-group/edit.js +6 -4
  20. package/build/blocks/faq/faq-group/factory.d.ts.map +1 -1
  21. package/build/blocks/faq/faq-group/factory.js +9 -10
  22. package/build/blocks/faq/faq-group/types.d.ts +6 -7
  23. package/build/blocks/faq/faq-group/types.d.ts.map +1 -1
  24. package/build/blocks/layout/box/constants.d.ts +12 -0
  25. package/build/blocks/layout/box/constants.d.ts.map +1 -0
  26. package/build/blocks/layout/box/constants.js +15 -0
  27. package/build/blocks/layout/box/controls.d.ts.map +1 -1
  28. package/build/blocks/layout/box/controls.js +6 -5
  29. package/build/blocks/layout/box/deprecated.d.ts +71 -0
  30. package/build/blocks/layout/box/deprecated.d.ts.map +1 -0
  31. package/build/blocks/layout/box/deprecated.js +100 -0
  32. package/build/blocks/layout/box/edit.d.ts.map +1 -1
  33. package/build/blocks/layout/box/edit.js +14 -18
  34. package/build/blocks/layout/box/factory.d.ts.map +1 -1
  35. package/build/blocks/layout/box/factory.js +4 -2
  36. package/build/blocks/layout/box/index.d.ts +1 -1
  37. package/build/blocks/layout/box/index.d.ts.map +1 -1
  38. package/build/blocks/layout/box/types.d.ts +5 -14
  39. package/build/blocks/layout/box/types.d.ts.map +1 -1
  40. package/build/components/EntitySelectModal/EntitySelectModal.d.ts +1 -1
  41. package/build/components/EntitySelectModal/EntitySelectModal.d.ts.map +1 -1
  42. package/build/components/EntitySelectModal/EntitySelectModal.js +1 -1
  43. package/build/components/LazyDataViews/LazyDataViews.d.ts +8 -0
  44. package/build/components/LazyDataViews/LazyDataViews.d.ts.map +1 -0
  45. package/build/components/LazyDataViews/LazyDataViews.js +11 -0
  46. package/build/components/SurfaceStyleControl/index.d.ts +53 -0
  47. package/build/components/SurfaceStyleControl/index.d.ts.map +1 -0
  48. package/build/components/SurfaceStyleControl/index.js +36 -0
  49. package/build/index.d.ts +5 -3
  50. package/build/index.d.ts.map +1 -1
  51. package/build/index.js +2 -1
  52. package/package.json +1 -1
  53. package/src/blocks/accordion/accordion-group/edit.tsx +16 -1
  54. package/src/blocks/accordion/accordion-group/factory.tsx +19 -7
  55. package/src/blocks/accordion/accordion-group/index.ts +8 -1
  56. package/src/blocks/accordion/accordion-group/types.ts +11 -1
  57. package/src/blocks/career/job-position-group/JobPositionsSelectModal.tsx +2 -1
  58. package/src/blocks/document/documents-grid/DocumentsSelectModal.tsx +2 -1
  59. package/src/blocks/faq/faq-group/constants.ts +0 -6
  60. package/src/blocks/faq/faq-group/edit.tsx +11 -56
  61. package/src/blocks/faq/faq-group/factory.tsx +6 -6
  62. package/src/blocks/faq/faq-group/types.ts +6 -7
  63. package/src/blocks/layout/box/constants.ts +19 -0
  64. package/src/blocks/layout/box/controls.tsx +42 -21
  65. package/src/blocks/layout/box/deprecated.tsx +146 -0
  66. package/src/blocks/layout/box/edit.tsx +15 -18
  67. package/src/blocks/layout/box/factory.tsx +4 -2
  68. package/src/blocks/layout/box/index.ts +1 -1
  69. package/src/blocks/layout/box/types.ts +5 -14
  70. package/src/components/EntitySelectModal/EntitySelectModal.tsx +2 -1
  71. package/src/components/LazyDataViews/LazyDataViews.tsx +17 -0
  72. package/src/components/SurfaceStyleControl/index.tsx +114 -0
  73. package/src/index.ts +11 -3
@@ -1 +1 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-group/edit.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,wBAAwB,EAAE,qBAAqB,EAAwB,MAAM,SAAS,CAAA;AAEnG,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,qBAAqB,oCAIlE;IACD,UAAU,EAAE,wBAAwB,CAAA;IACpC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,KAAK,IAAI,CAAA;CAC9D,iCA8BF"}
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-group/edit.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,wBAAwB,EAAE,qBAAqB,EAAwB,MAAM,SAAS,CAAA;AAEnG,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,qBAAqB,oCAOlE;IACD,UAAU,EAAE,wBAAwB,CAAA;IACpC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,KAAK,IAAI,CAAA;CAC9D,iCAwCF"}
@@ -2,20 +2,26 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
2
2
  import { InspectorControls } from '@wordpress/block-editor';
3
3
  import { PanelBody, SelectControl } from '@wordpress/components';
4
4
  import { __ } from '@wordpress/i18n';
5
+ import { ItemSpacingPanel, itemSpacingStyle } from '../../../components/ItemSpacingControl';
6
+ import { DEFAULT_SURFACE_SHADOWS, SurfaceStylePanel } from '../../../components/SurfaceStyleControl';
5
7
  import { useGroupBlock } from '../../../hooks/useGroupBlock';
6
8
  import { ACCORDION_HEADING_LEVELS } from './constants';
7
9
  export function createAccordionGroupEdit(options) {
10
+ var _a, _b;
11
+ const exclude = (_a = options.exclude) !== null && _a !== void 0 ? _a : [];
12
+ const shadows = (_b = options.shadows) !== null && _b !== void 0 ? _b : DEFAULT_SURFACE_SHADOWS;
8
13
  return function Edit({ attributes, setAttributes, }) {
9
14
  var _a, _b;
10
- const { headingLevel } = attributes;
15
+ const { headingLevel, style, spacing } = attributes;
11
16
  const { blockProps, innerBlocksProps } = useGroupBlock({
12
17
  blockClassName: (_a = options.blockClassName) !== null && _a !== void 0 ? _a : 'g-accordion wp-block-section',
13
18
  containerClassName: (_b = options.containerClassName) !== null && _b !== void 0 ? _b : 'g-accordion__items',
19
+ containerStyle: itemSpacingStyle(spacing),
14
20
  allowedBlocks: options.allowedBlocks,
15
21
  template: options.template,
16
22
  orientation: 'vertical',
17
23
  layout: { type: 'default' },
18
24
  });
19
- return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsx(PanelBody, { title: __('Nadpis', 'brilo-blocks'), children: _jsx(SelectControl, { label: __('Level nadpisu', 'brilo-blocks'), value: headingLevel, options: ACCORDION_HEADING_LEVELS.map((level) => ({ value: level, label: `H${level}` })), onChange: (value) => setAttributes({ headingLevel: value }) }) }) }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
25
+ return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsx(PanelBody, { title: __('Nadpis', 'brilo-blocks'), children: _jsx(SelectControl, { label: __('Level nadpisu', 'brilo-blocks'), value: headingLevel, options: ACCORDION_HEADING_LEVELS.map((level) => ({ value: level, label: `H${level}` })), onChange: (value) => setAttributes({ headingLevel: value }) }) }), !exclude.includes('colors') && style && (_jsx(SurfaceStylePanel, { style: style, shadows: shadows, idPrefix: "accordion-group", onChange: (next) => setAttributes({ style: next }) })), _jsx(ItemSpacingPanel, { spacing: spacing, onChange: (v) => setAttributes({ spacing: v }) })] }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
20
26
  };
21
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-group/factory.tsx"],"names":[],"mappings":"AACA,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,CAmBtH"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-group/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAMzD,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,CA6BtH"}
@@ -1,25 +1,34 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { InnerBlocks } from '@wordpress/block-editor';
3
3
  import { __ } from '@wordpress/i18n';
4
+ import { ITEM_SPACING_ATTRIBUTE } from '../../../components/ItemSpacingControl';
5
+ import { DEFAULT_SURFACE_SHADOWS, surfaceStyleAttribute } from '../../../components/SurfaceStyleControl';
4
6
  import { ACCORDION_HEADING_LEVELS } from './constants';
5
7
  import { createAccordionGroupEdit } from './edit';
6
8
  export function createAccordionGroupBlock(options) {
7
- var _a, _b, _c;
9
+ var _a, _b, _c, _d, _e;
10
+ const exclude = (_a = options.exclude) !== null && _a !== void 0 ? _a : [];
11
+ const shadows = (_b = options.shadows) !== null && _b !== void 0 ? _b : DEFAULT_SURFACE_SHADOWS;
12
+ const attributes = {
13
+ headingLevel: {
14
+ type: 'string',
15
+ default: ACCORDION_HEADING_LEVELS[1],
16
+ enum: [...ACCORDION_HEADING_LEVELS],
17
+ },
18
+ ...ITEM_SPACING_ATTRIBUTE,
19
+ };
20
+ if (!exclude.includes('colors')) {
21
+ attributes.style = surfaceStyleAttribute(shadows);
22
+ }
8
23
  return {
9
24
  name: options.name,
10
- title: (_a = options.title) !== null && _a !== void 0 ? _a : __('Accordion', 'brilo-blocks'),
25
+ title: (_c = options.title) !== null && _c !== void 0 ? _c : __('Accordion', 'brilo-blocks'),
11
26
  description: options.description,
12
- category: (_b = options.category) !== null && _b !== void 0 ? _b : 'layout',
27
+ category: (_d = options.category) !== null && _d !== void 0 ? _d : 'layout',
13
28
  ...(options.parent && { parent: options.parent }),
14
- icon: (_c = options.icon) !== null && _c !== void 0 ? _c : 'editor-ul',
29
+ icon: (_e = options.icon) !== null && _e !== void 0 ? _e : 'editor-ul',
15
30
  supports: { html: false, customClassName: false },
16
- attributes: {
17
- headingLevel: {
18
- type: 'string',
19
- default: ACCORDION_HEADING_LEVELS[1],
20
- enum: [...ACCORDION_HEADING_LEVELS],
21
- },
22
- },
31
+ attributes,
23
32
  edit: createAccordionGroupEdit(options),
24
33
  save: () => _jsx(InnerBlocks.Content, {}),
25
34
  };
@@ -1,4 +1,5 @@
1
- export type { AccordionGroupAttributes, AccordionGroupOptions, AccordionHeadingLevel } from './types';
1
+ export type { AccordionGroupAttributes, AccordionGroupOptions, AccordionHeadingLevel, AccordionShadow, ExcludableAccordionAttr, } from './types';
2
+ export { ACCORDION_HEADING_LEVELS } from './constants';
2
3
  export { createAccordionGroupBlock } from './factory';
3
4
  import type { AccordionGroupOptions } from './types';
4
5
  export declare const accordionGroupDefaults: AccordionGroupOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,wBAAwB,EAAE,qBAAqB,EAAE,qBAAqB,EAAC,MAAM,SAAS,CAAA;AACnG,OAAO,EAAC,yBAAyB,EAAC,MAAM,WAAW,CAAA;AAEnD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAA;AAElD,eAAO,MAAM,sBAAsB,EAAE,qBAKpC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,uBAAuB,GACxB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAC,wBAAwB,EAAC,MAAM,aAAa,CAAA;AACpD,OAAO,EAAC,yBAAyB,EAAC,MAAM,WAAW,CAAA;AAEnD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAA;AAElD,eAAO,MAAM,sBAAsB,EAAE,qBAKpC,CAAA"}
@@ -1,3 +1,4 @@
1
+ export { ACCORDION_HEADING_LEVELS } from './constants';
1
2
  export { createAccordionGroupBlock } from './factory';
2
3
  export const accordionGroupDefaults = {
3
4
  name: 'brilo/accordion-group',
@@ -1,9 +1,17 @@
1
+ import type { SurfaceShadowOption, SurfaceStyle } from '../../../components/SurfaceStyleControl';
1
2
  import type { BriloBlockType } from '../../../types';
2
3
  import type { ACCORDION_HEADING_LEVELS } from './constants';
3
4
  export type AccordionHeadingLevel = (typeof ACCORDION_HEADING_LEVELS)[number];
5
+ export type AccordionShadow = SurfaceStyle['shadow'];
6
+ export type ExcludableAccordionAttr = 'colors';
4
7
  export interface AccordionGroupAttributes extends Record<string, unknown> {
5
8
  headingLevel: AccordionHeadingLevel;
9
+ style?: SurfaceStyle<string>;
10
+ spacing?: number;
6
11
  }
7
12
  export interface AccordionGroupOptions extends BriloBlockType {
13
+ exclude?: ExcludableAccordionAttr[];
14
+ /** Overrides the shared shadow presets — see `DEFAULT_SURFACE_SHADOWS`. */
15
+ shadows?: readonly SurfaceShadowOption[];
8
16
  }
9
17
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAC3C,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,aAAa,CAAA;AAEzD,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE7E,MAAM,WAAW,wBAAyB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvE,YAAY,EAAE,qBAAqB,CAAA;CACpC;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc;CAAG"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/accordion/accordion-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAE,YAAY,EAAC,MAAM,kCAAkC,CAAA;AACvF,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAC3C,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,aAAa,CAAA;AAEzD,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAA;AAC7E,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAA;AAEpD,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAA;AAE9C,MAAM,WAAW,wBAAyB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvE,YAAY,EAAE,qBAAqB,CAAA;IACnC,KAAK,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,OAAO,CAAC,EAAE,uBAAuB,EAAE,CAAA;IACnC,2EAA2E;IAC3E,OAAO,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAA;CACzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"JobPositionsSelectModal.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/job-position-group/JobPositionsSelectModal.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAqC,MAAM,OAAO,CAAA;AACzD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AA0G/C;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EAAC,aAAa,EAAE,QAAQ,EAAC,EAAE,kBAAkB,qBAuHpF"}
1
+ {"version":3,"file":"JobPositionsSelectModal.d.ts","sourceRoot":"","sources":["../../../../src/blocks/career/job-position-group/JobPositionsSelectModal.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAqC,MAAM,OAAO,CAAA;AACzD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AA0G/C;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EAAC,aAAa,EAAE,QAAQ,EAAC,EAAE,kBAAkB,qBAuHpF"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import apiFetch from '@wordpress/api-fetch';
3
3
  import { Button, Card, CardBody, __experimentalHStack as HStack, Modal, __experimentalVStack as VStack } from '@wordpress/components';
4
- import { DataViews } from '@wordpress/dataviews/wp';
4
+ import { LazyDataViews as DataViews } from '../../../components/LazyDataViews/LazyDataViews';
5
5
  import { __ } from '@wordpress/i18n';
6
6
  import { arrowDown, arrowUp, close, plusCircle } from '@wordpress/icons';
7
7
  // biome-ignore lint/correctness/noUnusedImports: required in scope for classic JSX transform
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentsSelectModal.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-grid/DocumentsSelectModal.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAqC,MAAM,OAAO,CAAA;AACzD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAgH/C;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,EAAC,aAAa,EAAE,QAAQ,EAAC,EAAE,kBAAkB,qBAiJjF"}
1
+ {"version":3,"file":"DocumentsSelectModal.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-grid/DocumentsSelectModal.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAqC,MAAM,OAAO,CAAA;AACzD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAgH/C;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,EAAC,aAAa,EAAE,QAAQ,EAAC,EAAE,kBAAkB,qBAiJjF"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import apiFetch from '@wordpress/api-fetch';
3
3
  import { Button, Card, CardBody, __experimentalHStack as HStack, Modal, __experimentalVStack as VStack } from '@wordpress/components';
4
- import { DataViews } from '@wordpress/dataviews/wp';
4
+ import { LazyDataViews as DataViews } from '../../../components/LazyDataViews/LazyDataViews';
5
5
  import { __ } from '@wordpress/i18n';
6
6
  import { arrowDown, arrowUp, close, plusCircle } from '@wordpress/icons';
7
7
  // biome-ignore lint/correctness/noUnusedImports: required in scope for classic JSX transform
@@ -15,16 +15,6 @@ export declare const DEFAULT_ICON_VARIANTS: readonly [{
15
15
  readonly value: 'message';
16
16
  readonly label: import("@wordpress/i18n").TransformedText<"Zpráva">;
17
17
  }];
18
- export declare const DEFAULT_SHADOWS: readonly [{
19
- readonly value: 'none';
20
- readonly label: import("@wordpress/i18n").TransformedText<"Žádný">;
21
- }, {
22
- readonly value: 'sm';
23
- readonly label: import("@wordpress/i18n").TransformedText<"Malý">;
24
- }, {
25
- readonly value: 'md';
26
- readonly label: import("@wordpress/i18n").TransformedText<"Střední">;
27
- }];
28
18
  export declare const DEFAULT_ICON_SIZE = 24;
29
19
  export declare const ICON_SIZE_MIN = 12;
30
20
  export declare const ICON_SIZE_MAX = 64;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/faq/faq-group/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,YAAI,GAAG,EAAE,GAAG,CAAU,CAAA;AAErD,eAAO,MAAM,qBAAqB;aAC/B,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,UAAU;aAAE,KAAK;;aACxB,KAAK,EAAE,aAAa;aAAE,KAAK;;aAC3B,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,SAAS;aAAE,KAAK;EAChB,CAAA;AAEV,eAAO,MAAM,eAAe;aACzB,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,IAAI;aAAE,KAAK;;aAClB,KAAK,EAAE,IAAI;aAAE,KAAK;EACX,CAAA;AAEV,eAAO,MAAM,iBAAiB,KAAK,CAAA;AACnC,eAAO,MAAM,aAAa,KAAK,CAAA;AAC/B,eAAO,MAAM,aAAa,KAAK,CAAA;AAE/B,eAAO,MAAM,yBAAyB;aACnC,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;EACT,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/faq/faq-group/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,YAAI,GAAG,EAAE,GAAG,CAAU,CAAA;AAErD,eAAO,MAAM,qBAAqB;aAC/B,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,UAAU;aAAE,KAAK;;aACxB,KAAK,EAAE,aAAa;aAAE,KAAK;;aAC3B,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,SAAS;aAAE,KAAK;EAChB,CAAA;AAEV,eAAO,MAAM,iBAAiB,KAAK,CAAA;AACnC,eAAO,MAAM,aAAa,KAAK,CAAA;AAC/B,eAAO,MAAM,aAAa,KAAK,CAAA;AAE/B,eAAO,MAAM,yBAAyB;aACnC,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;EACT,CAAA"}
@@ -7,11 +7,6 @@ export const DEFAULT_ICON_VARIANTS = [
7
7
  { value: 'info', label: __('Informace', 'brilo-blocks') },
8
8
  { value: 'message', label: __('Zpráva', 'brilo-blocks') },
9
9
  ];
10
- export const DEFAULT_SHADOWS = [
11
- { value: 'none', label: __('Žádný', 'brilo-blocks') },
12
- { value: 'sm', label: __('Malý', 'brilo-blocks') },
13
- { value: 'md', label: __('Střední', 'brilo-blocks') },
14
- ];
15
10
  export const DEFAULT_ICON_SIZE = 24;
16
11
  export const ICON_SIZE_MIN = 12;
17
12
  export const ICON_SIZE_MAX = 64;
@@ -1 +1 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/faq/faq-group/edit.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAC,kBAAkB,EAAE,eAAe,EAA4D,MAAM,SAAS,CAAA;AA+B3H,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,oCAQtD;IACD,UAAU,EAAE,kBAAkB,CAAA;IAC9B,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAA;CACxD,iCA0GF"}
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/faq/faq-group/edit.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAC,kBAAkB,EAAE,eAAe,EAAiD,MAAM,SAAS,CAAA;AA+BhH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,oCAStD;IACD,UAAU,EAAE,kBAAkB,CAAA;IAC9B,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAA;CACxD,iCA2EF"}
@@ -1,19 +1,21 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { InspectorControls } from '@wordpress/block-editor';
3
- import { BaseControl, Button, ColorPalette, PanelBody, RangeControl, SelectControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from '@wordpress/components';
3
+ import { BaseControl, Button, ColorPalette, PanelBody, RangeControl, SelectControl } from '@wordpress/components';
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import { ItemSpacingPanel, itemSpacingStyle } from '../../../components/ItemSpacingControl';
6
+ import { DEFAULT_SURFACE_SHADOWS, SurfaceStylePanel } from '../../../components/SurfaceStyleControl';
6
7
  import { useGroupBlock } from '../../../hooks/useGroupBlock';
7
8
  import { useTenantColorPalette } from '../../../hooks/useTenantColorPalette';
8
- import { DEFAULT_ICON_SIZE_PRESETS, DEFAULT_ICON_VARIANTS, DEFAULT_SHADOWS, FAQ_HEADING_LEVELS, ICON_SIZE_MAX, ICON_SIZE_MIN, } from './constants';
9
+ import { DEFAULT_ICON_SIZE_PRESETS, DEFAULT_ICON_VARIANTS, FAQ_HEADING_LEVELS, ICON_SIZE_MAX, ICON_SIZE_MIN } from './constants';
9
10
  function PresetSizeControl({ label, value, presets, min, max, onChange, }) {
10
11
  return (_jsxs(BaseControl, { label: label, id: `faq-group-size-${label}`, children: [_jsx("div", { style: { display: 'flex', gap: 4, marginBottom: 8, flexWrap: 'wrap' }, children: presets.map((p) => (_jsx(Button, { variant: value === p.value ? 'primary' : 'secondary', size: "small", onClick: () => onChange(p.value), children: p.label }, p.label))) }), _jsx(RangeControl, { value: value, onChange: (v) => onChange(v !== null && v !== void 0 ? v : min), min: min, max: max, step: 1, withInputField: true })] }));
11
12
  }
12
13
  export function createFaqGroupEdit(options) {
13
- var _a, _b, _c;
14
+ var _a, _b, _c, _d;
14
15
  const ICON_VARIANTS = (_a = options.iconVariants) !== null && _a !== void 0 ? _a : DEFAULT_ICON_VARIANTS;
15
16
  const ICON_SIZE_PRESETS = (_b = options.iconSizePresets) !== null && _b !== void 0 ? _b : DEFAULT_ICON_SIZE_PRESETS;
16
17
  const exclude = (_c = options.exclude) !== null && _c !== void 0 ? _c : [];
18
+ const shadows = (_d = options.shadows) !== null && _d !== void 0 ? _d : DEFAULT_SURFACE_SHADOWS;
17
19
  return function Edit({ attributes, setAttributes, }) {
18
20
  var _a, _b;
19
21
  const { headingLevel, iconVariant, style, spacing } = attributes;
@@ -27,6 +29,6 @@ export function createFaqGroupEdit(options) {
27
29
  orientation: 'vertical',
28
30
  layout: { type: 'default' },
29
31
  });
30
- return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsx(PanelBody, { title: __('Nadpis', 'brilo-blocks'), children: _jsx(SelectControl, { label: __('Level nadpisu FAQ', 'brilo-blocks'), value: headingLevel, options: FAQ_HEADING_LEVELS.map((level) => ({ value: level, label: `H${level}` })), onChange: (value) => setAttributes({ headingLevel: value }) }) }), _jsxs(PanelBody, { title: __('Ikona', 'brilo-blocks'), children: [_jsx(SelectControl, { label: __('Typ ikonky', 'brilo-blocks'), value: iconVariant, options: ICON_VARIANTS.map((v) => ({ value: v.value, label: v.label })), onChange: (value) => setAttributes({ iconVariant: value }) }), !exclude.includes('colors') && style && (_jsxs(_Fragment, { children: [_jsx(PresetSizeControl, { label: __('Velikost', 'brilo-blocks'), value: style.icon.size, presets: ICON_SIZE_PRESETS, min: ICON_SIZE_MIN, max: ICON_SIZE_MAX, onChange: (v) => setAttributes({ style: { ...style, icon: { ...style.icon, size: v } } }) }), _jsx(BaseControl, { label: __('Barva', 'brilo-blocks'), id: "faq-group-icon-color", children: _jsx(ColorPalette, { colors: paletteColors, value: style.icon.color || undefined, onChange: (value) => setAttributes({ style: { ...style, icon: { ...style.icon, color: value !== null && value !== void 0 ? value : '' } } }) }) }), _jsx(BaseControl, { label: __('Pozadí', 'brilo-blocks'), id: "faq-group-icon-background-color", children: _jsx(ColorPalette, { colors: paletteColors, value: style.icon.background || undefined, onChange: (value) => setAttributes({ style: { ...style, icon: { ...style.icon, background: value !== null && value !== void 0 ? value : '' } } }) }) })] }))] }), !exclude.includes('colors') && style && (_jsxs(PanelBody, { title: __('Styl', 'brilo-blocks'), children: [_jsx(ToggleGroupControl, { isBlock: true, label: __('Stín', 'brilo-blocks'), value: style.shadow, onChange: (v) => setAttributes({ style: { ...style, shadow: v } }), children: DEFAULT_SHADOWS.map((s) => (_jsx(ToggleGroupControlOption, { value: s.value, label: s.label }, s.value))) }), _jsx(BaseControl, { label: __('Barva okraje', 'brilo-blocks'), help: __('Bez vybrané barvy se okraj nevykreslí.', 'brilo-blocks'), id: "faq-group-border-color", children: _jsx(ColorPalette, { colors: paletteColors, value: style.borderColor || undefined, onChange: (value) => setAttributes({ style: { ...style, borderColor: value !== null && value !== void 0 ? value : '' } }) }) }), _jsx(BaseControl, { label: __('Barva pozadí', 'brilo-blocks'), id: "faq-group-background-color", children: _jsx(ColorPalette, { colors: paletteColors, value: style.backgroundColor || undefined, onChange: (value) => setAttributes({ style: { ...style, backgroundColor: value !== null && value !== void 0 ? value : '' } }) }) }), _jsx(BaseControl, { label: __('Barva textu', 'brilo-blocks'), id: "faq-group-text-color", children: _jsx(ColorPalette, { colors: paletteColors, value: style.textColor || undefined, onChange: (value) => setAttributes({ style: { ...style, textColor: value !== null && value !== void 0 ? value : '' } }) }) })] })), _jsx(ItemSpacingPanel, { spacing: spacing, onChange: (v) => setAttributes({ spacing: v }) })] }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
32
+ return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsx(PanelBody, { title: __('Nadpis', 'brilo-blocks'), children: _jsx(SelectControl, { label: __('Level nadpisu FAQ', 'brilo-blocks'), value: headingLevel, options: FAQ_HEADING_LEVELS.map((level) => ({ value: level, label: `H${level}` })), onChange: (value) => setAttributes({ headingLevel: value }) }) }), _jsxs(PanelBody, { title: __('Ikona', 'brilo-blocks'), children: [_jsx(SelectControl, { label: __('Typ ikonky', 'brilo-blocks'), value: iconVariant, options: ICON_VARIANTS.map((v) => ({ value: v.value, label: v.label })), onChange: (value) => setAttributes({ iconVariant: value }) }), !exclude.includes('colors') && style && (_jsxs(_Fragment, { children: [_jsx(PresetSizeControl, { label: __('Velikost', 'brilo-blocks'), value: style.icon.size, presets: ICON_SIZE_PRESETS, min: ICON_SIZE_MIN, max: ICON_SIZE_MAX, onChange: (v) => setAttributes({ style: { ...style, icon: { ...style.icon, size: v } } }) }), _jsx(BaseControl, { label: __('Barva', 'brilo-blocks'), id: "faq-group-icon-color", children: _jsx(ColorPalette, { colors: paletteColors, value: style.icon.color || undefined, onChange: (value) => setAttributes({ style: { ...style, icon: { ...style.icon, color: value !== null && value !== void 0 ? value : '' } } }) }) }), _jsx(BaseControl, { label: __('Pozadí', 'brilo-blocks'), id: "faq-group-icon-background-color", children: _jsx(ColorPalette, { colors: paletteColors, value: style.icon.background || undefined, onChange: (value) => setAttributes({ style: { ...style, icon: { ...style.icon, background: value !== null && value !== void 0 ? value : '' } } }) }) })] }))] }), !exclude.includes('colors') && style && (_jsx(SurfaceStylePanel, { style: style, shadows: shadows, idPrefix: "faq-group", onChange: (next) => setAttributes({ style: { ...style, ...next } }) })), _jsx(ItemSpacingPanel, { spacing: spacing, onChange: (v) => setAttributes({ spacing: v }) })] }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
31
33
  };
32
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/faq/faq-group/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAGzD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AACxC,OAAO,EAAoB,qBAAqB,EAAsC,MAAM,aAAa,CAAA;AAEzG,OAAO,KAAK,EAAC,kBAAkB,EAAE,eAAe,EAAC,MAAM,SAAS,CAAA;AAEhE,YAAY,EAAC,kBAAkB,EAAE,eAAe,EAAC,CAAA;AAEjD,wBAAgB,mBAAmB,CAAC,aAAa,SAAS,WAAW,GAAG,OAAO,qBAAqB,EAClG,OAAO,EAAE,eAAe,CAAC,aAAa,CAAC,GACtC,kBAAkB,CAAC,kBAAkB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CA+CxE"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/faq/faq-group/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAGzD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AAExC,OAAO,EAAoB,qBAAqB,EAAqB,MAAM,aAAa,CAAA;AAExF,OAAO,KAAK,EAAC,kBAAkB,EAAE,eAAe,EAAC,MAAM,SAAS,CAAA;AAEhE,YAAY,EAAC,kBAAkB,EAAE,eAAe,EAAC,CAAA;AAEjD,wBAAgB,mBAAmB,CAAC,aAAa,SAAS,WAAW,GAAG,OAAO,qBAAqB,EAClG,OAAO,EAAE,eAAe,CAAC,aAAa,CAAC,GACtC,kBAAkB,CAAC,kBAAkB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CA8CxE"}
@@ -2,11 +2,12 @@ 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 { ITEM_SPACING_ATTRIBUTE } from '../../../components/ItemSpacingControl';
5
- import { DEFAULT_ICON_SIZE, DEFAULT_ICON_VARIANTS, DEFAULT_SHADOWS, FAQ_HEADING_LEVELS } from './constants';
5
+ import { DEFAULT_SURFACE_SHADOWS, surfaceStyleAttribute } from '../../../components/SurfaceStyleControl';
6
+ import { DEFAULT_ICON_SIZE, DEFAULT_ICON_VARIANTS, FAQ_HEADING_LEVELS } from './constants';
6
7
  import { createFaqGroupEdit } from './edit';
7
8
  export function createFaqGroupBlock(options) {
8
9
  var _a;
9
- var _b, _c, _d, _e, _f, _g;
10
+ var _b, _c, _d, _e, _f, _g, _h;
10
11
  const iconVariants = (_b = options.iconVariants) !== null && _b !== void 0 ? _b : DEFAULT_ICON_VARIANTS;
11
12
  const exclude = (_c = options.exclude) !== null && _c !== void 0 ? _c : [];
12
13
  const attributes = {
@@ -23,13 +24,11 @@ export function createFaqGroupBlock(options) {
23
24
  ...ITEM_SPACING_ATTRIBUTE,
24
25
  };
25
26
  if (!exclude.includes('colors')) {
27
+ const surfaceStyle = surfaceStyleAttribute((_e = options.shadows) !== null && _e !== void 0 ? _e : DEFAULT_SURFACE_SHADOWS);
26
28
  attributes.style = {
27
- type: 'object',
29
+ ...surfaceStyle,
28
30
  default: {
29
- shadow: DEFAULT_SHADOWS[0].value,
30
- borderColor: '',
31
- backgroundColor: '',
32
- textColor: '',
31
+ ...surfaceStyle.default,
33
32
  icon: {
34
33
  color: '',
35
34
  background: '',
@@ -40,11 +39,11 @@ export function createFaqGroupBlock(options) {
40
39
  }
41
40
  return {
42
41
  name: options.name,
43
- title: (_e = options.title) !== null && _e !== void 0 ? _e : __('FAQ', 'brilo-blocks'),
42
+ title: (_f = options.title) !== null && _f !== void 0 ? _f : __('FAQ', 'brilo-blocks'),
44
43
  description: options.description,
45
- category: (_f = options.category) !== null && _f !== void 0 ? _f : 'layout',
44
+ category: (_g = options.category) !== null && _g !== void 0 ? _g : 'layout',
46
45
  ...(options.parent && { parent: options.parent }),
47
- icon: (_g = options.icon) !== null && _g !== void 0 ? _g : 'editor-help',
46
+ icon: (_h = options.icon) !== null && _h !== void 0 ? _h : 'editor-help',
48
47
  supports: { html: false, customClassName: false },
49
48
  attributes,
50
49
  edit: createFaqGroupEdit(options),
@@ -1,8 +1,9 @@
1
+ import type { SurfaceShadowOption, SurfaceStyle } from '../../../components/SurfaceStyleControl';
1
2
  import type { BriloBlockType, OptionArray } from '../../../types';
2
- import type { DEFAULT_ICON_VARIANTS, DEFAULT_SHADOWS, FAQ_HEADING_LEVELS } from './constants';
3
+ import type { DEFAULT_ICON_VARIANTS, FAQ_HEADING_LEVELS } from './constants';
3
4
  export type FaqHeadingLevel = (typeof FAQ_HEADING_LEVELS)[number];
4
5
  export type FaqIconVariant = (typeof DEFAULT_ICON_VARIANTS)[number]['value'];
5
- export type FaqShadow = (typeof DEFAULT_SHADOWS)[number]['value'];
6
+ export type FaqShadow = SurfaceStyle['shadow'];
6
7
  export type ExcludableFaqAttr = 'colors';
7
8
  export interface FaqSizePreset {
8
9
  value: number;
@@ -11,11 +12,7 @@ export interface FaqSizePreset {
11
12
  export interface FaqGroupAttributes<TIconVariant extends string = FaqIconVariant> extends Record<string, unknown> {
12
13
  headingLevel: FaqHeadingLevel;
13
14
  iconVariant: TIconVariant;
14
- style: {
15
- shadow: FaqShadow;
16
- borderColor: string;
17
- backgroundColor: string;
18
- textColor: string;
15
+ style: SurfaceStyle<string> & {
19
16
  icon: {
20
17
  color: string;
21
18
  background: string;
@@ -28,5 +25,7 @@ export interface FaqGroupOptions<TIconVariants extends OptionArray = typeof DEFA
28
25
  iconVariants?: TIconVariants;
29
26
  iconSizePresets?: readonly FaqSizePreset[];
30
27
  exclude?: ExcludableFaqAttr[];
28
+ /** Overrides the shared shadow presets — see `DEFAULT_SURFACE_SHADOWS`. */
29
+ shadows?: readonly SurfaceShadowOption[];
31
30
  }
32
31
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/faq/faq-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AACxD,OAAO,KAAK,EAAC,qBAAqB,EAAE,eAAe,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAA;AAE3F,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAA;AACjE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAC5E,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAEjE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAA;AAExC,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,kBAAkB,CAAC,YAAY,SAAS,MAAM,GAAG,cAAc,CAAE,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/G,YAAY,EAAE,eAAe,CAAA;IAC7B,WAAW,EAAE,YAAY,CAAA;IACzB,KAAK,EAAE;QACL,MAAM,EAAE,SAAS,CAAA;QACjB,WAAW,EAAE,MAAM,CAAA;QACnB,eAAe,EAAE,MAAM,CAAA;QACvB,SAAS,EAAE,MAAM,CAAA;QACjB,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM,CAAA;YACb,UAAU,EAAE,MAAM,CAAA;YAClB,IAAI,EAAE,MAAM,CAAA;SACb,CAAA;KACF,CAAA;IACD,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,eAAe,CAAC,aAAa,SAAS,WAAW,GAAG,OAAO,qBAAqB,CAAE,SAAQ,cAAc;IACvH,YAAY,CAAC,EAAE,aAAa,CAAA;IAC5B,eAAe,CAAC,EAAE,SAAS,aAAa,EAAE,CAAA;IAC1C,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAA;CAC9B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/faq/faq-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAE,YAAY,EAAC,MAAM,kCAAkC,CAAA;AACvF,OAAO,KAAK,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AACxD,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAA;AAE1E,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAA;AACjE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAC5E,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAA;AAE9C,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAA;AAExC,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,kBAAkB,CAAC,YAAY,SAAS,MAAM,GAAG,cAAc,CAAE,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/G,YAAY,EAAE,eAAe,CAAA;IAC7B,WAAW,EAAE,YAAY,CAAA;IACzB,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG;QAC5B,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM,CAAA;YACb,UAAU,EAAE,MAAM,CAAA;YAClB,IAAI,EAAE,MAAM,CAAA;SACb,CAAA;KACF,CAAA;IACD,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,eAAe,CAAC,aAAa,SAAS,WAAW,GAAG,OAAO,qBAAqB,CAAE,SAAQ,cAAc;IACvH,YAAY,CAAC,EAAE,aAAa,CAAA;IAC5B,eAAe,CAAC,EAAE,SAAS,aAAa,EAAE,CAAA;IAC1C,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAC7B,2EAA2E;IAC3E,OAAO,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAA;CACzC"}
@@ -0,0 +1,12 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { BoxSpacingSide } from './types';
3
+ /** Sides shared by the padding and margin panels, in CSS shorthand order. */
4
+ export declare const BOX_SPACING_SIDES: readonly {
5
+ value: BoxSpacingSide;
6
+ label: string;
7
+ icon: ReactElement;
8
+ }[];
9
+ export declare const BOX_SPACING_MAX = 120;
10
+ export declare const BOX_BORDER_WIDTH_MAX = 20;
11
+ export declare const BOX_BORDER_RADIUS_MAX = 64;
12
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/layout/box/constants.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,OAAO,CAAA;AACvC,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,EAAE,SAAS;IAAC,KAAK,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,YAAY,CAAA;CAAC,EAKzF,CAAA;AAKV,eAAO,MAAM,eAAe,MAAM,CAAA;AAClC,eAAO,MAAM,oBAAoB,KAAK,CAAA;AACtC,eAAO,MAAM,qBAAqB,KAAK,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { __ } from '@wordpress/i18n';
2
+ import { justifyBottom, justifyLeft, justifyRight, justifyTop } from '@wordpress/icons';
3
+ /** Sides shared by the padding and margin panels, in CSS shorthand order. */
4
+ export const BOX_SPACING_SIDES = [
5
+ { value: 'top', label: __('Nahoře', 'brilo-blocks'), icon: justifyTop },
6
+ { value: 'right', label: __('Vpravo', 'brilo-blocks'), icon: justifyRight },
7
+ { value: 'bottom', label: __('Dole', 'brilo-blocks'), icon: justifyBottom },
8
+ { value: 'left', label: __('Vlevo', 'brilo-blocks'), icon: justifyLeft },
9
+ ];
10
+ // All box lengths are plain pixel numbers — the same convention as the shared
11
+ // `spacing` attribute — so the editor needs no unit picker and the template
12
+ // appends the unit.
13
+ export const BOX_SPACING_MAX = 120;
14
+ export const BOX_BORDER_WIDTH_MAX = 20;
15
+ export const BOX_BORDER_RADIUS_MAX = 64;
@@ -1 +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"}
1
+ {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../../src/blocks/layout/box/controls.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,aAAa,EAAa,MAAM,SAAS,CAAA;AAEtD,UAAU,gBAAgB;IACxB,UAAU,EAAE,aAAa,CAAA;IACzB,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK,IAAI,CAAA;CACvD;AAuBD,wBAAgB,WAAW,CAAC,EAAC,UAAU,EAAE,aAAa,EAAC,EAAE,gBAAgB,+BAmDxE"}
@@ -1,13 +1,14 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import * as blockEditor from '@wordpress/block-editor';
3
2
  import { ColorPalette, ContrastChecker } from '@wordpress/block-editor';
4
- import { BoxControl, PanelBody, __experimentalUnitControl as UnitControl } from '@wordpress/components';
3
+ import { PanelBody, RangeControl } from '@wordpress/components';
5
4
  import { __ } from '@wordpress/i18n';
6
5
  import { useTenantColorPalette } from '../../../hooks/useTenantColorPalette';
7
- const BorderRadiusControl = blockEditor
8
- .__experimentalBorderRadiusControl;
6
+ import { BOX_BORDER_RADIUS_MAX, BOX_BORDER_WIDTH_MAX, BOX_SPACING_MAX, BOX_SPACING_SIDES } from './constants';
7
+ function SpacingPanel({ title, values, onChange }) {
8
+ return (_jsx(PanelBody, { title: title, children: BOX_SPACING_SIDES.map((side) => (_jsx(RangeControl, { label: side.label, beforeIcon: side.icon, value: values === null || values === void 0 ? void 0 : values[side.value], onChange: (v) => onChange({ ...values, [side.value]: v }), min: 0, max: BOX_SPACING_MAX, step: 1, allowReset: true, withInputField: true }, side.value))) }));
9
+ }
9
10
  export function BoxControls({ attributes, setAttributes }) {
10
11
  const { padding, margin, borderRadius, borderWidth, borderColor, background, textColor } = attributes;
11
12
  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
+ return (_jsxs(_Fragment, { children: [_jsx(SpacingPanel, { title: __('Padding', 'brilo-blocks'), values: padding, onChange: (next) => setAttributes({ padding: next }) }), _jsx(SpacingPanel, { title: __('Margin', 'brilo-blocks'), values: margin, onChange: (next) => setAttributes({ margin: next }) }), _jsxs(PanelBody, { title: __('Ohraničení', 'brilo-blocks'), children: [_jsx(RangeControl, { label: __('Šířka okraje', 'brilo-blocks'), value: borderWidth, onChange: (v) => setAttributes({ borderWidth: v !== null && v !== void 0 ? v : 0 }), min: 0, max: BOX_BORDER_WIDTH_MAX, step: 1, allowReset: true, withInputField: true }), _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(RangeControl, { label: __('Zaoblení rohů', 'brilo-blocks'), value: borderRadius, onChange: (v) => setAttributes({ borderRadius: v !== null && v !== void 0 ? v : 0 }), min: 0, max: BOX_BORDER_RADIUS_MAX, step: 1, allowReset: true, withInputField: true })] }), _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
14
  }
@@ -0,0 +1,71 @@
1
+ import type { BoxSpacingSide } from './types';
2
+ interface LegacySpacing {
3
+ top?: string;
4
+ right?: string;
5
+ bottom?: string;
6
+ left?: string;
7
+ }
8
+ interface LegacyBorderRadius {
9
+ topLeft?: string;
10
+ topRight?: string;
11
+ bottomLeft?: string;
12
+ bottomRight?: string;
13
+ }
14
+ export interface LegacyBoxAttributes extends Record<string, unknown> {
15
+ padding: LegacySpacing;
16
+ margin: LegacySpacing;
17
+ borderRadius: string | LegacyBorderRadius;
18
+ borderWidth: string;
19
+ borderColor: string;
20
+ background: string;
21
+ textColor: string;
22
+ }
23
+ export declare const boxDeprecated: {
24
+ attributes: {
25
+ padding: {
26
+ type: string;
27
+ default: {};
28
+ };
29
+ margin: {
30
+ type: string;
31
+ default: {};
32
+ };
33
+ borderRadius: {
34
+ type: string[];
35
+ default: string;
36
+ };
37
+ borderWidth: {
38
+ type: string;
39
+ default: string;
40
+ };
41
+ borderColor: {
42
+ type: string;
43
+ default: string;
44
+ };
45
+ background: {
46
+ type: string;
47
+ default: string;
48
+ };
49
+ textColor: {
50
+ type: string;
51
+ default: string;
52
+ };
53
+ };
54
+ supports: {
55
+ html: boolean;
56
+ customClassName: boolean;
57
+ };
58
+ isEligible: (attributes: Record<string, unknown>) => boolean;
59
+ migrate: (attributes: Record<string, unknown>) => {
60
+ borderColor: string;
61
+ background: string;
62
+ textColor: string;
63
+ padding: Partial<Record<BoxSpacingSide, number>>;
64
+ margin: Partial<Record<BoxSpacingSide, number>>;
65
+ borderRadius: number;
66
+ borderWidth: number;
67
+ };
68
+ save: () => import("react").JSX.Element;
69
+ }[];
70
+ export {};
71
+ //# sourceMappingURL=deprecated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecated.d.ts","sourceRoot":"","sources":["../../../../src/blocks/layout/box/deprecated.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,cAAc,EAAC,MAAM,SAAS,CAAA;AAavD,UAAU,aAAa;IACrB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,UAAU,kBAAkB;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,mBAAoB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAClE,OAAO,EAAE,aAAa,CAAA;IACtB,MAAM,EAAE,aAAa,CAAA;IACrB,YAAY,EAAE,MAAM,GAAG,kBAAkB,CAAA;IACzC,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;CAClB;AAmFD,eAAO,MAAM,aAAa;;QAGpB,OAAO;YAAG,IAAI;YAAY,OAAO;;QACjC,MAAM;YAAG,IAAI;YAAY,OAAO;;QAChC,YAAY;YAAG,IAAI;YAAwB,OAAO;;QAClD,WAAW;YAAG,IAAI;YAAY,OAAO;;QACrC,WAAW;YAAG,IAAI;YAAY,OAAO;;QACrC,UAAU;YAAG,IAAI;YAAY,OAAO;;QACpC,SAAS;YAAG,IAAI;YAAY,OAAO;;;;QAE1B,IAAI;QAAS,eAAe;;6BACd,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;0BAC1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;qBAnGlC,MAAM;oBACP,MAAM;mBACP,MAAM;;;;;;;GA8GlB,CAAA"}
@@ -0,0 +1,100 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { InnerBlocks } from '@wordpress/block-editor';
3
+ /**
4
+ * v1 stored every length as a CSS string (`"16px"`, `"1rem"`) and allowed a
5
+ * per-corner `borderRadius` object. v2 stores plain pixel numbers, so posts
6
+ * saved by v1 have to be migrated — the save output is unchanged
7
+ * (`<InnerBlocks.Content />`), which means block validation never fails and
8
+ * would otherwise leave the legacy values in place, silently rendering
9
+ * `16pxpx`. `isEligible` is what forces the migration.
10
+ */
11
+ const BOX_SIDES = ['top', 'right', 'bottom', 'left'];
12
+ /**
13
+ * Parses a v1 CSS length into pixels. `rem`/`em` are approximated at the
14
+ * 16px browser default; anything else unitless-or-px is taken at face value.
15
+ * Unparseable values become 0, which renders as "no declaration".
16
+ */
17
+ function toPixels(value) {
18
+ if (typeof value === 'number') {
19
+ return Number.isFinite(value) ? value : 0;
20
+ }
21
+ if (typeof value !== 'string') {
22
+ return 0;
23
+ }
24
+ const match = value.trim().match(/^(-?\d*\.?\d+)\s*(px|rem|em)?$/);
25
+ if (!match) {
26
+ return 0;
27
+ }
28
+ const amount = Number.parseFloat(match[1]);
29
+ if (!Number.isFinite(amount)) {
30
+ return 0;
31
+ }
32
+ return match[2] === 'rem' || match[2] === 'em' ? Math.round(amount * 16) : Math.round(amount);
33
+ }
34
+ function migrateSpacing(spacing) {
35
+ const next = {};
36
+ for (const side of BOX_SIDES) {
37
+ const pixels = toPixels(spacing === null || spacing === void 0 ? void 0 : spacing[side]);
38
+ if (pixels !== 0) {
39
+ next[side] = pixels;
40
+ }
41
+ }
42
+ return next;
43
+ }
44
+ /**
45
+ * v1 could set each corner separately; v2 has a single radius. The first
46
+ * non-zero corner wins — lossy by design, and only for content that actually
47
+ * used per-corner radii.
48
+ */
49
+ function migrateBorderRadius(radius) {
50
+ if (radius && typeof radius === 'object') {
51
+ for (const corner of ['topLeft', 'topRight', 'bottomRight', 'bottomLeft']) {
52
+ const pixels = toPixels(radius[corner]);
53
+ if (pixels !== 0) {
54
+ return pixels;
55
+ }
56
+ }
57
+ return 0;
58
+ }
59
+ return toPixels(radius);
60
+ }
61
+ /** A v1 value still needing conversion: a non-empty string, or a corner object. */
62
+ function isLegacyLength(value) {
63
+ return (typeof value === 'string' && value !== '') || (!!value && typeof value === 'object');
64
+ }
65
+ function hasLegacyLengths(attributes) {
66
+ for (const spacing of [attributes.padding, attributes.margin]) {
67
+ for (const side of BOX_SIDES) {
68
+ if (isLegacyLength(spacing === null || spacing === void 0 ? void 0 : spacing[side])) {
69
+ return true;
70
+ }
71
+ }
72
+ }
73
+ return isLegacyLength(attributes.borderWidth) || isLegacyLength(attributes.borderRadius);
74
+ }
75
+ export const boxDeprecated = [
76
+ {
77
+ attributes: {
78
+ padding: { type: 'object', default: {} },
79
+ margin: { type: 'object', default: {} },
80
+ borderRadius: { type: ['string', 'object'], default: '' },
81
+ borderWidth: { type: 'string', default: '' },
82
+ borderColor: { type: 'string', default: '' },
83
+ background: { type: 'string', default: '' },
84
+ textColor: { type: 'string', default: '' },
85
+ },
86
+ supports: { html: false, customClassName: false },
87
+ isEligible: (attributes) => hasLegacyLengths(attributes),
88
+ migrate: (attributes) => {
89
+ const legacy = attributes;
90
+ return {
91
+ ...legacy,
92
+ padding: migrateSpacing(legacy.padding),
93
+ margin: migrateSpacing(legacy.margin),
94
+ borderRadius: migrateBorderRadius(legacy.borderRadius),
95
+ borderWidth: toPixels(legacy.borderWidth),
96
+ };
97
+ },
98
+ save: () => _jsx(InnerBlocks.Content, {}),
99
+ },
100
+ ];
@@ -1 +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"}
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;AAOtD,wBAAgB,aAAa,CAAC,OAAO,EAAE,UAAU,mCACG,cAAc,CAAC,aAAa,CAAC,iCAoChF"}