| 1 |
import { __ } from "@wordpress/i18n"; |
| 2 |
import { |
| 3 |
generateTypographyAttributes, |
| 4 |
generateResponsiveRangeAttributes, |
| 5 |
generateDimensionsAttributes, |
| 6 |
generateBackgroundAttributes, |
| 7 |
generateBorderShadowAttributes, |
| 8 |
} from "../../../util/helpers"; |
| 9 |
|
| 10 |
import { |
| 11 |
BOX_BACKGROUND, |
| 12 |
RESULT_BOX_WIDTH, |
| 13 |
RESULT_BOX_MAXWIDTH, |
| 14 |
RESULT_BOX_BORDER, |
| 15 |
ITEM_PADDING, |
| 16 |
BOX_PADDING, |
| 17 |
FIELD_PADDING, |
| 18 |
FIELD_BORDER, |
| 19 |
ITEM_BORDER, |
| 20 |
RESULT_BOX_BACKGROUND, |
| 21 |
ICON_SIZE, |
| 22 |
WRAPPER_MARGIN, |
| 23 |
SEARCH_BUTTON_BORDER, |
| 24 |
SEARCH_BUTTON_PADDING, |
| 25 |
POPULAR_SEARCH_MARGIN, |
| 26 |
POPULAR_SEARCH_KEYWORD_BORDER, |
| 27 |
POPULAR_SEARCH_KEYWORD_PADDING, |
| 28 |
POPULAR_SEARCH_KEYWORD_MARGIN, |
| 29 |
BOX_BACKGROUND_LAYOUT_2, |
| 30 |
BOX_PADDING_LAYOUT_2, |
| 31 |
FIELD_PADDING_LAYOUT_2, |
| 32 |
FIELD_BORDER_LAYOUT_2, |
| 33 |
ICON_SIZE_LAYOUT_2, |
| 34 |
SEARCH_MODAL_FIELD_BACKGROUND, |
| 35 |
SEARCH_MODAL_CONTENT_TABS_ICON_SIZE, |
| 36 |
SEARCH_MODAL_CONTENT_TABS_BORDER, |
| 37 |
SEARCH_MODAL_CONTENT_TABS_LIST_ICON_SIZE, |
| 38 |
SEARCH_MODAL_CONTENT_TABS_LIST_BORDER, |
| 39 |
SEARCH_MODAL_CONTENT_TABS_LIST_CATEGORY_ICON_SIZE, |
| 40 |
SEARCH_BUTTON_BACKGROUND_LAYOUT_2, |
| 41 |
WRAPPER_MARGIN_LAYOUT_2, |
| 42 |
AI_SUGGESTION_MARGIN, |
| 43 |
AI_SUGGESTION_PADDING, |
| 44 |
AI_SUGGESTION_BUTTON_MARGIN, |
| 45 |
AI_SUGGESTION_BUTTON_PADDING |
| 46 |
} from "./constants"; |
| 47 |
import * as typoPrefixs from "./typographyPrefixConstants"; |
| 48 |
|
| 49 |
const attributes = { |
| 50 |
// the following 4 attributes is must required for responsive options and asset generation for frontend |
| 51 |
// responsive control attributes ⬇ |
| 52 |
resOption: { |
| 53 |
type: "string", |
| 54 |
default: "Desktop", |
| 55 |
}, |
| 56 |
searchLayout:{ |
| 57 |
type:"string", |
| 58 |
default:"layout-1" |
| 59 |
}, |
| 60 |
searchModalLayout:{ |
| 61 |
type:"string", |
| 62 |
default:"layout-1" |
| 63 |
}, |
| 64 |
searchModalWidth:{ |
| 65 |
type:"number", |
| 66 |
default:100 |
| 67 |
}, |
| 68 |
searchModalWidthUnit:{ |
| 69 |
type:"string", |
| 70 |
default:"%" |
| 71 |
}, |
| 72 |
searchModalPosition:{ |
| 73 |
type:"string", |
| 74 |
default:"left" |
| 75 |
}, |
| 76 |
// blockId attribute for making unique className and other uniqueness ⬇ |
| 77 |
blockId: { |
| 78 |
type: "string", |
| 79 |
}, |
| 80 |
blockRoot: { |
| 81 |
type: "string", |
| 82 |
default: "better_docs", |
| 83 |
}, |
| 84 |
// blockMeta is for keeping all the styles ⬇ |
| 85 |
blockMeta: { |
| 86 |
type: "object", |
| 87 |
}, |
| 88 |
placeholderText: { |
| 89 |
type: "string", |
| 90 |
default: __("Search", "betterdocs"), |
| 91 |
}, |
| 92 |
fieldBackgroundColor: { |
| 93 |
type: "string", |
| 94 |
default: "#ffffff", |
| 95 |
}, |
| 96 |
fieldBackgroundColorLayout2:{ |
| 97 |
type: "string", |
| 98 |
default: "#FFFFFF", |
| 99 |
}, |
| 100 |
searchModalMagnifierColor:{ |
| 101 |
type:'string', |
| 102 |
default:'rgb(152, 162, 179)' |
| 103 |
}, |
| 104 |
searchModalFieldColor:{ |
| 105 |
type:'string', |
| 106 |
default:'#200505' |
| 107 |
}, |
| 108 |
searchModalFieldPlaceholderColor:{ |
| 109 |
type:'string', |
| 110 |
default:'#475479' |
| 111 |
}, |
| 112 |
searchModalCategoryColor:{ |
| 113 |
type:'string', |
| 114 |
default:'rgb(128, 128, 128)' |
| 115 |
}, |
| 116 |
searchModalContentTabsListColor:{ |
| 117 |
type:'string', |
| 118 |
default:'#1D2939' |
| 119 |
}, |
| 120 |
searchModalContentTabsListCategoryColor:{ |
| 121 |
type:'string', |
| 122 |
default:'#475467' |
| 123 |
}, |
| 124 |
categoryTextColor:{ |
| 125 |
type: "string", |
| 126 |
default: "#595959", |
| 127 |
}, |
| 128 |
searchButtonTextColor:{ |
| 129 |
type: "string", |
| 130 |
default: "#ffffff", |
| 131 |
}, |
| 132 |
searchButtonBackgroundColor:{ |
| 133 |
type: "string", |
| 134 |
default: "#24cc8f", |
| 135 |
}, |
| 136 |
searchButtonBackgroundColorHover:{ |
| 137 |
type: "string", |
| 138 |
default: "#24cc8f", |
| 139 |
}, |
| 140 |
fieldTextColor: { |
| 141 |
type: "string", |
| 142 |
default: "#595959", |
| 143 |
}, |
| 144 |
fieldTextColorLayout2:{ |
| 145 |
type:"string", |
| 146 |
default:'#667085' |
| 147 |
}, |
| 148 |
searchIconColor: { |
| 149 |
type: "string", |
| 150 |
default: "#444b54", |
| 151 |
}, |
| 152 |
searchIconColorLayout2: { |
| 153 |
type: "string", |
| 154 |
default: "rgb(152, 162, 179)", |
| 155 |
}, |
| 156 |
closeIconColor: { |
| 157 |
type: "string", |
| 158 |
default: "#ff697b", |
| 159 |
}, |
| 160 |
closeBorderColor: { |
| 161 |
type: "string", |
| 162 |
default: "#444b54", |
| 163 |
}, |
| 164 |
itemColor: { |
| 165 |
type: "string", |
| 166 |
default: "#444b54", |
| 167 |
}, |
| 168 |
itemHoverColor: { |
| 169 |
type: "string", |
| 170 |
}, |
| 171 |
searchButtonLayout2Color:{ |
| 172 |
type:"string", |
| 173 |
default:"#fff" |
| 174 |
}, |
| 175 |
// typography attributes |
| 176 |
...generateTypographyAttributes(Object.values(typoPrefixs)), |
| 177 |
// responsive range |
| 178 |
...generateResponsiveRangeAttributes(ICON_SIZE, { |
| 179 |
defaultRange: 30, |
| 180 |
}), |
| 181 |
...generateResponsiveRangeAttributes(ICON_SIZE_LAYOUT_2, { |
| 182 |
defaultRange: null, |
| 183 |
}), |
| 184 |
...generateResponsiveRangeAttributes(RESULT_BOX_WIDTH, { |
| 185 |
defaultRange: 100, |
| 186 |
defaultUnit: "%", |
| 187 |
}), |
| 188 |
...generateResponsiveRangeAttributes(RESULT_BOX_MAXWIDTH, { |
| 189 |
defaultRange: 1600, |
| 190 |
}), |
| 191 |
// dimension |
| 192 |
...generateDimensionsAttributes(ITEM_PADDING, { |
| 193 |
top: 10, |
| 194 |
right: 10, |
| 195 |
bottom: 10, |
| 196 |
left: 10, |
| 197 |
isLinked: true, |
| 198 |
}), |
| 199 |
...generateDimensionsAttributes(FIELD_PADDING, { |
| 200 |
top: 22, |
| 201 |
right: 15, |
| 202 |
bottom: 22, |
| 203 |
left: 15, |
| 204 |
isLinked: false, |
| 205 |
}), |
| 206 |
...generateDimensionsAttributes(FIELD_PADDING_LAYOUT_2, { |
| 207 |
top: 12, |
| 208 |
right: 12, |
| 209 |
bottom: 12, |
| 210 |
left: 20, |
| 211 |
isLinked: false, |
| 212 |
}), |
| 213 |
...generateDimensionsAttributes(WRAPPER_MARGIN, { |
| 214 |
top: 28, |
| 215 |
right: 0, |
| 216 |
bottom: 28, |
| 217 |
left: 0, |
| 218 |
isLinked: false, |
| 219 |
}), |
| 220 |
...generateDimensionsAttributes(WRAPPER_MARGIN_LAYOUT_2, { |
| 221 |
top: 0, |
| 222 |
right: 0, |
| 223 |
bottom: 0, |
| 224 |
left: 0, |
| 225 |
isLinked: false, |
| 226 |
}), |
| 227 |
...generateDimensionsAttributes(BOX_PADDING, { |
| 228 |
top: 0, |
| 229 |
right: 0, |
| 230 |
bottom: 0, |
| 231 |
left: 0, |
| 232 |
isLinked: true, |
| 233 |
}), |
| 234 |
...generateDimensionsAttributes(BOX_PADDING_LAYOUT_2, { |
| 235 |
top: 50, |
| 236 |
right: 0, |
| 237 |
bottom: 50, |
| 238 |
left: 0, |
| 239 |
isLinked: true, |
| 240 |
}), |
| 241 |
...generateDimensionsAttributes(SEARCH_BUTTON_PADDING, { |
| 242 |
top: 15, |
| 243 |
right: 25, |
| 244 |
bottom: 15, |
| 245 |
left: 25, |
| 246 |
isLinked: false, |
| 247 |
}), |
| 248 |
...generateDimensionsAttributes(POPULAR_SEARCH_MARGIN, { |
| 249 |
top: 24, |
| 250 |
right: 0, |
| 251 |
bottom: 0, |
| 252 |
left: 0, |
| 253 |
isLinked: false, |
| 254 |
}), |
| 255 |
// background |
| 256 |
...generateBackgroundAttributes(BOX_BACKGROUND, { |
| 257 |
defaultFillColor: "#f7f7f7", |
| 258 |
noOverlay: true, |
| 259 |
}), |
| 260 |
...generateBackgroundAttributes(SEARCH_MODAL_FIELD_BACKGROUND, { |
| 261 |
defaultFillColor: "#F9FAFB", |
| 262 |
noOverlay: true, |
| 263 |
}), |
| 264 |
...generateResponsiveRangeAttributes(SEARCH_MODAL_CONTENT_TABS_ICON_SIZE, { |
| 265 |
defaultRange: 21, |
| 266 |
}), |
| 267 |
...generateBorderShadowAttributes(SEARCH_MODAL_CONTENT_TABS_BORDER, { noShadow: true }), |
| 268 |
...generateResponsiveRangeAttributes(SEARCH_MODAL_CONTENT_TABS_LIST_ICON_SIZE, { |
| 269 |
defaultRange: 21, |
| 270 |
}), |
| 271 |
...generateBorderShadowAttributes(SEARCH_MODAL_CONTENT_TABS_LIST_BORDER, { noShadow: true }), |
| 272 |
...generateResponsiveRangeAttributes(SEARCH_MODAL_CONTENT_TABS_LIST_CATEGORY_ICON_SIZE, { |
| 273 |
defaultRange: 17, |
| 274 |
}), |
| 275 |
...generateBackgroundAttributes(BOX_BACKGROUND_LAYOUT_2, { |
| 276 |
defaultFillColor: "#F9FAFB", |
| 277 |
noOverlay: true, |
| 278 |
}), |
| 279 |
...generateBackgroundAttributes(RESULT_BOX_BACKGROUND, { |
| 280 |
defaultFillColor: "#ffffff", |
| 281 |
noOverlay: true, |
| 282 |
}), |
| 283 |
// border shadow attriubtes |
| 284 |
...generateBorderShadowAttributes(RESULT_BOX_BORDER, { noShadow: true }), |
| 285 |
...generateBorderShadowAttributes(ITEM_BORDER, { noShadow: true }), |
| 286 |
...generateBorderShadowAttributes(FIELD_BORDER, { noShadow: true }), |
| 287 |
...generateBorderShadowAttributes(FIELD_BORDER_LAYOUT_2, { noShadow: true }), |
| 288 |
...generateBorderShadowAttributes(SEARCH_BUTTON_BORDER, {noShadow: true, noBdrHover:true}), |
| 289 |
...generateBorderShadowAttributes(POPULAR_SEARCH_KEYWORD_BORDER, {noShadow: true, noBdrHover:true}), |
| 290 |
...generateDimensionsAttributes(POPULAR_SEARCH_KEYWORD_PADDING, { |
| 291 |
top: 8, |
| 292 |
right: 25, |
| 293 |
bottom: 8, |
| 294 |
left: 25, |
| 295 |
isLinked: false, |
| 296 |
}), |
| 297 |
...generateBackgroundAttributes(SEARCH_BUTTON_BACKGROUND_LAYOUT_2, { |
| 298 |
defaultFillColor: "#667085", |
| 299 |
noOverlay: true, |
| 300 |
}), |
| 301 |
...generateDimensionsAttributes(POPULAR_SEARCH_KEYWORD_MARGIN, { |
| 302 |
top: '', |
| 303 |
right: '', |
| 304 |
bottom: '', |
| 305 |
left: '', |
| 306 |
isLinked: false, |
| 307 |
}), |
| 308 |
categorySearch: { |
| 309 |
type:'boolean', |
| 310 |
default:false |
| 311 |
}, |
| 312 |
searchButton:{ |
| 313 |
type:'boolean', |
| 314 |
default:false |
| 315 |
}, |
| 316 |
popularSearch:{ |
| 317 |
type:'boolean', |
| 318 |
default:false |
| 319 |
}, |
| 320 |
popularSearchText:{ |
| 321 |
type: "string", |
| 322 |
default: "Popular Search", |
| 323 |
}, |
| 324 |
popularTitleColor:{ |
| 325 |
type: "string", |
| 326 |
default: "#8588a6", |
| 327 |
}, |
| 328 |
popularKeywordBackgroundColor:{ |
| 329 |
type: "string", |
| 330 |
default: "#fff", |
| 331 |
}, |
| 332 |
popularKeywordTextColor:{ |
| 333 |
type: "string", |
| 334 |
default: "#99a3ca", |
| 335 |
}, |
| 336 |
initialDocsNumber: { |
| 337 |
type: 'number', |
| 338 |
default: 5, |
| 339 |
}, |
| 340 |
initialFAQNumber:{ |
| 341 |
type: 'number', |
| 342 |
default: 5, |
| 343 |
}, |
| 344 |
searchButtonLayout2:{ |
| 345 |
type:'boolean', |
| 346 |
default:true |
| 347 |
}, |
| 348 |
categorySearchLayout2:{ |
| 349 |
type:'boolean', |
| 350 |
default:false |
| 351 |
}, |
| 352 |
popularSearchLayout2:{ |
| 353 |
type:'boolean', |
| 354 |
default:false |
| 355 |
}, |
| 356 |
searchHeading:{ |
| 357 |
type:'string', |
| 358 |
default:'' |
| 359 |
}, |
| 360 |
searchSubHeading:{ |
| 361 |
type:'string', |
| 362 |
default:'' |
| 363 |
}, |
| 364 |
searchHeadingTag:{ |
| 365 |
type:'string', |
| 366 |
default:'h1' |
| 367 |
}, |
| 368 |
searchSubHeadingTag:{ |
| 369 |
type:'string', |
| 370 |
default:'p' |
| 371 |
}, |
| 372 |
docQueryType:{ |
| 373 |
type:'string', |
| 374 |
default:'popular-docs' |
| 375 |
}, |
| 376 |
faqQueryType:{ |
| 377 |
type:'string', |
| 378 |
default:'default' |
| 379 |
}, |
| 380 |
searchModalQueryTermIds:{ |
| 381 |
type:'string', |
| 382 |
default:'' |
| 383 |
}, |
| 384 |
searchModalQueryDocIds:{ |
| 385 |
type:'string', |
| 386 |
default:'' |
| 387 |
}, |
| 388 |
searchModalQueriesFaqGroupIds:{ |
| 389 |
type:'string', |
| 390 |
default:'' |
| 391 |
}, |
| 392 |
|
| 393 |
// AI Search Suggestions attributes |
| 394 |
enable_ai_powered_search: { |
| 395 |
type: 'boolean', |
| 396 |
default: false, |
| 397 |
}, |
| 398 |
ai_suggestion_background_color: { |
| 399 |
type: 'string', |
| 400 |
default: '', |
| 401 |
}, |
| 402 |
ai_suggestion_hover_background_color: { |
| 403 |
type: 'string', |
| 404 |
default: '', |
| 405 |
}, |
| 406 |
...generateDimensionsAttributes(AI_SUGGESTION_MARGIN), |
| 407 |
...generateDimensionsAttributes(AI_SUGGESTION_PADDING), |
| 408 |
ai_suggestion_title_color: { |
| 409 |
type: 'string', |
| 410 |
default: '', |
| 411 |
}, |
| 412 |
ai_suggestion_title_font_size: { |
| 413 |
type: 'number', |
| 414 |
default: null, |
| 415 |
}, |
| 416 |
ai_suggestion_query_color: { |
| 417 |
type: 'string', |
| 418 |
default: '', |
| 419 |
}, |
| 420 |
ai_suggestion_query_font_size: { |
| 421 |
type: 'number', |
| 422 |
default: null, |
| 423 |
}, |
| 424 |
ai_suggestion_response_color: { |
| 425 |
type: 'string', |
| 426 |
default: '', |
| 427 |
}, |
| 428 |
ai_suggestion_response_font_size: { |
| 429 |
type: 'number', |
| 430 |
default: null, |
| 431 |
}, |
| 432 |
ai_suggestion_button_color: { |
| 433 |
type: 'string', |
| 434 |
default: '', |
| 435 |
}, |
| 436 |
ai_suggestion_button_bg_color: { |
| 437 |
type: 'string', |
| 438 |
default: '', |
| 439 |
}, |
| 440 |
ai_suggestion_button_font_size: { |
| 441 |
type: 'number', |
| 442 |
default: null, |
| 443 |
}, |
| 444 |
...generateDimensionsAttributes(AI_SUGGESTION_BUTTON_PADDING), |
| 445 |
...generateDimensionsAttributes(AI_SUGGESTION_BUTTON_MARGIN), |
| 446 |
}; |
| 447 |
|
| 448 |
export default attributes; |
| 449 |
|