| 1 |
import { __ } from "@wordpress/i18n"; |
| 2 |
import { |
| 3 |
InputControl, |
| 4 |
Layouts, |
| 5 |
MultiSelectDndKit, |
| 6 |
SelectField, |
| 7 |
SPRangeControl, |
| 8 |
SPToggleGroupControl, |
| 9 |
Toggle, |
| 10 |
} from "../../components"; |
| 11 |
|
| 12 |
import { useMemo } from "@wordpress/element"; |
| 13 |
import RangeControl from "../../components/rangeControl/rangeControl"; |
| 14 |
import useMetaData from "../../hooks/useMetaData"; |
| 15 |
import { getObjectValuesToJsArray } from "../shared/helpFn"; |
| 16 |
import { capitalizeString, filterSelectOptions, findDataFromArray } from "../../controls/controls"; |
| 17 |
import { |
| 18 |
SearchFormPresetFive, |
| 19 |
SearchFormPresetFour, |
| 20 |
SearchFormPresetOne, |
| 21 |
SearchFormPresetThree, |
| 22 |
SearchFormPresetTwo, |
| 23 |
SearchResultLayoutOne, |
| 24 |
SearchResultLayoutThree, |
| 25 |
SearchResultLayoutTwo, |
| 26 |
} from "./icons"; |
| 27 |
import { AlignCenter, AlignLeft, AlignRight } from "../../icons/icons"; |
| 28 |
|
| 29 |
export const PresetTab = ({ attributes, setAttributes }) => { |
| 30 |
const { |
| 31 |
searchFormPreset, |
| 32 |
displayType, |
| 33 |
placeholderEnable, |
| 34 |
placeholder, |
| 35 |
searchFormBorderWidth, |
| 36 |
searchFormHoverBorder, |
| 37 |
searchFormBorder, |
| 38 |
searchFormPadding, |
| 39 |
searchButtonPosition, |
| 40 |
searchFormAlignment, |
| 41 |
searchFormHoverBorderWidth, |
| 42 |
searchFormWidth, |
| 43 |
searchFormHeight, |
| 44 |
} = attributes; |
| 45 |
|
| 46 |
const layoutDefault = useMemo( |
| 47 |
() => ({ |
| 48 |
"smart-search-form-preset-one": { |
| 49 |
searchFormBorderWidth: { |
| 50 |
...searchFormBorderWidth, |
| 51 |
device: { |
| 52 |
Desktop: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 53 |
Mobile: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 54 |
Tablet: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 55 |
}, |
| 56 |
}, |
| 57 |
searchFormBorder: { |
| 58 |
...searchFormBorder, |
| 59 |
style: "solid", |
| 60 |
color: "#CCCCCC", |
| 61 |
}, |
| 62 |
searchFormHoverBorderWidth: { |
| 63 |
...searchFormHoverBorderWidth, |
| 64 |
device: { |
| 65 |
Desktop: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 66 |
Mobile: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 67 |
Tablet: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 68 |
}, |
| 69 |
}, |
| 70 |
searchFormHoverBorder: { |
| 71 |
...searchFormHoverBorder, |
| 72 |
style: "solid", |
| 73 |
color: "#CCCCCC", |
| 74 |
}, |
| 75 |
searchFormPadding: { |
| 76 |
...searchFormPadding, |
| 77 |
device: { |
| 78 |
Desktop: { top: 12, right: 12, bottom: 12, left: 12 }, |
| 79 |
Mobile: { top: 12, right: 12, bottom: 12, left: 12 }, |
| 80 |
Tablet: { top: 12, right: 12, bottom: 12, left: 12 }, |
| 81 |
}, |
| 82 |
}, |
| 83 |
searchButtonIconColor: { |
| 84 |
color: "#2F2F2F", |
| 85 |
hoverColor: "", |
| 86 |
}, |
| 87 |
searchButtonPosition: "right", |
| 88 |
}, |
| 89 |
"smart-search-form-preset-two": { |
| 90 |
searchFormBorderWidth: { |
| 91 |
...searchFormBorderWidth, |
| 92 |
device: { |
| 93 |
Desktop: { top: 0, right: 0, bottom: 1, left: 0 }, |
| 94 |
Mobile: { top: 0, right: 0, bottom: 1, left: 0 }, |
| 95 |
Tablet: { top: 0, right: 0, bottom: 1, left: 0 }, |
| 96 |
}, |
| 97 |
}, |
| 98 |
searchFormBorder: { |
| 99 |
...searchFormBorder, |
| 100 |
style: "solid", |
| 101 |
color: "#2F2F2F", |
| 102 |
}, |
| 103 |
searchFormHoverBorderWidth: { |
| 104 |
...searchFormHoverBorderWidth, |
| 105 |
device: { |
| 106 |
Desktop: { top: 0, right: 0, bottom: 1, left: 0 }, |
| 107 |
Mobile: { top: 0, right: 0, bottom: 1, left: 0 }, |
| 108 |
Tablet: { top: 0, right: 0, bottom: 1, left: 0 }, |
| 109 |
}, |
| 110 |
}, |
| 111 |
searchFormHoverBorder: { |
| 112 |
...searchFormHoverBorder, |
| 113 |
style: "solid", |
| 114 |
color: "#2F2F2F", |
| 115 |
}, |
| 116 |
searchFormPadding: { |
| 117 |
...searchFormPadding, |
| 118 |
device: { |
| 119 |
Desktop: { top: 12, right: 12, bottom: 12, left: 12 }, |
| 120 |
Mobile: { top: 12, right: 12, bottom: 12, left: 12 }, |
| 121 |
Tablet: { top: 12, right: 12, bottom: 12, left: 12 }, |
| 122 |
}, |
| 123 |
}, |
| 124 |
searchButtonIconColor: { |
| 125 |
color: "#2F2F2F", |
| 126 |
hoverColor: "", |
| 127 |
}, |
| 128 |
searchButtonPosition: "left" |
| 129 |
}, |
| 130 |
"smart-search-form-preset-three": { |
| 131 |
searchFormBorderWidth: { |
| 132 |
...searchFormBorderWidth, |
| 133 |
device: { |
| 134 |
Desktop: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 135 |
Mobile: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 136 |
Tablet: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 137 |
}, |
| 138 |
}, |
| 139 |
searchFormBorder: { |
| 140 |
...searchFormBorder, |
| 141 |
style: "solid", |
| 142 |
color: "#2F2F2F", |
| 143 |
}, |
| 144 |
searchFormHoverBorderWidth: { |
| 145 |
...searchFormHoverBorderWidth, |
| 146 |
device: { |
| 147 |
Desktop: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 148 |
Mobile: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 149 |
Tablet: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 150 |
}, |
| 151 |
}, |
| 152 |
searchFormHoverBorder: { |
| 153 |
...searchFormHoverBorder, |
| 154 |
style: "solid", |
| 155 |
color: "#2F2F2F", |
| 156 |
}, |
| 157 |
searchFormPadding: { |
| 158 |
...searchFormPadding, |
| 159 |
device: { |
| 160 |
Desktop: { |
| 161 |
...searchFormPadding.Desktop, |
| 162 |
right: 0, |
| 163 |
left: searchButtonPosition === "left" ? 0 : 12, |
| 164 |
}, |
| 165 |
Mobile: { |
| 166 |
...searchFormPadding.Mobile, |
| 167 |
right: 0, |
| 168 |
left: searchButtonPosition === "left" ? 0 : 12, |
| 169 |
}, |
| 170 |
Tablet: { |
| 171 |
...searchFormPadding.Tablet, |
| 172 |
right: 0, |
| 173 |
left: searchButtonPosition === "left" ? 0 : 12, |
| 174 |
}, |
| 175 |
}, |
| 176 |
}, |
| 177 |
searchButtonIconColor: { |
| 178 |
color: "#ffffff", |
| 179 |
hoverColor: "", |
| 180 |
}, |
| 181 |
searchButtonPosition: "right", |
| 182 |
}, |
| 183 |
"smart-search-form-preset-four": { |
| 184 |
searchFormBorderWidth: { |
| 185 |
...searchFormBorderWidth, |
| 186 |
device: { |
| 187 |
Desktop: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 188 |
Mobile: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 189 |
Tablet: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 190 |
}, |
| 191 |
}, |
| 192 |
searchFormBorder: { |
| 193 |
...searchFormBorder, |
| 194 |
style: "solid", |
| 195 |
color: "#2F2F2F", |
| 196 |
}, |
| 197 |
searchFormHoverBorderWidth: { |
| 198 |
...searchFormHoverBorderWidth, |
| 199 |
device: { |
| 200 |
Desktop: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 201 |
Mobile: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 202 |
Tablet: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 203 |
}, |
| 204 |
}, |
| 205 |
searchFormHoverBorder: { |
| 206 |
...searchFormHoverBorder, |
| 207 |
style: "solid", |
| 208 |
color: "#2F2F2F", |
| 209 |
}, |
| 210 |
searchFormPadding: { |
| 211 |
...searchFormPadding, |
| 212 |
device: { |
| 213 |
Desktop: { |
| 214 |
...searchFormPadding.Desktop, |
| 215 |
right: 0, |
| 216 |
left: 12, |
| 217 |
}, |
| 218 |
Mobile: { |
| 219 |
...searchFormPadding.Mobile, |
| 220 |
right: 0, |
| 221 |
left: 12, |
| 222 |
}, |
| 223 |
Tablet: { |
| 224 |
...searchFormPadding.Tablet, |
| 225 |
right: 0, |
| 226 |
left: 12, |
| 227 |
}, |
| 228 |
}, |
| 229 |
}, |
| 230 |
searchButtonIconColor: { |
| 231 |
color: "#ffffff", |
| 232 |
hoverColor: "", |
| 233 |
}, |
| 234 |
searchButtonPosition: "right", |
| 235 |
}, |
| 236 |
"smart-search-form-preset-five": { |
| 237 |
searchFormBorderWidth: { |
| 238 |
...searchFormBorderWidth, |
| 239 |
device: { |
| 240 |
Desktop: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 241 |
Mobile: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 242 |
Tablet: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 243 |
}, |
| 244 |
}, |
| 245 |
searchFormBorder: { |
| 246 |
...searchFormBorder, |
| 247 |
style: "solid", |
| 248 |
color: "#2F2F2F", |
| 249 |
}, |
| 250 |
searchFormHoverBorderWidth: { |
| 251 |
...searchFormHoverBorderWidth, |
| 252 |
device: { |
| 253 |
Desktop: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 254 |
Mobile: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 255 |
Tablet: { top: 1, right: 1, bottom: 1, left: 1 }, |
| 256 |
}, |
| 257 |
}, |
| 258 |
searchFormHoverBorder: { |
| 259 |
...searchFormHoverBorder, |
| 260 |
style: "solid", |
| 261 |
color: "#2F2F2F", |
| 262 |
}, |
| 263 |
searchFormPadding: { |
| 264 |
...searchFormPadding, |
| 265 |
device: { |
| 266 |
Desktop: { |
| 267 |
top: 4, |
| 268 |
right: 4, |
| 269 |
bottom: 4, |
| 270 |
left: searchButtonPosition === "left" ? 4 : 12, |
| 271 |
}, |
| 272 |
Mobile: { |
| 273 |
top: 4, |
| 274 |
right: 4, |
| 275 |
bottom: 4, |
| 276 |
left: searchButtonPosition === "left" ? 4 : 12, |
| 277 |
}, |
| 278 |
Tablet: { |
| 279 |
top: 4, |
| 280 |
right: 4, |
| 281 |
bottom: 4, |
| 282 |
left: searchButtonPosition === "left" ? 4 : 12, |
| 283 |
}, |
| 284 |
}, |
| 285 |
}, |
| 286 |
searchButtonIconColor: { |
| 287 |
color: "#ffffff", |
| 288 |
hoverColor: "", |
| 289 |
}, |
| 290 |
searchButtonPosition: "right", |
| 291 |
}, |
| 292 |
}), |
| 293 |
[] |
| 294 |
); |
| 295 |
|
| 296 |
const layoutChange = (newValue) => { |
| 297 |
if (newValue === searchFormPreset) { |
| 298 |
return; |
| 299 |
} |
| 300 |
const newData = { |
| 301 |
searchFormPreset: newValue, |
| 302 |
...layoutDefault[newValue], |
| 303 |
}; |
| 304 |
setAttributes(newData); |
| 305 |
}; |
| 306 |
return ( |
| 307 |
<> |
| 308 |
<Layouts |
| 309 |
attributes={searchFormPreset} |
| 310 |
setAttributes={setAttributes} |
| 311 |
attributesKey={"searchFormPreset"} |
| 312 |
displayActive={true} |
| 313 |
grid={3} |
| 314 |
showDemoTitle={true} |
| 315 |
onChange={layoutChange} |
| 316 |
label={__("Search Preset", "post-carousel")} |
| 317 |
items={[ |
| 318 |
{ |
| 319 |
icon: <SearchFormPresetOne value={searchFormPreset} />, |
| 320 |
value: "smart-search-form-preset-one", |
| 321 |
}, |
| 322 |
{ |
| 323 |
icon: <SearchFormPresetTwo value={searchFormPreset} />, |
| 324 |
value: "smart-search-form-preset-two", |
| 325 |
}, |
| 326 |
{ |
| 327 |
icon: <SearchFormPresetThree value={searchFormPreset} />, |
| 328 |
value: "smart-search-form-preset-three", |
| 329 |
}, |
| 330 |
{ |
| 331 |
icon: <SearchFormPresetFour value={searchFormPreset} />, |
| 332 |
value: "smart-search-form-preset-four", |
| 333 |
}, |
| 334 |
{ |
| 335 |
icon: <SearchFormPresetFive value={searchFormPreset} />, |
| 336 |
value: "smart-search-form-preset-five", |
| 337 |
}, |
| 338 |
]} |
| 339 |
/> |
| 340 |
<SPToggleGroupControl |
| 341 |
label={__("Display Type", "post-carousel")} |
| 342 |
attributes={displayType} |
| 343 |
attributesKey={"displayType"} |
| 344 |
setAttributes={setAttributes} |
| 345 |
items={[ |
| 346 |
{ label: "Normal", value: "normal" }, |
| 347 |
{ label: "Popup", value: "popup" }, |
| 348 |
]} |
| 349 |
/> |
| 350 |
<Toggle |
| 351 |
label={__("Placeholder", "post-carousel")} |
| 352 |
attributes={placeholderEnable} |
| 353 |
attributesKey={"placeholderEnable"} |
| 354 |
setAttributes={setAttributes} |
| 355 |
/> |
| 356 |
{placeholderEnable && ( |
| 357 |
<InputControl |
| 358 |
label={__("Placeholder Text", "post-carousel")} |
| 359 |
attributes={placeholder} |
| 360 |
attributesKey={"placeholder"} |
| 361 |
setAttributes={setAttributes} |
| 362 |
flex={false} |
| 363 |
inputType="string" |
| 364 |
placeholder={__("Search…", "post-carousel")} |
| 365 |
/> |
| 366 |
)} |
| 367 |
<SPRangeControl |
| 368 |
label={__("Width", "post-carousel")} |
| 369 |
attributes={searchFormWidth} |
| 370 |
attributesKey={"searchFormWidth"} |
| 371 |
setAttributes={setAttributes} |
| 372 |
max={1000} |
| 373 |
units={["px", "%", "em"]} |
| 374 |
defaultValue={{ unit: "%", value: 100 }} |
| 375 |
/> |
| 376 |
<SPRangeControl |
| 377 |
label={__("Height", "post-carousel")} |
| 378 |
attributes={searchFormHeight} |
| 379 |
attributesKey={"searchFormHeight"} |
| 380 |
setAttributes={setAttributes} |
| 381 |
max={200} |
| 382 |
units={["px", "%", "em"]} |
| 383 |
defaultValue={{ unit: "px", value: 20 }} |
| 384 |
/> |
| 385 |
<SPToggleGroupControl |
| 386 |
label={__("Alignment", "post-carousel")} |
| 387 |
attributes={searchFormAlignment} |
| 388 |
attributesKey={"searchFormAlignment"} |
| 389 |
setAttributes={setAttributes} |
| 390 |
items={[ |
| 391 |
{ label: <AlignLeft />, value: "flex-start" }, |
| 392 |
{ label: <AlignCenter />, value: "center" }, |
| 393 |
{ label: <AlignRight />, value: "flex-end" }, |
| 394 |
]} |
| 395 |
/> |
| 396 |
</> |
| 397 |
); |
| 398 |
}; |
| 399 |
|
| 400 |
export const SearchButtonGeneralTab = ({ attributes, setAttributes }) => { |
| 401 |
const { |
| 402 |
searchButtonPosition, |
| 403 |
searchIcon, |
| 404 |
searchButtonIconSize, |
| 405 |
searchButtonNewTabEnable, |
| 406 |
searchIconDivider, |
| 407 |
searchFormPreset, |
| 408 |
searchBtnLabelText, |
| 409 |
searchBtnLabel, |
| 410 |
searchBtnReverse, |
| 411 |
} = attributes; |
| 412 |
|
| 413 |
return ( |
| 414 |
<> |
| 415 |
<Toggle |
| 416 |
label={__("Search Icon", "post-carousel")} |
| 417 |
attributes={searchIcon} |
| 418 |
setAttributes={setAttributes} |
| 419 |
attributesKey={"searchIcon"} |
| 420 |
/> |
| 421 |
{searchIcon && ( |
| 422 |
<> |
| 423 |
<RangeControl |
| 424 |
label={__("Icon Size", "post-carousel")} |
| 425 |
setAttributes={setAttributes} |
| 426 |
attributes={searchButtonIconSize} |
| 427 |
attributesKey={"searchButtonIconSize"} |
| 428 |
max={100} |
| 429 |
defaultValue={{ value: 20, unit: "px" }} |
| 430 |
/> |
| 431 |
<SPToggleGroupControl |
| 432 |
label={__("Button Position", "post-carousel")} |
| 433 |
attributes={searchButtonPosition} |
| 434 |
attributesKey={"searchButtonPosition"} |
| 435 |
setAttributes={setAttributes} |
| 436 |
items={[ |
| 437 |
{ label: "Left", value: "left" }, |
| 438 |
{ label: "Right", value: "right" }, |
| 439 |
]} |
| 440 |
/> |
| 441 |
{searchFormPreset === "smart-search-form-preset-one" && ( |
| 442 |
<Toggle |
| 443 |
label={__("Divider", "post-carousel")} |
| 444 |
attributes={searchIconDivider} |
| 445 |
setAttributes={setAttributes} |
| 446 |
attributesKey={"searchIconDivider"} |
| 447 |
/> |
| 448 |
)} |
| 449 |
</> |
| 450 |
)} |
| 451 |
{[ |
| 452 |
"smart-search-form-preset-three", |
| 453 |
"smart-search-form-preset-four", |
| 454 |
"smart-search-form-preset-five", |
| 455 |
].includes(searchFormPreset) && ( |
| 456 |
<> |
| 457 |
<Toggle |
| 458 |
label={__("Button Label", "post-carousel")} |
| 459 |
attributes={searchBtnLabel} |
| 460 |
setAttributes={setAttributes} |
| 461 |
attributesKey={"searchBtnLabel"} |
| 462 |
/> |
| 463 |
{searchBtnLabel && ( |
| 464 |
<> |
| 465 |
<InputControl |
| 466 |
label={__("Button Label", "post-carousel")} |
| 467 |
attributes={searchBtnLabelText} |
| 468 |
attributesKey={"searchBtnLabelText"} |
| 469 |
setAttributes={setAttributes} |
| 470 |
flex={false} |
| 471 |
inputType="string" |
| 472 |
placeholder={__("Search…", "post-carousel")} |
| 473 |
/> |
| 474 |
{searchIcon && ( |
| 475 |
<Toggle |
| 476 |
label={__("Button Reverse", "post-carousel")} |
| 477 |
attributes={searchBtnReverse} |
| 478 |
setAttributes={setAttributes} |
| 479 |
attributesKey={"searchBtnReverse"} |
| 480 |
/> |
| 481 |
)} |
| 482 |
</> |
| 483 |
)} |
| 484 |
</> |
| 485 |
)} |
| 486 |
|
| 487 |
<Toggle |
| 488 |
label={__("Link Open In New Tab", "post-carousel")} |
| 489 |
attributes={searchButtonNewTabEnable} |
| 490 |
setAttributes={setAttributes} |
| 491 |
attributesKey={"searchButtonNewTabEnable"} |
| 492 |
/> |
| 493 |
</> |
| 494 |
); |
| 495 |
}; |
| 496 |
|
| 497 |
export const SearchResultGeneralTab = ({ attributes, setAttributes }) => { |
| 498 |
const { |
| 499 |
ajaxSearch, |
| 500 |
searchResultDisplayType, |
| 501 |
searchResultNotFoundText, |
| 502 |
searchResultColumns, |
| 503 |
searchResultColumnGap, |
| 504 |
searchResultBoxWidth, |
| 505 |
searchResultBoxHeight, |
| 506 |
searchResultShowImage, |
| 507 |
searchResultImageSize, |
| 508 |
searchResultImageContentGap, |
| 509 |
searchResultShowExcerpt, |
| 510 |
searchResultShowTaxonomy, |
| 511 |
searchResultShowAuthor, |
| 512 |
searchResultShowDate, |
| 513 |
hightLightSearchTerm, |
| 514 |
searchResultItemSeparator, |
| 515 |
searchResultHorizontalPosition, |
| 516 |
searchResultVerticalPosition, |
| 517 |
searchResultTitleFontSize, |
| 518 |
searchResultExcerptLimit, |
| 519 |
searchResultSpaceBetweenMeta, |
| 520 |
taxonomyFilterEnable, |
| 521 |
} = attributes; |
| 522 |
|
| 523 |
const layoutDefault = useMemo( |
| 524 |
() => ({ |
| 525 |
"smart-search-result-layout-one": { |
| 526 |
searchResultColumns: { |
| 527 |
...searchResultColumns, |
| 528 |
device: { |
| 529 |
Desktop: 1, |
| 530 |
Tablet: 1, |
| 531 |
Mobile: 1, |
| 532 |
}, |
| 533 |
}, |
| 534 |
searchResultColumnGap: { |
| 535 |
...searchResultColumnGap, |
| 536 |
device: { |
| 537 |
Desktop: 0, |
| 538 |
Tablet: 0, |
| 539 |
Mobile: 0, |
| 540 |
}, |
| 541 |
unit: { |
| 542 |
Desktop: "px", |
| 543 |
Tablet: "px", |
| 544 |
Mobile: "px", |
| 545 |
}, |
| 546 |
}, |
| 547 |
searchResultImageContentGap: { |
| 548 |
...searchResultImageContentGap, |
| 549 |
device: { |
| 550 |
Desktop: 20, |
| 551 |
Tablet: 20, |
| 552 |
Mobile: 20, |
| 553 |
}, |
| 554 |
unit: { |
| 555 |
Desktop: "px", |
| 556 |
Tablet: "px", |
| 557 |
Mobile: "px", |
| 558 |
}, |
| 559 |
}, |
| 560 |
searchResultTitleFontSize: { |
| 561 |
...searchResultTitleFontSize, |
| 562 |
device: { |
| 563 |
Desktop: 18, |
| 564 |
Tablet: 18, |
| 565 |
Mobile: 18, |
| 566 |
}, |
| 567 |
unit: { |
| 568 |
Desktop: "px", |
| 569 |
Tablet: "px", |
| 570 |
Mobile: "px", |
| 571 |
}, |
| 572 |
}, |
| 573 |
popupCanvasWidth: { |
| 574 |
device: { |
| 575 |
Desktop: 500, |
| 576 |
Tablet: 500, |
| 577 |
Mobile: 500, |
| 578 |
}, |
| 579 |
unit: { |
| 580 |
Desktop: "px", |
| 581 |
Tablet: "px", |
| 582 |
Mobile: "px", |
| 583 |
}, |
| 584 |
}, |
| 585 |
searchResultVerticalPosition: { |
| 586 |
device: { |
| 587 |
Desktop: 100, |
| 588 |
Tablet: 100, |
| 589 |
Mobile: 100, |
| 590 |
}, |
| 591 |
unit: { |
| 592 |
Desktop: "%", |
| 593 |
Tablet: "%", |
| 594 |
Mobile: "%", |
| 595 |
}, |
| 596 |
}, |
| 597 |
searchResultImageSize: { |
| 598 |
device: { |
| 599 |
Desktop: 55, |
| 600 |
Tablet: 55, |
| 601 |
Mobile: 55, |
| 602 |
}, |
| 603 |
unit: { |
| 604 |
Desktop: "px", |
| 605 |
Tablet: "px", |
| 606 |
Mobile: "px", |
| 607 |
}, |
| 608 |
}, |
| 609 |
}, |
| 610 |
"smart-search-result-layout-two": { |
| 611 |
searchResultColumns: { |
| 612 |
...searchResultColumns, |
| 613 |
device: { |
| 614 |
Desktop: 1, |
| 615 |
Tablet: 1, |
| 616 |
Mobile: 1, |
| 617 |
}, |
| 618 |
}, |
| 619 |
searchResultColumnGap: { |
| 620 |
...searchResultColumnGap, |
| 621 |
device: { |
| 622 |
Desktop: 0, |
| 623 |
Tablet: 0, |
| 624 |
Mobile: 0, |
| 625 |
}, |
| 626 |
unit: { |
| 627 |
Desktop: "px", |
| 628 |
Tablet: "px", |
| 629 |
Mobile: "px", |
| 630 |
}, |
| 631 |
}, |
| 632 |
searchResultTitleFontSize: { |
| 633 |
...searchResultTitleFontSize, |
| 634 |
device: { |
| 635 |
Desktop: 18, |
| 636 |
Tablet: 18, |
| 637 |
Mobile: 18, |
| 638 |
}, |
| 639 |
unit: { |
| 640 |
Desktop: "px", |
| 641 |
Tablet: "px", |
| 642 |
Mobile: "px", |
| 643 |
}, |
| 644 |
}, |
| 645 |
popupCanvasWidth: { |
| 646 |
device: { |
| 647 |
Desktop: 500, |
| 648 |
Tablet: 500, |
| 649 |
Mobile: 500, |
| 650 |
}, |
| 651 |
unit: { |
| 652 |
Desktop: "px", |
| 653 |
Tablet: "px", |
| 654 |
Mobile: "px", |
| 655 |
}, |
| 656 |
}, |
| 657 |
searchResultImageContentGap: { |
| 658 |
device: { |
| 659 |
Desktop: 20, |
| 660 |
Tablet: 20, |
| 661 |
Mobile: 20, |
| 662 |
}, |
| 663 |
unit: { |
| 664 |
Desktop: "px", |
| 665 |
Tablet: "px", |
| 666 |
Mobile: "px", |
| 667 |
}, |
| 668 |
searchResultVerticalPosition: { |
| 669 |
device: { |
| 670 |
Desktop: 100, |
| 671 |
Tablet: 100, |
| 672 |
Mobile: 100, |
| 673 |
}, |
| 674 |
unit: { |
| 675 |
Desktop: "%", |
| 676 |
Tablet: "%", |
| 677 |
Mobile: "%", |
| 678 |
}, |
| 679 |
}, |
| 680 |
}, |
| 681 |
}, |
| 682 |
"smart-search-result-layout-three": { |
| 683 |
searchResultColumns: { |
| 684 |
...searchResultColumns, |
| 685 |
device: { |
| 686 |
Desktop: 6, |
| 687 |
Tablet: 4, |
| 688 |
Mobile: 1, |
| 689 |
}, |
| 690 |
}, |
| 691 |
searchResultColumnGap: { |
| 692 |
...searchResultColumnGap, |
| 693 |
device: { |
| 694 |
Desktop: 10, |
| 695 |
Tablet: 10, |
| 696 |
Mobile: 10, |
| 697 |
}, |
| 698 |
unit: { |
| 699 |
Desktop: "px", |
| 700 |
Tablet: "px", |
| 701 |
Mobile: "px", |
| 702 |
}, |
| 703 |
}, |
| 704 |
searchResultImageContentGap: { |
| 705 |
...searchResultImageContentGap, |
| 706 |
device: { |
| 707 |
Desktop: 12, |
| 708 |
Tablet: 12, |
| 709 |
Mobile: 12, |
| 710 |
}, |
| 711 |
unit: { |
| 712 |
Desktop: "px", |
| 713 |
Tablet: "px", |
| 714 |
Mobile: "px", |
| 715 |
}, |
| 716 |
}, |
| 717 |
searchResultTitleFontSize: { |
| 718 |
...searchResultTitleFontSize, |
| 719 |
device: { |
| 720 |
Desktop: 16, |
| 721 |
Tablet: 16, |
| 722 |
Mobile: 16, |
| 723 |
}, |
| 724 |
unit: { |
| 725 |
Desktop: "px", |
| 726 |
Tablet: "px", |
| 727 |
Mobile: "px", |
| 728 |
}, |
| 729 |
}, |
| 730 |
popupCanvasWidth: { |
| 731 |
device: { |
| 732 |
Desktop: 65, |
| 733 |
Tablet: 65, |
| 734 |
Mobile: 65, |
| 735 |
}, |
| 736 |
unit: { |
| 737 |
Desktop: "%", |
| 738 |
Tablet: "%", |
| 739 |
Mobile: "%", |
| 740 |
}, |
| 741 |
}, |
| 742 |
searchResultVerticalPosition: { |
| 743 |
device: { |
| 744 |
Desktop: 80, |
| 745 |
Tablet: 80, |
| 746 |
Mobile: 80, |
| 747 |
}, |
| 748 |
unit: { |
| 749 |
Desktop: "px", |
| 750 |
Tablet: "px", |
| 751 |
Mobile: "px", |
| 752 |
}, |
| 753 |
}, |
| 754 |
searchResultImageSize: { |
| 755 |
device: { |
| 756 |
Desktop: 150, |
| 757 |
Tablet: 150, |
| 758 |
Mobile: 150, |
| 759 |
}, |
| 760 |
unit: { |
| 761 |
Desktop: "px", |
| 762 |
Tablet: "px", |
| 763 |
Mobile: "px", |
| 764 |
}, |
| 765 |
}, |
| 766 |
}, |
| 767 |
}), |
| 768 |
[] |
| 769 |
); |
| 770 |
|
| 771 |
const layoutChange = (newValue) => { |
| 772 |
if (newValue === searchResultDisplayType) { |
| 773 |
return; |
| 774 |
} |
| 775 |
const newData = { |
| 776 |
searchResultDisplayType: newValue, |
| 777 |
...layoutDefault[newValue], |
| 778 |
}; |
| 779 |
setAttributes(newData); |
| 780 |
}; |
| 781 |
|
| 782 |
return ( |
| 783 |
<> |
| 784 |
{!taxonomyFilterEnable && ( |
| 785 |
<Toggle |
| 786 |
label={__("Ajax Search", "post-carousel")} |
| 787 |
attributes={ajaxSearch} |
| 788 |
setAttributes={setAttributes} |
| 789 |
attributesKey={"ajaxSearch"} |
| 790 |
/> |
| 791 |
)} |
| 792 |
<Layouts |
| 793 |
attributes={searchResultDisplayType} |
| 794 |
setAttributes={setAttributes} |
| 795 |
attributesKey={"searchResultDisplayType"} |
| 796 |
displayActive={true} |
| 797 |
grid={3} |
| 798 |
onChange={layoutChange} |
| 799 |
label={__("Search Result Display Type", "post-carousel")} |
| 800 |
items={[ |
| 801 |
{ |
| 802 |
icon: <SearchResultLayoutOne value={searchResultDisplayType} />, |
| 803 |
value: "smart-search-result-layout-one", |
| 804 |
}, |
| 805 |
{ |
| 806 |
icon: <SearchResultLayoutTwo value={searchResultDisplayType} />, |
| 807 |
value: "smart-search-result-layout-two", |
| 808 |
}, |
| 809 |
{ |
| 810 |
icon: <SearchResultLayoutThree value={searchResultDisplayType} />, |
| 811 |
value: "smart-search-result-layout-three", |
| 812 |
}, |
| 813 |
]} |
| 814 |
/> |
| 815 |
<InputControl |
| 816 |
label={__("No Result Found Text", "post-carousel")} |
| 817 |
attributes={searchResultNotFoundText} |
| 818 |
attributesKey={"searchResultNotFoundText"} |
| 819 |
setAttributes={setAttributes} |
| 820 |
flex={false} |
| 821 |
inputType="string" |
| 822 |
placeholder={__("No Result Found", "post-carousel")} |
| 823 |
/> |
| 824 |
<SPRangeControl |
| 825 |
label={__("Columns", "post-carousel")} |
| 826 |
attributes={searchResultColumns} |
| 827 |
attributesKey={"searchResultColumns"} |
| 828 |
setAttributes={setAttributes} |
| 829 |
max={12} |
| 830 |
/> |
| 831 |
<SPRangeControl |
| 832 |
label={__("Gap", "post-carousel")} |
| 833 |
attributes={searchResultColumnGap} |
| 834 |
attributesKey={"searchResultColumnGap"} |
| 835 |
setAttributes={setAttributes} |
| 836 |
max={200} |
| 837 |
units={["px", "%", "em"]} |
| 838 |
defaultValue={{ unit: "px", value: 20 }} |
| 839 |
/> |
| 840 |
<SPRangeControl |
| 841 |
label={__("Result Box Width", "post-carousel")} |
| 842 |
attributes={searchResultBoxWidth} |
| 843 |
attributesKey={"searchResultBoxWidth"} |
| 844 |
setAttributes={setAttributes} |
| 845 |
max={1000} |
| 846 |
units={["px", "%", "em"]} |
| 847 |
defaultValue={{ unit: "%", value: 100 }} |
| 848 |
/> |
| 849 |
<SPRangeControl |
| 850 |
label={__("Result Box Height", "post-carousel")} |
| 851 |
attributes={searchResultBoxHeight} |
| 852 |
attributesKey={"searchResultBoxHeight"} |
| 853 |
setAttributes={setAttributes} |
| 854 |
max={1000} |
| 855 |
units={["px", "%", "em"]} |
| 856 |
defaultValue={{ unit: "px", value: 552 }} |
| 857 |
/> |
| 858 |
{searchResultDisplayType !== "smart-search-result-layout-two" && ( |
| 859 |
<> |
| 860 |
<Toggle |
| 861 |
label={__("Image", "post-carousel")} |
| 862 |
attributes={searchResultShowImage} |
| 863 |
setAttributes={setAttributes} |
| 864 |
attributesKey={"searchResultShowImage"} |
| 865 |
/> |
| 866 |
{!!searchResultShowImage && ( |
| 867 |
<> |
| 868 |
<SPRangeControl |
| 869 |
label={__("Image Size", "post-carousel")} |
| 870 |
attributes={searchResultImageSize} |
| 871 |
attributesKey={"searchResultImageSize"} |
| 872 |
setAttributes={setAttributes} |
| 873 |
max={200} |
| 874 |
units={["px", "%", "em"]} |
| 875 |
defaultValue={{ unit: "px", value: 20 }} |
| 876 |
/> |
| 877 |
<SPRangeControl |
| 878 |
label={__("Image - Content Gap", "post-carousel")} |
| 879 |
attributes={searchResultImageContentGap} |
| 880 |
attributesKey={"searchResultImageContentGap"} |
| 881 |
setAttributes={setAttributes} |
| 882 |
max={200} |
| 883 |
units={["px", "%", "em"]} |
| 884 |
defaultValue={{ unit: "px", value: 20 }} |
| 885 |
/> |
| 886 |
</> |
| 887 |
)} |
| 888 |
</> |
| 889 |
)} |
| 890 |
<Toggle |
| 891 |
label={__("Excerpt", "post-carousel")} |
| 892 |
attributes={searchResultShowExcerpt} |
| 893 |
setAttributes={setAttributes} |
| 894 |
attributesKey={"searchResultShowExcerpt"} |
| 895 |
/> |
| 896 |
{searchResultShowExcerpt && ( |
| 897 |
<SPRangeControl |
| 898 |
label={__("Excerpt Limit", "post-carousel")} |
| 899 |
className="sp-smart-post-ranger-length" |
| 900 |
attributes={searchResultExcerptLimit} |
| 901 |
attributesKey={"searchResultExcerptLimit"} |
| 902 |
setAttributes={setAttributes} |
| 903 |
min={1} |
| 904 |
units={["words", "chars"]} |
| 905 |
defaultValue={{ unit: "words", value: 20 }} |
| 906 |
/> |
| 907 |
)} |
| 908 |
<Toggle |
| 909 |
label={__("Taxonomy", "post-carousel")} |
| 910 |
attributes={searchResultShowTaxonomy} |
| 911 |
setAttributes={setAttributes} |
| 912 |
attributesKey={"searchResultShowTaxonomy"} |
| 913 |
/> |
| 914 |
<Toggle |
| 915 |
label={__("Author", "post-carousel")} |
| 916 |
attributes={searchResultShowAuthor} |
| 917 |
setAttributes={setAttributes} |
| 918 |
attributesKey={"searchResultShowAuthor"} |
| 919 |
/> |
| 920 |
<Toggle |
| 921 |
label={__("Publish Date", "post-carousel")} |
| 922 |
attributes={searchResultShowDate} |
| 923 |
setAttributes={setAttributes} |
| 924 |
attributesKey={"searchResultShowDate"} |
| 925 |
/> |
| 926 |
<SPRangeControl |
| 927 |
label={__("Space Between Meta", "post-carousel")} |
| 928 |
attributes={searchResultSpaceBetweenMeta} |
| 929 |
attributesKey={"searchResultSpaceBetweenMeta"} |
| 930 |
setAttributes={setAttributes} |
| 931 |
max={100} |
| 932 |
defaultValue={{ value: 4 }} |
| 933 |
/> |
| 934 |
<Toggle |
| 935 |
label={__("Highlight Search Term", "post-carousel")} |
| 936 |
attributes={hightLightSearchTerm} |
| 937 |
setAttributes={setAttributes} |
| 938 |
attributesKey={"hightLightSearchTerm"} |
| 939 |
/> |
| 940 |
<Toggle |
| 941 |
label={__("Item Separator", "post-carousel")} |
| 942 |
attributes={searchResultItemSeparator} |
| 943 |
setAttributes={setAttributes} |
| 944 |
attributesKey={"searchResultItemSeparator"} |
| 945 |
/> |
| 946 |
{/* TODO: Need to clarification about this feature*/} |
| 947 |
<SPRangeControl |
| 948 |
label={__("Horizontal Position", "post-carousel")} |
| 949 |
attributes={searchResultHorizontalPosition} |
| 950 |
attributesKey={"searchResultHorizontalPosition"} |
| 951 |
setAttributes={setAttributes} |
| 952 |
max={1000} |
| 953 |
min={-1000} |
| 954 |
units={["px", "%", "em"]} |
| 955 |
defaultValue={{ unit: "px", value: "" }} |
| 956 |
/> |
| 957 |
<SPRangeControl |
| 958 |
label={__("Vertical Position", "post-carousel")} |
| 959 |
attributes={searchResultVerticalPosition} |
| 960 |
attributesKey={"searchResultVerticalPosition"} |
| 961 |
setAttributes={setAttributes} |
| 962 |
max={1000} |
| 963 |
min={-1000} |
| 964 |
units={["px", "%", "em"]} |
| 965 |
defaultValue={{ unit: "px", value: "" }} |
| 966 |
/> |
| 967 |
</> |
| 968 |
); |
| 969 |
}; |
| 970 |
export const MoreResultGeneralTab = ({ attributes, setAttributes }) => { |
| 971 |
const { |
| 972 |
moreResultsEnable, |
| 973 |
moreResultLabelText, |
| 974 |
showResultsCount, |
| 975 |
initialPostDisplay, |
| 976 |
moreResultClickAction, |
| 977 |
taxonomyFilterEnable, |
| 978 |
} = attributes; |
| 979 |
|
| 980 |
const actionOptions = [ |
| 981 |
{ |
| 982 |
value: "expanded", |
| 983 |
label: __("Expanded", "post-carousel"), |
| 984 |
}, |
| 985 |
{ |
| 986 |
value: "same_tab", |
| 987 |
label: __("Same Tab", "post-carousel"), |
| 988 |
}, |
| 989 |
{ |
| 990 |
value: "new_tab", |
| 991 |
label: __("New Tab", "post-carousel"), |
| 992 |
}, |
| 993 |
]; |
| 994 |
|
| 995 |
return ( |
| 996 |
<> |
| 997 |
<Toggle |
| 998 |
label={__("More Result", "post-carousel")} |
| 999 |
attributes={moreResultsEnable} |
| 1000 |
setAttributes={setAttributes} |
| 1001 |
attributesKey={"moreResultsEnable"} |
| 1002 |
/> |
| 1003 |
{moreResultsEnable && ( |
| 1004 |
<> |
| 1005 |
<Toggle |
| 1006 |
label={__("Results Count", "post-carousel")} |
| 1007 |
attributes={showResultsCount} |
| 1008 |
setAttributes={setAttributes} |
| 1009 |
attributesKey={"showResultsCount"} |
| 1010 |
/> |
| 1011 |
<SPRangeControl |
| 1012 |
label={__("Initial Post Display", "post-carousel")} |
| 1013 |
attributes={initialPostDisplay} |
| 1014 |
attributesKey={"initialPostDisplay"} |
| 1015 |
setAttributes={setAttributes} |
| 1016 |
max={12} |
| 1017 |
/> |
| 1018 |
<InputControl |
| 1019 |
label={__("More Results Label", "post-carousel")} |
| 1020 |
attributes={moreResultLabelText} |
| 1021 |
attributesKey={"moreResultLabelText"} |
| 1022 |
setAttributes={setAttributes} |
| 1023 |
flex={false} |
| 1024 |
inputType="string" |
| 1025 |
placeholder={__("Enter More Results Label", "post-carousel")} |
| 1026 |
/> |
| 1027 |
{!taxonomyFilterEnable && ( |
| 1028 |
<SelectField |
| 1029 |
label={__("More Result Click Action", "post-carousel")} |
| 1030 |
attributes={moreResultClickAction} |
| 1031 |
attributesKey={"moreResultClickAction"} |
| 1032 |
setAttributes={setAttributes} |
| 1033 |
items={actionOptions} |
| 1034 |
/> |
| 1035 |
)} |
| 1036 |
</> |
| 1037 |
)} |
| 1038 |
</> |
| 1039 |
); |
| 1040 |
}; |
| 1041 |
export const QueryFilterGeneralTab = ({ attributes, setAttributes }) => { |
| 1042 |
const { uniqueId, postType, taxonomyFilterEnable, selectedTaxonomy, selectedTerms, filterLabelText } = attributes; |
| 1043 |
const { allPostTypes, allTaxonomies } = useMetaData(attributes, "editSite"); |
| 1044 |
const postTypeValues = getObjectValuesToJsArray(allPostTypes); |
| 1045 |
const postTypeOptions = postTypeValues?.map((singlePostType) => ({ |
| 1046 |
label: `${capitalizeString(singlePostType)}s`, |
| 1047 |
value: singlePostType, |
| 1048 |
})); |
| 1049 |
|
| 1050 |
const updatePostTypeOptions = postTypeOptions?.map((item, index) => ({ |
| 1051 |
id: index + 1, |
| 1052 |
label: item.value === "attachment" ? "Media" : item.label, |
| 1053 |
value: item.value, |
| 1054 |
})); |
| 1055 |
|
| 1056 |
const defaultPostType = [ |
| 1057 |
{ label: "Posts", value: "post" }, |
| 1058 |
{ label: "Pages", value: "page" }, |
| 1059 |
]; |
| 1060 |
const postTypeChangeHandler = (newValue) => { |
| 1061 |
if (postType === newValue) { |
| 1062 |
return; |
| 1063 |
} |
| 1064 |
setAttributes({ postType: newValue, selectedTerms: [] }); |
| 1065 |
}; |
| 1066 |
|
| 1067 |
const taxonomiesSelectOptions = filterSelectOptions(allTaxonomies, "label", "name"); |
| 1068 |
|
| 1069 |
const selectedTaxonomyData = findDataFromArray(allTaxonomies, "name", selectedTaxonomy); |
| 1070 |
const terms = selectedTaxonomyData?.terms_items.map((item) => ({ |
| 1071 |
...item, |
| 1072 |
id: item.value, |
| 1073 |
})); |
| 1074 |
|
| 1075 |
const taxonomyTypeTitle = selectedTaxonomy ? selectedTaxonomyData?.label : __("Taxonomy", "post-carousel"); |
| 1076 |
|
| 1077 |
return ( |
| 1078 |
<> |
| 1079 |
<SelectField |
| 1080 |
label={__("Search for Post Types", "post-carousel")} |
| 1081 |
attributes={postType} |
| 1082 |
attributesKey={"postType"} |
| 1083 |
setAttributes={setAttributes} |
| 1084 |
items={updatePostTypeOptions?.length > 0 ? [...updatePostTypeOptions] : defaultPostType} |
| 1085 |
onChange={postTypeChangeHandler} |
| 1086 |
/> |
| 1087 |
{postType && taxonomiesSelectOptions?.length > 0 && ( |
| 1088 |
<> |
| 1089 |
<Toggle |
| 1090 |
label={__("Taxonomy Filter", "post-carousel")} |
| 1091 |
attributes={taxonomyFilterEnable} |
| 1092 |
setAttributes={setAttributes} |
| 1093 |
attributesKey={"taxonomyFilterEnable"} |
| 1094 |
/> |
| 1095 |
{taxonomyFilterEnable && ( |
| 1096 |
<> |
| 1097 |
<SelectField |
| 1098 |
label={__("Taxonomy Type", "post-carousel")} |
| 1099 |
attributes={selectedTaxonomy} |
| 1100 |
attributesKey={"selectedTaxonomy"} |
| 1101 |
setAttributes={setAttributes} |
| 1102 |
items={ |
| 1103 |
taxonomiesSelectOptions?.length > 0 |
| 1104 |
? taxonomiesSelectOptions |
| 1105 |
: [{ label: "Default", value: "" }] |
| 1106 |
} |
| 1107 |
/> |
| 1108 |
{selectedTaxonomy !== "" && taxonomyTypeTitle && ( |
| 1109 |
<MultiSelectDndKit |
| 1110 |
label={`${taxonomyTypeTitle} (s)`} |
| 1111 |
uniqueId={uniqueId} |
| 1112 |
items={terms} |
| 1113 |
values={selectedTerms} |
| 1114 |
searchable={true} |
| 1115 |
onChange={(e) => setAttributes({ selectedTerms: e })} |
| 1116 |
/> |
| 1117 |
)} |
| 1118 |
<InputControl |
| 1119 |
label={__("Filter Label", "post-carousel")} |
| 1120 |
attributes={filterLabelText} |
| 1121 |
attributesKey={"filterLabelText"} |
| 1122 |
setAttributes={setAttributes} |
| 1123 |
flex={false} |
| 1124 |
inputType="string" |
| 1125 |
placeholder={__("All Categories", "post-carousel")} |
| 1126 |
/> |
| 1127 |
</> |
| 1128 |
)} |
| 1129 |
</> |
| 1130 |
)} |
| 1131 |
</> |
| 1132 |
); |
| 1133 |
}; |
| 1134 |
|
| 1135 |
export const PopupCanvasGeneralTab = ({ attributes, setAttributes }) => { |
| 1136 |
const { |
| 1137 |
popupHeadingGap, |
| 1138 |
enablePopupCloseButton, |
| 1139 |
popupHeadingText, |
| 1140 |
enablePopupHeading, |
| 1141 |
popupCanvasWidth, |
| 1142 |
popupCloseBtnIconSize, |
| 1143 |
popupHeadingAlignment, |
| 1144 |
} = attributes; |
| 1145 |
|
| 1146 |
return ( |
| 1147 |
<> |
| 1148 |
<RangeControl |
| 1149 |
label={__("Canvas Width", "post-carousel")} |
| 1150 |
setAttributes={setAttributes} |
| 1151 |
attributes={popupCanvasWidth} |
| 1152 |
attributesKey={"popupCanvasWidth"} |
| 1153 |
max={1600} |
| 1154 |
defaultValue={{ value: 500, unit: "px" }} |
| 1155 |
units={["px", "%", "em"]} |
| 1156 |
/> |
| 1157 |
<Toggle |
| 1158 |
label={__("Search Popup Heading", "post-carousel")} |
| 1159 |
attributes={enablePopupHeading} |
| 1160 |
setAttributes={setAttributes} |
| 1161 |
attributesKey={"enablePopupHeading"} |
| 1162 |
/> |
| 1163 |
{enablePopupHeading && ( |
| 1164 |
<> |
| 1165 |
<InputControl |
| 1166 |
label={__("Heading Label", "post-carousel")} |
| 1167 |
attributes={popupHeadingText} |
| 1168 |
attributesKey={"popupHeadingText"} |
| 1169 |
setAttributes={setAttributes} |
| 1170 |
flex={false} |
| 1171 |
inputType="string" |
| 1172 |
placeholder={__("Enter Popup Heading", "post-carousel")} |
| 1173 |
/> |
| 1174 |
<RangeControl |
| 1175 |
label={__("Gap", "post-carousel")} |
| 1176 |
setAttributes={setAttributes} |
| 1177 |
attributes={popupHeadingGap} |
| 1178 |
attributesKey={"popupHeadingGap"} |
| 1179 |
max={100} |
| 1180 |
defaultValue={{ value: 15, unit: "px" }} |
| 1181 |
units={["px", "%", "em"]} |
| 1182 |
/> |
| 1183 |
</> |
| 1184 |
)} |
| 1185 |
|
| 1186 |
<Toggle |
| 1187 |
label={__("Close Icon", "post-carousel")} |
| 1188 |
attributes={enablePopupCloseButton} |
| 1189 |
setAttributes={setAttributes} |
| 1190 |
attributesKey={"enablePopupCloseButton"} |
| 1191 |
/> |
| 1192 |
{enablePopupCloseButton && ( |
| 1193 |
<RangeControl |
| 1194 |
label={__("Icon Size", "post-carousel")} |
| 1195 |
setAttributes={setAttributes} |
| 1196 |
attributes={popupCloseBtnIconSize} |
| 1197 |
attributesKey={"popupCloseBtnIconSize"} |
| 1198 |
max={100} |
| 1199 |
defaultValue={{ value: 10, unit: "px" }} |
| 1200 |
units={["px", "%", "em"]} |
| 1201 |
/> |
| 1202 |
)} |
| 1203 |
<SPToggleGroupControl |
| 1204 |
label={__("Heading Alignment", "post-carousel")} |
| 1205 |
attributes={popupHeadingAlignment} |
| 1206 |
attributesKey={"popupHeadingAlignment"} |
| 1207 |
setAttributes={setAttributes} |
| 1208 |
items={[ |
| 1209 |
{ label: <AlignLeft />, value: "left" }, |
| 1210 |
{ label: <AlignCenter />, value: "center" }, |
| 1211 |
{ label: <AlignRight />, value: "right" }, |
| 1212 |
]} |
| 1213 |
/> |
| 1214 |
</> |
| 1215 |
); |
| 1216 |
}; |
| 1217 |
|