@brilo/base-blocks 0.1.58 → 0.1.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/.tsbuildinfo +1 -1
- package/build/blocks/anchor/anchor-group/icon.js +1 -1
- package/build/blocks/career/career-benefits/icon.js +1 -1
- package/build/blocks/career/career-header/icon.js +1 -1
- package/build/blocks/career/job-position-group/icon.js +1 -1
- package/build/blocks/column/column-item/edit.d.ts.map +1 -1
- package/build/blocks/column/column-item/index.d.ts.map +1 -1
- package/build/blocks/column/column-item/index.js +1 -0
- package/build/blocks/compare/compare-option/edit.d.ts +1 -1
- package/build/blocks/compare/compare-option/edit.d.ts.map +1 -1
- package/build/blocks/compare/compare-option/edit.js +1 -1
- package/build/blocks/contact/contact-item/factory.d.ts.map +1 -1
- package/build/blocks/document/documents-grid/icon.js +1 -1
- package/build/blocks/event/event-detail-content/icon.js +1 -1
- package/build/blocks/event/event-detail-header/icon.js +1 -1
- package/build/blocks/event/event-list-group/icon.js +1 -1
- package/build/blocks/faq/faq-item/edit.d.ts.map +1 -1
- package/build/blocks/faq/faq-item/edit.js +2 -2
- package/build/blocks/food-menu/food-menu-group/FoodMenuPreview.d.ts.map +1 -1
- package/build/blocks/food-menu/food-menu-group/FoodMenuPreview.js +36 -6
- package/build/blocks/food-menu/food-menu-group/constants.d.ts +51 -3
- package/build/blocks/food-menu/food-menu-group/constants.d.ts.map +1 -1
- package/build/blocks/food-menu/food-menu-group/constants.js +32 -6
- package/build/blocks/food-menu/food-menu-group/edit.d.ts.map +1 -1
- package/build/blocks/food-menu/food-menu-group/edit.js +61 -2
- package/build/blocks/food-menu/food-menu-group/factory.d.ts.map +1 -1
- package/build/blocks/food-menu/food-menu-group/factory.js +77 -45
- package/build/blocks/food-menu/food-menu-group/index.d.ts +1 -1
- package/build/blocks/food-menu/food-menu-group/index.d.ts.map +1 -1
- package/build/blocks/food-menu/food-menu-group/types.d.ts +12 -5
- package/build/blocks/food-menu/food-menu-group/types.d.ts.map +1 -1
- package/build/blocks/food-menu/food-reservation/edit.d.ts +7 -0
- package/build/blocks/food-menu/food-reservation/edit.d.ts.map +1 -0
- package/build/blocks/food-menu/food-reservation/edit.js +69 -0
- package/build/blocks/food-menu/food-reservation/factory.d.ts +4 -0
- package/build/blocks/food-menu/food-reservation/factory.d.ts.map +1 -0
- package/build/blocks/food-menu/food-reservation/factory.js +24 -0
- package/build/blocks/food-menu/food-reservation/icon.d.ts +2 -0
- package/build/blocks/food-menu/food-reservation/icon.d.ts.map +1 -0
- package/build/blocks/food-menu/food-reservation/icon.js +2 -0
- package/build/blocks/food-menu/food-reservation/index.d.ts +5 -0
- package/build/blocks/food-menu/food-reservation/index.d.ts.map +1 -0
- package/build/blocks/food-menu/food-reservation/index.js +6 -0
- package/build/blocks/food-menu/food-reservation/types.d.ts +7 -0
- package/build/blocks/food-menu/food-reservation/types.d.ts.map +1 -0
- package/build/blocks/food-menu/food-reservation/types.js +1 -0
- package/build/blocks/form/form-field/types.d.ts +1 -1
- package/build/blocks/form/form-field/types.d.ts.map +1 -1
- package/build/blocks/form/form-group/index.js +1 -1
- package/build/blocks/gallery/gallery-group/constants.d.ts +1 -19
- package/build/blocks/gallery/gallery-group/constants.d.ts.map +1 -1
- package/build/blocks/gallery/gallery-group/constants.js +1 -8
- package/build/blocks/gallery/gallery-group/edit.d.ts.map +1 -1
- package/build/blocks/gallery/gallery-group/edit.js +3 -19
- package/build/blocks/gallery/gallery-item/index.js +1 -1
- package/build/blocks/gallery/gallery-strip-group/constants.d.ts +34 -0
- package/build/blocks/gallery/gallery-strip-group/constants.d.ts.map +1 -0
- package/build/blocks/gallery/gallery-strip-group/constants.js +17 -0
- package/build/blocks/gallery/gallery-strip-group/edit.d.ts +7 -0
- package/build/blocks/gallery/gallery-strip-group/edit.d.ts.map +1 -0
- package/build/blocks/gallery/gallery-strip-group/edit.js +34 -0
- package/build/blocks/gallery/gallery-strip-group/factory.d.ts +5 -0
- package/build/blocks/gallery/gallery-strip-group/factory.d.ts.map +1 -0
- package/build/blocks/gallery/gallery-strip-group/factory.js +28 -0
- package/build/blocks/gallery/gallery-strip-group/index.d.ts +5 -0
- package/build/blocks/gallery/gallery-strip-group/index.d.ts.map +1 -0
- package/build/blocks/gallery/gallery-strip-group/index.js +7 -0
- package/build/blocks/gallery/gallery-strip-group/types.d.ts +18 -0
- package/build/blocks/gallery/gallery-strip-group/types.d.ts.map +1 -0
- package/build/blocks/gallery/gallery-strip-group/types.js +1 -0
- package/build/blocks/groups/banner-group/icon.js +1 -1
- package/build/blocks/groups/content-group/icon.js +1 -1
- package/build/blocks/groups/text-and-media-group/index.d.ts.map +1 -1
- package/build/blocks/groups/text-and-media-group/index.js +2 -0
- package/build/blocks/hero/hero-group/edit.js +1 -1
- package/build/blocks/hero/hero-group/icon.js +1 -1
- package/build/blocks/hero/hero-group/types.d.ts +1 -1
- package/build/blocks/hero/hero-group/types.d.ts.map +1 -1
- package/build/blocks/hero/hero-item/edit.js +1 -1
- package/build/blocks/hero/hero-item/index.js +1 -1
- package/build/blocks/layout/box/icon.js +1 -1
- package/build/blocks/layout/layout-aside/edit.d.ts +1 -2
- package/build/blocks/layout/layout-aside/edit.d.ts.map +1 -1
- package/build/blocks/layout/layout-aside/edit.js +1 -1
- package/build/blocks/layout/layout-aside/factory.d.ts.map +1 -1
- package/build/blocks/layout/layout-aside/icon.d.ts +1 -2
- package/build/blocks/layout/layout-aside/icon.d.ts.map +1 -1
- package/build/blocks/layout/layout-aside/icon.js +1 -1
- package/build/blocks/layout/layout-content/edit.d.ts +1 -2
- package/build/blocks/layout/layout-content/edit.d.ts.map +1 -1
- package/build/blocks/layout/layout-content/edit.js +1 -1
- package/build/blocks/layout/layout-content/factory.d.ts.map +1 -1
- package/build/blocks/layout/layout-content/icon.d.ts +1 -2
- package/build/blocks/layout/layout-content/icon.d.ts.map +1 -1
- package/build/blocks/layout/layout-content/icon.js +1 -1
- package/build/blocks/layout/layout-content-w-aside/edit.d.ts +1 -2
- package/build/blocks/layout/layout-content-w-aside/edit.d.ts.map +1 -1
- package/build/blocks/layout/layout-content-w-aside/factory.d.ts.map +1 -1
- package/build/blocks/layout/layout-content-w-aside/icon.d.ts +1 -2
- package/build/blocks/layout/layout-content-w-aside/icon.d.ts.map +1 -1
- package/build/blocks/layout/layout-content-w-aside/icon.js +1 -1
- package/build/blocks/link/link-item/icon.js +1 -1
- package/build/blocks/map/map-group/edit.d.ts.map +1 -1
- package/build/blocks/map/map-group/edit.js +1 -1
- package/build/blocks/map/map-group/factory.d.ts.map +1 -1
- package/build/blocks/map/map-group/types.d.ts.map +1 -1
- package/build/blocks/newsletter/newsletter-form/edit.d.ts.map +1 -1
- package/build/blocks/newsletter/newsletter-form/edit.js +2 -1
- package/build/blocks/person/person-group/icon.js +1 -1
- package/build/blocks/person/person-item/constants.d.ts.map +1 -1
- package/build/blocks/post/post-content/icon.js +1 -1
- package/build/blocks/post/post-content/types.d.ts.map +1 -1
- package/build/blocks/post/post-slider-group/icon.js +1 -1
- package/build/blocks/post/posts-grid/icon.js +1 -1
- package/build/blocks/review/review-summary-item/constants.d.ts +3 -0
- package/build/blocks/review/review-summary-item/constants.d.ts.map +1 -0
- package/build/blocks/review/review-summary-item/constants.js +2 -0
- package/build/blocks/review/review-summary-item/edit.d.ts +6 -0
- package/build/blocks/review/review-summary-item/edit.d.ts.map +1 -0
- package/build/blocks/review/review-summary-item/edit.js +17 -0
- package/build/blocks/review/review-summary-item/factory.d.ts +5 -0
- package/build/blocks/review/review-summary-item/factory.d.ts.map +1 -0
- package/build/blocks/review/review-summary-item/factory.js +23 -0
- package/build/blocks/review/review-summary-item/index.d.ts +5 -0
- package/build/blocks/review/review-summary-item/index.d.ts.map +1 -0
- package/build/blocks/review/review-summary-item/index.js +5 -0
- package/build/blocks/review/review-summary-item/types.d.ts +11 -0
- package/build/blocks/review/review-summary-item/types.d.ts.map +1 -0
- package/build/blocks/review/review-summary-item/types.js +1 -0
- package/build/blocks/share/share/icon.js +1 -1
- package/build/blocks/signpost/signpost-group/icon.js +1 -1
- package/build/blocks/step/step-group/factory.d.ts.map +1 -1
- package/build/blocks/step/step-group/icon.js +1 -1
- package/build/blocks/testimonial/testimonial-group/icon.js +1 -1
- package/build/blocks/urgency/urgency-item/constants.d.ts +56 -0
- package/build/blocks/urgency/urgency-item/constants.d.ts.map +1 -0
- package/build/blocks/urgency/urgency-item/constants.js +32 -0
- package/build/blocks/urgency/urgency-item/edit.d.ts +7 -0
- package/build/blocks/urgency/urgency-item/edit.d.ts.map +1 -0
- package/build/blocks/urgency/urgency-item/edit.js +83 -0
- package/build/blocks/urgency/urgency-item/factory.d.ts +5 -0
- package/build/blocks/urgency/urgency-item/factory.d.ts.map +1 -0
- package/build/blocks/urgency/urgency-item/factory.js +31 -0
- package/build/blocks/urgency/urgency-item/index.d.ts +5 -0
- package/build/blocks/urgency/urgency-item/index.d.ts.map +1 -0
- package/build/blocks/urgency/urgency-item/index.js +5 -0
- package/build/blocks/urgency/urgency-item/types.d.ts +22 -0
- package/build/blocks/urgency/urgency-item/types.d.ts.map +1 -0
- package/build/blocks/urgency/urgency-item/types.js +1 -0
- package/build/components/GalleryImagesAppender/index.d.ts +5 -0
- package/build/components/GalleryImagesAppender/index.d.ts.map +1 -0
- package/build/components/GalleryImagesAppender/index.js +12 -0
- package/build/components/ImagePicker/ImagePicker.d.ts.map +1 -1
- package/build/components/ImagePicker/ImagePicker.js +1 -5
- package/build/constants.d.ts +19 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +8 -0
- package/build/hooks/useGroupBlock.d.ts.map +1 -1
- package/build/hooks/useGroupBlock.js +10 -3
- package/build/index.d.ts +8 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -0
- package/package.json +4 -3
- package/src/blocks/anchor/anchor-group/icon.tsx +1 -1
- package/src/blocks/career/career-benefits/icon.tsx +1 -1
- package/src/blocks/career/career-header/icon.tsx +1 -1
- package/src/blocks/career/job-position-group/icon.tsx +1 -1
- package/src/blocks/column/column-item/edit.tsx +0 -1
- package/src/blocks/column/column-item/index.ts +1 -0
- package/src/blocks/compare/compare-option/edit.tsx +1 -1
- package/src/blocks/contact/contact-item/factory.tsx +1 -2
- package/src/blocks/document/documents-grid/icon.tsx +1 -1
- package/src/blocks/event/event-detail-content/icon.tsx +1 -1
- package/src/blocks/event/event-detail-header/icon.tsx +1 -1
- package/src/blocks/event/event-list-group/icon.tsx +1 -1
- package/src/blocks/faq/faq-item/edit.tsx +23 -25
- package/src/blocks/food-menu/food-menu-group/FoodMenuPreview.tsx +58 -9
- package/src/blocks/food-menu/food-menu-group/constants.ts +37 -6
- package/src/blocks/food-menu/food-menu-group/edit.tsx +116 -20
- package/src/blocks/food-menu/food-menu-group/editor.scss +35 -6
- package/src/blocks/food-menu/food-menu-group/factory.tsx +77 -39
- package/src/blocks/food-menu/food-menu-group/index.ts +2 -0
- package/src/blocks/food-menu/food-menu-group/types.ts +18 -5
- package/src/blocks/food-menu/food-reservation/edit.tsx +179 -0
- package/src/blocks/food-menu/food-reservation/factory.tsx +28 -0
- package/src/blocks/food-menu/food-reservation/icon.tsx +9 -0
- package/src/blocks/food-menu/food-reservation/index.ts +10 -0
- package/src/blocks/food-menu/food-reservation/types.ts +8 -0
- package/src/blocks/form/form-field/types.ts +1 -7
- package/src/blocks/form/form-group/index.ts +1 -1
- package/src/blocks/gallery/gallery-group/constants.ts +1 -8
- package/src/blocks/gallery/gallery-group/edit.tsx +3 -39
- package/src/blocks/gallery/gallery-group/editor.scss +0 -12
- package/src/blocks/gallery/gallery-item/index.ts +1 -1
- package/src/blocks/gallery/gallery-strip-group/constants.ts +22 -0
- package/src/blocks/gallery/gallery-strip-group/edit.tsx +112 -0
- package/src/blocks/gallery/gallery-strip-group/editor.scss +36 -0
- package/src/blocks/gallery/gallery-strip-group/factory.tsx +32 -0
- package/src/blocks/gallery/gallery-strip-group/index.ts +11 -0
- package/src/blocks/gallery/gallery-strip-group/types.ts +20 -0
- package/src/blocks/groups/banner-group/edit.tsx +1 -1
- package/src/blocks/groups/banner-group/icon.tsx +1 -1
- package/src/blocks/groups/content-group/icon.tsx +1 -1
- package/src/blocks/groups/text-and-media-group/index.ts +2 -0
- package/src/blocks/hero/hero-group/edit.tsx +3 -3
- package/src/blocks/hero/hero-group/icon.tsx +1 -1
- package/src/blocks/hero/hero-group/types.ts +1 -1
- package/src/blocks/hero/hero-item/edit.tsx +5 -5
- package/src/blocks/hero/hero-item/index.ts +1 -1
- package/src/blocks/layout/box/icon.tsx +1 -1
- package/src/blocks/layout/layout-aside/edit.tsx +2 -3
- package/src/blocks/layout/layout-aside/factory.tsx +0 -1
- package/src/blocks/layout/layout-aside/icon.tsx +1 -3
- package/src/blocks/layout/layout-content/edit.tsx +2 -3
- package/src/blocks/layout/layout-content/factory.tsx +0 -1
- package/src/blocks/layout/layout-content/icon.tsx +1 -3
- package/src/blocks/layout/layout-content-w-aside/edit.tsx +0 -1
- package/src/blocks/layout/layout-content-w-aside/factory.tsx +0 -1
- package/src/blocks/layout/layout-content-w-aside/icon.tsx +1 -3
- package/src/blocks/link/link-item/icon.tsx +1 -1
- package/src/blocks/map/map-group/edit.tsx +8 -3
- package/src/blocks/map/map-group/factory.tsx +1 -1
- package/src/blocks/map/map-group/types.ts +1 -1
- package/src/blocks/newsletter/newsletter-form/edit.tsx +5 -2
- package/src/blocks/person/person-group/icon.tsx +1 -1
- package/src/blocks/person/person-item/constants.ts +1 -1
- package/src/blocks/post/post-content/icon.tsx +1 -1
- package/src/blocks/post/post-content/types.ts +0 -1
- package/src/blocks/post/post-slider-group/icon.tsx +1 -1
- package/src/blocks/post/posts-grid/icon.tsx +1 -1
- package/src/blocks/review/review-summary-item/constants.ts +2 -0
- package/src/blocks/review/review-summary-item/edit.tsx +86 -0
- package/src/blocks/review/review-summary-item/editor.scss +44 -0
- package/src/blocks/review/review-summary-item/factory.tsx +27 -0
- package/src/blocks/review/review-summary-item/index.ts +9 -0
- package/src/blocks/review/review-summary-item/types.ts +11 -0
- package/src/blocks/share/share/icon.tsx +1 -1
- package/src/blocks/signpost/signpost-group/icon.tsx +1 -1
- package/src/blocks/step/step-group/factory.tsx +1 -1
- package/src/blocks/step/step-group/icon.tsx +1 -1
- package/src/blocks/testimonial/testimonial-group/icon.tsx +1 -1
- package/src/blocks/urgency/urgency-item/constants.ts +39 -0
- package/src/blocks/urgency/urgency-item/edit.tsx +319 -0
- package/src/blocks/urgency/urgency-item/editor.scss +99 -0
- package/src/blocks/urgency/urgency-item/factory.tsx +36 -0
- package/src/blocks/urgency/urgency-item/index.ts +9 -0
- package/src/blocks/urgency/urgency-item/types.ts +23 -0
- package/src/components/GalleryImagesAppender/editor.scss +15 -0
- package/src/components/GalleryImagesAppender/index.tsx +29 -0
- package/src/components/ImagePicker/ImagePicker.tsx +6 -6
- package/src/components/ItemIconControl/types.d.ts +0 -1
- package/src/constants.ts +9 -0
- package/src/editor.scss +4 -0
- package/src/hooks/useGroupBlock.ts +10 -2
- package/src/index.ts +8 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {InspectorControls} from '@wordpress/block-editor'
|
|
2
|
+
import {
|
|
3
|
+
PanelBody,
|
|
4
|
+
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
5
|
+
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
6
|
+
} from '@wordpress/components'
|
|
7
|
+
import {__} from '@wordpress/i18n'
|
|
8
|
+
import clsx from 'clsx'
|
|
9
|
+
import {GalleryImagesAppender} from '~/components/GalleryImagesAppender'
|
|
10
|
+
import {ItemSpacingPanel, itemSpacingStyle} from '~/components/ItemSpacingControl'
|
|
11
|
+
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
12
|
+
import {DEFAULT_RATIOS, DIRECTIONS, HEIGHTS, HEIGHT_PIXELS, SPEEDS} from './constants'
|
|
13
|
+
import type {
|
|
14
|
+
GalleryStripDirection,
|
|
15
|
+
GalleryStripGroupAttributes,
|
|
16
|
+
GalleryStripGroupOptions,
|
|
17
|
+
GalleryStripHeight,
|
|
18
|
+
GalleryStripRatio,
|
|
19
|
+
GalleryStripSpeed,
|
|
20
|
+
} from './types'
|
|
21
|
+
|
|
22
|
+
export function createGalleryStripGroupEdit(options: GalleryStripGroupOptions) {
|
|
23
|
+
const RATIOS = options.ratios ?? DEFAULT_RATIOS
|
|
24
|
+
|
|
25
|
+
return function Edit({
|
|
26
|
+
attributes,
|
|
27
|
+
setAttributes,
|
|
28
|
+
clientId,
|
|
29
|
+
}: {
|
|
30
|
+
attributes: GalleryStripGroupAttributes
|
|
31
|
+
setAttributes: (a: Partial<GalleryStripGroupAttributes>) => void
|
|
32
|
+
clientId: string
|
|
33
|
+
}) {
|
|
34
|
+
const {height, ratio, speed, direction, spacing} = attributes
|
|
35
|
+
const heightPx = HEIGHT_PIXELS[height] ?? HEIGHT_PIXELS.md
|
|
36
|
+
const [ratioWidth, ratioHeight] = ratio.split(':').map(Number)
|
|
37
|
+
|
|
38
|
+
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
39
|
+
blockClassName: clsx(
|
|
40
|
+
options.blockClassName ?? 'g-gallery g-gallery-strip wp-block-section',
|
|
41
|
+
`--speed-${speed}`,
|
|
42
|
+
`--direction-${direction}`,
|
|
43
|
+
),
|
|
44
|
+
containerClassName: options.containerClassName ?? 'g-gallery-strip__track',
|
|
45
|
+
containerStyle: {
|
|
46
|
+
'--gallery-strip-height': `${heightPx}px`,
|
|
47
|
+
'--gallery-strip-item-width': `${Math.round((heightPx * ratioWidth) / ratioHeight)}px`,
|
|
48
|
+
...itemSpacingStyle(spacing),
|
|
49
|
+
},
|
|
50
|
+
allowedBlocks: options.allowedBlocks,
|
|
51
|
+
orientation: 'horizontal',
|
|
52
|
+
renderAppender: () => <GalleryImagesAppender clientId={clientId} itemBlock={options.allowedBlocks[0]} />,
|
|
53
|
+
template: options.template,
|
|
54
|
+
layout: {type: 'default'},
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<>
|
|
59
|
+
<InspectorControls>
|
|
60
|
+
<PanelBody title={__('Rozložení', 'brilo-blocks')}>
|
|
61
|
+
<ToggleGroupControl
|
|
62
|
+
isBlock
|
|
63
|
+
label={__('Výška', 'brilo-blocks')}
|
|
64
|
+
value={height}
|
|
65
|
+
onChange={(v) => setAttributes({height: v as GalleryStripHeight})}
|
|
66
|
+
>
|
|
67
|
+
{HEIGHTS.map((h) => (
|
|
68
|
+
<ToggleGroupControlOption key={h.value} value={h.value} label={h.label} />
|
|
69
|
+
))}
|
|
70
|
+
</ToggleGroupControl>
|
|
71
|
+
<ToggleGroupControl
|
|
72
|
+
isBlock
|
|
73
|
+
label={__('Poměr stran', 'brilo-blocks')}
|
|
74
|
+
value={ratio}
|
|
75
|
+
onChange={(v) => setAttributes({ratio: v as GalleryStripRatio})}
|
|
76
|
+
>
|
|
77
|
+
{RATIOS.map((r) => (
|
|
78
|
+
<ToggleGroupControlOption key={r.value} value={r.value} label={r.label} />
|
|
79
|
+
))}
|
|
80
|
+
</ToggleGroupControl>
|
|
81
|
+
</PanelBody>
|
|
82
|
+
<PanelBody title={__('Animace', 'brilo-blocks')}>
|
|
83
|
+
<ToggleGroupControl
|
|
84
|
+
isBlock
|
|
85
|
+
label={__('Rychlost', 'brilo-blocks')}
|
|
86
|
+
value={speed}
|
|
87
|
+
onChange={(v) => setAttributes({speed: v as GalleryStripSpeed})}
|
|
88
|
+
>
|
|
89
|
+
{SPEEDS.map((s) => (
|
|
90
|
+
<ToggleGroupControlOption key={s.value} value={s.value} label={s.label} />
|
|
91
|
+
))}
|
|
92
|
+
</ToggleGroupControl>
|
|
93
|
+
<ToggleGroupControl
|
|
94
|
+
isBlock
|
|
95
|
+
label={__('Směr', 'brilo-blocks')}
|
|
96
|
+
value={direction}
|
|
97
|
+
onChange={(v) => setAttributes({direction: v as GalleryStripDirection})}
|
|
98
|
+
>
|
|
99
|
+
{DIRECTIONS.map((d) => (
|
|
100
|
+
<ToggleGroupControlOption key={d.value} value={d.value} label={d.label} />
|
|
101
|
+
))}
|
|
102
|
+
</ToggleGroupControl>
|
|
103
|
+
</PanelBody>
|
|
104
|
+
<ItemSpacingPanel spacing={spacing} onChange={(v) => setAttributes({spacing: v})} />
|
|
105
|
+
</InspectorControls>
|
|
106
|
+
<div {...blockProps}>
|
|
107
|
+
<div {...innerBlocksProps} />
|
|
108
|
+
</div>
|
|
109
|
+
</>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.g-gallery-strip {
|
|
2
|
+
// Horizontal scroll only: items get a fixed width (height × ratio) and grow
|
|
3
|
+
// vertically to fit the gallery-item controls instead of overflowing.
|
|
4
|
+
.g-gallery-strip__track {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-wrap: nowrap;
|
|
7
|
+
align-items: stretch;
|
|
8
|
+
gap: 16px;
|
|
9
|
+
overflow-x: auto;
|
|
10
|
+
overflow-y: hidden;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.g-gallery-strip__track > .wp-block,
|
|
14
|
+
.g-gallery-strip__track > .block-list-appender {
|
|
15
|
+
flex: 0 0 var(--gallery-strip-item-width);
|
|
16
|
+
width: var(--gallery-strip-item-width);
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
min-height: var(--gallery-strip-height);
|
|
20
|
+
margin: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.i-gallery {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex: 1;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.i-gallery__image-wrapper {
|
|
30
|
+
flex: 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.g-gallery__appender {
|
|
34
|
+
min-height: var(--gallery-strip-height);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {InnerBlocks} from '@wordpress/block-editor'
|
|
2
|
+
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
3
|
+
import {__} from '@wordpress/i18n'
|
|
4
|
+
import {ITEM_SPACING_ATTRIBUTE} from '~/components/ItemSpacingControl'
|
|
5
|
+
import {DEFAULT_RATIOS, DIRECTIONS, HEIGHTS, SPEEDS} from './constants'
|
|
6
|
+
import {createGalleryStripGroupEdit} from './edit'
|
|
7
|
+
import type {GalleryStripGroupAttributes, GalleryStripGroupOptions} from './types'
|
|
8
|
+
|
|
9
|
+
export type {GalleryStripGroupAttributes, GalleryStripGroupOptions}
|
|
10
|
+
|
|
11
|
+
export function createGalleryStripGroupBlock(options: GalleryStripGroupOptions): BlockConfiguration<GalleryStripGroupAttributes> {
|
|
12
|
+
const ratios = options.ratios ?? DEFAULT_RATIOS
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
name: options.name,
|
|
16
|
+
title: options.title ?? __('Pás obrázků', 'brilo-blocks'),
|
|
17
|
+
description: options.description ?? __('Nekonečně se posouvající pás obrázků', 'brilo-blocks'),
|
|
18
|
+
category: options.category ?? 'layout',
|
|
19
|
+
...(options.parent && {parent: options.parent}),
|
|
20
|
+
icon: options.icon ?? 'images-alt2',
|
|
21
|
+
supports: {html: false, customClassName: false},
|
|
22
|
+
attributes: {
|
|
23
|
+
height: {type: 'string', default: HEIGHTS[1].value, enum: HEIGHTS.map((h) => h.value)},
|
|
24
|
+
ratio: {type: 'string', default: ratios[0].value, enum: ratios.map((r) => r.value)},
|
|
25
|
+
speed: {type: 'string', default: SPEEDS[1].value, enum: SPEEDS.map((s) => s.value)},
|
|
26
|
+
direction: {type: 'string', default: DIRECTIONS[0].value, enum: DIRECTIONS.map((d) => d.value)},
|
|
27
|
+
...ITEM_SPACING_ATTRIBUTE,
|
|
28
|
+
},
|
|
29
|
+
edit: createGalleryStripGroupEdit(options),
|
|
30
|
+
save: () => <InnerBlocks.Content />,
|
|
31
|
+
} as unknown as BlockConfiguration<GalleryStripGroupAttributes>
|
|
32
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type {GalleryStripGroupAttributes, GalleryStripGroupOptions} from './types'
|
|
2
|
+
export {createGalleryStripGroupBlock} from './factory'
|
|
3
|
+
|
|
4
|
+
import type {GalleryStripGroupOptions} from './types'
|
|
5
|
+
|
|
6
|
+
export const galleryStripGroupDefaults: GalleryStripGroupOptions = {
|
|
7
|
+
name: 'brilo/gallery-strip-group',
|
|
8
|
+
parent: ['brilo/base-section'],
|
|
9
|
+
allowedBlocks: ['brilo/gallery-item'],
|
|
10
|
+
template: [],
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type {BriloBlockType, OptionArray} from '~/types'
|
|
2
|
+
import type {DEFAULT_RATIOS, DIRECTIONS, HEIGHTS, SPEEDS} from './constants'
|
|
3
|
+
|
|
4
|
+
export type GalleryStripHeight = (typeof HEIGHTS)[number]['value']
|
|
5
|
+
export type GalleryStripSpeed = (typeof SPEEDS)[number]['value']
|
|
6
|
+
export type GalleryStripRatio = (typeof DEFAULT_RATIOS)[number]['value']
|
|
7
|
+
export type GalleryStripDirection = (typeof DIRECTIONS)[number]['value']
|
|
8
|
+
|
|
9
|
+
export interface GalleryStripGroupAttributes extends Record<string, unknown> {
|
|
10
|
+
height: GalleryStripHeight
|
|
11
|
+
ratio: GalleryStripRatio
|
|
12
|
+
speed: GalleryStripSpeed
|
|
13
|
+
direction: GalleryStripDirection
|
|
14
|
+
spacing?: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface GalleryStripGroupOptions extends BriloBlockType {
|
|
18
|
+
allowedBlocks: string[]
|
|
19
|
+
ratios?: OptionArray
|
|
20
|
+
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
BaseControl,
|
|
9
9
|
} from '@wordpress/components'
|
|
10
10
|
import {__} from '@wordpress/i18n'
|
|
11
|
-
import {
|
|
11
|
+
import {ImagePickerControl} from '~/components/ImagePicker'
|
|
12
12
|
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
13
13
|
import {useTenantColorPalette} from '~/hooks/useTenantColorPalette'
|
|
14
14
|
import {DEFAULT_HEADING_STYLES, DEFAULT_VARIANTS} from './constants'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const icon = (
|
|
2
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<svg aria-hidden="true" focusable="false" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<rect x="0.5" y="5.5" width="19" height="8" stroke="black" fill="none" />
|
|
4
4
|
<path d="M2 8H8V9H2V8Z" fill="black" />
|
|
5
5
|
<path d="M2 10H9V11H2V10Z" fill="black" />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const icon = (
|
|
2
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<svg aria-hidden="true" focusable="false" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<rect x="1.5" y="12.5" width="17" height="7" stroke="black" fill="none" />
|
|
4
4
|
<path fillRule="evenodd" clipRule="evenodd" d="M8.5 15L6 18L11 18L8.5 15Z" fill="black" />
|
|
5
5
|
<path
|
|
@@ -54,13 +54,13 @@ export function createHeroGroupEdit(options: HeroGroupOptions) {
|
|
|
54
54
|
<SelectControl
|
|
55
55
|
label={__('Efekt přechodu', 'brilo-blocks')}
|
|
56
56
|
value={effect}
|
|
57
|
-
options={EFFECTS_OPTIONS
|
|
57
|
+
options={EFFECTS_OPTIONS}
|
|
58
58
|
onChange={(v) => setAttributes({effect: v as Effect})}
|
|
59
59
|
/>
|
|
60
60
|
<SelectControl
|
|
61
61
|
label={__('Poměr stran', 'brilo-blocks')}
|
|
62
62
|
value={aspectRatio}
|
|
63
|
-
options={ASPECT_RATIOS_OPTIONS
|
|
63
|
+
options={ASPECT_RATIOS_OPTIONS}
|
|
64
64
|
onChange={(v) => setAttributes({aspectRatio: v as AspectRatio})}
|
|
65
65
|
/>
|
|
66
66
|
</PanelBody>
|
|
@@ -74,7 +74,7 @@ export function createHeroGroupEdit(options: HeroGroupOptions) {
|
|
|
74
74
|
<NumberControl
|
|
75
75
|
label={__('Rychlost přehrávání (ms)', 'brilo-blocks')}
|
|
76
76
|
value={autoplaySpeed}
|
|
77
|
-
onChange={(v) => setAttributes({autoplaySpeed: parseInt(v ?? '3000')})}
|
|
77
|
+
onChange={(v) => setAttributes({autoplaySpeed: parseInt(v ?? '3000', 10)})}
|
|
78
78
|
/>
|
|
79
79
|
)}
|
|
80
80
|
<ToggleControl
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const icon = (
|
|
2
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<svg aria-hidden="true" focusable="false" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<path d="M4 4H8V5H4V4Z" fill="black" />
|
|
4
4
|
<path d="M7 19H9V20H7V19Z" fill="black" />
|
|
5
5
|
<path d="M10 19H11V20H10V19Z" fill="black" />
|
|
@@ -2,7 +2,7 @@ import type {BlockEditProps} from '@wordpress/blocks'
|
|
|
2
2
|
import type {ReactNode} from 'react'
|
|
3
3
|
import type {BriloBlockType, OptionArray} from '~/types'
|
|
4
4
|
import type {HeroSliderItem} from '../hero-item/types'
|
|
5
|
-
import {DEFAULT_ASPECT_RATIOS, EFFECTS, VARIANTS} from './constants'
|
|
5
|
+
import type {DEFAULT_ASPECT_RATIOS, EFFECTS, VARIANTS} from './constants'
|
|
6
6
|
|
|
7
7
|
export type Variant = (typeof VARIANTS)[number]['value']
|
|
8
8
|
export type Effect = (typeof EFFECTS)[number]['value']
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {InspectorControls, RichText
|
|
1
|
+
import {InspectorControls, RichText} from '@wordpress/block-editor'
|
|
2
2
|
import type {BlockEditProps} from '@wordpress/blocks'
|
|
3
3
|
import {
|
|
4
4
|
PanelBody,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from '@wordpress/components'
|
|
13
13
|
import {__} from '@wordpress/i18n'
|
|
14
14
|
import {ImagePickerBody, ImagePickerControl} from '~/components/ImagePicker'
|
|
15
|
-
import {
|
|
15
|
+
import {HEADING_LEVELS} from './constants'
|
|
16
16
|
import type {ContentPosition, HeroItemAttributes, HeroItemOptions} from './types'
|
|
17
17
|
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
18
18
|
import {useTenantColorPalette} from '~/hooks/useTenantColorPalette'
|
|
@@ -41,14 +41,14 @@ export function createHeroItemEdit(options: HeroItemOptions) {
|
|
|
41
41
|
|
|
42
42
|
<BaseControl label={__('Focal point (desktop)', 'brilo-blocks')}>
|
|
43
43
|
<AlignmentMatrixControl
|
|
44
|
-
value={focalPoint.point
|
|
44
|
+
value={focalPoint.point}
|
|
45
45
|
onChange={(v) => setAttributes({focalPoint: {...focalPoint, point: (v ?? 'center center') as ContentPosition}})}
|
|
46
46
|
/>
|
|
47
47
|
</BaseControl>
|
|
48
48
|
|
|
49
49
|
<BaseControl label={__('Focal point (mobil)', 'brilo-blocks')}>
|
|
50
50
|
<AlignmentMatrixControl
|
|
51
|
-
value={
|
|
51
|
+
value={focalPoint.sm?.point ?? 'center center'}
|
|
52
52
|
onChange={(v) => setAttributes({focalPoint: {...focalPoint, sm: {point: (v ?? 'center center') as ContentPosition}}})}
|
|
53
53
|
/>
|
|
54
54
|
</BaseControl>
|
|
@@ -136,7 +136,7 @@ export function createHeroItemEdit(options: HeroItemOptions) {
|
|
|
136
136
|
/>
|
|
137
137
|
|
|
138
138
|
<RichText
|
|
139
|
-
tagName={`h${headingLevel}` as
|
|
139
|
+
tagName={`h${headingLevel}` as 'h1' | 'h2' | 'h3' | 'h4'}
|
|
140
140
|
className="i-hero__title u-text-editable"
|
|
141
141
|
style={titleColor ? {color: titleColor} : undefined}
|
|
142
142
|
value={title}
|
|
@@ -6,5 +6,5 @@ import type {HeroItemOptions} from './types'
|
|
|
6
6
|
export const heroItemDefaults: HeroItemOptions = {
|
|
7
7
|
name: 'brilo/hero-item',
|
|
8
8
|
parent: ['brilo/hero-group'],
|
|
9
|
-
allowedBlocks: ['core/list', 'core/paragraph', 'brilo/button-group'],
|
|
9
|
+
allowedBlocks: ['core/list', 'core/paragraph', 'brilo/button-group', 'brilo/review-summary-item'],
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const icon = (
|
|
2
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<svg aria-hidden="true" focusable="false" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<rect x="1.5" y="1.5" width="17" height="17" rx="2" stroke="black" fill="none" />
|
|
4
4
|
</svg>
|
|
5
5
|
)
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
3
|
-
import type {
|
|
2
|
+
import type {AsideOptions} from './types'
|
|
4
3
|
|
|
5
|
-
export function createAsideEdit(
|
|
4
|
+
export function createAsideEdit(_options: AsideOptions) {
|
|
6
5
|
return function Edit() {
|
|
7
6
|
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
8
7
|
blockClassName: 'l-content-w-aside__aside',
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {InnerBlocks} from '@wordpress/block-editor'
|
|
2
2
|
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
3
3
|
import {__} from '@wordpress/i18n'
|
|
4
|
-
import React from 'react'
|
|
5
4
|
import {createAsideEdit} from './edit'
|
|
6
5
|
import {icon as defaultIcon} from './icon'
|
|
7
6
|
import type {AsideAttributes, AsideOptions} from './types'
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
1
|
export const icon = (
|
|
4
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<svg aria-hidden="true" focusable="false" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5
3
|
<path fillRule="evenodd" clipRule="evenodd" d="M8 4H20V20H8V4ZM10 6H18V18H10V6Z" fill="currentColor" />
|
|
6
4
|
</svg>
|
|
7
5
|
)
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
3
|
-
import type {
|
|
2
|
+
import type {ContentOptions} from './types'
|
|
4
3
|
|
|
5
|
-
export function createContentEdit(
|
|
4
|
+
export function createContentEdit(_options: ContentOptions) {
|
|
6
5
|
return function Edit() {
|
|
7
6
|
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
8
7
|
blockClassName: 'l-content-w-aside__content',
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {InnerBlocks} from '@wordpress/block-editor'
|
|
2
2
|
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
3
3
|
import {__} from '@wordpress/i18n'
|
|
4
|
-
import React from 'react'
|
|
5
4
|
import {createContentEdit} from './edit'
|
|
6
5
|
import {icon as defaultIcon} from './icon'
|
|
7
6
|
import type {ContentAttributes, ContentOptions} from './types'
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
1
|
export const icon = (
|
|
4
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<svg aria-hidden="true" focusable="false" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5
3
|
<path fillRule="evenodd" clipRule="evenodd" d="M4 4H16V20H4V4ZM6 6H14V18H6V6Z" fill="currentColor" />
|
|
6
4
|
</svg>
|
|
7
5
|
)
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
6
6
|
} from '@wordpress/components'
|
|
7
7
|
import {__} from '@wordpress/i18n'
|
|
8
|
-
import React from 'react'
|
|
9
8
|
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
10
9
|
import {ASIDE_SIZES} from './constants'
|
|
11
10
|
import type {AsideSize, ContentWithAsideAttributes, ContentWithAsideOptions} from './types'
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {InnerBlocks} from '@wordpress/block-editor'
|
|
2
2
|
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
3
3
|
import {__} from '@wordpress/i18n'
|
|
4
|
-
import React from 'react'
|
|
5
4
|
import type {OptionArray} from '~/types'
|
|
6
5
|
import {ASIDE_SIZES} from './constants'
|
|
7
6
|
import {createContentWithAsideEdit} from './edit'
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
1
|
export const icon = (
|
|
4
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<svg aria-hidden="true" focusable="false" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5
3
|
<path fillRule="evenodd" clipRule="evenodd" d="M4 4H20V20H4V4ZM6 6H13V18H6V6ZM15 6H18V18H15V6Z" fill="currentColor" />
|
|
6
4
|
</svg>
|
|
7
5
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const icon = (
|
|
2
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<svg aria-hidden="true" focusable="false" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<path d="M8 4H4C2.895 4 2 4.895 2 6v10c0 1.105.895 2 2 2h10c1.105 0 2-.895 2-2v-4" stroke="black" strokeWidth="1.5" fill="none" />
|
|
4
4
|
<path d="M12 2h6v6M18 2L10 10" stroke="black" strokeWidth="1.5" strokeLinecap="round" />
|
|
5
5
|
</svg>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {InspectorControls, RichText
|
|
1
|
+
import {InspectorControls, RichText} from '@wordpress/block-editor'
|
|
2
2
|
import {
|
|
3
3
|
PanelBody,
|
|
4
4
|
BaseControl,
|
|
@@ -157,8 +157,13 @@ export function createMapGroupEdit(options: MapGroupOptions) {
|
|
|
157
157
|
<p>{[lat, long].filter(Boolean).join(', ')}</p>
|
|
158
158
|
</div>
|
|
159
159
|
)}
|
|
160
|
-
{mapType === 'url' && iframeSrc &&
|
|
161
|
-
|
|
160
|
+
{mapType === 'url' && iframeSrc && (
|
|
161
|
+
<iframe src={iframeSrc} title={__('Náhled mapy', 'brilo-blocks')} width={640} height={320}></iframe>
|
|
162
|
+
)}
|
|
163
|
+
{mapType === 'element' && iframeElement && (
|
|
164
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: the editor's own embed code (an iframe from the map provider), previewed as the page will show it
|
|
165
|
+
<div dangerouslySetInnerHTML={{__html: iframeElement}} />
|
|
166
|
+
)}
|
|
162
167
|
{mapType === 'image' && img && <ImagePickerControl value={img} onChange={(v) => setAttributes({img: v})} size={[640, 320]} />}
|
|
163
168
|
{(!mapType ||
|
|
164
169
|
(mapType === 'gps' && !lat && !long) ||
|
|
@@ -5,7 +5,7 @@ import {createMapGroupEdit} from './edit'
|
|
|
5
5
|
import type {MapGroupAttributes, MapGroupOptions} from './types'
|
|
6
6
|
import {MAP_TYPES} from './constants'
|
|
7
7
|
import type {StringArray} from '~/types'
|
|
8
|
-
import {DEFAULT_HEADING_STYLES
|
|
8
|
+
import {DEFAULT_HEADING_STYLES} from '~/blocks/groups/banner-group/constants'
|
|
9
9
|
import {InnerBlocks} from '@wordpress/block-editor'
|
|
10
10
|
import {HEADING_LEVELS} from '~/constants'
|
|
11
11
|
|
|
@@ -26,6 +26,7 @@ export function createNewsletterFormEdit(options: NewsletterFormOptions) {
|
|
|
26
26
|
}) {
|
|
27
27
|
const {heading, description, form} = attributes
|
|
28
28
|
const {email, submit, terms} = form.fields
|
|
29
|
+
const TermsTag = terms.isCheckbox ? 'label' : 'div'
|
|
29
30
|
|
|
30
31
|
const setForm = (patch: Partial<NewsletterFormAttributes['form']>) => setAttributes({form: {...form, ...patch}})
|
|
31
32
|
const setFields = (patch: Partial<NewsletterFormAttributes['form']['fields']>) => setForm({fields: {...form.fields, ...patch}})
|
|
@@ -77,6 +78,7 @@ export function createNewsletterFormEdit(options: NewsletterFormOptions) {
|
|
|
77
78
|
|
|
78
79
|
<PanelBody title={__('Skrytá pole', 'brilo-blocks')} initialOpen={false}>
|
|
79
80
|
{form.hiddenFields.map((field, i) => (
|
|
81
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: hidden fields carry no id; the list is edited by position
|
|
80
82
|
<div key={i} className="f-newsletter__hidden-field">
|
|
81
83
|
<TextControl
|
|
82
84
|
label={__('Název', 'brilo-blocks')}
|
|
@@ -176,7 +178,8 @@ export function createNewsletterFormEdit(options: NewsletterFormOptions) {
|
|
|
176
178
|
</button>
|
|
177
179
|
</div>
|
|
178
180
|
|
|
179
|
-
|
|
181
|
+
{/* A label only around a checkbox; without one the terms are plain text. */}
|
|
182
|
+
<TermsTag className="f-newsletter__terms">
|
|
180
183
|
{terms.isCheckbox && <input type="checkbox" disabled />}
|
|
181
184
|
<RichText
|
|
182
185
|
tagName="span"
|
|
@@ -186,7 +189,7 @@ export function createNewsletterFormEdit(options: NewsletterFormOptions) {
|
|
|
186
189
|
placeholder={__('Souhlas se zpracováním...', 'brilo-blocks')}
|
|
187
190
|
allowedFormats={['core/bold', 'core/italic', 'core/link']}
|
|
188
191
|
/>
|
|
189
|
-
</
|
|
192
|
+
</TermsTag>
|
|
190
193
|
</div>
|
|
191
194
|
</>
|
|
192
195
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const icon = (
|
|
2
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<svg aria-hidden="true" focusable="false" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<rect x="2.5" y="1.5" width="15" height="17" stroke="black" fill="none" />
|
|
4
4
|
<path d="M7 13H13V14H7V13Z" fill="black" />
|
|
5
5
|
<path d="M6 15H14V16H6V15Z" fill="black" />
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const icon = (
|
|
2
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<svg aria-hidden="true" focusable="false" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<rect x="3" y="2" width="14" height="16" rx="1" stroke="black" fill="none" />
|
|
4
4
|
<line x1="6" y1="6" x2="14" y2="6" stroke="black" />
|
|
5
5
|
<line x1="6" y1="9" x2="14" y2="9" stroke="black" />
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type {BriloBlockType} from '~/types'
|
|
2
2
|
|
|
3
|
-
// biome-ignore lint/complexity/noBannedTypes: no block-specific attributes, matches BriloBlockType's generic constraint shape
|
|
4
3
|
export interface PostContentAttributes extends Record<string, unknown> {}
|
|
5
4
|
|
|
6
5
|
export type PostContentOptions = BriloBlockType
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const icon = (
|
|
2
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<svg aria-hidden="true" focusable="false" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<rect x="1" y="4" width="18" height="12" rx="1" stroke="black" fill="none" />
|
|
4
4
|
<rect x="3" y="6" width="6" height="5" stroke="black" fill="none" />
|
|
5
5
|
<path d="M3 13H7V14H3V13Z" fill="black" />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const icon = (
|
|
2
|
-
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<svg aria-hidden="true" focusable="false" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<rect x="1" y="1" width="8" height="8" stroke="black" fill="none" />
|
|
4
4
|
<rect x="11" y="1" width="8" height="8" stroke="black" fill="none" />
|
|
5
5
|
<rect x="1" y="11" width="8" height="8" stroke="black" fill="none" />
|