@designcrowd/library.brand-page 5.18.1 → 5.18.2-ast-padding-1

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.
Files changed (108) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-DFpjIAUv.js → CreatedOnBrandCrowd-de-de-GFYl8DtL.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-BapIT2xO.js → CreatedOnBrandCrowd-en-us-D5CcXf2I.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-DaSf3Dt6.js → CreatedOnBrandCrowd-es-es-Cr7J3ooe.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-Cvgei7yn.js → CreatedOnBrandCrowd-fr-ca-BC1NFFIW.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-Cvgei7yn.js → CreatedOnBrandCrowd-fr-fr-BC1NFFIW.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-Duxd2NmR.js → CreatedOnBrandCrowd-pt-br-BdiCcpwi.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-Duxd2NmR.js → CreatedOnBrandCrowd-pt-pt-BdiCcpwi.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-DXwNbruv.js → CreatedOnDcom-de-de-d4TmC_lo.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-CkNGwN-p.js → CreatedOnDcom-en-us-DlvLEF-R.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-Csyf5yhI.js → CreatedOnDcom-es-es-BulpVp3k.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-GOIUmIdy.js → CreatedOnDcom-fr-ca-M4xqunZe.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-DF63cL2a.js → CreatedOnDcom-fr-fr-BFqUXgzb.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-Ct6FWj7D.js → CreatedOnDcom-pt-br-CUVcVkV2.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-D22yb8Ci.js → CreatedOnDcom-pt-pt-Dc4CZ4xW.js} +1 -1
  15. package/lib/src/brand-page/components/contact-form/ContactForm.mixin.d.ts +4 -0
  16. package/lib/src/brand-page/components/contact-form/ContactForm.mixin.js +8 -4
  17. package/lib/src/brand-page/components/image-gallery/ImageGallery.mixin.d.ts +4 -0
  18. package/lib/src/brand-page/components/image-gallery/ImageGallery.mixin.js +4 -0
  19. package/lib/src/brand-page/components/mailing-list/MailingList.mixin.d.ts +4 -0
  20. package/lib/src/brand-page/components/mailing-list/MailingList.mixin.js +4 -1
  21. package/lib/src/brand-page/components/page/Page.mixin.d.ts +1 -1
  22. package/lib/src/brand-page/components/page/PageComponent.mixin.d.ts +1 -1
  23. package/lib/src/brand-page/components/payment/request-payment/RequestPayment.mixin.d.ts +4 -0
  24. package/lib/src/brand-page/components/payment/request-payment/RequestPayment.mixin.js +4 -0
  25. package/lib/src/brand-page/components/payment/support-me/SupportMe.mixin.d.ts +4 -0
  26. package/lib/src/brand-page/components/payment/support-me/SupportMe.mixin.js +4 -1
  27. package/lib/src/brand-page/components/video/Video.mixin.d.ts +4 -0
  28. package/lib/src/brand-page/components/video/Video.mixin.js +4 -0
  29. package/lib/src/brand-page/constants/misc.constants.d.ts +17 -0
  30. package/lib/src/brand-page/constants/misc.constants.js +25 -0
  31. package/lib/src/brand-page/models/content.model.d.ts +2 -0
  32. package/lib/src/brand-page/utils/content-padding.util.d.ts +13 -0
  33. package/lib/src/brand-page/utils/content-padding.util.js +10 -0
  34. package/lib/src/brand-page/utils/index.d.ts +1 -0
  35. package/lib/src/brand-page/utils/index.js +1 -0
  36. package/lib/src/brand-page/utils/migration/migration-16.d.ts +2 -0
  37. package/lib/src/brand-page/utils/migration/migration-16.js +37 -0
  38. package/lib/src/brand-page/utils/migration.util.js +6 -0
  39. package/lib/src/brand-page-maker/components/admin-logo-settings/AdminLogoSettings.mixin.d.ts +2 -0
  40. package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +12 -0
  41. package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +15 -1
  42. package/lib/src/brand-page-maker/constants/config-settings-constant.js +34 -0
  43. package/lib/src/brand-page-maker/convertors/banner-align-display-style.convertor.js +56 -2
  44. package/lib/src/brand-page-maker/convertors/contact-layout-style.convertor.js +6 -1
  45. package/lib/src/brand-page-maker/models/content-settings.js +30 -2
  46. package/lib/src/brand-page-maker/stores/ai-checkpoint/ai-checkpoint-store.d.ts +12 -0
  47. package/lib/src/{bundled-translations-CnareLWC.js → bundled-translations-DYd5oFZv.js} +1 -1
  48. package/lib/src/bundles/bundled-translations.json +2 -0
  49. package/lib/src/css/library.brand-page-brandCrowd.min.css +152 -140
  50. package/lib/src/css/library.brand-page-brandPage.min.css +153 -140
  51. package/lib/src/css/library.brand-page-designCom.min.css +152 -140
  52. package/lib/src/css/library.brand-page-preview.min.css +152 -140
  53. package/lib/src/index.mjs +1 -1
  54. package/lib/src/{lib-_iwoSD1Z.js → lib-CRihSxY0.js} +20195 -19572
  55. package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +14 -0
  56. package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +14 -0
  57. package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +12 -0
  58. package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +12 -0
  59. package/lib/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.d.ts +12 -0
  60. package/lib/src/shared/content-settings/components/slider-field/SliderField.mixin.js +9 -0
  61. package/lib/src/shared/content-settings/store/content-settings-store.d.ts +12 -0
  62. package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +16 -0
  63. package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +14 -0
  64. package/lib/src/utils/minify-brand-page-metadata.js +11 -1
  65. package/package.json +2 -2
  66. package/src/brand-page/components/banner-section/BannerSection.vue +360 -12
  67. package/src/brand-page/components/banner-section/BannerSection.vue.test.ts +201 -0
  68. package/src/brand-page/components/booking-section/BookingSection.vue +11 -3
  69. package/src/brand-page/components/contact-form/ContactForm.mixin.ts +12 -6
  70. package/src/brand-page/components/contact-form/ContactForm.vue +115 -118
  71. package/src/brand-page/components/image-gallery/ImageGallery.mixin.ts +5 -0
  72. package/src/brand-page/components/image-gallery/ImageGallery.vue +1 -1
  73. package/src/brand-page/components/mailing-list/MailingList.mixin.ts +8 -1
  74. package/src/brand-page/components/mailing-list/MailingList.vue +1 -1
  75. package/src/brand-page/components/map/Map.vue +5 -1
  76. package/src/brand-page/components/payment/request-payment/RequestPayment.mixin.ts +5 -0
  77. package/src/brand-page/components/payment/request-payment/RequestPayment.vue +1 -0
  78. package/src/brand-page/components/payment/support-me/SupportMe.mixin.ts +8 -1
  79. package/src/brand-page/components/payment/support-me/SupportMe.vue +1 -0
  80. package/src/brand-page/components/placeholder/Placeholder.vue +39 -100
  81. package/src/brand-page/components/social-links/SocialLinks.vue +7 -3
  82. package/src/brand-page/components/text/Text.vue +12 -5
  83. package/src/brand-page/components/text-media-section/TextMediaSection.vue +11 -3
  84. package/src/brand-page/components/video/Video.mixin.ts +5 -0
  85. package/src/brand-page/components/video/Video.vue +1 -1
  86. package/src/brand-page/constants/misc.constants.ts +26 -0
  87. package/src/brand-page/models/content.model.ts +2 -0
  88. package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +7 -3
  89. package/src/brand-page/utils/content-padding.util.test.ts +29 -0
  90. package/src/brand-page/utils/content-padding.util.ts +13 -0
  91. package/src/brand-page/utils/index.ts +1 -0
  92. package/src/brand-page/utils/migration/migration-16.ts +51 -0
  93. package/src/brand-page/utils/migration.util.test.ts +64 -0
  94. package/src/brand-page/utils/migration.util.ts +7 -0
  95. package/src/brand-page-maker/constants/config-settings-constant.ts +40 -0
  96. package/src/brand-page-maker/convertors/banner-align-display-style.convertor.ts +61 -1
  97. package/src/brand-page-maker/convertors/contact-layout-style.convertor.test.ts +50 -0
  98. package/src/brand-page-maker/convertors/contact-layout-style.convertor.ts +8 -0
  99. package/src/brand-page-maker/models/content-settings.ts +32 -2
  100. package/src/bundles/bundled-translations.json +2 -0
  101. package/src/shared/content-settings/components/content-settings/i18n/content-settings.json +2 -0
  102. package/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.vue +1 -1
  103. package/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.vue +2 -2
  104. package/src/shared/content-settings/components/slider-field/SliderField.mixin.ts +9 -0
  105. package/src/utils/minify-brand-page-metadata.ts +11 -1
  106. package/lib/src/brand-page/components/banner-section/BannerSection.mixin.d.ts +0 -103
  107. package/lib/src/brand-page/components/banner-section/BannerSection.mixin.js +0 -178
  108. package/src/brand-page/components/banner-section/BannerSection.mixin.ts +0 -213
@@ -0,0 +1,50 @@
1
+ import { describe, test, expect } from 'vitest';
2
+ import { contactLayoutStyleConvertor } from './contact-layout-style.convertor';
3
+ import {
4
+ ALIGN_CENTERED,
5
+ ALIGN_CARD_CENTER,
6
+ ALIGN_CARD_CENTER_IMAGE,
7
+ ALIGN_LEFT_FULL_IMAGE,
8
+ TEXT_ONLY,
9
+ } from '@brand-page/constants';
10
+
11
+ const configWithSelected = (selected: string) => ({
12
+ options: contactLayoutStyleConvertor
13
+ .convert(selected)
14
+ .options.map((option) => ({
15
+ ...option,
16
+ isSelected: option.value === selected,
17
+ })),
18
+ });
19
+
20
+ describe('contact-layout-style.convertor', () => {
21
+ test.each([
22
+ [ALIGN_CARD_CENTER, 32, 'center'],
23
+ [ALIGN_CENTERED, 24, 'center'],
24
+ [ALIGN_CARD_CENTER_IMAGE, 0, 'center'],
25
+ [TEXT_ONLY, 32, 'left'],
26
+ [ALIGN_LEFT_FULL_IMAGE, 0, 'left'],
27
+ ])(
28
+ 'convertBack should apply the default padding and text alignment for %s',
29
+ (layoutStyle, padding, textAlign) => {
30
+ const result = contactLayoutStyleConvertor.convertBack(
31
+ configWithSelected(layoutStyle),
32
+ );
33
+
34
+ expect(result).toStrictEqual({
35
+ layoutStyle,
36
+ topPadding: padding,
37
+ bottomPadding: padding,
38
+ titleStyle: {
39
+ textAlign,
40
+ },
41
+ descriptionStyle: {
42
+ textAlign,
43
+ },
44
+ buttonTextStyle: {
45
+ textAlign: 'center',
46
+ },
47
+ });
48
+ },
49
+ );
50
+ });
@@ -6,6 +6,7 @@ import {
6
6
  ALIGN_CARD_CENTER_IMAGE,
7
7
  TEXT_ONLY,
8
8
  ALIGN_CARD_CENTER,
9
+ CONTACT_FORM_LAYOUT_DEFAULT_PADDING,
9
10
  } from '@brand-page/constants';
10
11
  import type { ContactFormContent } from '@brand-page';
11
12
 
@@ -84,8 +85,15 @@ export const contactLayoutStyleConvertor: ValueConvertor<
84
85
  textAlign = 'left';
85
86
  }
86
87
 
88
+ // Switching layout adopts that layout's canonical look — same as the
89
+ // textAlign resets below — including its default block padding.
90
+ const padding =
91
+ CONTACT_FORM_LAYOUT_DEFAULT_PADDING[selectedOption?.value ?? ''] ?? 0;
92
+
87
93
  return {
88
94
  layoutStyle: selectedOption?.value,
95
+ topPadding: padding,
96
+ bottomPadding: padding,
89
97
  titleStyle: {
90
98
  textAlign,
91
99
  },
@@ -24,6 +24,7 @@ import {
24
24
  EMPTY_LOGO_IMAGE_MODEL,
25
25
  BRAND_PAGE_TYPES,
26
26
  SENSITIVE_CONTENT_TYPES,
27
+ CONTACT_FORM_LAYOUT_DEFAULT_PADDING,
27
28
  } from '@brand-page';
28
29
  import type {
29
30
  ButtonContent,
@@ -171,6 +172,8 @@ export const createInitialImageGalleryContent = (): ImageGalleryContent => {
171
172
  galleryStyles: {
172
173
  galleryType: 'grid',
173
174
  },
175
+ topPadding: 0,
176
+ bottomPadding: 0,
174
177
  };
175
178
  };
176
179
 
@@ -182,6 +185,8 @@ export const createInitialVideoContent = (): VideoContent => {
182
185
  displayStyle: DISPLAY_STYLE_PREVIEW,
183
186
  mute: false,
184
187
  videoUrl: '',
188
+ topPadding: 0,
189
+ bottomPadding: 0,
185
190
  };
186
191
  };
187
192
 
@@ -239,6 +244,8 @@ export const createInitialTextContent = (
239
244
  ]
240
245
  : undefined,
241
246
  type: 'text',
247
+ topPadding: 12,
248
+ bottomPadding: 12,
242
249
  textSize: {
243
250
  fontSize: FONT_SIZE_BODY,
244
251
  lineHeight: LINE_HEIGHT_BODY,
@@ -282,6 +289,8 @@ export const createInitialMapContent = (): MapContent => {
282
289
  formattedAddress: '',
283
290
  placeId: '',
284
291
  },
292
+ topPadding: 0,
293
+ bottomPadding: 0,
285
294
  };
286
295
  };
287
296
 
@@ -291,6 +300,8 @@ export const createInitialMailingListContent = (
291
300
  return {
292
301
  id: uuid.v4(),
293
302
  type: 'mailing-list',
303
+ topPadding: 0,
304
+ bottomPadding: 0,
294
305
  title: contentSettingsTr(`mailingListTitle`),
295
306
  buttonText: contentSettingsTr(`subscribePlaceholder`),
296
307
  acceptedFields: 'emailOnly',
@@ -324,6 +335,8 @@ export const createInitialRequestPaymentContent = (
324
335
  successMessage: '',
325
336
  title: contentSettingsTr(`buyNowTitle`),
326
337
  type: 'request-payment',
338
+ topPadding: 0,
339
+ bottomPadding: 0,
327
340
  fillColor: {},
328
341
  defaultBorderColor: {},
329
342
  selectedBorderColor: {},
@@ -415,6 +428,8 @@ export const createInitialSupportMeContent = (
415
428
  successMessage: contentSettingsTr(`successSupportPlaceholder`),
416
429
  description: contentSettingsTr(`makeADonationDescription`),
417
430
  type: 'support-me',
431
+ topPadding: 0,
432
+ bottomPadding: 0,
418
433
  titleStyle: {
419
434
  applyAutoScale: options?.brandPageType === BRAND_PAGE_TYPES.brandSite,
420
435
  textStyleType: TEXT_STYLE_TYPES.headings,
@@ -453,14 +468,21 @@ export const createInitialContactFormContent: CreateInitialContentFunction<
453
468
  console.error('userState.emailAddress should not be undefined');
454
469
  }
455
470
 
471
+ // New blocks inherit the padding their initial layout previously had
472
+ // hard-coded — same source as the migration backfill for existing pages.
473
+ const layoutStyle =
474
+ options?.brandPageType === 'brandSite' ? 'center-card-aligned' : '';
475
+ const padding = CONTACT_FORM_LAYOUT_DEFAULT_PADDING[layoutStyle] ?? 0;
476
+
456
477
  return {
457
478
  id: uuid.v4(),
458
479
  title: contentSettingsTr(`contactUsTitle`),
459
480
  description: '',
460
481
  buttonText: contentSettingsTr(`sendPlaceholder`),
461
482
  displayStyle: DISPLAY_STYLE_PREVIEW,
462
- layoutStyle:
463
- options?.brandPageType === 'brandSite' ? 'center-card-aligned' : '',
483
+ layoutStyle,
484
+ topPadding: padding,
485
+ bottomPadding: padding,
464
486
  imageUrl: '',
465
487
  fields: [
466
488
  {
@@ -599,6 +621,8 @@ export const createInitialBookingSectionContent: CreateInitialContentFunction<
599
621
  buttonText: contentSettingsTr(`bookNowLabel`),
600
622
  url: '',
601
623
  type: 'booking-section',
624
+ topPadding: 32,
625
+ bottomPadding: 32,
602
626
  descriptionStyle: {
603
627
  applyAutoScale: options?.brandPageType === BRAND_PAGE_TYPES.brandSite,
604
628
  textStyleType: TEXT_STYLE_TYPES.paragraphs,
@@ -628,6 +652,8 @@ export const createInitialImagesSectionContent: CreateInitialContentFunction<
628
652
  title: contentSettingsTr(`imagesTitle`),
629
653
  description: '',
630
654
  type: 'images-section',
655
+ topPadding: 32,
656
+ bottomPadding: 32,
631
657
  displayStyle: 'centered',
632
658
  aspectRatio: 'Default',
633
659
  areImagesFullWidth: false,
@@ -793,6 +819,8 @@ export const createInitialSocialLinksContent = (
793
819
  return {
794
820
  id: uuid.v4(),
795
821
  type: 'social-links',
822
+ topPadding: 32,
823
+ bottomPadding: 32,
796
824
  title: contentSettingsTr(`followUsOnTitle`),
797
825
  links: [
798
826
  {
@@ -846,6 +874,8 @@ export const createInitialShapesSectionContent: CreateInitialContentFunction<
846
874
  title: contentSettingsTr(`shapesTitle`),
847
875
  description: '',
848
876
  type: 'shapes-section',
877
+ topPadding: 32,
878
+ bottomPadding: 32,
849
879
  displayStyle: 'centered',
850
880
  items: [
851
881
  {
@@ -1525,6 +1525,8 @@
1525
1525
  "iconFillColorTitle": "Icon fill color",
1526
1526
  "iconBackgroundColorTitle": "Icon background color",
1527
1527
  "paddingTitle": "Padding",
1528
+ "topPaddingTitle": "Top padding",
1529
+ "bottomPaddingTitle": "Bottom padding",
1528
1530
  "dividerStyleTitle": "Divider Style",
1529
1531
  "dividerColorTitle": "Divider color",
1530
1532
  "addItemTitle": "Add Item",
@@ -113,6 +113,8 @@
113
113
  "iconFillColorTitle": "Icon fill color",
114
114
  "iconBackgroundColorTitle": "Icon background color",
115
115
  "paddingTitle": "Padding",
116
+ "topPaddingTitle": "Top padding",
117
+ "bottomPaddingTitle": "Bottom padding",
116
118
  "dividerStyleTitle": "Divider Style",
117
119
  "dividerColorTitle": "Divider color",
118
120
  "addItemTitle": "Add Item",
@@ -56,7 +56,7 @@
56
56
  >
57
57
  <li
58
58
  v-for="(field, index) in fields"
59
- :key="`content-settings-item-field-${id}-${index}`"
59
+ :key="`content-settings-item-field-${id}-${field.name}`"
60
60
  class="tw-cursor-pointer"
61
61
  :class="{
62
62
  'tw-mb-3': index !== fields.length - 1,
@@ -25,8 +25,8 @@
25
25
  >
26
26
  <ul>
27
27
  <li
28
- v-for="(field, fieldIndex) in group.fields"
29
- :key="`content-settings-item-group-field-${id}-${group.id}-${fieldIndex}`"
28
+ v-for="field in group.fields"
29
+ :key="`content-settings-item-group-field-${id}-${group.id}-${field.name}`"
30
30
  >
31
31
  <ContentSettingsItemField
32
32
  v-if="
@@ -45,6 +45,15 @@ export default defineComponent({
45
45
  sliderValue: value,
46
46
  };
47
47
  },
48
+ watch: {
49
+ // The value can change outside the slider (e.g. a layout switch
50
+ // re-applying default padding, or undo) — keep the display in sync.
51
+ value(newValue: string | undefined) {
52
+ this.sliderValue = this.valueConvertor
53
+ ? this.valueConvertor.convert(newValue as any)
54
+ : newValue;
55
+ },
56
+ },
48
57
  computed: {
49
58
  innerMinLength(): number {
50
59
  return this.minLength ?? 0;
@@ -205,7 +205,17 @@ const minifyContent = (
205
205
  editor: Editor,
206
206
  assets?: AssetEntry[],
207
207
  ): MinifiedContent => {
208
- const base: MinifiedContent = { id: content.id, type: content.type };
208
+ const base: MinifiedContent = {
209
+ id: content.id,
210
+ type: content.type,
211
+ // Padding Control (BP-5687) — shared across every block, persist when set.
212
+ ...(typeof content.topPadding === 'number' && {
213
+ topPadding: content.topPadding,
214
+ }),
215
+ ...(typeof content.bottomPadding === 'number' && {
216
+ bottomPadding: content.bottomPadding,
217
+ }),
218
+ };
209
219
  const c = content as any;
210
220
 
211
221
  // Helper: include imageUrl and its asset key if available
@@ -1,103 +0,0 @@
1
- import type { PropType } from 'vue';
2
- import type { BannerSectionViewModel, ButtonViewModel } from '@brand-page/view-models';
3
- import type { BrandPageContext } from '@brand-page/models';
4
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
- viewModel: {
6
- type: PropType<BannerSectionViewModel>;
7
- required: true;
8
- };
9
- context: {
10
- type: PropType<BrandPageContext>;
11
- required: true;
12
- };
13
- containerClientWidth: {
14
- type: PropType<number | undefined>;
15
- required: false;
16
- default: undefined;
17
- };
18
- containerClientHeight: {
19
- type: PropType<number | undefined>;
20
- required: false;
21
- default: undefined;
22
- };
23
- contentIndex: {
24
- type: NumberConstructor;
25
- required: false;
26
- default: undefined;
27
- };
28
- }>, {}, {
29
- shouldStackOnTop: boolean;
30
- }, {
31
- displayAlignClass(): "" | "tw-items-center tw-w-full" | "tw-items-start tw-w-2/3" | "tw-items-end tw-w-2/3" | "tw-items-end";
32
- displayButtonClass(): "" | "tw-justify-start" | "tw-justify-center" | "tw-justify-end";
33
- isLeftImageAligned(): boolean;
34
- isRightImageAligned(): boolean;
35
- isDividedContent(): boolean;
36
- isCardBannerContent(): boolean;
37
- isCardAlignedOnLeft(): boolean;
38
- getbuttonViewModel(): ButtonViewModel;
39
- shouldShowButton(): boolean;
40
- isHorizontalAligned(): boolean;
41
- isBigImageAligned(): boolean;
42
- renderText(): string;
43
- hasDescriptionText(): boolean;
44
- overlayColor(): BrandPageCssStyle;
45
- opacity(): number;
46
- backgroundOverlay(): BrandPageCssStyle;
47
- }, {
48
- onResize(): void;
49
- }, import("vue").DefineComponent<import("vue").ExtractPropTypes<{
50
- isPreview: {
51
- type: BooleanConstructor;
52
- required: false;
53
- default: boolean;
54
- };
55
- isMobileDevice: {
56
- type: BooleanConstructor;
57
- required: false;
58
- default: undefined;
59
- };
60
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
61
- isPreview: {
62
- type: BooleanConstructor;
63
- required: false;
64
- default: boolean;
65
- };
66
- isMobileDevice: {
67
- type: BooleanConstructor;
68
- required: false;
69
- default: undefined;
70
- };
71
- }>> & Readonly<{}>, {
72
- isPreview: boolean;
73
- isMobileDevice: boolean;
74
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
75
- viewModel: {
76
- type: PropType<BannerSectionViewModel>;
77
- required: true;
78
- };
79
- context: {
80
- type: PropType<BrandPageContext>;
81
- required: true;
82
- };
83
- containerClientWidth: {
84
- type: PropType<number | undefined>;
85
- required: false;
86
- default: undefined;
87
- };
88
- containerClientHeight: {
89
- type: PropType<number | undefined>;
90
- required: false;
91
- default: undefined;
92
- };
93
- contentIndex: {
94
- type: NumberConstructor;
95
- required: false;
96
- default: undefined;
97
- };
98
- }>> & Readonly<{}>, {
99
- containerClientWidth: number | undefined;
100
- containerClientHeight: number | undefined;
101
- contentIndex: number;
102
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
103
- export default _default;
@@ -1,178 +0,0 @@
1
- import { defineComponent } from 'vue';
2
- import ComponentCommonMixin from '../mixins/component-common.mixin';
3
- import { isURL, hasValidButton as shouldShowButtonUtil, } from '../../../utils/validator.util';
4
- import { ALIGN_CENTERED, ALIGN_LEFT_ALIGNED, ALIGN_RIGHT_ALIGNED, BIG_IMAGE, ALIGN_LEFT_BIG_IMAGE, ALIGN_RIGHT_FULL_IMAGE, ALIGN_LEFT_FULL_IMAGE, ALIGN_CARD_CENTER_IMAGE, ALIGN_CARD_LEFT_IMAGE, } from '../../constants';
5
- import { getRenderText, escapeContentText } from '@brand-page/utils';
6
- import { hasRTEContent } from '@brand-page-maker/utils';
7
- export default defineComponent({
8
- mixins: [ComponentCommonMixin],
9
- props: {
10
- viewModel: {
11
- type: Object,
12
- required: true,
13
- },
14
- context: {
15
- type: Object,
16
- required: true,
17
- },
18
- containerClientWidth: {
19
- type: Number,
20
- required: false,
21
- default: undefined,
22
- },
23
- containerClientHeight: {
24
- type: Number,
25
- required: false,
26
- default: undefined,
27
- },
28
- contentIndex: {
29
- type: Number,
30
- required: false,
31
- default: undefined,
32
- },
33
- },
34
- data() {
35
- return {
36
- shouldStackOnTop: false,
37
- };
38
- },
39
- mounted() {
40
- this.$nextTick(() => {
41
- window.addEventListener('resize', this.onResize);
42
- });
43
- },
44
- unmounted() {
45
- if (typeof window !== undefined) {
46
- window.removeEventListener(`resize`, this.onResize);
47
- }
48
- },
49
- computed: {
50
- displayAlignClass() {
51
- switch (this.viewModel.displayStyle) {
52
- case ALIGN_CENTERED:
53
- return 'tw-items-center tw-w-full';
54
- case BIG_IMAGE:
55
- return 'tw-items-center tw-w-full';
56
- case ALIGN_LEFT_ALIGNED:
57
- return 'tw-items-start tw-w-2/3';
58
- case ALIGN_RIGHT_ALIGNED:
59
- return 'tw-items-end tw-w-2/3';
60
- case ALIGN_LEFT_BIG_IMAGE:
61
- return 'tw-items-start tw-w-2/3';
62
- case ALIGN_CARD_CENTER_IMAGE:
63
- return 'tw-items-center tw-w-full';
64
- case ALIGN_CARD_LEFT_IMAGE:
65
- return 'tw-items-end';
66
- default:
67
- return '';
68
- }
69
- },
70
- displayButtonClass() {
71
- if (this.viewModel.buttonTextStyle) {
72
- switch (this.viewModel.buttonTextStyle.textAlign) {
73
- case 'left':
74
- return 'tw-justify-start';
75
- case 'center':
76
- return 'tw-justify-center';
77
- case 'right':
78
- return 'tw-justify-end';
79
- default:
80
- return '';
81
- }
82
- }
83
- else {
84
- return this.viewModel.displayStyle === ALIGN_CARD_CENTER_IMAGE ||
85
- this.viewModel.displayStyle === ALIGN_CENTERED
86
- ? 'tw-justify-center'
87
- : 'tw-justify-start';
88
- }
89
- },
90
- isLeftImageAligned() {
91
- if (this.viewModel.displayStyle === ALIGN_LEFT_FULL_IMAGE) {
92
- return true;
93
- }
94
- return false;
95
- },
96
- isRightImageAligned() {
97
- if (this.viewModel.displayStyle === ALIGN_RIGHT_FULL_IMAGE) {
98
- return true;
99
- }
100
- return false;
101
- },
102
- isDividedContent() {
103
- if (this.viewModel.displayStyle === ALIGN_RIGHT_FULL_IMAGE ||
104
- this.viewModel.displayStyle === ALIGN_LEFT_FULL_IMAGE) {
105
- return true;
106
- }
107
- return false;
108
- },
109
- isCardBannerContent() {
110
- if (this.viewModel.displayStyle === ALIGN_CARD_CENTER_IMAGE ||
111
- this.viewModel.displayStyle === ALIGN_CARD_LEFT_IMAGE) {
112
- return true;
113
- }
114
- return false;
115
- },
116
- isCardAlignedOnLeft() {
117
- return this.viewModel.displayStyle === ALIGN_CARD_LEFT_IMAGE;
118
- },
119
- getbuttonViewModel() {
120
- const { buttonViewModel, buttonLinkType, pageSlug } = this.viewModel;
121
- buttonViewModel.buttonLinkType = buttonLinkType;
122
- buttonViewModel.pageSlug = pageSlug;
123
- return buttonViewModel;
124
- },
125
- shouldShowButton() {
126
- return shouldShowButtonUtil({
127
- buttonText: this.viewModel.buttonText,
128
- buttonViewModel: this.viewModel.buttonViewModel,
129
- });
130
- },
131
- isHorizontalAligned() {
132
- return (this.viewModel.displayStyle === ALIGN_LEFT_ALIGNED ||
133
- this.viewModel.displayStyle === ALIGN_RIGHT_ALIGNED ||
134
- this.viewModel.displayStyle === ALIGN_LEFT_FULL_IMAGE ||
135
- this.viewModel.displayStyle === ALIGN_RIGHT_FULL_IMAGE);
136
- },
137
- isBigImageAligned() {
138
- return (this.viewModel.displayStyle === ALIGN_LEFT_BIG_IMAGE ||
139
- this.viewModel.displayStyle === ALIGN_CARD_LEFT_IMAGE);
140
- },
141
- renderText() {
142
- if (!this.viewModel.description) {
143
- return '';
144
- }
145
- if (hasRTEContent(this.viewModel.description)) {
146
- return this.viewModel.description;
147
- }
148
- else {
149
- return getRenderText(this.viewModel.description);
150
- }
151
- },
152
- hasDescriptionText() {
153
- if (hasRTEContent(this.viewModel.description)) {
154
- return escapeContentText(this.viewModel.description) !== '';
155
- }
156
- else {
157
- return this.viewModel?.description?.length > 0;
158
- }
159
- },
160
- overlayColor() {
161
- return this.viewModel.overlayColor || 'rgb(0,0,0)';
162
- },
163
- opacity() {
164
- return this.viewModel.overlayOpacity;
165
- },
166
- backgroundOverlay() {
167
- return {
168
- background: this.overlayColor.backgroundColor,
169
- opacity: `${this.opacity}%`,
170
- };
171
- },
172
- },
173
- methods: {
174
- onResize() {
175
- this.shouldStackOnTop = window.innerWidth < 640;
176
- },
177
- },
178
- });