@brilo/base-blocks 0.1.29 → 0.1.31
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/document/documents-grid/DocumentsSelectModal.d.ts.map +1 -0
- package/build/blocks/document/documents-grid/constants.d.ts +9 -0
- package/build/blocks/document/documents-grid/constants.d.ts.map +1 -0
- package/build/blocks/document/documents-grid/constants.js +8 -0
- package/build/blocks/document/documents-grid/edit.d.ts +6 -0
- package/build/blocks/document/documents-grid/edit.d.ts.map +1 -0
- package/build/blocks/document/{documents-group → documents-grid}/edit.js +10 -8
- package/build/blocks/document/documents-grid/factory.d.ts +5 -0
- package/build/blocks/document/documents-grid/factory.d.ts.map +1 -0
- package/build/blocks/document/{documents-group → documents-grid}/factory.js +12 -12
- package/build/blocks/document/documents-grid/icon.d.ts.map +1 -0
- package/build/blocks/document/documents-grid/index.d.ts +6 -0
- package/build/blocks/document/documents-grid/index.d.ts.map +1 -0
- package/build/blocks/document/documents-grid/index.js +5 -0
- package/build/blocks/document/documents-grid/types.d.ts +23 -0
- package/build/blocks/document/documents-grid/types.d.ts.map +1 -0
- package/build/blocks/groups/banner-group/edit.d.ts.map +1 -1
- package/build/blocks/groups/banner-group/edit.js +3 -1
- package/build/blocks/groups/banner-group/factory.js +1 -1
- package/build/blocks/groups/banner-group/types.d.ts +1 -0
- package/build/blocks/groups/banner-group/types.d.ts.map +1 -1
- package/build/blocks/groups/basic-header-group/edit.d.ts.map +1 -1
- package/build/blocks/groups/basic-header-group/edit.js +4 -2
- package/build/blocks/groups/basic-header-group/factory.js +1 -1
- package/build/blocks/groups/basic-header-group/types.d.ts +1 -0
- package/build/blocks/groups/basic-header-group/types.d.ts.map +1 -1
- package/build/blocks/hero/hero-item/edit.d.ts.map +1 -1
- package/build/blocks/hero/hero-item/edit.js +5 -3
- package/build/blocks/hero/hero-item/factory.d.ts.map +1 -1
- package/build/blocks/hero/hero-item/factory.js +1 -0
- package/build/blocks/hero/hero-item/types.d.ts +1 -0
- package/build/blocks/hero/hero-item/types.d.ts.map +1 -1
- package/build/index.d.ts +2 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/package.json +1 -1
- package/src/blocks/document/documents-grid/constants.ts +9 -0
- package/src/blocks/document/{documents-group → documents-grid}/edit.tsx +17 -15
- package/src/blocks/document/documents-grid/factory.tsx +63 -0
- package/src/blocks/document/documents-grid/index.ts +15 -0
- package/src/blocks/document/documents-grid/types.ts +26 -0
- package/src/blocks/groups/banner-group/edit.tsx +10 -0
- package/src/blocks/groups/banner-group/factory.tsx +1 -1
- package/src/blocks/groups/banner-group/types.ts +1 -1
- package/src/blocks/groups/basic-header-group/edit.tsx +13 -1
- package/src/blocks/groups/basic-header-group/factory.tsx +1 -1
- package/src/blocks/groups/basic-header-group/types.ts +1 -1
- package/src/blocks/hero/hero-item/edit.tsx +9 -1
- package/src/blocks/hero/hero-item/factory.tsx +1 -0
- package/src/blocks/hero/hero-item/types.ts +1 -0
- package/src/index.ts +7 -7
- package/build/blocks/document/documents-group/DocumentsSelectModal.d.ts.map +0 -1
- package/build/blocks/document/documents-group/constants.d.ts +0 -7
- package/build/blocks/document/documents-group/constants.d.ts.map +0 -1
- package/build/blocks/document/documents-group/constants.js +0 -5
- package/build/blocks/document/documents-group/edit.d.ts +0 -6
- package/build/blocks/document/documents-group/edit.d.ts.map +0 -1
- package/build/blocks/document/documents-group/factory.d.ts +0 -5
- package/build/blocks/document/documents-group/factory.d.ts.map +0 -1
- package/build/blocks/document/documents-group/icon.d.ts.map +0 -1
- package/build/blocks/document/documents-group/index.d.ts +0 -6
- package/build/blocks/document/documents-group/index.d.ts.map +0 -1
- package/build/blocks/document/documents-group/index.js +0 -5
- package/build/blocks/document/documents-group/types.d.ts +0 -22
- package/build/blocks/document/documents-group/types.d.ts.map +0 -1
- package/src/blocks/document/documents-group/constants.ts +0 -7
- package/src/blocks/document/documents-group/factory.tsx +0 -59
- package/src/blocks/document/documents-group/index.ts +0 -15
- package/src/blocks/document/documents-group/types.ts +0 -25
- /package/build/blocks/document/{documents-group → documents-grid}/DocumentsSelectModal.d.ts +0 -0
- /package/build/blocks/document/{documents-group → documents-grid}/DocumentsSelectModal.js +0 -0
- /package/build/blocks/document/{documents-group → documents-grid}/icon.d.ts +0 -0
- /package/build/blocks/document/{documents-group → documents-grid}/icon.js +0 -0
- /package/build/blocks/document/{documents-group → documents-grid}/types.js +0 -0
- /package/src/blocks/document/{documents-group → documents-grid}/DocumentsSelectModal.tsx +0 -0
- /package/src/blocks/document/{documents-group → documents-grid}/icon.tsx +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
2
|
+
import {__} from '@wordpress/i18n'
|
|
3
|
+
import {
|
|
4
|
+
DOCUMENTS_GRID_COLUMN_OPTIONS,
|
|
5
|
+
DOCUMENTS_GRID_COLUMNS,
|
|
6
|
+
DOCUMENTS_GRID_LISTING_STYLE,
|
|
7
|
+
DOCUMENTS_GRID_LISTING_STYLES,
|
|
8
|
+
DOCUMENTS_GRID_MODE,
|
|
9
|
+
DOCUMENTS_GRID_MODES,
|
|
10
|
+
DOCUMENTS_GRID_SORT_BY,
|
|
11
|
+
DOCUMENTS_GRID_SORT_BYS,
|
|
12
|
+
} from './constants'
|
|
13
|
+
import {createDocumentsGridEdit} from './edit'
|
|
14
|
+
import {icon as defaultIcon} from './icon'
|
|
15
|
+
import type {DocumentsGridAttributes, DocumentsGridOptions} from './types'
|
|
16
|
+
|
|
17
|
+
export type {DocumentsGridAttributes, DocumentsGridOptions}
|
|
18
|
+
|
|
19
|
+
export function createDocumentsGridBlock(options: DocumentsGridOptions): BlockConfiguration<DocumentsGridAttributes> {
|
|
20
|
+
return {
|
|
21
|
+
name: options.name,
|
|
22
|
+
title: options.title ?? __('Dokumenty', 'brilo-blocks'),
|
|
23
|
+
description: options.description,
|
|
24
|
+
category: options.category ?? 'widgets',
|
|
25
|
+
...(options.parent && {parent: options.parent}),
|
|
26
|
+
icon: options.icon ?? {src: defaultIcon},
|
|
27
|
+
supports: {html: false, customClassName: false},
|
|
28
|
+
attributes: {
|
|
29
|
+
mode: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
default: DOCUMENTS_GRID_MODE,
|
|
32
|
+
enum: [...DOCUMENTS_GRID_MODES],
|
|
33
|
+
},
|
|
34
|
+
listingStyle: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
default: DOCUMENTS_GRID_LISTING_STYLE,
|
|
37
|
+
enum: [...DOCUMENTS_GRID_LISTING_STYLES],
|
|
38
|
+
},
|
|
39
|
+
sortBy: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
default: DOCUMENTS_GRID_SORT_BY,
|
|
42
|
+
enum: [...DOCUMENTS_GRID_SORT_BYS],
|
|
43
|
+
},
|
|
44
|
+
columns: {
|
|
45
|
+
type: 'number',
|
|
46
|
+
default: DOCUMENTS_GRID_COLUMNS,
|
|
47
|
+
enum: [...DOCUMENTS_GRID_COLUMN_OPTIONS],
|
|
48
|
+
},
|
|
49
|
+
selectedDocuments: {
|
|
50
|
+
type: 'array',
|
|
51
|
+
default: [],
|
|
52
|
+
items: {type: 'number'},
|
|
53
|
+
},
|
|
54
|
+
selectedCategories: {
|
|
55
|
+
type: 'array',
|
|
56
|
+
default: [],
|
|
57
|
+
items: {type: 'number'},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
edit: createDocumentsGridEdit(options),
|
|
61
|
+
save: () => null,
|
|
62
|
+
} as unknown as BlockConfiguration<DocumentsGridAttributes>
|
|
63
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
DocumentsGridAttributes,
|
|
3
|
+
DocumentsGridOptions,
|
|
4
|
+
DocumentsGridListingStyle,
|
|
5
|
+
DocumentsGridMode,
|
|
6
|
+
DocumentsGridSortBy,
|
|
7
|
+
} from './types'
|
|
8
|
+
export {createDocumentsGridBlock} from './factory'
|
|
9
|
+
export {DocumentsSelectModal} from './DocumentsSelectModal'
|
|
10
|
+
|
|
11
|
+
import type {DocumentsGridOptions} from './types'
|
|
12
|
+
|
|
13
|
+
export const documentsGridDefaults: DocumentsGridOptions = {
|
|
14
|
+
name: 'brilo/documents-grid',
|
|
15
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type {BriloBlockType} from '~/types'
|
|
2
|
+
import type {DOCUMENTS_GRID_COLUMN_OPTIONS, DOCUMENTS_GRID_LISTING_STYLES, DOCUMENTS_GRID_MODES, DOCUMENTS_GRID_SORT_BYS} from './constants'
|
|
3
|
+
|
|
4
|
+
export type DocumentsGridMode = (typeof DOCUMENTS_GRID_MODES)[number]
|
|
5
|
+
export type DocumentsGridListingStyle = (typeof DOCUMENTS_GRID_LISTING_STYLES)[number]
|
|
6
|
+
export type DocumentsGridSortBy = (typeof DOCUMENTS_GRID_SORT_BYS)[number]
|
|
7
|
+
export type DocumentsGridColumns = (typeof DOCUMENTS_GRID_COLUMN_OPTIONS)[number]
|
|
8
|
+
|
|
9
|
+
export interface DocumentsGridAttributes extends Record<string, unknown> {
|
|
10
|
+
mode: DocumentsGridMode
|
|
11
|
+
listingStyle: DocumentsGridListingStyle
|
|
12
|
+
sortBy: DocumentsGridSortBy
|
|
13
|
+
columns: DocumentsGridColumns
|
|
14
|
+
selectedDocuments: number[]
|
|
15
|
+
selectedCategories: number[]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SelectControlProps {
|
|
19
|
+
selectedItems: number[]
|
|
20
|
+
onChange: (ids: number[]) => void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface DocumentsGridOptions extends BriloBlockType {
|
|
24
|
+
renderCategoryControl?: (props: SelectControlProps) => JSX.Element
|
|
25
|
+
renderDocumentsControl?: (props: SelectControlProps) => JSX.Element
|
|
26
|
+
}
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import {__} from '@wordpress/i18n'
|
|
11
11
|
import {ImagePickerBody, ImagePickerControl} from '~/components/ImagePicker'
|
|
12
12
|
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
13
|
+
import {useTenantColorPalette} from '~/hooks/useTenantColorPalette'
|
|
13
14
|
import {DEFAULT_HEADING_STYLES, DEFAULT_VARIANTS} from './constants'
|
|
14
15
|
import {HEADING_LEVELS} from '~/constants'
|
|
15
16
|
import type {BannerGroupAttributes, BannerGroupOptions, HeadingLevels, HeadingStyles, Variants} from './types'
|
|
@@ -27,6 +28,7 @@ export function createBannerGroupEdit(options: BannerGroupOptions) {
|
|
|
27
28
|
setAttributes: (a: Partial<BannerGroupAttributes>) => void
|
|
28
29
|
}) {
|
|
29
30
|
const {header, img, description, variant, hasBackgroundColor, backgroundColor, textColor} = attributes
|
|
31
|
+
const {paletteColors} = useTenantColorPalette()
|
|
30
32
|
|
|
31
33
|
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
32
34
|
blockClassName: [options.blockClassName ?? 'g-banner wp-block-section', `--variant-${variant}`],
|
|
@@ -74,6 +76,13 @@ export function createBannerGroupEdit(options: BannerGroupOptions) {
|
|
|
74
76
|
<ToggleGroupControlOption key={s} value={s} label={s} />
|
|
75
77
|
))}
|
|
76
78
|
</ToggleGroupControl>
|
|
79
|
+
<BaseControl label={__('Barva nadpisu', 'brilo-blocks')}>
|
|
80
|
+
<ColorPalette
|
|
81
|
+
colors={paletteColors}
|
|
82
|
+
value={header.heading.color || undefined}
|
|
83
|
+
onChange={(value) => setAttributes({header: {...header, heading: {...header.heading, color: value ?? ''}}})}
|
|
84
|
+
/>
|
|
85
|
+
</BaseControl>
|
|
77
86
|
</PanelBody>
|
|
78
87
|
|
|
79
88
|
<PanelBody title={__('Obrázek v pozadí', 'brilo-blocks')}>
|
|
@@ -101,6 +110,7 @@ export function createBannerGroupEdit(options: BannerGroupOptions) {
|
|
|
101
110
|
<RichText
|
|
102
111
|
tagName={`h${header.heading.level}` as HeadingStyles}
|
|
103
112
|
className={clsx('g-banner__heading', `--heading-style-${header.heading.style}`, 'u-text-editable')}
|
|
113
|
+
style={header.heading.color ? {color: header.heading.color} : undefined}
|
|
104
114
|
value={header.heading.title}
|
|
105
115
|
onChange={(value: string) => setAttributes({header: {...header, heading: {...header.heading, title: value}}})}
|
|
106
116
|
placeholder={__('Nadpis...', 'brilo-blocks')}
|
|
@@ -35,7 +35,7 @@ export function createBannerGroupBlock<
|
|
|
35
35
|
header: {
|
|
36
36
|
type: 'object',
|
|
37
37
|
default: {
|
|
38
|
-
heading: {title: '', level: HEADING_LEVELS[1], style: headingStyles[1] ?? headingStyles[0]},
|
|
38
|
+
heading: {title: '', level: HEADING_LEVELS[1], style: headingStyles[1] ?? headingStyles[0], color: ''},
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
img: {
|
|
@@ -10,7 +10,7 @@ export interface BannerGroupAttributes<TVariant extends string = Variants, THead
|
|
|
10
10
|
extends Record<string, unknown> {
|
|
11
11
|
title: string
|
|
12
12
|
header: {
|
|
13
|
-
heading: {title: string; level: HeadingLevels; style: THeadingStyle}
|
|
13
|
+
heading: {title: string; level: HeadingLevels; style: THeadingStyle; color?: string}
|
|
14
14
|
}
|
|
15
15
|
img: Media
|
|
16
16
|
hasBackgroundColor: boolean
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import {InspectorControls, RichText, useBlockProps} from '@wordpress/block-editor'
|
|
2
2
|
import {
|
|
3
|
+
BaseControl,
|
|
4
|
+
ColorPalette,
|
|
3
5
|
PanelBody,
|
|
4
6
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
5
7
|
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
6
8
|
} from '@wordpress/components'
|
|
7
9
|
import {__} from '@wordpress/i18n'
|
|
8
10
|
import clsx from 'clsx'
|
|
11
|
+
import {useTenantColorPalette} from '~/hooks/useTenantColorPalette'
|
|
9
12
|
import {DEFAULT_ALIGNMENTS, DEFAULT_LEVELS, DEFAULT_STYLES} from './constants'
|
|
10
13
|
import type {BasicHeaderGroupAttributes, BasicHeaderGroupOptions, HeaderAlignment, HeadingStyle} from './types'
|
|
11
14
|
|
|
@@ -25,6 +28,7 @@ export function createBasicHeaderGroupEdit(options: BasicHeaderGroupOptions) {
|
|
|
25
28
|
const blockProps = useBlockProps({
|
|
26
29
|
className: clsx(options.blockClassName ?? 'g-header wp-block-section', `--textAlign-${textAlign}`),
|
|
27
30
|
})
|
|
31
|
+
const {paletteColors} = useTenantColorPalette()
|
|
28
32
|
|
|
29
33
|
return (
|
|
30
34
|
<>
|
|
@@ -54,6 +58,13 @@ export function createBasicHeaderGroupEdit(options: BasicHeaderGroupOptions) {
|
|
|
54
58
|
<ToggleGroupControlOption key={s} value={s} label={s.toUpperCase()} />
|
|
55
59
|
))}
|
|
56
60
|
</ToggleGroupControl>
|
|
61
|
+
<BaseControl label={__('Barva nadpisu', 'brilo-blocks')}>
|
|
62
|
+
<ColorPalette
|
|
63
|
+
colors={paletteColors}
|
|
64
|
+
value={heading.color || undefined}
|
|
65
|
+
onChange={(value) => setAttributes({heading: {...heading, color: value ?? ''}})}
|
|
66
|
+
/>
|
|
67
|
+
</BaseControl>
|
|
57
68
|
<ToggleGroupControl
|
|
58
69
|
label={__('Zarovnání', 'brilo-blocks')}
|
|
59
70
|
value={textAlign}
|
|
@@ -78,10 +89,11 @@ export function createBasicHeaderGroupEdit(options: BasicHeaderGroupOptions) {
|
|
|
78
89
|
<RichText
|
|
79
90
|
tagName={`h${heading.level}` as 'h1' | 'h2' | 'h3' | 'h4'}
|
|
80
91
|
className={clsx('g-header__heading', `--heading-style-${heading.style}`, 'u-text-editable')}
|
|
92
|
+
style={heading.color ? {color: heading.color} : undefined}
|
|
81
93
|
value={heading.title}
|
|
82
94
|
onChange={(value) => setAttributes({heading: {...heading, title: value}})}
|
|
83
95
|
placeholder={__('Nadpis...', 'brilo-blocks')}
|
|
84
|
-
allowedFormats={['core/bold', 'core/italic']}
|
|
96
|
+
allowedFormats={['core/bold', 'core/italic', 'core/text-color']}
|
|
85
97
|
/>
|
|
86
98
|
<RichText
|
|
87
99
|
tagName="div"
|
|
@@ -30,7 +30,7 @@ export function createBasicHeaderGroupBlock<
|
|
|
30
30
|
attributes: {
|
|
31
31
|
heading: {
|
|
32
32
|
type: 'object',
|
|
33
|
-
default: {title: '', level: levels[1] ?? levels[0], style: styles[1] ?? styles[0]},
|
|
33
|
+
default: {title: '', level: levels[1] ?? levels[0], style: styles[1] ?? styles[0], color: ''},
|
|
34
34
|
},
|
|
35
35
|
overline: {type: 'object', default: {title: ''}},
|
|
36
36
|
content: {type: 'string', default: ''},
|
|
@@ -10,7 +10,7 @@ export interface BasicHeaderGroupAttributes<
|
|
|
10
10
|
TStyle extends string = HeadingStyle,
|
|
11
11
|
TAlignment extends string = HeaderAlignment,
|
|
12
12
|
> extends Record<string, unknown> {
|
|
13
|
-
heading: {title: string; level: TLevel; style: TStyle}
|
|
13
|
+
heading: {title: string; level: TLevel; style: TStyle; color?: string}
|
|
14
14
|
overline: {title: string}
|
|
15
15
|
content: string
|
|
16
16
|
textAlign: TAlignment
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
AlignmentMatrixControl,
|
|
6
6
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
7
7
|
BaseControl,
|
|
8
|
+
ColorPalette,
|
|
8
9
|
TextControl,
|
|
9
10
|
ToggleControl,
|
|
10
11
|
} from '@wordpress/components'
|
|
@@ -13,6 +14,7 @@ import {ImagePickerBody, ImagePickerControl} from '~/components/ImagePicker'
|
|
|
13
14
|
import {CONTENT_POSITIONS, HEADING_LEVELS} from './constants'
|
|
14
15
|
import type {ContentPosition, HeroItemAttributes, HeroItemOptions} from './types'
|
|
15
16
|
import {useGroupBlock} from '~/hooks/useGroupBlock'
|
|
17
|
+
import {useTenantColorPalette} from '~/hooks/useTenantColorPalette'
|
|
16
18
|
import clsx from 'clsx'
|
|
17
19
|
|
|
18
20
|
export function createHeroItemEdit(options: HeroItemOptions) {
|
|
@@ -23,7 +25,8 @@ export function createHeroItemEdit(options: HeroItemOptions) {
|
|
|
23
25
|
attributes: HeroItemAttributes
|
|
24
26
|
setAttributes: (a: Partial<HeroItemAttributes>) => void
|
|
25
27
|
}) {
|
|
26
|
-
const {title, img, headingLevel, contentPosition, url, focalPoint} = attributes
|
|
28
|
+
const {title, titleColor, img, headingLevel, contentPosition, url, focalPoint} = attributes
|
|
29
|
+
const {paletteColors} = useTenantColorPalette()
|
|
27
30
|
|
|
28
31
|
const {blockProps, innerBlocksProps} = useGroupBlock({
|
|
29
32
|
blockClassName: clsx(options.blockClassName ?? 'i-hero'),
|
|
@@ -54,6 +57,10 @@ export function createHeroItemEdit(options: HeroItemOptions) {
|
|
|
54
57
|
/>
|
|
55
58
|
</BaseControl>
|
|
56
59
|
|
|
60
|
+
<BaseControl label={__('Barva nadpisu', 'brilo-blocks')}>
|
|
61
|
+
<ColorPalette colors={paletteColors} value={titleColor || undefined} onChange={(v) => setAttributes({titleColor: v ?? ''})} />
|
|
62
|
+
</BaseControl>
|
|
63
|
+
|
|
57
64
|
<ToggleGroupControl
|
|
58
65
|
isBlock
|
|
59
66
|
label={__('Úroveň nadpisu položek', 'brilo-blocks')}
|
|
@@ -94,6 +101,7 @@ export function createHeroItemEdit(options: HeroItemOptions) {
|
|
|
94
101
|
<RichText
|
|
95
102
|
tagName={`h${headingLevel}` as any}
|
|
96
103
|
className="i-hero__title u-text-editable"
|
|
104
|
+
style={titleColor ? {color: titleColor} : undefined}
|
|
97
105
|
value={title}
|
|
98
106
|
onChange={(v) => setAttributes({title: v})}
|
|
99
107
|
placeholder={__('Nadpis...', 'brilo-blocks')}
|
|
@@ -20,6 +20,7 @@ export function createHeroItemBlock(options: HeroItemOptions): BlockConfiguratio
|
|
|
20
20
|
supports: {html: false, customClassName: false},
|
|
21
21
|
attributes: {
|
|
22
22
|
title: {type: 'string', default: ''},
|
|
23
|
+
titleColor: {type: 'string', default: ''},
|
|
23
24
|
img: {
|
|
24
25
|
type: 'object',
|
|
25
26
|
default: {id: 0, url: '', alt: ''},
|
package/src/index.ts
CHANGED
|
@@ -150,13 +150,13 @@ export {createPostSliderGroupBlock, postSliderGroupDefaults} from './blocks/post
|
|
|
150
150
|
export type {PostsGridAttributes, PostsGridOptions} from './blocks/post/posts-grid'
|
|
151
151
|
export {createPostsGridBlock, postsGridDefaults} from './blocks/post/posts-grid'
|
|
152
152
|
export type {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
} from './blocks/document/documents-
|
|
159
|
-
export {
|
|
153
|
+
DocumentsGridAttributes,
|
|
154
|
+
DocumentsGridOptions,
|
|
155
|
+
DocumentsGridListingStyle,
|
|
156
|
+
DocumentsGridMode,
|
|
157
|
+
DocumentsGridSortBy,
|
|
158
|
+
} from './blocks/document/documents-grid'
|
|
159
|
+
export {createDocumentsGridBlock, documentsGridDefaults, DocumentsSelectModal} from './blocks/document/documents-grid'
|
|
160
160
|
export type {LinkItemAttributes, LinkItemIcon, LinkItemOptions} from './blocks/link/link-item'
|
|
161
161
|
export {createLinkItemBlock, linkItemDefaults} from './blocks/link/link-item'
|
|
162
162
|
export type {ContentWithAsideAttributes, ContentWithAsideOptions} from './blocks/layout/layout-content-w-aside'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentsSelectModal.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-group/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,7 +0,0 @@
|
|
|
1
|
-
import type { DocumentsGroupColumns, DocumentsGroupMode, DocumentsGroupListingStyle, DocumentsGroupSortBy } from './types';
|
|
2
|
-
export declare const DOCUMENTS_GROUP_MODE_DEFAULT: DocumentsGroupMode;
|
|
3
|
-
export declare const DOCUMENTS_GROUP_LISTING_STYLE_DEFAULT: DocumentsGroupListingStyle;
|
|
4
|
-
export declare const DOCUMENTS_GROUP_SORT_BY_DEFAULT: DocumentsGroupSortBy;
|
|
5
|
-
export declare const DOCUMENTS_GROUP_COLUMNS_DEFAULT: DocumentsGroupColumns;
|
|
6
|
-
export declare const DOCUMENTS_GROUP_COLUMNS: DocumentsGroupColumns[];
|
|
7
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-group/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,oBAAoB,EAAC,MAAM,SAAS,CAAA;AAExH,eAAO,MAAM,4BAA4B,EAAE,kBAA6B,CAAA;AACxE,eAAO,MAAM,qCAAqC,EAAE,0BAAsC,CAAA;AAC1F,eAAO,MAAM,+BAA+B,EAAE,oBAAqC,CAAA;AACnF,eAAO,MAAM,+BAA+B,EAAE,qBAAyB,CAAA;AACvE,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAAoB,CAAA"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export const DOCUMENTS_GROUP_MODE_DEFAULT = 'manual';
|
|
2
|
-
export const DOCUMENTS_GROUP_LISTING_STYLE_DEFAULT = 'classic';
|
|
3
|
-
export const DOCUMENTS_GROUP_SORT_BY_DEFAULT = 'manual-order';
|
|
4
|
-
export const DOCUMENTS_GROUP_COLUMNS_DEFAULT = 1;
|
|
5
|
-
export const DOCUMENTS_GROUP_COLUMNS = [1, 2, 3, 4, 6];
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { DocumentsGroupAttributes, DocumentsGroupOptions } from './types';
|
|
2
|
-
export declare function createDocumentsGroupEdit(options: DocumentsGroupOptions): ({ attributes, setAttributes, }: {
|
|
3
|
-
attributes: DocumentsGroupAttributes;
|
|
4
|
-
setAttributes: (a: Partial<DocumentsGroupAttributes>) => void;
|
|
5
|
-
}) => import("react").JSX.Element;
|
|
6
|
-
//# sourceMappingURL=edit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-group/edit.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAC,wBAAwB,EAAE,qBAAqB,EAAC,MAAM,SAAS,CAAA;AAE5E,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,iCA8EF"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { BlockConfiguration } from '@wordpress/blocks';
|
|
2
|
-
import type { DocumentsGroupAttributes, DocumentsGroupOptions } from './types';
|
|
3
|
-
export type { DocumentsGroupAttributes, DocumentsGroupOptions };
|
|
4
|
-
export declare function createDocumentsGroupBlock(options: DocumentsGroupOptions): BlockConfiguration<DocumentsGroupAttributes>;
|
|
5
|
-
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-group/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAUzD,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,CA4CtH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-group/icon.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,6BAQhB,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export type { DocumentsGroupAttributes, DocumentsGroupOptions, DocumentsGroupListingStyle, DocumentsGroupMode, DocumentsGroupSortBy, } from './types';
|
|
2
|
-
export { createDocumentsGroupBlock } from './factory';
|
|
3
|
-
export { DocumentsSelectModal } from './DocumentsSelectModal';
|
|
4
|
-
import type { DocumentsGroupOptions } from './types';
|
|
5
|
-
export declare const documentsGroupDefaults: DocumentsGroupOptions;
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,EAC1B,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAC,yBAAyB,EAAC,MAAM,WAAW,CAAA;AACnD,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;AAE3D,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAA;AAElD,eAAO,MAAM,sBAAsB,EAAE,qBAEpC,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { BriloBlockType } from '../../../types';
|
|
2
|
-
export type DocumentsGroupMode = 'manual' | 'category';
|
|
3
|
-
export type DocumentsGroupListingStyle = 'classic' | 'group-by-category';
|
|
4
|
-
export type DocumentsGroupSortBy = 'menu_order' | 'date' | 'manual-order';
|
|
5
|
-
export type DocumentsGroupColumns = 1 | 2 | 3 | 4 | 6;
|
|
6
|
-
export interface DocumentsGroupAttributes extends Record<string, unknown> {
|
|
7
|
-
mode: DocumentsGroupMode;
|
|
8
|
-
listingStyle: DocumentsGroupListingStyle;
|
|
9
|
-
sortBy: DocumentsGroupSortBy;
|
|
10
|
-
columns: DocumentsGroupColumns;
|
|
11
|
-
selectedDocuments: number[];
|
|
12
|
-
selectedCategories: number[];
|
|
13
|
-
}
|
|
14
|
-
export interface SelectControlProps {
|
|
15
|
-
selectedItems: number[];
|
|
16
|
-
onChange: (ids: number[]) => void;
|
|
17
|
-
}
|
|
18
|
-
export interface DocumentsGroupOptions extends BriloBlockType {
|
|
19
|
-
renderCategoryControl?: (props: SelectControlProps) => JSX.Element;
|
|
20
|
-
renderDocumentsControl?: (props: SelectControlProps) => JSX.Element;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/document/documents-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,UAAU,CAAA;AACtD,MAAM,MAAM,0BAA0B,GAAG,SAAS,GAAG,mBAAmB,CAAA;AACxE,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,MAAM,GAAG,cAAc,CAAA;AACzE,MAAM,MAAM,qBAAqB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAErD,MAAM,WAAW,wBAAyB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvE,IAAI,EAAE,kBAAkB,CAAA;IACxB,YAAY,EAAE,0BAA0B,CAAA;IACxC,MAAM,EAAE,oBAAoB,CAAA;IAC5B,OAAO,EAAE,qBAAqB,CAAA;IAC9B,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAC3B,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CAClC;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,GAAG,CAAC,OAAO,CAAA;IAClE,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,GAAG,CAAC,OAAO,CAAA;CACpE"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type {DocumentsGroupColumns, DocumentsGroupMode, DocumentsGroupListingStyle, DocumentsGroupSortBy} from './types'
|
|
2
|
-
|
|
3
|
-
export const DOCUMENTS_GROUP_MODE_DEFAULT: DocumentsGroupMode = 'manual'
|
|
4
|
-
export const DOCUMENTS_GROUP_LISTING_STYLE_DEFAULT: DocumentsGroupListingStyle = 'classic'
|
|
5
|
-
export const DOCUMENTS_GROUP_SORT_BY_DEFAULT: DocumentsGroupSortBy = 'manual-order'
|
|
6
|
-
export const DOCUMENTS_GROUP_COLUMNS_DEFAULT: DocumentsGroupColumns = 1
|
|
7
|
-
export const DOCUMENTS_GROUP_COLUMNS: DocumentsGroupColumns[] = [1, 2, 3, 4, 6]
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type {BlockConfiguration} from '@wordpress/blocks'
|
|
2
|
-
import {__} from '@wordpress/i18n'
|
|
3
|
-
import {
|
|
4
|
-
DOCUMENTS_GROUP_COLUMNS_DEFAULT,
|
|
5
|
-
DOCUMENTS_GROUP_LISTING_STYLE_DEFAULT,
|
|
6
|
-
DOCUMENTS_GROUP_MODE_DEFAULT,
|
|
7
|
-
DOCUMENTS_GROUP_SORT_BY_DEFAULT,
|
|
8
|
-
} from './constants'
|
|
9
|
-
import {createDocumentsGroupEdit} from './edit'
|
|
10
|
-
import {icon as defaultIcon} from './icon'
|
|
11
|
-
import type {DocumentsGroupAttributes, DocumentsGroupOptions} from './types'
|
|
12
|
-
|
|
13
|
-
export type {DocumentsGroupAttributes, DocumentsGroupOptions}
|
|
14
|
-
|
|
15
|
-
export function createDocumentsGroupBlock(options: DocumentsGroupOptions): BlockConfiguration<DocumentsGroupAttributes> {
|
|
16
|
-
return {
|
|
17
|
-
name: options.name,
|
|
18
|
-
title: options.title ?? __('Dokumenty', 'brilo-blocks'),
|
|
19
|
-
description: options.description,
|
|
20
|
-
category: options.category ?? 'widgets',
|
|
21
|
-
...(options.parent && {parent: options.parent}),
|
|
22
|
-
icon: options.icon ?? {src: defaultIcon},
|
|
23
|
-
supports: {html: false, customClassName: false},
|
|
24
|
-
attributes: {
|
|
25
|
-
mode: {
|
|
26
|
-
type: 'string',
|
|
27
|
-
default: DOCUMENTS_GROUP_MODE_DEFAULT,
|
|
28
|
-
enum: ['manual', 'category'],
|
|
29
|
-
},
|
|
30
|
-
listingStyle: {
|
|
31
|
-
type: 'string',
|
|
32
|
-
default: DOCUMENTS_GROUP_LISTING_STYLE_DEFAULT,
|
|
33
|
-
enum: ['classic', 'group-by-category'],
|
|
34
|
-
},
|
|
35
|
-
sortBy: {
|
|
36
|
-
type: 'string',
|
|
37
|
-
default: DOCUMENTS_GROUP_SORT_BY_DEFAULT,
|
|
38
|
-
enum: ['menu_order', 'date', 'manual-order'],
|
|
39
|
-
},
|
|
40
|
-
columns: {
|
|
41
|
-
type: 'number',
|
|
42
|
-
default: DOCUMENTS_GROUP_COLUMNS_DEFAULT,
|
|
43
|
-
enum: [1, 2, 3, 4, 6],
|
|
44
|
-
},
|
|
45
|
-
selectedDocuments: {
|
|
46
|
-
type: 'array',
|
|
47
|
-
default: [],
|
|
48
|
-
items: {type: 'number'},
|
|
49
|
-
},
|
|
50
|
-
selectedCategories: {
|
|
51
|
-
type: 'array',
|
|
52
|
-
default: [],
|
|
53
|
-
items: {type: 'number'},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
edit: createDocumentsGroupEdit(options),
|
|
57
|
-
save: () => null,
|
|
58
|
-
} as unknown as BlockConfiguration<DocumentsGroupAttributes>
|
|
59
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
DocumentsGroupAttributes,
|
|
3
|
-
DocumentsGroupOptions,
|
|
4
|
-
DocumentsGroupListingStyle,
|
|
5
|
-
DocumentsGroupMode,
|
|
6
|
-
DocumentsGroupSortBy,
|
|
7
|
-
} from './types'
|
|
8
|
-
export {createDocumentsGroupBlock} from './factory'
|
|
9
|
-
export {DocumentsSelectModal} from './DocumentsSelectModal'
|
|
10
|
-
|
|
11
|
-
import type {DocumentsGroupOptions} from './types'
|
|
12
|
-
|
|
13
|
-
export const documentsGroupDefaults: DocumentsGroupOptions = {
|
|
14
|
-
name: 'brilo/documents-group',
|
|
15
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type {BriloBlockType} from '~/types'
|
|
2
|
-
|
|
3
|
-
export type DocumentsGroupMode = 'manual' | 'category'
|
|
4
|
-
export type DocumentsGroupListingStyle = 'classic' | 'group-by-category'
|
|
5
|
-
export type DocumentsGroupSortBy = 'menu_order' | 'date' | 'manual-order'
|
|
6
|
-
export type DocumentsGroupColumns = 1 | 2 | 3 | 4 | 6
|
|
7
|
-
|
|
8
|
-
export interface DocumentsGroupAttributes extends Record<string, unknown> {
|
|
9
|
-
mode: DocumentsGroupMode
|
|
10
|
-
listingStyle: DocumentsGroupListingStyle
|
|
11
|
-
sortBy: DocumentsGroupSortBy
|
|
12
|
-
columns: DocumentsGroupColumns
|
|
13
|
-
selectedDocuments: number[]
|
|
14
|
-
selectedCategories: number[]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface SelectControlProps {
|
|
18
|
-
selectedItems: number[]
|
|
19
|
-
onChange: (ids: number[]) => void
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface DocumentsGroupOptions extends BriloBlockType {
|
|
23
|
-
renderCategoryControl?: (props: SelectControlProps) => JSX.Element
|
|
24
|
-
renderDocumentsControl?: (props: SelectControlProps) => JSX.Element
|
|
25
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|