@brilo/base-blocks 0.1.58 → 0.1.60
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/food-menu/food-menu-group/FoodMenuPreview.js +2 -2
- package/build/blocks/food-menu/food-menu-group/edit.js +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/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-item/index.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/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/constants.d.ts +19 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +8 -0
- package/build/index.d.ts +6 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -0
- package/package.json +1 -1
- package/src/blocks/food-menu/food-menu-group/FoodMenuPreview.tsx +3 -3
- package/src/blocks/food-menu/food-menu-group/edit.tsx +2 -2
- 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/text-and-media-group/index.ts +2 -0
- package/src/blocks/hero/hero-item/index.ts +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/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/constants.ts +9 -0
- package/src/editor.scss +4 -0
- package/src/index.ts +6 -0
|
@@ -125,11 +125,11 @@ function PreviewCard({ attributes, data, day, tabs }) {
|
|
|
125
125
|
const { menu } = day;
|
|
126
126
|
const source = sourceLabel(mode, day, data);
|
|
127
127
|
const reservation = showReservation ? menu === null || menu === void 0 ? void 0 : menu.reservation : null;
|
|
128
|
-
return (_jsxs("div", { className: `${BASE}__card`, children: [_jsxs("div", { className: `${BASE}__head`, children: [_jsxs("div", { className: `${BASE}__title`, children: [menuIcon, _jsx("span", { children: day.label }), day.date === data.today && _jsx("span", { className: `${BASE}__pill`, children: __('dnes', 'brilo-blocks') })] }), _jsxs("div", { className: `${BASE}__meta`, children: [source && _jsx("span", { className: clsx(`${BASE}__pill`, `${BASE}__pill--muted`), children: source }), 'open' === (reservation === null || reservation === void 0 ? void 0 : reservation.state) && (_jsx("span", { className: clsx(`${BASE}__pill`, `${BASE}__pill--ok`), children: __('
|
|
128
|
+
return (_jsxs("div", { className: `${BASE}__card`, children: [_jsxs("div", { className: `${BASE}__head`, children: [_jsxs("div", { className: `${BASE}__title`, children: [menuIcon, _jsx("span", { children: day.label }), day.date === data.today && _jsx("span", { className: `${BASE}__pill`, children: __('dnes', 'brilo-blocks') })] }), _jsxs("div", { className: `${BASE}__meta`, children: [source && _jsx("span", { className: clsx(`${BASE}__pill`, `${BASE}__pill--muted`), children: source }), 'open' === (reservation === null || reservation === void 0 ? void 0 : reservation.state) && (_jsx("span", { className: clsx(`${BASE}__pill`, `${BASE}__pill--ok`), children: __('Rezervace otevřené', 'brilo-blocks') })), 'closed' === (reservation === null || reservation === void 0 ? void 0 : reservation.state) && (_jsx("span", { className: clsx(`${BASE}__pill`, `${BASE}__pill--muted`), children: __('Rezervace uzavřené', 'brilo-blocks') }))] })] }), _jsxs("div", { className: `${BASE}__body`, children: [tabs, _jsx("div", { role: tabs ? 'tabpanel' : undefined, children: menu ? (_jsx(PreviewRows, { menu: menu, showPrices: showPrices, showAllergens: showAllergens })) : (_jsx(NoMenuNotice, { attributes: attributes, data: data })) }), menu && (_jsxs("div", { className: `${BASE}__foot`, children: [_jsx("span", { children: [
|
|
129
129
|
`${menu.dishCount} ${plural(menu.dishCount, __('jídlo', 'brilo-blocks'), __('jídla', 'brilo-blocks'), __('jídel', 'brilo-blocks'))}`,
|
|
130
130
|
showAllergens ? __('alergeny v závorce', 'brilo-blocks') : __('alergeny skryté', 'brilo-blocks'),
|
|
131
131
|
showPrices ? __('ceny zobrazeny', 'brilo-blocks') : __('ceny skryté', 'brilo-blocks'),
|
|
132
|
-
].join(' · ') }), showReservation && _jsx("span", { children: sprintf(__('Uzávěrka
|
|
132
|
+
].join(' · ') }), showReservation && _jsx("span", { children: sprintf(__('Uzávěrka rezervací: %s', 'brilo-blocks'), ((_a = menu.reservation) === null || _a === void 0 ? void 0 : _a.deadline) || '—') })] }))] })] }));
|
|
133
133
|
}
|
|
134
134
|
function WeekPreview({ attributes, data }) {
|
|
135
135
|
const [selectedDate, setSelectedDate] = useState(null);
|
|
@@ -28,7 +28,7 @@ export function createFoodMenuGroupEdit(options) {
|
|
|
28
28
|
var _b;
|
|
29
29
|
const { mode, layout, menuIds, showPrices, showAllergens, showReservation, emptyBehaviour, emptyText } = attributes;
|
|
30
30
|
const blockProps = useBlockProps({ className: clsx((_b = options.blockClassName) !== null && _b !== void 0 ? _b : 'g-food-menu', `--${layout}`) });
|
|
31
|
-
return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Nastavení lístku', 'brilo-blocks'), initialOpen: true, children: [_jsxs(ToggleGroupControl, { label: __('Zdroj lístků', 'brilo-blocks'), help: MODE_HINTS[mode], value: mode, onChange: (value) => setAttributes({ mode: value }), isBlock: true, children: [_jsx(ToggleGroupControlOption, { value: "manual", label: __('Ruční výběr', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "today", label: __('Dnešní', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "week", label: __('Týden', 'brilo-blocks') })] }), _jsxs(ToggleGroupControl, { label: __('Rozvržení', 'brilo-blocks'), help: __('Slider se použije jen tehdy, když je lístků víc než jeden.', 'brilo-blocks'), value: layout, onChange: (value) => setAttributes({ layout: value }), isBlock: true, children: [_jsx(ToggleGroupControlOption, { value: "slider", label: __('Slider', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "list", label: __('Seznam', 'brilo-blocks') })] }), _jsx(ToggleControl, { __nextHasNoMarginBottom: true, label: __('Zobrazit ceny', 'brilo-blocks'), checked: showPrices, onChange: (value) => setAttributes({ showPrices: value }) }), _jsx(ToggleControl, { __nextHasNoMarginBottom: true, label: __('Zobrazit alergeny a legendu', 'brilo-blocks'), checked: showAllergens, onChange: (value) => setAttributes({ showAllergens: value }) }), _jsx(ToggleControl, { __nextHasNoMarginBottom: true, label: __('Umožnit
|
|
31
|
+
return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Nastavení lístku', 'brilo-blocks'), initialOpen: true, children: [_jsxs(ToggleGroupControl, { label: __('Zdroj lístků', 'brilo-blocks'), help: MODE_HINTS[mode], value: mode, onChange: (value) => setAttributes({ mode: value }), isBlock: true, children: [_jsx(ToggleGroupControlOption, { value: "manual", label: __('Ruční výběr', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "today", label: __('Dnešní', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "week", label: __('Týden', 'brilo-blocks') })] }), _jsxs(ToggleGroupControl, { label: __('Rozvržení', 'brilo-blocks'), help: __('Slider se použije jen tehdy, když je lístků víc než jeden.', 'brilo-blocks'), value: layout, onChange: (value) => setAttributes({ layout: value }), isBlock: true, children: [_jsx(ToggleGroupControlOption, { value: "slider", label: __('Slider', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "list", label: __('Seznam', 'brilo-blocks') })] }), _jsx(ToggleControl, { __nextHasNoMarginBottom: true, label: __('Zobrazit ceny', 'brilo-blocks'), checked: showPrices, onChange: (value) => setAttributes({ showPrices: value }) }), _jsx(ToggleControl, { __nextHasNoMarginBottom: true, label: __('Zobrazit alergeny a legendu', 'brilo-blocks'), checked: showAllergens, onChange: (value) => setAttributes({ showAllergens: value }) }), _jsx(ToggleControl, { __nextHasNoMarginBottom: true, label: __('Umožnit rezervaci obědu', 'brilo-blocks'), help: __('Tlačítko rezervace se ukáže jen u denních lístků a jen když jsou rezervace zapnuté v nastavení modulu.', 'brilo-blocks'), checked: showReservation, onChange: (value) => setAttributes({ showReservation: value }) })] }), _jsxs(PanelBody, { title: __('Když není co zobrazit', 'brilo-blocks'), initialOpen: false, children: [_jsxs(ToggleGroupControl, { label: __('Chování', 'brilo-blocks'), help: EMPTY_HINTS[emptyBehaviour], value: emptyBehaviour, onChange: (value) => setAttributes({ emptyBehaviour: value }), isBlock: true, children: [_jsx(ToggleGroupControlOption, { value: "message", label: __('Zpráva', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "permanent", label: __('Stálá nabídka', 'brilo-blocks') }), _jsx(ToggleGroupControlOption, { value: "hide", label: __('Skrýt', 'brilo-blocks') })] }), 'hide' !== emptyBehaviour && (_jsx(TextareaControl, { __nextHasNoMarginBottom: true, label: __('Vlastní text zprávy', 'brilo-blocks'), help: __('Když zůstane prázdné, použije se věta podle zvoleného zdroje lístků.', 'brilo-blocks'), rows: 2, value: emptyText, onChange: (value) => setAttributes({ emptyText: value }) }))] })] }), _jsxs("div", { ...blockProps, children: ['manual' === mode && (_jsxs("div", { className: "brilo-food-menu-preview__pick", children: [(_a = options.renderMenusControl) === null || _a === void 0 ? void 0 : _a.call(options, {
|
|
32
32
|
selectedItems: menuIds,
|
|
33
33
|
onChange: (ids) => setAttributes({ menuIds: ids }),
|
|
34
34
|
}), _jsx(Text, { variant: "muted", children: pickedNote(menuIds.length) })] })), _jsx(FoodMenuPreview, { attributes: attributes })] })] }));
|
|
@@ -2,7 +2,7 @@ export { createFormGroupBlock } from './factory';
|
|
|
2
2
|
export { EXTERNAL_METHODS, INTERNAL_SUBMIT_BEHAVIORS, PROCESSING_MODES } from './constants';
|
|
3
3
|
export const formGroupDefaults = {
|
|
4
4
|
name: 'brilo/form-group',
|
|
5
|
-
parent: ['brilo/base-section'],
|
|
5
|
+
parent: ['brilo/base-section', 'brilo/column-item', 'brilo/responsive-grid-item'],
|
|
6
6
|
allowedBlocks: ['brilo/form-field'],
|
|
7
7
|
template: [['brilo/form-field', { type: 'text' }]],
|
|
8
8
|
};
|
|
@@ -1,21 +1,3 @@
|
|
|
1
1
|
export declare const DEFAULT_COLUMNS: readonly [2, 3, 4, 6];
|
|
2
|
-
export
|
|
3
|
-
readonly value: '4:3';
|
|
4
|
-
readonly label: '4:3';
|
|
5
|
-
}, {
|
|
6
|
-
readonly value: '16:9';
|
|
7
|
-
readonly label: '16:9';
|
|
8
|
-
}, {
|
|
9
|
-
readonly value: '3:2';
|
|
10
|
-
readonly label: '3:2';
|
|
11
|
-
}, {
|
|
12
|
-
readonly value: '1:1';
|
|
13
|
-
readonly label: '1:1';
|
|
14
|
-
}, {
|
|
15
|
-
readonly value: '2:1';
|
|
16
|
-
readonly label: '2:1';
|
|
17
|
-
}, {
|
|
18
|
-
readonly value: '3:4';
|
|
19
|
-
readonly label: '3:4';
|
|
20
|
-
}];
|
|
2
|
+
export { GALLERY_RATIOS as DEFAULT_RATIOS } from '../../../constants';
|
|
21
3
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-group/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,YAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAU,CAAA;AAEpD,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-group/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,YAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAU,CAAA;AAEpD,OAAO,EAAC,cAAc,IAAI,cAAc,EAAC,MAAM,aAAa,CAAA"}
|
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
export const DEFAULT_COLUMNS = [2, 3, 4, 6];
|
|
2
|
-
export
|
|
3
|
-
{ value: '4:3', label: '4:3' },
|
|
4
|
-
{ value: '16:9', label: '16:9' },
|
|
5
|
-
{ value: '3:2', label: '3:2' },
|
|
6
|
-
{ value: '1:1', label: '1:1' },
|
|
7
|
-
{ value: '2:1', label: '2:1' },
|
|
8
|
-
{ value: '3:4', label: '3:4' },
|
|
9
|
-
];
|
|
2
|
+
export { GALLERY_RATIOS as DEFAULT_RATIOS } from '../../../constants';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-group/edit.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-group/edit.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAC,sBAAsB,EAAE,mBAAmB,EAAe,MAAM,SAAS,CAAA;AAEtF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,mBAAmB,8CAQ9D;IACD,UAAU,EAAE,sBAAsB,CAAA;IAClC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAA;IAC3D,QAAQ,EAAE,MAAM,CAAA;CACjB,iCAwDF"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { InspectorControls
|
|
2
|
+
import { InspectorControls } from '@wordpress/block-editor';
|
|
3
3
|
import { PanelBody, TextControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from '@wordpress/components';
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { useDispatch } from '@wordpress/data';
|
|
6
|
-
import { createBlock } from '@wordpress/blocks';
|
|
7
5
|
import clsx from 'clsx';
|
|
6
|
+
import { GalleryImagesAppender } from '../../../components/GalleryImagesAppender';
|
|
8
7
|
import { ItemSpacingPanel, itemSpacingStyle } from '../../../components/ItemSpacingControl';
|
|
9
8
|
import { useGroupBlock } from '../../../hooks/useGroupBlock';
|
|
10
9
|
import { DEFAULT_COLUMNS, DEFAULT_RATIOS } from './constants';
|
|
@@ -15,21 +14,6 @@ export function createGalleryGroupEdit(options) {
|
|
|
15
14
|
return function Edit({ attributes, setAttributes, clientId, }) {
|
|
16
15
|
var _a, _b;
|
|
17
16
|
const { columns, ratio, galleryId, spacing } = attributes;
|
|
18
|
-
const { insertBlock } = useDispatch('core/block-editor');
|
|
19
|
-
const addNewBlock = (imageId) => {
|
|
20
|
-
const newBlock = createBlock(options.allowedBlocks[0], {
|
|
21
|
-
img: {
|
|
22
|
-
id: imageId,
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
insertBlock(newBlock, undefined, clientId);
|
|
26
|
-
};
|
|
27
|
-
const onSelectImages = (media) => {
|
|
28
|
-
media.forEach((item) => addNewBlock(item.id));
|
|
29
|
-
};
|
|
30
|
-
const CustomAppender = () => {
|
|
31
|
-
return (_jsx(MediaUpload, { onSelect: onSelectImages, multiple: "add", allowedTypes: ['image'], render: ({ open }) => (_jsx("div", { onClick: open, className: "g-gallery__appender", children: __('Přidat obrázky', 'brilo-blocks') })) }));
|
|
32
|
-
};
|
|
33
17
|
const { blockProps, innerBlocksProps } = useGroupBlock({
|
|
34
18
|
blockClassName: clsx((_a = options.blockClassName) !== null && _a !== void 0 ? _a : 'g-gallery wp-block-section'),
|
|
35
19
|
containerClassName: [(_b = options.containerClassName) !== null && _b !== void 0 ? _b : 'u-grid-responsive', `--cols-${columns}`],
|
|
@@ -39,7 +23,7 @@ export function createGalleryGroupEdit(options) {
|
|
|
39
23
|
...itemSpacingStyle(spacing),
|
|
40
24
|
},
|
|
41
25
|
allowedBlocks: options.allowedBlocks,
|
|
42
|
-
renderAppender:
|
|
26
|
+
renderAppender: () => _jsx(GalleryImagesAppender, { clientId: clientId, itemBlock: options.allowedBlocks[0] }),
|
|
43
27
|
template: options.template,
|
|
44
28
|
layout: { type: 'default' },
|
|
45
29
|
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const HEIGHTS: readonly [{
|
|
2
|
+
readonly value: 'sm';
|
|
3
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Malá">;
|
|
4
|
+
}, {
|
|
5
|
+
readonly value: 'md';
|
|
6
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Střední">;
|
|
7
|
+
}, {
|
|
8
|
+
readonly value: 'lg';
|
|
9
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Velká">;
|
|
10
|
+
}];
|
|
11
|
+
export declare const SPEEDS: readonly [{
|
|
12
|
+
readonly value: 'slow';
|
|
13
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Pomalu">;
|
|
14
|
+
}, {
|
|
15
|
+
readonly value: 'medium';
|
|
16
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Středně">;
|
|
17
|
+
}, {
|
|
18
|
+
readonly value: 'fast';
|
|
19
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Rychle">;
|
|
20
|
+
}];
|
|
21
|
+
export declare const DIRECTIONS: readonly [{
|
|
22
|
+
readonly value: 'left';
|
|
23
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Doleva">;
|
|
24
|
+
}, {
|
|
25
|
+
readonly value: 'right';
|
|
26
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Doprava">;
|
|
27
|
+
}];
|
|
28
|
+
export { GALLERY_RATIOS as DEFAULT_RATIOS } from '../../../constants';
|
|
29
|
+
export declare const HEIGHT_PIXELS: {
|
|
30
|
+
readonly sm: 160;
|
|
31
|
+
readonly md: 240;
|
|
32
|
+
readonly lg: 320;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-strip-group/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO;aACjB,KAAK,EAAE,IAAI;aAAE,KAAK;;aAClB,KAAK,EAAE,IAAI;aAAE,KAAK;;aAClB,KAAK,EAAE,IAAI;aAAE,KAAK;EACX,CAAA;AAEV,eAAO,MAAM,MAAM;aAChB,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,QAAQ;aAAE,KAAK;;aACtB,KAAK,EAAE,MAAM;aAAE,KAAK;EACb,CAAA;AAEV,eAAO,MAAM,UAAU;aACpB,KAAK,EAAE,MAAM;aAAE,KAAK;;aACpB,KAAK,EAAE,OAAO;aAAE,KAAK;EACd,CAAA;AAEV,OAAO,EAAC,cAAc,IAAI,cAAc,EAAC,MAAM,aAAa,CAAA;AAE5D,eAAO,MAAM,aAAa;aAAI,EAAE,EAAE,GAAG;aAAE,EAAE,EAAE,GAAG;aAAE,EAAE,EAAE,GAAG;CAAU,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
export const HEIGHTS = [
|
|
3
|
+
{ value: 'sm', label: __('Malá', 'brilo-blocks') },
|
|
4
|
+
{ value: 'md', label: __('Střední', 'brilo-blocks') },
|
|
5
|
+
{ value: 'lg', label: __('Velká', 'brilo-blocks') },
|
|
6
|
+
];
|
|
7
|
+
export const SPEEDS = [
|
|
8
|
+
{ value: 'slow', label: __('Pomalu', 'brilo-blocks') },
|
|
9
|
+
{ value: 'medium', label: __('Středně', 'brilo-blocks') },
|
|
10
|
+
{ value: 'fast', label: __('Rychle', 'brilo-blocks') },
|
|
11
|
+
];
|
|
12
|
+
export const DIRECTIONS = [
|
|
13
|
+
{ value: 'left', label: __('Doleva', 'brilo-blocks') },
|
|
14
|
+
{ value: 'right', label: __('Doprava', 'brilo-blocks') },
|
|
15
|
+
];
|
|
16
|
+
export { GALLERY_RATIOS as DEFAULT_RATIOS } from '../../../constants';
|
|
17
|
+
export const HEIGHT_PIXELS = { sm: 160, md: 240, lg: 320 };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GalleryStripGroupAttributes, GalleryStripGroupOptions } from './types';
|
|
2
|
+
export declare function createGalleryStripGroupEdit(options: GalleryStripGroupOptions): ({ attributes, setAttributes, clientId, }: {
|
|
3
|
+
attributes: GalleryStripGroupAttributes;
|
|
4
|
+
setAttributes: (a: Partial<GalleryStripGroupAttributes>) => void;
|
|
5
|
+
clientId: string;
|
|
6
|
+
}) => import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=edit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-strip-group/edit.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAEV,2BAA2B,EAC3B,wBAAwB,EAIzB,MAAM,SAAS,CAAA;AAEhB,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,wBAAwB,8CAOxE;IACD,UAAU,EAAE,2BAA2B,CAAA;IACvC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,KAAK,IAAI,CAAA;IAChE,QAAQ,EAAE,MAAM,CAAA;CACjB,iCA+EF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { InspectorControls } from '@wordpress/block-editor';
|
|
3
|
+
import { PanelBody, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, } from '@wordpress/components';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { GalleryImagesAppender } from '../../../components/GalleryImagesAppender';
|
|
7
|
+
import { ItemSpacingPanel, itemSpacingStyle } from '../../../components/ItemSpacingControl';
|
|
8
|
+
import { useGroupBlock } from '../../../hooks/useGroupBlock';
|
|
9
|
+
import { DEFAULT_RATIOS, DIRECTIONS, HEIGHTS, HEIGHT_PIXELS, SPEEDS } from './constants';
|
|
10
|
+
export function createGalleryStripGroupEdit(options) {
|
|
11
|
+
var _a;
|
|
12
|
+
const RATIOS = (_a = options.ratios) !== null && _a !== void 0 ? _a : DEFAULT_RATIOS;
|
|
13
|
+
return function Edit({ attributes, setAttributes, clientId, }) {
|
|
14
|
+
var _a, _b, _c;
|
|
15
|
+
const { height, ratio, speed, direction, spacing } = attributes;
|
|
16
|
+
const heightPx = (_a = HEIGHT_PIXELS[height]) !== null && _a !== void 0 ? _a : HEIGHT_PIXELS.md;
|
|
17
|
+
const [ratioWidth, ratioHeight] = ratio.split(':').map(Number);
|
|
18
|
+
const { blockProps, innerBlocksProps } = useGroupBlock({
|
|
19
|
+
blockClassName: clsx((_b = options.blockClassName) !== null && _b !== void 0 ? _b : 'g-gallery g-gallery-strip wp-block-section', `--speed-${speed}`, `--direction-${direction}`),
|
|
20
|
+
containerClassName: (_c = options.containerClassName) !== null && _c !== void 0 ? _c : 'g-gallery-strip__track',
|
|
21
|
+
containerStyle: {
|
|
22
|
+
'--gallery-strip-height': `${heightPx}px`,
|
|
23
|
+
'--gallery-strip-item-width': `${Math.round((heightPx * ratioWidth) / ratioHeight)}px`,
|
|
24
|
+
...itemSpacingStyle(spacing),
|
|
25
|
+
},
|
|
26
|
+
allowedBlocks: options.allowedBlocks,
|
|
27
|
+
orientation: 'horizontal',
|
|
28
|
+
renderAppender: () => _jsx(GalleryImagesAppender, { clientId: clientId, itemBlock: options.allowedBlocks[0] }),
|
|
29
|
+
template: options.template,
|
|
30
|
+
layout: { type: 'default' },
|
|
31
|
+
});
|
|
32
|
+
return (_jsxs(_Fragment, { children: [_jsxs(InspectorControls, { children: [_jsxs(PanelBody, { title: __('Rozložení', 'brilo-blocks'), children: [_jsx(ToggleGroupControl, { isBlock: true, label: __('Výška', 'brilo-blocks'), value: height, onChange: (v) => setAttributes({ height: v }), children: HEIGHTS.map((h) => (_jsx(ToggleGroupControlOption, { value: h.value, label: h.label }, h.value))) }), _jsx(ToggleGroupControl, { isBlock: true, label: __('Poměr stran', 'brilo-blocks'), value: ratio, onChange: (v) => setAttributes({ ratio: v }), children: RATIOS.map((r) => (_jsx(ToggleGroupControlOption, { value: r.value, label: r.label }, r.value))) })] }), _jsxs(PanelBody, { title: __('Animace', 'brilo-blocks'), children: [_jsx(ToggleGroupControl, { isBlock: true, label: __('Rychlost', 'brilo-blocks'), value: speed, onChange: (v) => setAttributes({ speed: v }), children: SPEEDS.map((s) => (_jsx(ToggleGroupControlOption, { value: s.value, label: s.label }, s.value))) }), _jsx(ToggleGroupControl, { isBlock: true, label: __('Směr', 'brilo-blocks'), value: direction, onChange: (v) => setAttributes({ direction: v }), children: DIRECTIONS.map((d) => (_jsx(ToggleGroupControlOption, { value: d.value, label: d.label }, d.value))) })] }), _jsx(ItemSpacingPanel, { spacing: spacing, onChange: (v) => setAttributes({ spacing: v }) })] }), _jsx("div", { ...blockProps, children: _jsx("div", { ...innerBlocksProps }) })] }));
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BlockConfiguration } from '@wordpress/blocks';
|
|
2
|
+
import type { GalleryStripGroupAttributes, GalleryStripGroupOptions } from './types';
|
|
3
|
+
export type { GalleryStripGroupAttributes, GalleryStripGroupOptions };
|
|
4
|
+
export declare function createGalleryStripGroupBlock(options: GalleryStripGroupOptions): BlockConfiguration<GalleryStripGroupAttributes>;
|
|
5
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-strip-group/factory.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAKzD,OAAO,KAAK,EAAC,2BAA2B,EAAE,wBAAwB,EAAC,MAAM,SAAS,CAAA;AAElF,YAAY,EAAC,2BAA2B,EAAE,wBAAwB,EAAC,CAAA;AAEnE,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,wBAAwB,GAAG,kBAAkB,CAAC,2BAA2B,CAAC,CAqB/H"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { InnerBlocks } from '@wordpress/block-editor';
|
|
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
|
+
export function createGalleryStripGroupBlock(options) {
|
|
8
|
+
var _a, _b, _c, _d, _e;
|
|
9
|
+
const ratios = (_a = options.ratios) !== null && _a !== void 0 ? _a : DEFAULT_RATIOS;
|
|
10
|
+
return {
|
|
11
|
+
name: options.name,
|
|
12
|
+
title: (_b = options.title) !== null && _b !== void 0 ? _b : __('Pás obrázků', 'brilo-blocks'),
|
|
13
|
+
description: (_c = options.description) !== null && _c !== void 0 ? _c : __('Nekonečně se posouvající pás obrázků', 'brilo-blocks'),
|
|
14
|
+
category: (_d = options.category) !== null && _d !== void 0 ? _d : 'layout',
|
|
15
|
+
...(options.parent && { parent: options.parent }),
|
|
16
|
+
icon: (_e = options.icon) !== null && _e !== void 0 ? _e : 'images-alt2',
|
|
17
|
+
supports: { html: false, customClassName: false },
|
|
18
|
+
attributes: {
|
|
19
|
+
height: { type: 'string', default: HEIGHTS[1].value, enum: HEIGHTS.map((h) => h.value) },
|
|
20
|
+
ratio: { type: 'string', default: ratios[0].value, enum: ratios.map((r) => r.value) },
|
|
21
|
+
speed: { type: 'string', default: SPEEDS[1].value, enum: SPEEDS.map((s) => s.value) },
|
|
22
|
+
direction: { type: 'string', default: DIRECTIONS[0].value, enum: DIRECTIONS.map((d) => d.value) },
|
|
23
|
+
...ITEM_SPACING_ATTRIBUTE,
|
|
24
|
+
},
|
|
25
|
+
edit: createGalleryStripGroupEdit(options),
|
|
26
|
+
save: () => _jsx(InnerBlocks.Content, {}),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { GalleryStripGroupAttributes, GalleryStripGroupOptions } from './types';
|
|
2
|
+
export { createGalleryStripGroupBlock } from './factory';
|
|
3
|
+
import type { GalleryStripGroupOptions } from './types';
|
|
4
|
+
export declare const galleryStripGroupDefaults: GalleryStripGroupOptions;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-strip-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,2BAA2B,EAAE,wBAAwB,EAAC,MAAM,SAAS,CAAA;AAClF,OAAO,EAAC,4BAA4B,EAAC,MAAM,WAAW,CAAA;AAEtD,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,SAAS,CAAA;AAErD,eAAO,MAAM,yBAAyB,EAAE,wBAKvC,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BriloBlockType, OptionArray } from '../../../types';
|
|
2
|
+
import type { DEFAULT_RATIOS, DIRECTIONS, HEIGHTS, SPEEDS } from './constants';
|
|
3
|
+
export type GalleryStripHeight = (typeof HEIGHTS)[number]['value'];
|
|
4
|
+
export type GalleryStripSpeed = (typeof SPEEDS)[number]['value'];
|
|
5
|
+
export type GalleryStripRatio = (typeof DEFAULT_RATIOS)[number]['value'];
|
|
6
|
+
export type GalleryStripDirection = (typeof DIRECTIONS)[number]['value'];
|
|
7
|
+
export interface GalleryStripGroupAttributes extends Record<string, unknown> {
|
|
8
|
+
height: GalleryStripHeight;
|
|
9
|
+
ratio: GalleryStripRatio;
|
|
10
|
+
speed: GalleryStripSpeed;
|
|
11
|
+
direction: GalleryStripDirection;
|
|
12
|
+
spacing?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface GalleryStripGroupOptions extends BriloBlockType {
|
|
15
|
+
allowedBlocks: string[];
|
|
16
|
+
ratios?: OptionArray;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/gallery/gallery-strip-group/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AACxD,OAAO,KAAK,EAAC,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,aAAa,CAAA;AAE5E,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAClE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAChE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AACxE,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAA;AAExE,MAAM,WAAW,2BAA4B,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1E,MAAM,EAAE,kBAAkB,CAAA;IAC1B,KAAK,EAAE,iBAAiB,CAAA;IACxB,KAAK,EAAE,iBAAiB,CAAA;IACxB,SAAS,EAAE,qBAAqB,CAAA;IAChC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,wBAAyB,SAAQ,cAAc;IAC9D,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/groups/text-and-media-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,2BAA2B,EAAE,wBAAwB,EAAC,MAAM,SAAS,CAAA;AAClF,OAAO,EAAC,4BAA4B,EAAC,MAAM,WAAW,CAAA;AAEtD,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,SAAS,CAAA;AAErD,eAAO,MAAM,yBAAyB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/groups/text-and-media-group/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,2BAA2B,EAAE,wBAAwB,EAAC,MAAM,SAAS,CAAA;AAClF,OAAO,EAAC,4BAA4B,EAAC,MAAM,WAAW,CAAA;AAEtD,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,SAAS,CAAA;AAErD,eAAO,MAAM,yBAAyB,EAAE,wBAevC,CAAA"}
|
|
@@ -2,5 +2,5 @@ export { createHeroItemBlock } from './factory';
|
|
|
2
2
|
export const heroItemDefaults = {
|
|
3
3
|
name: 'brilo/hero-item',
|
|
4
4
|
parent: ['brilo/hero-group'],
|
|
5
|
-
allowedBlocks: ['core/list', 'core/paragraph', 'brilo/button-group'],
|
|
5
|
+
allowedBlocks: ['core/list', 'core/paragraph', 'brilo/button-group', 'brilo/review-summary-item'],
|
|
6
6
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/review/review-summary-item/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,IAAI,CAAA;AAC3B,eAAO,MAAM,WAAW,MAAM,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReviewSummaryItemAttributes, ReviewSummaryItemOptions } from './types';
|
|
2
|
+
export declare function createReviewSummaryItemEdit(options: ReviewSummaryItemOptions): ({ attributes, setAttributes, }: {
|
|
3
|
+
attributes: ReviewSummaryItemAttributes;
|
|
4
|
+
setAttributes: (a: Partial<ReviewSummaryItemAttributes>) => void;
|
|
5
|
+
}) => import("react").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=edit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../src/blocks/review/review-summary-item/edit.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,2BAA2B,EAAE,wBAAwB,EAAC,MAAM,SAAS,CAAA;AAIlF,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,wBAAwB,oCAIxE;IACD,UAAU,EAAE,2BAA2B,CAAA;IACvC,aAAa,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,2BAA2B,CAAC,KAAK,IAAI,CAAA;CACjE,iCAoEF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { InspectorControls, RichText, useBlockProps } from '@wordpress/block-editor';
|
|
3
|
+
import { PanelBody, RangeControl, TextControl, ToggleControl } from '@wordpress/components';
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { RATING_MAX, RATING_STEP } from './constants';
|
|
7
|
+
const roundToHalf = (value) => Math.round(value * 2) / 2;
|
|
8
|
+
export function createReviewSummaryItemEdit(options) {
|
|
9
|
+
return function Edit({ attributes, setAttributes, }) {
|
|
10
|
+
var _a;
|
|
11
|
+
const { rating, count, countLabel, showMax, description } = attributes;
|
|
12
|
+
const hasRating = typeof rating === 'number';
|
|
13
|
+
const hasCount = typeof count === 'number' && count > 0;
|
|
14
|
+
const blockProps = useBlockProps({ className: clsx((_a = options.blockClassName) !== null && _a !== void 0 ? _a : 'i-review-summary-item wp-block-section') });
|
|
15
|
+
return (_jsxs(_Fragment, { children: [_jsx(InspectorControls, { children: _jsxs(PanelBody, { title: __('Hodnocení', 'brilo-blocks'), children: [_jsx(RangeControl, { label: __('Průměrné hodnocení', 'brilo-blocks'), help: __('Bez hodnoty se hvězdičky ani číslo nezobrazí.', 'brilo-blocks'), value: rating, onChange: (v) => setAttributes({ rating: v }), min: 0, max: RATING_MAX, step: RATING_STEP, allowReset: true, withInputField: true }), _jsx(ToggleControl, { label: __('Zobrazit „/ 5"', 'brilo-blocks'), checked: showMax, onChange: (v) => setAttributes({ showMax: v }) }), _jsx(TextControl, { type: "number", min: 0, label: __('Počet recenzí', 'brilo-blocks'), help: __('Při nule nebo prázdné hodnotě se počet nezobrazí.', 'brilo-blocks'), value: typeof count === 'number' ? String(count) : '', onChange: (v) => setAttributes({ count: v === '' ? undefined : Math.max(0, Number.parseInt(v, 10) || 0) }) }), _jsx(TextControl, { label: __('Popisek počtu', 'brilo-blocks'), value: countLabel, onChange: (v) => setAttributes({ countLabel: v }) })] }) }), _jsxs("div", { ...blockProps, children: [_jsxs("div", { className: "i-review-summary-item__score", children: [hasRating && (_jsxs(_Fragment, { children: [_jsx("span", { className: "i-review-summary-item__stars", style: { '--rating-fill': `${(roundToHalf(rating) / RATING_MAX) * 100}%` }, children: "\u2605\u2605\u2605\u2605\u2605" }), _jsxs("strong", { className: "i-review-summary-item__value", children: [rating.toLocaleString(undefined, { minimumFractionDigits: 1, maximumFractionDigits: 1 }), showMax && ` / ${RATING_MAX}`] })] })), hasCount && _jsx("span", { className: "i-review-summary-item__count", children: `${count} ${countLabel}` }), !hasRating && !hasCount && (_jsx("span", { className: "i-review-summary-item__placeholder", children: __('Nastavte hodnocení v postranním panelu', 'brilo-blocks') }))] }), _jsx(RichText, { tagName: "p", className: "i-review-summary-item__description u-text-editable", value: description, onChange: (v) => setAttributes({ description: v }), placeholder: __('Popis hodnocení...', 'brilo-blocks'), allowedFormats: ['core/bold', 'core/italic', 'core/link', 'brilo-blocks/text-color'] })] })] }));
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BlockConfiguration } from '@wordpress/blocks';
|
|
2
|
+
import type { ReviewSummaryItemAttributes, ReviewSummaryItemOptions } from './types';
|
|
3
|
+
export type { ReviewSummaryItemAttributes, ReviewSummaryItemOptions };
|
|
4
|
+
export declare function createReviewSummaryItemBlock(options: ReviewSummaryItemOptions): BlockConfiguration<ReviewSummaryItemAttributes>;
|
|
5
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/blocks/review/review-summary-item/factory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAA;AAGzD,OAAO,KAAK,EAAC,2BAA2B,EAAE,wBAAwB,EAAC,MAAM,SAAS,CAAA;AAElF,YAAY,EAAC,2BAA2B,EAAE,wBAAwB,EAAC,CAAA;AAEnE,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,wBAAwB,GAAG,kBAAkB,CAAC,2BAA2B,CAAC,CAmB/H"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import { createReviewSummaryItemEdit } from './edit';
|
|
3
|
+
export function createReviewSummaryItemBlock(options) {
|
|
4
|
+
var _a, _b, _c, _d;
|
|
5
|
+
return {
|
|
6
|
+
name: options.name,
|
|
7
|
+
title: (_a = options.title) !== null && _a !== void 0 ? _a : __('Souhrn hodnocení', 'brilo-blocks'),
|
|
8
|
+
description: (_b = options.description) !== null && _b !== void 0 ? _b : __('Průměrné hodnocení hvězdičkami s počtem recenzí a popisem', 'brilo-blocks'),
|
|
9
|
+
category: (_c = options.category) !== null && _c !== void 0 ? _c : 'layout',
|
|
10
|
+
...(options.parent && { parent: options.parent }),
|
|
11
|
+
icon: (_d = options.icon) !== null && _d !== void 0 ? _d : 'star-half',
|
|
12
|
+
supports: { html: false, customClassName: false },
|
|
13
|
+
attributes: {
|
|
14
|
+
rating: { type: 'number' },
|
|
15
|
+
count: { type: 'number' },
|
|
16
|
+
countLabel: { type: 'string', default: __('hodnocení', 'brilo-blocks') },
|
|
17
|
+
showMax: { type: 'boolean', default: false },
|
|
18
|
+
description: { type: 'string', default: '' },
|
|
19
|
+
},
|
|
20
|
+
edit: createReviewSummaryItemEdit(options),
|
|
21
|
+
save: () => null,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { ReviewSummaryItemAttributes, ReviewSummaryItemOptions } from './types';
|
|
2
|
+
export { createReviewSummaryItemBlock } from './factory';
|
|
3
|
+
import type { ReviewSummaryItemOptions } from './types';
|
|
4
|
+
export declare const reviewSummaryItemDefaults: ReviewSummaryItemOptions;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/review/review-summary-item/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,2BAA2B,EAAE,wBAAwB,EAAC,MAAM,SAAS,CAAA;AAClF,OAAO,EAAC,4BAA4B,EAAC,MAAM,WAAW,CAAA;AAEtD,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,SAAS,CAAA;AAErD,eAAO,MAAM,yBAAyB,EAAE,wBAGvC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BriloBlockType } from '../../../types';
|
|
2
|
+
export interface ReviewSummaryItemAttributes extends Record<string, unknown> {
|
|
3
|
+
rating?: number;
|
|
4
|
+
count?: number;
|
|
5
|
+
countLabel: string;
|
|
6
|
+
showMax: boolean;
|
|
7
|
+
description: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ReviewSummaryItemOptions extends BriloBlockType {
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/blocks/review/review-summary-item/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,WAAW,2BAA4B,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,wBAAyB,SAAQ,cAAc;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export { CONTENT_SIZES as TEXT_SIZES } from '../../../constants';
|
|
2
|
+
export declare const TYPES: readonly [{
|
|
3
|
+
readonly value: 'deadline';
|
|
4
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Termín">;
|
|
5
|
+
}, {
|
|
6
|
+
readonly value: 'capacity';
|
|
7
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Volná místa">;
|
|
8
|
+
}, {
|
|
9
|
+
readonly value: 'season';
|
|
10
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Sezóna">;
|
|
11
|
+
}];
|
|
12
|
+
export declare const DEADLINE_DISPLAYS: readonly [{
|
|
13
|
+
readonly value: 'countdown';
|
|
14
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Odpočet">;
|
|
15
|
+
}, {
|
|
16
|
+
readonly value: 'date';
|
|
17
|
+
readonly label: import("@wordpress/i18n").TransformedText<"Datum">;
|
|
18
|
+
}];
|
|
19
|
+
export declare const TEXTS: {
|
|
20
|
+
readonly countdown: import("@wordpress/i18n").TransformedText<"Nabídka končí za">;
|
|
21
|
+
readonly date: import("@wordpress/i18n").TransformedText<"Nabídka platí do">;
|
|
22
|
+
readonly capacity: import("@wordpress/i18n").TransformedText<"Zbývá volných míst">;
|
|
23
|
+
readonly season: import("@wordpress/i18n").TransformedText<"Nabídka platí pouze tuto sezónu">;
|
|
24
|
+
};
|
|
25
|
+
export declare const COUNTDOWN_UNITS: readonly [{
|
|
26
|
+
readonly key: 'days';
|
|
27
|
+
readonly label: import("@wordpress/i18n").TransformedText<"dní">;
|
|
28
|
+
}, {
|
|
29
|
+
readonly key: 'hours';
|
|
30
|
+
readonly label: import("@wordpress/i18n").TransformedText<"hod">;
|
|
31
|
+
}, {
|
|
32
|
+
readonly key: 'minutes';
|
|
33
|
+
readonly label: import("@wordpress/i18n").TransformedText<"min">;
|
|
34
|
+
}, {
|
|
35
|
+
readonly key: 'seconds';
|
|
36
|
+
readonly label: import("@wordpress/i18n").TransformedText<"sek">;
|
|
37
|
+
}];
|
|
38
|
+
export declare const NUMBER_SIZE_MIN = 16;
|
|
39
|
+
export declare const NUMBER_SIZE_MAX = 120;
|
|
40
|
+
export declare const NUMBER_SIZE_PRESETS: readonly [{
|
|
41
|
+
readonly value: 32;
|
|
42
|
+
readonly label: import("@wordpress/i18n").TransformedText<"XS">;
|
|
43
|
+
}, {
|
|
44
|
+
readonly value: 40;
|
|
45
|
+
readonly label: import("@wordpress/i18n").TransformedText<"SM">;
|
|
46
|
+
}, {
|
|
47
|
+
readonly value: 48;
|
|
48
|
+
readonly label: import("@wordpress/i18n").TransformedText<"MD">;
|
|
49
|
+
}, {
|
|
50
|
+
readonly value: 60;
|
|
51
|
+
readonly label: import("@wordpress/i18n").TransformedText<"LG">;
|
|
52
|
+
}, {
|
|
53
|
+
readonly value: 72;
|
|
54
|
+
readonly label: import("@wordpress/i18n").TransformedText<"XL">;
|
|
55
|
+
}];
|
|
56
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/urgency/urgency-item/constants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,IAAI,UAAU,EAAC,MAAM,aAAa,CAAA;AAEvD,eAAO,MAAM,KAAK;aACf,KAAK,EAAE,UAAU;aAAE,KAAK;;aACxB,KAAK,EAAE,UAAU;aAAE,KAAK;;aACxB,KAAK,EAAE,QAAQ;aAAE,KAAK;EACf,CAAA;AAEV,eAAO,MAAM,iBAAiB;aAC3B,KAAK,EAAE,WAAW;aAAE,KAAK;;aACzB,KAAK,EAAE,MAAM;aAAE,KAAK;EACb,CAAA;AAEV,eAAO,MAAM,KAAK;aAChB,SAAS;aACT,IAAI;aACJ,QAAQ;aACR,MAAM;CACE,CAAA;AAEV,eAAO,MAAM,eAAe;aACzB,GAAG,EAAE,MAAM;aAAE,KAAK;;aAClB,GAAG,EAAE,OAAO;aAAE,KAAK;;aACnB,GAAG,EAAE,SAAS;aAAE,KAAK;;aACrB,GAAG,EAAE,SAAS;aAAE,KAAK;EACd,CAAA;AAEV,eAAO,MAAM,eAAe,KAAK,CAAA;AACjC,eAAO,MAAM,eAAe,MAAM,CAAA;AAElC,eAAO,MAAM,mBAAmB;aAC7B,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;;aAChB,KAAK,EAAE,EAAE;aAAE,KAAK;EACT,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
export { CONTENT_SIZES as TEXT_SIZES } from '../../../constants';
|
|
3
|
+
export const TYPES = [
|
|
4
|
+
{ value: 'deadline', label: __('Termín', 'brilo-blocks') },
|
|
5
|
+
{ value: 'capacity', label: __('Volná místa', 'brilo-blocks') },
|
|
6
|
+
{ value: 'season', label: __('Sezóna', 'brilo-blocks') },
|
|
7
|
+
];
|
|
8
|
+
export const DEADLINE_DISPLAYS = [
|
|
9
|
+
{ value: 'countdown', label: __('Odpočet', 'brilo-blocks') },
|
|
10
|
+
{ value: 'date', label: __('Datum', 'brilo-blocks') },
|
|
11
|
+
];
|
|
12
|
+
export const TEXTS = {
|
|
13
|
+
countdown: __('Nabídka končí za', 'brilo-blocks'),
|
|
14
|
+
date: __('Nabídka platí do', 'brilo-blocks'),
|
|
15
|
+
capacity: __('Zbývá volných míst', 'brilo-blocks'),
|
|
16
|
+
season: __('Nabídka platí pouze tuto sezónu', 'brilo-blocks'),
|
|
17
|
+
};
|
|
18
|
+
export const COUNTDOWN_UNITS = [
|
|
19
|
+
{ key: 'days', label: __('dní', 'brilo-blocks') },
|
|
20
|
+
{ key: 'hours', label: __('hod', 'brilo-blocks') },
|
|
21
|
+
{ key: 'minutes', label: __('min', 'brilo-blocks') },
|
|
22
|
+
{ key: 'seconds', label: __('sek', 'brilo-blocks') },
|
|
23
|
+
];
|
|
24
|
+
export const NUMBER_SIZE_MIN = 16;
|
|
25
|
+
export const NUMBER_SIZE_MAX = 120;
|
|
26
|
+
export const NUMBER_SIZE_PRESETS = [
|
|
27
|
+
{ value: 32, label: __('XS', 'brilo-blocks') },
|
|
28
|
+
{ value: 40, label: __('SM', 'brilo-blocks') },
|
|
29
|
+
{ value: 48, label: __('MD', 'brilo-blocks') },
|
|
30
|
+
{ value: 60, label: __('LG', 'brilo-blocks') },
|
|
31
|
+
{ value: 72, label: __('XL', 'brilo-blocks') },
|
|
32
|
+
];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UrgencyItemAttributes, UrgencyItemOptions } from './types';
|
|
2
|
+
export declare function createUrgencyItemEdit(options: UrgencyItemOptions): ({ attributes, setAttributes, clientId, }: {
|
|
3
|
+
attributes: UrgencyItemAttributes;
|
|
4
|
+
setAttributes: (a: Partial<UrgencyItemAttributes>) => void;
|
|
5
|
+
clientId: string;
|
|
6
|
+
}) => import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=edit.d.ts.map
|