| 1 |
(function(element, blocks, blockEditor, components, i18n, ServerSideRender) { |
| 2 |
"use strict"; |
| 3 |
function Edit({ attributes: attributes2, setAttributes }) { |
| 4 |
return /* @__PURE__ */ element.createElement(element.Fragment, null, /* @__PURE__ */ element.createElement(blockEditor.InspectorControls, null, /* @__PURE__ */ element.createElement(components.PanelBody, { title: i18n.__("Activity Settings", "yatra"), initialOpen: true }, /* @__PURE__ */ element.createElement( |
| 5 |
components.TextControl, |
| 6 |
{ |
| 7 |
label: i18n.__("Title", "yatra"), |
| 8 |
value: attributes2.title, |
| 9 |
onChange: (value) => setAttributes({ title: value }) |
| 10 |
} |
| 11 |
), /* @__PURE__ */ element.createElement( |
| 12 |
components.SelectControl, |
| 13 |
{ |
| 14 |
label: i18n.__("Order", "yatra"), |
| 15 |
value: attributes2.order, |
| 16 |
options: [ |
| 17 |
{ label: i18n.__("Ascending", "yatra"), value: "asc" }, |
| 18 |
{ label: i18n.__("Descending", "yatra"), value: "desc" } |
| 19 |
], |
| 20 |
onChange: (value) => setAttributes({ order: value }) |
| 21 |
} |
| 22 |
), /* @__PURE__ */ element.createElement( |
| 23 |
components.RangeControl, |
| 24 |
{ |
| 25 |
label: i18n.__("Number of Activities", "yatra"), |
| 26 |
value: attributes2.per_page, |
| 27 |
onChange: (value) => setAttributes({ |
| 28 |
per_page: value !== void 0 && value !== null ? value : 10 |
| 29 |
}), |
| 30 |
min: 1, |
| 31 |
max: 50 |
| 32 |
} |
| 33 |
), /* @__PURE__ */ element.createElement( |
| 34 |
components.RangeControl, |
| 35 |
{ |
| 36 |
label: i18n.__("Columns", "yatra"), |
| 37 |
value: attributes2.columns, |
| 38 |
onChange: (value) => setAttributes({ |
| 39 |
columns: value !== void 0 && value !== null ? value : 3 |
| 40 |
}), |
| 41 |
min: 1, |
| 42 |
max: 6 |
| 43 |
} |
| 44 |
), /* @__PURE__ */ element.createElement( |
| 45 |
components.ToggleControl, |
| 46 |
{ |
| 47 |
label: i18n.__("Show pagination", "yatra"), |
| 48 |
checked: attributes2.show_pagination, |
| 49 |
onChange: (value) => setAttributes({ show_pagination: value }) |
| 50 |
} |
| 51 |
))), /* @__PURE__ */ element.createElement("div", { className: "yatra-block-editor-preview" }, /* @__PURE__ */ element.createElement( |
| 52 |
ServerSideRender, |
| 53 |
{ |
| 54 |
block: "yatra/activity", |
| 55 |
attributes: attributes2, |
| 56 |
key: JSON.stringify(attributes2) |
| 57 |
} |
| 58 |
))); |
| 59 |
} |
| 60 |
const $schema = "https://schemas.wp.org/trunk/block.json"; |
| 61 |
const apiVersion = 3; |
| 62 |
const name = "yatra/activity"; |
| 63 |
const title = "Activity"; |
| 64 |
const category = "yatra"; |
| 65 |
const icon = "buddicons-pm"; |
| 66 |
const description = "Display activity listings with customizable options"; |
| 67 |
const keywords = [ |
| 68 |
"activity", |
| 69 |
"things to do", |
| 70 |
"yatra" |
| 71 |
]; |
| 72 |
const textdomain = "yatra"; |
| 73 |
const attributes = { |
| 74 |
order: { |
| 75 |
type: "string", |
| 76 |
"default": "asc" |
| 77 |
}, |
| 78 |
columns: { |
| 79 |
type: "number", |
| 80 |
"default": 3 |
| 81 |
}, |
| 82 |
per_page: { |
| 83 |
type: "number", |
| 84 |
"default": 10 |
| 85 |
}, |
| 86 |
title: { |
| 87 |
type: "string", |
| 88 |
"default": "Activity Listings" |
| 89 |
}, |
| 90 |
show_pagination: { |
| 91 |
type: "boolean", |
| 92 |
"default": true |
| 93 |
} |
| 94 |
}; |
| 95 |
const supports = { |
| 96 |
html: false, |
| 97 |
inserter: true, |
| 98 |
align: [ |
| 99 |
"wide", |
| 100 |
"full" |
| 101 |
] |
| 102 |
}; |
| 103 |
const editorScript = "yatra-activity-block-editor"; |
| 104 |
const blockMetadata = { |
| 105 |
$schema, |
| 106 |
apiVersion, |
| 107 |
name, |
| 108 |
title, |
| 109 |
category, |
| 110 |
icon, |
| 111 |
description, |
| 112 |
keywords, |
| 113 |
textdomain, |
| 114 |
attributes, |
| 115 |
supports, |
| 116 |
editorScript |
| 117 |
}; |
| 118 |
const { |
| 119 |
$schema: _$schema, |
| 120 |
editorScript: _$editorScript, |
| 121 |
...metadata |
| 122 |
} = blockMetadata; |
| 123 |
if (blocks.getBlockType(metadata.name)) { |
| 124 |
blocks.unregisterBlockType(metadata.name); |
| 125 |
} |
| 126 |
blocks.registerBlockType(metadata.name, { |
| 127 |
...metadata, |
| 128 |
edit: Edit, |
| 129 |
save: () => null |
| 130 |
}); |
| 131 |
})(wp.element, wp.blocks, wp.blockEditor, wp.components, wp.i18n, wp.serverSideRender); |
| 132 |
//# sourceMappingURL=activity.js.map |
| 133 |
|