@brilo/base-blocks 0.1.0
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/.editorconfig +12 -0
- package/.prettierrc +8 -0
- package/README.md +59 -0
- package/USAGE.md +263 -0
- package/biome.json +38 -0
- package/bun.lock +1392 -0
- package/docs/block-anatomy.md +73 -0
- package/docs/conventions.md +204 -0
- package/docs/new-block.md +179 -0
- package/package.json +41 -0
- package/src/blocks/column/column-group/edit.tsx +56 -0
- package/src/blocks/column/column-group/editor.scss +7 -0
- package/src/blocks/column/column-group/factory.tsx +29 -0
- package/src/blocks/column/column-group/index.ts +14 -0
- package/src/blocks/column/column-group/types.ts +8 -0
- package/src/blocks/column/column-item/constants.ts +1 -0
- package/src/blocks/column/column-item/edit.tsx +48 -0
- package/src/blocks/column/column-item/editor.scss +34 -0
- package/src/blocks/column/column-item/factory.tsx +25 -0
- package/src/blocks/column/column-item/index.ts +10 -0
- package/src/blocks/column/column-item/types.ts +7 -0
- package/src/blocks/compare/compare-group/constants.ts +1 -0
- package/src/blocks/compare/compare-group/edit.tsx +52 -0
- package/src/blocks/compare/compare-group/factory.tsx +29 -0
- package/src/blocks/compare/compare-group/icon.tsx +7 -0
- package/src/blocks/compare/compare-group/index.ts +13 -0
- package/src/blocks/compare/compare-group/types.ts +12 -0
- package/src/blocks/compare/compare-item/edit.tsx +38 -0
- package/src/blocks/compare/compare-item/editor.scss +15 -0
- package/src/blocks/compare/compare-item/factory.tsx +28 -0
- package/src/blocks/compare/compare-item/icon.tsx +9 -0
- package/src/blocks/compare/compare-item/index.ts +13 -0
- package/src/blocks/compare/compare-item/types.ts +9 -0
- package/src/blocks/compare/compare-option/constants.ts +7 -0
- package/src/blocks/compare/compare-option/edit.tsx +64 -0
- package/src/blocks/compare/compare-option/editor.scss +26 -0
- package/src/blocks/compare/compare-option/factory.tsx +35 -0
- package/src/blocks/compare/compare-option/icon.tsx +7 -0
- package/src/blocks/compare/compare-option/index.ts +8 -0
- package/src/blocks/compare/compare-option/types.ts +12 -0
- package/src/blocks/contact/contact-group/constants.ts +3 -0
- package/src/blocks/contact/contact-group/edit.tsx +57 -0
- package/src/blocks/contact/contact-group/editor.scss +20 -0
- package/src/blocks/contact/contact-group/factory.tsx +35 -0
- package/src/blocks/contact/contact-group/index.ts +12 -0
- package/src/blocks/contact/contact-group/types.ts +12 -0
- package/src/blocks/contact/contact-item/constants.ts +17 -0
- package/src/blocks/contact/contact-item/edit.tsx +93 -0
- package/src/blocks/contact/contact-item/editor.scss +38 -0
- package/src/blocks/contact/contact-item/factory.tsx +35 -0
- package/src/blocks/contact/contact-item/index.ts +23 -0
- package/src/blocks/contact/contact-item/types.ts +21 -0
- package/src/blocks/core/basic-button/constants.ts +17 -0
- package/src/blocks/core/basic-button/edit.tsx +107 -0
- package/src/blocks/core/basic-button/editor.scss +80 -0
- package/src/blocks/core/basic-button/factory.tsx +54 -0
- package/src/blocks/core/basic-button/index.ts +8 -0
- package/src/blocks/core/basic-button/types.ts +29 -0
- package/src/blocks/core/basic-heading/constants.ts +1 -0
- package/src/blocks/core/basic-heading/edit.tsx +76 -0
- package/src/blocks/core/basic-heading/editor.scss +8 -0
- package/src/blocks/core/basic-heading/factory.tsx +40 -0
- package/src/blocks/core/basic-heading/index.ts +8 -0
- package/src/blocks/core/basic-heading/types.ts +20 -0
- package/src/blocks/core/basic-overline/edit.tsx +28 -0
- package/src/blocks/core/basic-overline/editor.scss +14 -0
- package/src/blocks/core/basic-overline/factory.tsx +22 -0
- package/src/blocks/core/basic-overline/index.ts +8 -0
- package/src/blocks/core/basic-overline/types.ts +7 -0
- package/src/blocks/faq/faq-group/constants.ts +11 -0
- package/src/blocks/faq/faq-group/edit.tsx +55 -0
- package/src/blocks/faq/faq-group/editor.scss +11 -0
- package/src/blocks/faq/faq-group/factory.tsx +39 -0
- package/src/blocks/faq/faq-group/index.ts +11 -0
- package/src/blocks/faq/faq-group/types.ts +14 -0
- package/src/blocks/faq/faq-item/edit.tsx +50 -0
- package/src/blocks/faq/faq-item/editor.scss +57 -0
- package/src/blocks/faq/faq-item/factory.tsx +24 -0
- package/src/blocks/faq/faq-item/index.ts +9 -0
- package/src/blocks/faq/faq-item/types.ts +7 -0
- package/src/blocks/form/form-field/constants.ts +14 -0
- package/src/blocks/form/form-field/edit.tsx +178 -0
- package/src/blocks/form/form-field/editor.scss +71 -0
- package/src/blocks/form/form-field/factory.tsx +32 -0
- package/src/blocks/form/form-field/index.ts +10 -0
- package/src/blocks/form/form-field/types.ts +18 -0
- package/src/blocks/form/form-group/constants.ts +16 -0
- package/src/blocks/form/form-group/edit.tsx +190 -0
- package/src/blocks/form/form-group/editor.scss +41 -0
- package/src/blocks/form/form-group/factory.tsx +35 -0
- package/src/blocks/form/form-group/index.ts +18 -0
- package/src/blocks/form/form-group/types.ts +22 -0
- package/src/blocks/groups/banner-group/constants.ts +15 -0
- package/src/blocks/groups/banner-group/edit.tsx +122 -0
- package/src/blocks/groups/banner-group/editor.scss +18 -0
- package/src/blocks/groups/banner-group/factory.tsx +64 -0
- package/src/blocks/groups/banner-group/icon.tsx +13 -0
- package/src/blocks/groups/banner-group/index.ts +11 -0
- package/src/blocks/groups/banner-group/types.ts +30 -0
- package/src/blocks/groups/basic-header-group/constants.ts +9 -0
- package/src/blocks/groups/basic-header-group/edit.tsx +99 -0
- package/src/blocks/groups/basic-header-group/editor.scss +35 -0
- package/src/blocks/groups/basic-header-group/factory.tsx +46 -0
- package/src/blocks/groups/basic-header-group/icon.tsx +17 -0
- package/src/blocks/groups/basic-header-group/index.ts +9 -0
- package/src/blocks/groups/basic-header-group/types.ts +27 -0
- package/src/blocks/groups/button-group/constants.ts +7 -0
- package/src/blocks/groups/button-group/edit.tsx +52 -0
- package/src/blocks/groups/button-group/editor.scss +23 -0
- package/src/blocks/groups/button-group/factory.tsx +34 -0
- package/src/blocks/groups/button-group/index.ts +11 -0
- package/src/blocks/groups/button-group/types.ts +12 -0
- package/src/blocks/groups/text-and-media-group/constants.ts +43 -0
- package/src/blocks/groups/text-and-media-group/edit.tsx +241 -0
- package/src/blocks/groups/text-and-media-group/editor.scss +123 -0
- package/src/blocks/groups/text-and-media-group/factory.tsx +100 -0
- package/src/blocks/groups/text-and-media-group/icon.tsx +37 -0
- package/src/blocks/groups/text-and-media-group/index.ts +18 -0
- package/src/blocks/groups/text-and-media-group/types.ts +60 -0
- package/src/blocks/hero/hero-group/constants.ts +23 -0
- package/src/blocks/hero/hero-group/edit.tsx +85 -0
- package/src/blocks/hero/hero-group/editor.scss +0 -0
- package/src/blocks/hero/hero-group/factory.tsx +45 -0
- package/src/blocks/hero/hero-group/icon.tsx +28 -0
- package/src/blocks/hero/hero-group/index.ts +11 -0
- package/src/blocks/hero/hero-group/types.ts +22 -0
- package/src/blocks/hero/hero-item/constants.ts +15 -0
- package/src/blocks/hero/hero-item/edit.tsx +107 -0
- package/src/blocks/hero/hero-item/editor.scss +87 -0
- package/src/blocks/hero/hero-item/factory.tsx +49 -0
- package/src/blocks/hero/hero-item/index.ts +10 -0
- package/src/blocks/hero/hero-item/types.ts +38 -0
- package/src/blocks/map/map-group/constants.ts +20 -0
- package/src/blocks/map/map-group/edit.tsx +108 -0
- package/src/blocks/map/map-group/editor.scss +24 -0
- package/src/blocks/map/map-group/factory.tsx +51 -0
- package/src/blocks/map/map-group/index.ts +9 -0
- package/src/blocks/map/map-group/types.ts +16 -0
- package/src/blocks/newsletter/newsletter-form/constants.ts +5 -0
- package/src/blocks/newsletter/newsletter-form/edit.tsx +194 -0
- package/src/blocks/newsletter/newsletter-form/editor.scss +68 -0
- package/src/blocks/newsletter/newsletter-form/factory.tsx +59 -0
- package/src/blocks/newsletter/newsletter-form/index.ts +11 -0
- package/src/blocks/newsletter/newsletter-form/types.ts +45 -0
- package/src/blocks/post/post-slider-group/constants.ts +3 -0
- package/src/blocks/post/post-slider-group/edit.tsx +76 -0
- package/src/blocks/post/post-slider-group/factory.tsx +43 -0
- package/src/blocks/post/post-slider-group/icon.tsx +13 -0
- package/src/blocks/post/post-slider-group/index.ts +9 -0
- package/src/blocks/post/post-slider-group/types.ts +20 -0
- package/src/blocks/responsive-grid/responsive-grid-group/edit.tsx +95 -0
- package/src/blocks/responsive-grid/responsive-grid-group/factory.tsx +33 -0
- package/src/blocks/responsive-grid/responsive-grid-group/index.ts +13 -0
- package/src/blocks/responsive-grid/responsive-grid-group/types.ts +9 -0
- package/src/blocks/responsive-grid/responsive-grid-item/edit.tsx +19 -0
- package/src/blocks/responsive-grid/responsive-grid-item/factory.tsx +20 -0
- package/src/blocks/responsive-grid/responsive-grid-item/index.ts +9 -0
- package/src/blocks/responsive-grid/responsive-grid-item/types.ts +5 -0
- package/src/blocks/sections/base-section/attributes.ts +17 -0
- package/src/blocks/sections/base-section/constants.ts +18 -0
- package/src/blocks/sections/base-section/controls.tsx +70 -0
- package/src/blocks/sections/base-section/edit.tsx +34 -0
- package/src/blocks/sections/base-section/editor.scss +24 -0
- package/src/blocks/sections/base-section/factory.tsx +47 -0
- package/src/blocks/sections/base-section/icon.tsx +6 -0
- package/src/blocks/sections/base-section/index.ts +14 -0
- package/src/blocks/sections/base-section/types.ts +26 -0
- package/src/blocks/signpost/signpost-group/constants.ts +3 -0
- package/src/blocks/signpost/signpost-group/edit.tsx +75 -0
- package/src/blocks/signpost/signpost-group/editor.scss +0 -0
- package/src/blocks/signpost/signpost-group/factory.tsx +40 -0
- package/src/blocks/signpost/signpost-group/icon.tsx +19 -0
- package/src/blocks/signpost/signpost-group/index.ts +15 -0
- package/src/blocks/signpost/signpost-group/types.ts +9 -0
- package/src/blocks/signpost/signpost-item/constants.ts +4 -0
- package/src/blocks/signpost/signpost-item/edit.tsx +90 -0
- package/src/blocks/signpost/signpost-item/editor.scss +25 -0
- package/src/blocks/signpost/signpost-item/factory.tsx +29 -0
- package/src/blocks/signpost/signpost-item/icon.tsx +7 -0
- package/src/blocks/signpost/signpost-item/index.ts +10 -0
- package/src/blocks/signpost/signpost-item/types.ts +12 -0
- package/src/blocks/step/step-group/constants.ts +6 -0
- package/src/blocks/step/step-group/edit.tsx +64 -0
- package/src/blocks/step/step-group/editor.scss +19 -0
- package/src/blocks/step/step-group/factory.tsx +36 -0
- package/src/blocks/step/step-group/icon.tsx +27 -0
- package/src/blocks/step/step-group/index.ts +15 -0
- package/src/blocks/step/step-group/types.ts +13 -0
- package/src/blocks/step/step-item/constants.ts +6 -0
- package/src/blocks/step/step-item/edit.tsx +60 -0
- package/src/blocks/step/step-item/editor.scss +18 -0
- package/src/blocks/step/step-item/factory.tsx +27 -0
- package/src/blocks/step/step-item/index.ts +11 -0
- package/src/blocks/step/step-item/types.ts +12 -0
- package/src/blocks/testimonial/testimonial-group/constants.ts +27 -0
- package/src/blocks/testimonial/testimonial-group/edit.tsx +74 -0
- package/src/blocks/testimonial/testimonial-group/editor.scss +38 -0
- package/src/blocks/testimonial/testimonial-group/factory.tsx +44 -0
- package/src/blocks/testimonial/testimonial-group/icon.tsx +33 -0
- package/src/blocks/testimonial/testimonial-group/index.ts +15 -0
- package/src/blocks/testimonial/testimonial-group/types.ts +19 -0
- package/src/blocks/testimonial/testimonial-item/edit.tsx +48 -0
- package/src/blocks/testimonial/testimonial-item/editor.scss +20 -0
- package/src/blocks/testimonial/testimonial-item/factory.tsx +35 -0
- package/src/blocks/testimonial/testimonial-item/index.ts +9 -0
- package/src/blocks/testimonial/testimonial-item/types.ts +9 -0
- package/src/blocks/text-and-form/text-and-form-group/constants.ts +6 -0
- package/src/blocks/text-and-form/text-and-form-group/edit.tsx +59 -0
- package/src/blocks/text-and-form/text-and-form-group/editor.scss +21 -0
- package/src/blocks/text-and-form/text-and-form-group/factory.tsx +38 -0
- package/src/blocks/text-and-form/text-and-form-group/icon.tsx +23 -0
- package/src/blocks/text-and-form/text-and-form-group/index.ts +9 -0
- package/src/blocks/text-and-form/text-and-form-group/types.ts +23 -0
- package/src/blocks/text-and-form/text-and-form-text-column/constants.ts +10 -0
- package/src/blocks/text-and-form/text-and-form-text-column/edit.tsx +94 -0
- package/src/blocks/text-and-form/text-and-form-text-column/editor.scss +29 -0
- package/src/blocks/text-and-form/text-and-form-text-column/factory.tsx +41 -0
- package/src/blocks/text-and-form/text-and-form-text-column/index.ts +18 -0
- package/src/blocks/text-and-form/text-and-form-text-column/types.ts +23 -0
- package/src/blocks/usp/usp-group/constants.ts +54 -0
- package/src/blocks/usp/usp-group/edit.tsx +197 -0
- package/src/blocks/usp/usp-group/editor.scss +24 -0
- package/src/blocks/usp/usp-group/factory.tsx +113 -0
- package/src/blocks/usp/usp-group/icon.tsx +18 -0
- package/src/blocks/usp/usp-group/index.ts +15 -0
- package/src/blocks/usp/usp-group/types.ts +70 -0
- package/src/blocks/usp/usp-item/constants.ts +7 -0
- package/src/blocks/usp/usp-item/edit.tsx +65 -0
- package/src/blocks/usp/usp-item/editor.scss +17 -0
- package/src/blocks/usp/usp-item/factory.tsx +30 -0
- package/src/blocks/usp/usp-item/index.ts +11 -0
- package/src/blocks/usp/usp-item/types.ts +17 -0
- package/src/components/IconControl/IconControl.tsx +55 -0
- package/src/components/IconControl/editor.scss +53 -0
- package/src/components/IconControl/index.ts +2 -0
- package/src/components/IconControl/index.tsx +1 -0
- package/src/components/ImagePicker/ImagePicker.tsx +124 -0
- package/src/components/ImagePicker/editor.scss +79 -0
- package/src/components/ImagePicker/index.ts +2 -0
- package/src/components/ImagePicker/index.tsx +1 -0
- package/src/components/ItemIconControl/ItemIconControl.tsx +72 -0
- package/src/components/ItemIconControl/ItemIconModal.tsx +12 -0
- package/src/components/ItemIconControl/ItemIconPreview.tsx +93 -0
- package/src/components/ItemIconControl/editor.scss +52 -0
- package/src/components/ItemIconControl/index.ts +2 -0
- package/src/components/ItemIconControl/types.d.ts +30 -0
- package/src/constants.ts +20 -0
- package/src/editor.scss +34 -0
- package/src/globals.scss +237 -0
- package/src/hooks/useGroupBlock.ts +53 -0
- package/src/index.ts +122 -0
- package/src/types.ts +33 -0
- package/src/utils/createEditAdapter.ts +11 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {RichText, useBlockProps} from '@wordpress/block-editor'
|
|
2
|
+
import {__} from '@wordpress/i18n'
|
|
3
|
+
import type {BasicOverlineAttributes, BasicOverlineOptions} from './types'
|
|
4
|
+
|
|
5
|
+
export function createBasicOverlineEdit(options: BasicOverlineOptions) {
|
|
6
|
+
return function Edit({
|
|
7
|
+
attributes,
|
|
8
|
+
setAttributes,
|
|
9
|
+
}: {
|
|
10
|
+
attributes: BasicOverlineAttributes
|
|
11
|
+
setAttributes: (a: Partial<BasicOverlineAttributes>) => void
|
|
12
|
+
}) {
|
|
13
|
+
const blockProps = useBlockProps({className: options.blockClassName ?? 'i-overline'})
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div {...blockProps}>
|
|
17
|
+
<RichText
|
|
18
|
+
tagName="span"
|
|
19
|
+
className="i-overline__text u-text-editable"
|
|
20
|
+
value={attributes.title}
|
|
21
|
+
onChange={(value) => setAttributes({title: value})}
|
|
22
|
+
placeholder={__('Overline...', 'brilo-blocks')}
|
|
23
|
+
allowedFormats={[]}
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
2
|
+
import {__} from '@wordpress/i18n'
|
|
3
|
+
import {createBasicOverlineEdit} from './edit'
|
|
4
|
+
import type {BasicOverlineAttributes, BasicOverlineOptions} from './types'
|
|
5
|
+
|
|
6
|
+
export type {BasicOverlineAttributes, BasicOverlineOptions}
|
|
7
|
+
|
|
8
|
+
export function createBasicOverlineBlock(options: BasicOverlineOptions): BlockConfiguration<BasicOverlineAttributes> {
|
|
9
|
+
return {
|
|
10
|
+
name: options.name,
|
|
11
|
+
title: options.title ?? __('Overline', 'brilo-blocks'),
|
|
12
|
+
description: options.description,
|
|
13
|
+
category: options.category ?? 'text',
|
|
14
|
+
supports: {html: false, customClassName: false},
|
|
15
|
+
icon: options.icon ?? 'text',
|
|
16
|
+
attributes: {
|
|
17
|
+
title: {type: 'string', default: ''},
|
|
18
|
+
},
|
|
19
|
+
edit: createBasicOverlineEdit(options),
|
|
20
|
+
save: () => null,
|
|
21
|
+
} as unknown as BlockConfiguration<BasicOverlineAttributes>
|
|
22
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type {BasicOverlineAttributes, BasicOverlineOptions} from './types'
|
|
2
|
+
export {createBasicOverlineBlock} from './factory'
|
|
3
|
+
|
|
4
|
+
import type {BasicOverlineOptions} from './types'
|
|
5
|
+
|
|
6
|
+
export const basicOverlineDefaults: BasicOverlineOptions = {
|
|
7
|
+
name: 'brilo/basic-overline',
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {__} from '@wordpress/i18n'
|
|
2
|
+
|
|
3
|
+
export const FAQ_HEADING_LEVELS = ['2', '3'] as const
|
|
4
|
+
|
|
5
|
+
export const DEFAULT_ICON_VARIANTS = [
|
|
6
|
+
{value: 'none', label: __('Nic', 'brilo-blocks')},
|
|
7
|
+
{value: 'question', label: __('Otazník', 'brilo-blocks')},
|
|
8
|
+
{value: 'exclamation', label: __('Vykřičník', 'brilo-blocks')},
|
|
9
|
+
{value: 'info', label: __('Informace', 'brilo-blocks')},
|
|
10
|
+
{value: 'message', label: __('Zpráva', 'brilo-blocks')},
|
|
11
|
+
] as const
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {InspectorControls} from '@wordpress/block-editor'
|
|
2
|
+
import {PanelBody, SelectControl} from '@wordpress/components'
|
|
3
|
+
import {__} from '@wordpress/i18n'
|
|
4
|
+
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
5
|
+
import {DEFAULT_ICON_VARIANTS, FAQ_HEADING_LEVELS} from './constants'
|
|
6
|
+
import type {FaqGroupAttributes, FaqGroupOptions, FaqHeadingLevel, FaqIconVariant} from './types'
|
|
7
|
+
|
|
8
|
+
export function createFaqGroupEdit(options: FaqGroupOptions) {
|
|
9
|
+
const ICON_VARIANTS = options.iconVariants ?? DEFAULT_ICON_VARIANTS
|
|
10
|
+
|
|
11
|
+
return function Edit({
|
|
12
|
+
attributes,
|
|
13
|
+
setAttributes,
|
|
14
|
+
}: {
|
|
15
|
+
attributes: FaqGroupAttributes
|
|
16
|
+
setAttributes: (a: Partial<FaqGroupAttributes>) => void
|
|
17
|
+
}) {
|
|
18
|
+
const {headingLevel, iconVariant} = attributes
|
|
19
|
+
|
|
20
|
+
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
21
|
+
blockClassName: options.blockClassName ?? 'g-faq wp-block-section',
|
|
22
|
+
containerClassName: options.containerClassName ?? 'g-faq__items',
|
|
23
|
+
allowedBlocks: options.allowedBlocks,
|
|
24
|
+
template: options.template,
|
|
25
|
+
orientation: 'vertical',
|
|
26
|
+
layout: {type: 'default'},
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<>
|
|
31
|
+
<InspectorControls>
|
|
32
|
+
<PanelBody title={__('Nadpis', 'brilo-blocks')}>
|
|
33
|
+
<SelectControl
|
|
34
|
+
label={__('Level nadpisu FAQ', 'brilo-blocks')}
|
|
35
|
+
value={headingLevel}
|
|
36
|
+
options={FAQ_HEADING_LEVELS.map((level) => ({value: level, label: `H${level}`}))}
|
|
37
|
+
onChange={(value) => setAttributes({headingLevel: value as FaqHeadingLevel})}
|
|
38
|
+
/>
|
|
39
|
+
</PanelBody>
|
|
40
|
+
<PanelBody title={__('Ikona', 'brilo-blocks')}>
|
|
41
|
+
<SelectControl
|
|
42
|
+
label={__('Typ ikonky', 'brilo-blocks')}
|
|
43
|
+
value={iconVariant}
|
|
44
|
+
options={ICON_VARIANTS.map((v) => ({value: v.value, label: v.label}))}
|
|
45
|
+
onChange={(value) => setAttributes({iconVariant: value as FaqIconVariant})}
|
|
46
|
+
/>
|
|
47
|
+
</PanelBody>
|
|
48
|
+
</InspectorControls>
|
|
49
|
+
<div {...blockProps}>
|
|
50
|
+
<div {...innerBlocksProps} />
|
|
51
|
+
</div>
|
|
52
|
+
</>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {InnerBlocks} from '@wordpress/block-editor'
|
|
2
|
+
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
3
|
+
import {__} from '@wordpress/i18n'
|
|
4
|
+
import type {OptionArray} from '~/types'
|
|
5
|
+
import {DEFAULT_ICON_VARIANTS, FAQ_HEADING_LEVELS} from './constants'
|
|
6
|
+
import {createFaqGroupEdit} from './edit'
|
|
7
|
+
import type {FaqGroupAttributes, FaqGroupOptions} from './types'
|
|
8
|
+
|
|
9
|
+
export type {FaqGroupAttributes, FaqGroupOptions}
|
|
10
|
+
|
|
11
|
+
export function createFaqGroupBlock<TIconVariants extends OptionArray = typeof DEFAULT_ICON_VARIANTS>(
|
|
12
|
+
options: FaqGroupOptions<TIconVariants>,
|
|
13
|
+
): BlockConfiguration<FaqGroupAttributes<TIconVariants[number]['value']>> {
|
|
14
|
+
const iconVariants = options.iconVariants ?? DEFAULT_ICON_VARIANTS
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
name: options.name,
|
|
18
|
+
title: options.title ?? __('FAQ', 'brilo-blocks'),
|
|
19
|
+
description: options.description,
|
|
20
|
+
category: options.category ?? 'layout',
|
|
21
|
+
...(options.parent && {parent: options.parent}),
|
|
22
|
+
icon: options.icon ?? 'editor-help',
|
|
23
|
+
supports: {html: false, customClassName: false},
|
|
24
|
+
attributes: {
|
|
25
|
+
headingLevel: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
default: FAQ_HEADING_LEVELS[1],
|
|
28
|
+
enum: [...FAQ_HEADING_LEVELS],
|
|
29
|
+
},
|
|
30
|
+
iconVariant: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
default: iconVariants[1]?.value ?? iconVariants[0].value,
|
|
33
|
+
enum: iconVariants.map((v) => v.value),
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
edit: createFaqGroupEdit(options as unknown as FaqGroupOptions),
|
|
37
|
+
save: () => <InnerBlocks.Content />,
|
|
38
|
+
} as unknown as BlockConfiguration<FaqGroupAttributes<TIconVariants[number]['value']>>
|
|
39
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type {FaqGroupAttributes, FaqGroupOptions} from './types'
|
|
2
|
+
export {createFaqGroupBlock} from './factory'
|
|
3
|
+
|
|
4
|
+
import type {FaqGroupOptions} from './types'
|
|
5
|
+
|
|
6
|
+
export const faqGroupDefaults: FaqGroupOptions = {
|
|
7
|
+
name: 'brilo/faq-group',
|
|
8
|
+
parent: ['brilo/base-section'],
|
|
9
|
+
allowedBlocks: ['brilo/faq-item'],
|
|
10
|
+
template: [['brilo/faq-item', {}]],
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type {BriloBlockType, OptionArray} from '~/types'
|
|
2
|
+
import type {DEFAULT_ICON_VARIANTS, FAQ_HEADING_LEVELS} from './constants'
|
|
3
|
+
|
|
4
|
+
export type FaqHeadingLevel = (typeof FAQ_HEADING_LEVELS)[number]
|
|
5
|
+
export type FaqIconVariant = (typeof DEFAULT_ICON_VARIANTS)[number]['value']
|
|
6
|
+
|
|
7
|
+
export interface FaqGroupAttributes<TIconVariant extends string = FaqIconVariant> extends Record<string, unknown> {
|
|
8
|
+
headingLevel: FaqHeadingLevel
|
|
9
|
+
iconVariant: TIconVariant
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface FaqGroupOptions<TIconVariants extends OptionArray = typeof DEFAULT_ICON_VARIANTS> extends BriloBlockType {
|
|
13
|
+
iconVariants?: TIconVariants
|
|
14
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {InspectorControls, RichText, useBlockProps, useInnerBlocksProps} from '@wordpress/block-editor'
|
|
2
|
+
import {BaseControl, PanelBody} from '@wordpress/components'
|
|
3
|
+
import {Icon, chevronDown} from '@wordpress/icons'
|
|
4
|
+
import {__} from '@wordpress/i18n'
|
|
5
|
+
import clsx from 'clsx'
|
|
6
|
+
import type {FaqItemAttributes, FaqItemOptions} from './types'
|
|
7
|
+
|
|
8
|
+
export function createFaqItemEdit(_options: FaqItemOptions) {
|
|
9
|
+
return function Edit({
|
|
10
|
+
attributes,
|
|
11
|
+
setAttributes,
|
|
12
|
+
}: {
|
|
13
|
+
attributes: FaqItemAttributes
|
|
14
|
+
setAttributes: (a: Partial<FaqItemAttributes>) => void
|
|
15
|
+
}) {
|
|
16
|
+
const {title} = attributes
|
|
17
|
+
|
|
18
|
+
const blockProps = useBlockProps({className: clsx('faq-item')})
|
|
19
|
+
const innerBlocksProps = useInnerBlocksProps(
|
|
20
|
+
{},
|
|
21
|
+
{allowedBlocks: ['core/paragraph', 'core/list', 'core/image', 'core/table', 'brilo/button-group']},
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<div {...blockProps}>
|
|
27
|
+
<header className="faq-item__header flex gap-2">
|
|
28
|
+
<RichText
|
|
29
|
+
identifier="title"
|
|
30
|
+
className="title u-text-editable grow"
|
|
31
|
+
tagName="h3"
|
|
32
|
+
value={title}
|
|
33
|
+
allowedFormats={[]}
|
|
34
|
+
onChange={(value: string) => setAttributes({title: value})}
|
|
35
|
+
placeholder={__('Nadpis prvku', 'brilo-blocks')}
|
|
36
|
+
data-custom-placeholder={true}
|
|
37
|
+
/>
|
|
38
|
+
<label className="faq-item__dropdown flex items-center justify-center cursor-pointer">
|
|
39
|
+
<Icon icon={chevronDown} size={32} className="faq-item__dropdown-icon" color="white" />
|
|
40
|
+
<input type="checkbox" defaultChecked />
|
|
41
|
+
</label>
|
|
42
|
+
</header>
|
|
43
|
+
<BaseControl label={__('Odpověď:', 'brilo-blocks')} className="faq-item__content">
|
|
44
|
+
<div {...innerBlocksProps} />
|
|
45
|
+
</BaseControl>
|
|
46
|
+
</div>
|
|
47
|
+
</>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.wp-block-brilo-faq-item {
|
|
2
|
+
padding: 16px;
|
|
3
|
+
border: 1px solid var(--border-color);
|
|
4
|
+
background: white;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.faq-item {
|
|
8
|
+
--dropdown-scale: -1;
|
|
9
|
+
--content-display: block;
|
|
10
|
+
|
|
11
|
+
&:has(input:checked) {
|
|
12
|
+
--dropdown-scale: 1;
|
|
13
|
+
--content-display: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.block-editor-block-list__layout {
|
|
17
|
+
p {
|
|
18
|
+
margin-block: 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.faq-item__content {
|
|
24
|
+
border: 1px solid var(--border-color);
|
|
25
|
+
padding: 12px;
|
|
26
|
+
display: var(--content-display);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.faq-item__dropdown {
|
|
30
|
+
height: 32px;
|
|
31
|
+
width: 32px;
|
|
32
|
+
margin-top: 21px;
|
|
33
|
+
border-radius: 4px;
|
|
34
|
+
position: relative;
|
|
35
|
+
background-color: #2271b1;
|
|
36
|
+
transition: background-color 0.3s ease;
|
|
37
|
+
|
|
38
|
+
&:hover {
|
|
39
|
+
background-color: #135e96;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
svg {
|
|
43
|
+
fill: white;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
input {
|
|
47
|
+
position: absolute;
|
|
48
|
+
bottom: 100%;
|
|
49
|
+
left: 0;
|
|
50
|
+
display: none;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.faq-item__dropdown-icon {
|
|
55
|
+
transition: transform 0.3s ease;
|
|
56
|
+
transform: scale(var(--dropdown-scale));
|
|
57
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {InnerBlocks} from '@wordpress/block-editor'
|
|
2
|
+
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
3
|
+
import {__} from '@wordpress/i18n'
|
|
4
|
+
import {createFaqItemEdit} from './edit'
|
|
5
|
+
import type {FaqItemAttributes, FaqItemOptions} from './types'
|
|
6
|
+
|
|
7
|
+
export type {FaqItemAttributes, FaqItemOptions}
|
|
8
|
+
|
|
9
|
+
export function createFaqItemBlock(options: FaqItemOptions): BlockConfiguration<FaqItemAttributes> {
|
|
10
|
+
return {
|
|
11
|
+
name: options.name,
|
|
12
|
+
title: options.title ?? __('FAQ položka', 'brilo-blocks'),
|
|
13
|
+
description: options.description,
|
|
14
|
+
category: options.category ?? 'layout',
|
|
15
|
+
...(options.parent && {parent: options.parent}),
|
|
16
|
+
icon: options.icon ?? 'editor-help',
|
|
17
|
+
supports: {html: false, customClassName: false},
|
|
18
|
+
attributes: {
|
|
19
|
+
title: {type: 'string', default: ''},
|
|
20
|
+
},
|
|
21
|
+
edit: createFaqItemEdit(options),
|
|
22
|
+
save: () => <InnerBlocks.Content />,
|
|
23
|
+
} as unknown as BlockConfiguration<FaqItemAttributes>
|
|
24
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type {FaqItemAttributes, FaqItemOptions} from './types'
|
|
2
|
+
export {createFaqItemBlock} from './factory'
|
|
3
|
+
|
|
4
|
+
import type {FaqItemOptions} from './types'
|
|
5
|
+
|
|
6
|
+
export const faqItemDefaults: FaqItemOptions = {
|
|
7
|
+
name: 'brilo/faq-item',
|
|
8
|
+
parent: ['brilo/faq-group'],
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {__} from '@wordpress/i18n'
|
|
2
|
+
|
|
3
|
+
export const FIELD_TYPE_VALUES = ['text', 'textarea', 'select', 'hidden'] as const
|
|
4
|
+
|
|
5
|
+
export const FIELD_TYPES = [
|
|
6
|
+
{value: FIELD_TYPE_VALUES[0], label: __('Text', 'brilo-blocks')},
|
|
7
|
+
{value: FIELD_TYPE_VALUES[1], label: __('Textarea', 'brilo-blocks')},
|
|
8
|
+
{value: FIELD_TYPE_VALUES[2], label: __('Select', 'brilo-blocks')},
|
|
9
|
+
{value: FIELD_TYPE_VALUES[3], label: __('Hidden', 'brilo-blocks')},
|
|
10
|
+
] as const
|
|
11
|
+
|
|
12
|
+
export const FIELD_COLUMNS_RANGE = {min: 1, max: 12} as const
|
|
13
|
+
|
|
14
|
+
export const FIELD_COLUMNS_DEFAULT = 6
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import {InspectorControls, useBlockProps} from '@wordpress/block-editor'
|
|
2
|
+
import {Button, FormTokenField, PanelBody, RangeControl, SelectControl, TextControl, ToggleControl} from '@wordpress/components'
|
|
3
|
+
import {__} from '@wordpress/i18n'
|
|
4
|
+
import clsx from 'clsx'
|
|
5
|
+
import {FIELD_COLUMNS_DEFAULT, FIELD_COLUMNS_RANGE, FIELD_TYPES} from './constants'
|
|
6
|
+
import type {FormFieldAttributes, FormFieldOptions, FormFieldType} from './types'
|
|
7
|
+
|
|
8
|
+
const {min: MIN_COLUMNS, max: MAX_COLUMNS} = FIELD_COLUMNS_RANGE
|
|
9
|
+
|
|
10
|
+
function sanitizeHtmlName(raw: string): string {
|
|
11
|
+
return (raw ?? '')
|
|
12
|
+
.normalize('NFD')
|
|
13
|
+
.replace(/\p{Diacritic}/gu, '')
|
|
14
|
+
.replace(/[\s_]+/g, '-')
|
|
15
|
+
.replace(/[^a-zA-Z0-9_-]/g, '')
|
|
16
|
+
.replace(/[-_]{2,}/g, '-')
|
|
17
|
+
.replace(/^[-_]+/g, '')
|
|
18
|
+
.toLowerCase()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function createFormFieldEdit(_options: FormFieldOptions) {
|
|
22
|
+
return function Edit({
|
|
23
|
+
attributes,
|
|
24
|
+
setAttributes,
|
|
25
|
+
}: {
|
|
26
|
+
attributes: FormFieldAttributes
|
|
27
|
+
setAttributes: (a: Partial<FormFieldAttributes>) => void
|
|
28
|
+
}) {
|
|
29
|
+
const currentColumns = Math.max(MIN_COLUMNS, Math.min(MAX_COLUMNS, attributes.columns || MIN_COLUMNS))
|
|
30
|
+
|
|
31
|
+
const blockProps = useBlockProps({
|
|
32
|
+
className: clsx('i-form-field', `--type-${attributes.type}`, `--cols-${currentColumns}`, attributes.required && '--required'),
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const options = Array.isArray(attributes.options) ? attributes.options.filter((opt): opt is string => typeof opt === 'string') : []
|
|
36
|
+
|
|
37
|
+
const selectOptions = [{label: __('Žádná', 'brilo-blocks'), value: ''}, ...options.map((opt) => ({label: opt, value: opt}))]
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<>
|
|
41
|
+
<InspectorControls>
|
|
42
|
+
<PanelBody title={__('Pole formuláře', 'brilo-blocks')}>
|
|
43
|
+
<SelectControl
|
|
44
|
+
label={__('Typ inputu', 'brilo-blocks')}
|
|
45
|
+
value={attributes.type}
|
|
46
|
+
options={FIELD_TYPES.map((t) => ({label: t.label, value: t.value}))}
|
|
47
|
+
onChange={(type) => setAttributes({type: type as FormFieldType})}
|
|
48
|
+
/>
|
|
49
|
+
|
|
50
|
+
{attributes.type !== 'hidden' && (
|
|
51
|
+
<>
|
|
52
|
+
<TextControl label={__('Popisek', 'brilo-blocks')} value={attributes.label} onChange={(label) => setAttributes({label})} />
|
|
53
|
+
<ToggleControl
|
|
54
|
+
label={__('Povinné', 'brilo-blocks')}
|
|
55
|
+
checked={attributes.required}
|
|
56
|
+
onChange={(required) => setAttributes({required})}
|
|
57
|
+
/>
|
|
58
|
+
<TextControl
|
|
59
|
+
label={__('Název html atributu', 'brilo-blocks')}
|
|
60
|
+
value={attributes.name}
|
|
61
|
+
help={__(
|
|
62
|
+
'Použijte pouze bezpečné znaky: a-z, 0-9, pomlčka a podtržítko. Např. city-born-to. Mezery a diakritika se automaticky odstraní.',
|
|
63
|
+
'brilo-blocks',
|
|
64
|
+
)}
|
|
65
|
+
onChange={(name) => setAttributes({name: sanitizeHtmlName(name)})}
|
|
66
|
+
/>
|
|
67
|
+
<TextControl
|
|
68
|
+
label={__('Placeholder', 'brilo-blocks')}
|
|
69
|
+
value={attributes.placeholder}
|
|
70
|
+
onChange={(placeholder) => setAttributes({placeholder})}
|
|
71
|
+
/>
|
|
72
|
+
</>
|
|
73
|
+
)}
|
|
74
|
+
|
|
75
|
+
{attributes.type === 'select' && (
|
|
76
|
+
<>
|
|
77
|
+
<FormTokenField
|
|
78
|
+
label={__('Možnosti', 'brilo-blocks')}
|
|
79
|
+
value={options}
|
|
80
|
+
onChange={(nextOptions) =>
|
|
81
|
+
setAttributes({
|
|
82
|
+
options: (nextOptions ?? [])
|
|
83
|
+
.map((opt) => (typeof opt === 'string' ? opt : (opt as {value?: unknown}).value))
|
|
84
|
+
.filter((opt): opt is string => typeof opt === 'string' && opt.length > 0),
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
/>
|
|
88
|
+
|
|
89
|
+
<SelectControl
|
|
90
|
+
label={__('Výchozí hodnota', 'brilo-blocks')}
|
|
91
|
+
value={attributes.defaultValue ?? ''}
|
|
92
|
+
options={selectOptions}
|
|
93
|
+
onChange={(defaultValue) => setAttributes({defaultValue: defaultValue ?? ''})}
|
|
94
|
+
/>
|
|
95
|
+
</>
|
|
96
|
+
)}
|
|
97
|
+
|
|
98
|
+
{attributes.type === 'hidden' && (
|
|
99
|
+
<>
|
|
100
|
+
<TextControl
|
|
101
|
+
label={__('Hodnota', 'brilo-blocks')}
|
|
102
|
+
value={attributes.value ?? ''}
|
|
103
|
+
onChange={(value) => setAttributes({value})}
|
|
104
|
+
help={__('Hodnota, která bude odeslána s formulářem.', 'brilo-blocks')}
|
|
105
|
+
/>
|
|
106
|
+
<TextControl
|
|
107
|
+
label={__('Název html atributu', 'brilo-blocks')}
|
|
108
|
+
value={attributes.name}
|
|
109
|
+
help={__(
|
|
110
|
+
'Použijte pouze bezpečné znaky: a-z, 0-9, pomlčka a podtržítko. Mezery a diakritika se automaticky odstraní.',
|
|
111
|
+
'brilo-blocks',
|
|
112
|
+
)}
|
|
113
|
+
onChange={(name) => setAttributes({name: sanitizeHtmlName(name)})}
|
|
114
|
+
/>
|
|
115
|
+
</>
|
|
116
|
+
)}
|
|
117
|
+
|
|
118
|
+
{attributes.type !== 'hidden' && (
|
|
119
|
+
<RangeControl
|
|
120
|
+
label={__('Počet sloupců', 'brilo-blocks')}
|
|
121
|
+
value={currentColumns}
|
|
122
|
+
min={MIN_COLUMNS}
|
|
123
|
+
max={MAX_COLUMNS}
|
|
124
|
+
onChange={(columns) =>
|
|
125
|
+
setAttributes({columns: Math.max(MIN_COLUMNS, Math.min(MAX_COLUMNS, columns ?? FIELD_COLUMNS_DEFAULT))})
|
|
126
|
+
}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
129
|
+
</PanelBody>
|
|
130
|
+
</InspectorControls>
|
|
131
|
+
|
|
132
|
+
<div {...blockProps}>
|
|
133
|
+
<div className="i-form-field__wrapper">
|
|
134
|
+
{attributes.type === 'hidden' ? (
|
|
135
|
+
<>
|
|
136
|
+
<strong>{__('Skryté pole', 'brilo-blocks')}</strong>
|
|
137
|
+
<div>
|
|
138
|
+
{__('Hodnota', 'brilo-blocks')}: {attributes.value ?? ''}
|
|
139
|
+
</div>
|
|
140
|
+
<div>
|
|
141
|
+
{__('Název', 'brilo-blocks')}: {attributes.name ?? ''}
|
|
142
|
+
</div>
|
|
143
|
+
</>
|
|
144
|
+
) : (
|
|
145
|
+
<>
|
|
146
|
+
<strong>{attributes.label || __('Pole', 'brilo-blocks')}</strong>
|
|
147
|
+
<div>{attributes.type}</div>
|
|
148
|
+
<div className="i-form-field__columns-control">
|
|
149
|
+
<Button
|
|
150
|
+
size="small"
|
|
151
|
+
variant="secondary"
|
|
152
|
+
onClick={() => setAttributes({columns: Math.max(MIN_COLUMNS, currentColumns - 1)})}
|
|
153
|
+
disabled={currentColumns <= MIN_COLUMNS}
|
|
154
|
+
aria-label={__('Snížit počet sloupců', 'brilo-blocks')}
|
|
155
|
+
>
|
|
156
|
+
-
|
|
157
|
+
</Button>
|
|
158
|
+
|
|
159
|
+
<div className="i-form-field__columns-value">{`${currentColumns}/${MAX_COLUMNS}`}</div>
|
|
160
|
+
|
|
161
|
+
<Button
|
|
162
|
+
size="small"
|
|
163
|
+
variant="secondary"
|
|
164
|
+
onClick={() => setAttributes({columns: Math.min(MAX_COLUMNS, currentColumns + 1)})}
|
|
165
|
+
disabled={currentColumns >= MAX_COLUMNS}
|
|
166
|
+
aria-label={__('Zvýšit počet sloupců', 'brilo-blocks')}
|
|
167
|
+
>
|
|
168
|
+
+
|
|
169
|
+
</Button>
|
|
170
|
+
</div>
|
|
171
|
+
</>
|
|
172
|
+
)}
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
</>
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
.i-form-field {
|
|
2
|
+
width: 100%;
|
|
3
|
+
margin-block: 0;
|
|
4
|
+
|
|
5
|
+
&.--cols-1 {
|
|
6
|
+
grid-column: span 1;
|
|
7
|
+
}
|
|
8
|
+
&.--cols-2 {
|
|
9
|
+
grid-column: span 2;
|
|
10
|
+
}
|
|
11
|
+
&.--cols-3 {
|
|
12
|
+
grid-column: span 3;
|
|
13
|
+
}
|
|
14
|
+
&.--cols-4 {
|
|
15
|
+
grid-column: span 4;
|
|
16
|
+
}
|
|
17
|
+
&.--cols-5 {
|
|
18
|
+
grid-column: span 5;
|
|
19
|
+
}
|
|
20
|
+
&.--cols-6 {
|
|
21
|
+
grid-column: span 6;
|
|
22
|
+
}
|
|
23
|
+
&.--cols-7 {
|
|
24
|
+
grid-column: span 7;
|
|
25
|
+
}
|
|
26
|
+
&.--cols-8 {
|
|
27
|
+
grid-column: span 8;
|
|
28
|
+
}
|
|
29
|
+
&.--cols-9 {
|
|
30
|
+
grid-column: span 9;
|
|
31
|
+
}
|
|
32
|
+
&.--cols-10 {
|
|
33
|
+
grid-column: span 10;
|
|
34
|
+
}
|
|
35
|
+
&.--cols-11 {
|
|
36
|
+
grid-column: span 11;
|
|
37
|
+
}
|
|
38
|
+
&.--cols-12 {
|
|
39
|
+
grid-column: span 12;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Hidden fields span the full row — no column control
|
|
43
|
+
&.--type-hidden {
|
|
44
|
+
grid-column: span 12;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.--type-hidden .i-form-field__wrapper {
|
|
48
|
+
background: #f6f7f7;
|
|
49
|
+
border-style: dotted;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.i-form-field__wrapper {
|
|
54
|
+
padding: 12px;
|
|
55
|
+
border: 1px dashed rgba(0, 0, 0, 0.25);
|
|
56
|
+
background: #fff;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.i-form-field__columns-control {
|
|
60
|
+
margin-top: 10px;
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: space-between;
|
|
64
|
+
gap: 8px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.i-form-field__columns-value {
|
|
68
|
+
flex: 1;
|
|
69
|
+
text-align: center;
|
|
70
|
+
font-weight: 600;
|
|
71
|
+
}
|