| @@ -85,9 +85,16 @@ | ||
| 85 | 85 | { |
| 86 | 86 | className: "yatra-block-taxonomy-field", |
| 87 | 87 | style: { margin: "0 0 16px", border: "none", padding: 0 } |
| 88 | 88 | }, |
| 89 | - /* @__PURE__ */ element.createElement("legend", { className: "components-base-control__label", style: { padding: 0 } }, label), | |
| 89 | + /* @__PURE__ */ element.createElement( | |
| 90 | + "legend", | |
| 91 | + { | |
| 92 | + className: "components-base-control__label", | |
| 93 | + style: { padding: 0 } | |
| 94 | + }, | |
| 95 | + label | |
| 96 | + ), | |
| 90 | 97 | /* @__PURE__ */ element.createElement(components.Spinner, null) |
| 91 | 98 | ); |
| 92 | 99 | } |
| 93 | 100 | return /* @__PURE__ */ element.createElement( |
| @@ -144,30 +151,30 @@ | ||
| 144 | 151 | value: search, |
| 145 | 152 | onChange: (s) => setSearch(s), |
| 146 | 153 | __nextHasNoMarginBottom: true |
| 147 | 154 | } |
| 148 | - ), value.length > 0 && /* @__PURE__ */ element.createElement("p", { className: "components-base-control__help", style: { marginTop: 4 } }, i18n.sprintf( | |
| 149 | - /* translators: %d = number of selected taxonomy items */ | |
| 150 | - i18n.__("%d selected", "yatra"), | |
| 151 | - value.length | |
| 152 | - )), items.length === 0 && !loadError ? /* @__PURE__ */ element.createElement("p", { className: "components-base-control__help" }, i18n.__("No published items of this type yet.", "yatra")) : /* @__PURE__ */ element.createElement("div", { role: "group", "aria-label": label, style: listWrapStyle }, filteredItems.length === 0 ? /* @__PURE__ */ element.createElement("p", { style: { padding: "8px 12px", margin: 0, fontSize: 12 } }, i18n.__("No matching items.", "yatra")) : filteredItems.map((item) => { | |
| 155 | + ), value.length > 0 && /* @__PURE__ */ element.createElement( | |
| 156 | + "p", | |
| 157 | + { | |
| 158 | + className: "components-base-control__help", | |
| 159 | + style: { marginTop: 4 } | |
| 160 | + }, | |
| 161 | + i18n.sprintf( | |
| 162 | + /* translators: %d = number of selected taxonomy items */ | |
| 163 | + i18n.__("%d selected", "yatra"), | |
| 164 | + value.length | |
| 165 | + ) | |
| 166 | + ), items.length === 0 && !loadError ? /* @__PURE__ */ element.createElement("p", { className: "components-base-control__help" }, i18n.__("No published items of this type yet.", "yatra")) : /* @__PURE__ */ element.createElement("div", { role: "group", "aria-label": label, style: listWrapStyle }, filteredItems.length === 0 ? /* @__PURE__ */ element.createElement("p", { style: { padding: "8px 12px", margin: 0, fontSize: 12 } }, i18n.__("No matching items.", "yatra")) : filteredItems.map((item) => { | |
| 153 | 167 | const cid = Number(item.id); |
| 154 | - return /* @__PURE__ */ element.createElement( | |
| 155 | - "div", | |
| 168 | + return /* @__PURE__ */ element.createElement("div", { key: cid, style: { padding: "2px 8px" } }, /* @__PURE__ */ element.createElement( | |
| 169 | + components.CheckboxControl, | |
| 156 | 170 | { |
| 157 | - key: cid, | |
| 158 | - style: { padding: "2px 8px" } | |
| 159 | - }, | |
| 160 | - /* @__PURE__ */ element.createElement( | |
| 161 | - components.CheckboxControl, | |
| 162 | - { | |
| 163 | - label: `${item.name} (${cid})`, | |
| 164 | - checked: selectedSet.has(cid), | |
| 165 | - onChange: (checked) => toggleId(cid, checked === true), | |
| 166 | - __nextHasNoMarginBottom: true | |
| 167 | - } | |
| 168 | - ) | |
| 169 | - ); | |
| 171 | + label: `${item.name} (${cid})`, | |
| 172 | + checked: selectedSet.has(cid), | |
| 173 | + onChange: (checked) => toggleId(cid, checked === true), | |
| 174 | + __nextHasNoMarginBottom: true | |
| 175 | + } | |
| 176 | + )); | |
| 170 | 177 | })), value.length > 0 && /* @__PURE__ */ element.createElement( |
| 171 | 178 | components.Button, |
| 172 | 179 | { |
| 173 | 180 | variant: "link", |
| @@ -224,9 +231,12 @@ | ||
| 224 | 231 | } |
| 225 | 232 | } |
| 226 | 233 | let actIds = normalizeIds(attributes2.activityIds); |
| 227 | 234 | if (actIds.length === 0) { |
| 228 | - actIds = migrateNumericCsvPairToIds(attributes2.activity_ids, attributes2.activity); | |
| 235 | + actIds = migrateNumericCsvPairToIds( | |
| 236 | + attributes2.activity_ids, | |
| 237 | + attributes2.activity | |
| 238 | + ); | |
| 229 | 239 | if (actIds.length) { |
| 230 | 240 | clears.activity = ""; |
| 231 | 241 | clears.activity_ids = ""; |
| 232 | 242 | } |
| @@ -266,9 +276,11 @@ | ||
| 266 | 276 | } |
| 267 | 277 | if (diffIds.length) { |
| 268 | 278 | next.difficultyIds = diffIds; |
| 269 | 279 | } |
| 270 | - const touched = Object.keys(next).filter((key) => next[key] !== void 0).length > 0; | |
| 280 | + const touched = Object.keys(next).filter( | |
| 281 | + (key) => next[key] !== void 0 | |
| 282 | + ).length > 0; | |
| 271 | 283 | if (touched) { |
| 272 | 284 | setAttributes(next); |
| 273 | 285 | } |
| 274 | 286 | }, [setAttributes]); |
| @@ -342,8 +354,33 @@ | ||
| 342 | 354 | label: i18n.__("Show pagination", "yatra"), |
| 343 | 355 | checked: attributes2.show_pagination, |
| 344 | 356 | onChange: (value) => setAttributes({ show_pagination: value }) |
| 345 | 357 | } |
| 358 | + ), /* @__PURE__ */ element.createElement( | |
| 359 | + components.SelectControl, | |
| 360 | + { | |
| 361 | + label: i18n.__("Card layout", "yatra"), | |
| 362 | + help: i18n.__( | |
| 363 | + "Override the site-wide Listing Card Layout (Settings → Design) for this block only. Compact shows a denser image + title + price + View Details card.", | |
| 364 | + "yatra" | |
| 365 | + ), | |
| 366 | + value: attributes2.cardLayout || "inherit", | |
| 367 | + options: [ | |
| 368 | + { label: i18n.__("Use site default", "yatra"), value: "inherit" }, | |
| 369 | + { label: i18n.__("Standard", "yatra"), value: "standard" }, | |
| 370 | + { | |
| 371 | + label: i18n.__("Compact (mobile only)", "yatra"), | |
| 372 | + value: "compact_mobile" | |
| 373 | + }, | |
| 374 | + { | |
| 375 | + label: i18n.__("Compact (everywhere)", "yatra"), | |
| 376 | + value: "compact_all" | |
| 377 | + } | |
| 378 | + ], | |
| 379 | + onChange: (value) => setAttributes({ | |
| 380 | + cardLayout: value | |
| 381 | + }) | |
| 382 | + } | |
| 346 | 383 | )), /* @__PURE__ */ element.createElement(components.PanelBody, { title: i18n.__("Filters", "yatra"), initialOpen: false }, /* @__PURE__ */ element.createElement( |
| 347 | 384 | ClassificationMultiSelect, |
| 348 | 385 | { |
| 349 | 386 | taxonomy: "destination", |
| @@ -488,8 +525,18 @@ | ||
| 488 | 525 | }, |
| 489 | 526 | show_pagination: { |
| 490 | 527 | type: "boolean", |
| 491 | 528 | "default": true |
| 529 | + }, | |
| 530 | + cardLayout: { | |
| 531 | + type: "string", | |
| 532 | + "default": "inherit", | |
| 533 | + "enum": [ | |
| 534 | + "inherit", | |
| 535 | + "standard", | |
| 536 | + "compact_mobile", | |
| 537 | + "compact_all" | |
| 538 | + ] | |
| 492 | 539 | }, |
| 493 | 540 | destinationIds: { |
| 494 | 541 | type: "array", |
| 495 | 542 | "default": [] |