@sapudex/web-components 2.10.0 → 2.11.0
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.
- package/bundle.esm.js +1 -0
- package/cypress/specs/Accordion.cy.tsx +19 -0
- package/cypress/specs/AccordionItem.cy.tsx +9 -0
- package/cypress/specs/Footer.cy.tsx +48 -11
- package/cypress/specs/PromoTile.cy.tsx +124 -0
- package/cypress/specs/Quote.cy.tsx +65 -0
- package/cypress/support/component-imports.instrumented.ts +4 -0
- package/cypress/support/component-imports.src.ts +5 -1
- package/dist/Accordion.d.ts +15 -0
- package/dist/Accordion.js +19 -0
- package/dist/Accordion.js.map +1 -1
- package/dist/AccordionItem.d.ts +19 -0
- package/dist/AccordionItem.js +23 -0
- package/dist/AccordionItem.js.map +1 -1
- package/dist/AccordionItemTemplate.js +7 -2
- package/dist/AccordionItemTemplate.js.map +1 -1
- package/dist/AccordionTemplate.js +21 -1
- package/dist/AccordionTemplate.js.map +1 -1
- package/dist/Footer.d.ts +45 -3
- package/dist/Footer.js +41 -17
- package/dist/Footer.js.map +1 -1
- package/dist/PromoTile.d.ts +143 -0
- package/dist/PromoTile.js +198 -0
- package/dist/PromoTile.js.map +1 -0
- package/dist/PromoTileTemplate.d.ts +2 -0
- package/dist/PromoTileTemplate.js +22 -0
- package/dist/PromoTileTemplate.js.map +1 -0
- package/dist/Quote.d.ts +11 -0
- package/dist/Quote.js +18 -3
- package/dist/Quote.js.map +1 -1
- package/dist/Search.d.ts +3 -1
- package/dist/Search.js +1 -0
- package/dist/Search.js.map +1 -1
- package/dist/assets/{InputSuggestions-xcV7PZDf.js → InputSuggestions-9WQMOg4t.js} +1 -1
- package/dist/assets/{ListItemStandardExpandableTextTemplate-RYCr4pVL.js → ListItemStandardExpandableTextTemplate-BQaMMo_n.js} +1 -1
- package/dist/assets/{bundle.esm-bg-64miJ.js → bundle.esm-ZNiP-jPI.js} +210 -209
- package/dist/assets/messagebundle_en-DwlTjyni.js +1 -0
- package/dist/css/themes/AccordionItem.css +1 -1
- package/dist/css/themes/BreadcrumbsPopover.css +1 -1
- package/dist/css/themes/CountrySelector.css +1 -1
- package/dist/css/themes/Divider.css +1 -1
- package/dist/css/themes/Footer.css +1 -1
- package/dist/css/themes/HeroBanner.css +1 -1
- package/dist/css/themes/PromoTile.css +1 -0
- package/dist/css/themes/Quote.css +1 -1
- package/dist/css/themes/RatingIndicator.css +1 -1
- package/dist/css/themes/Slider.css +1 -1
- package/dist/css/themes/Tag.css +1 -1
- package/dist/custom-elements-internal.json +614 -160
- package/dist/custom-elements.json +572 -128
- package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
- package/dist/generated/i18n/i18n-defaults.d.ts +3 -1
- package/dist/generated/i18n/i18n-defaults.js +3 -1
- package/dist/generated/i18n/i18n-defaults.js.map +1 -1
- package/dist/generated/templates/FooterTemplate.lit.js +33 -32
- package/dist/generated/templates/FooterTemplate.lit.js.map +1 -1
- package/dist/generated/templates/HeroBannerTemplate.lit.js +1 -1
- package/dist/generated/templates/HeroBannerTemplate.lit.js.map +1 -1
- package/dist/generated/themes/AccordionItem.css.d.ts +1 -1
- package/dist/generated/themes/AccordionItem.css.js +1 -1
- package/dist/generated/themes/AccordionItem.css.js.map +1 -1
- package/dist/generated/themes/BreadcrumbsPopover.css.d.ts +1 -1
- package/dist/generated/themes/BreadcrumbsPopover.css.js +1 -1
- package/dist/generated/themes/BreadcrumbsPopover.css.js.map +1 -1
- package/dist/generated/themes/CountrySelector.css.d.ts +1 -1
- package/dist/generated/themes/CountrySelector.css.js +1 -1
- package/dist/generated/themes/CountrySelector.css.js.map +1 -1
- package/dist/generated/themes/Divider.css.d.ts +1 -1
- package/dist/generated/themes/Divider.css.js +1 -1
- package/dist/generated/themes/Divider.css.js.map +1 -1
- package/dist/generated/themes/Footer.css.d.ts +1 -1
- package/dist/generated/themes/Footer.css.js +1 -1
- package/dist/generated/themes/Footer.css.js.map +1 -1
- package/dist/generated/themes/HeroBanner.css.d.ts +1 -1
- package/dist/generated/themes/HeroBanner.css.js +1 -1
- package/dist/generated/themes/HeroBanner.css.js.map +1 -1
- package/dist/generated/themes/PromoTile.css.d.ts +2 -0
- package/dist/generated/themes/PromoTile.css.js +8 -0
- package/dist/generated/themes/PromoTile.css.js.map +1 -0
- package/dist/generated/themes/Quote.css.d.ts +1 -1
- package/dist/generated/themes/Quote.css.js +1 -1
- package/dist/generated/themes/Quote.css.js.map +1 -1
- package/dist/generated/themes/RatingIndicator.css.d.ts +1 -1
- package/dist/generated/themes/RatingIndicator.css.js +1 -1
- package/dist/generated/themes/RatingIndicator.css.js.map +1 -1
- package/dist/generated/themes/Slider.css.d.ts +1 -1
- package/dist/generated/themes/Slider.css.js +1 -1
- package/dist/generated/themes/Slider.css.js.map +1 -1
- package/dist/generated/themes/Tag.css.d.ts +1 -1
- package/dist/generated/themes/Tag.css.js +1 -1
- package/dist/generated/themes/Tag.css.js.map +1 -1
- package/dist/messagebundle.properties +6 -0
- package/dist/messagebundle_en.properties +2 -0
- package/dist/types/PromoTile.d.ts +60 -0
- package/dist/types/PromoTile.js +63 -0
- package/dist/types/PromoTile.js.map +1 -0
- package/dist/utils/debounce.d.ts +3 -1
- package/dist/utils/debounce.js +16 -4
- package/dist/utils/debounce.js.map +1 -1
- package/dist/vscode.html-custom-data.json +102 -0
- package/dist/web-types.json +230 -5
- package/package.json +1 -1
- package/src/Accordion.ts +19 -0
- package/src/AccordionItem.ts +28 -0
- package/src/AccordionItemTemplate.tsx +25 -10
- package/src/AccordionTemplate.tsx +22 -1
- package/src/Footer.hbs +39 -36
- package/src/Footer.ts +81 -6
- package/src/HeroBanner.hbs +0 -1
- package/src/PromoTile.ts +290 -0
- package/src/PromoTileTemplate.tsx +68 -0
- package/src/Quote.ts +17 -3
- package/src/Search.ts +1 -0
- package/src/generated/i18n/i18n-defaults.ts +2 -2
- package/src/generated/templates/FooterTemplate.lit.ts +33 -32
- package/src/generated/templates/HeroBannerTemplate.lit.ts +1 -1
- package/src/generated/themes/AccordionItem.css.ts +1 -1
- package/src/generated/themes/BreadcrumbsPopover.css.ts +1 -1
- package/src/generated/themes/CountrySelector.css.ts +1 -1
- package/src/generated/themes/Divider.css.ts +1 -1
- package/src/generated/themes/Footer.css.ts +1 -1
- package/src/generated/themes/HeroBanner.css.ts +1 -1
- package/src/generated/themes/PromoTile.css.ts +9 -0
- package/src/generated/themes/Quote.css.ts +1 -1
- package/src/generated/themes/RatingIndicator.css.ts +1 -1
- package/src/generated/themes/Slider.css.ts +1 -1
- package/src/generated/themes/Tag.css.ts +1 -1
- package/src/i18n/messagebundle.properties +6 -0
- package/src/i18n/messagebundle_en.properties +2 -0
- package/src/themes/AccordionItem.css +61 -22
- package/src/themes/BreadcrumbsPopover.css +2 -1
- package/src/themes/CountrySelector.css +4 -0
- package/src/themes/Divider.css +2 -1
- package/src/themes/Footer.css +44 -9
- package/src/themes/HeroBanner.css +34 -32
- package/src/themes/PromoTile.css +152 -0
- package/src/themes/Quote.css +21 -24
- package/src/themes/Tag.css +18 -24
- package/src/types/PromoTile.ts +61 -0
- package/src/utils/debounce.ts +19 -4
- package/dist/assets/messagebundle_en-BHfPJk-2.js +0 -1
package/src/Footer.hbs
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
<footer class="udex-footer">
|
|
2
2
|
<div class="udex-footer__content">
|
|
3
3
|
<div class="udex-footer__contact-social">
|
|
4
|
-
{{#if
|
|
4
|
+
{{#if hasLogo}}
|
|
5
5
|
<div class="udex-footer__logo">
|
|
6
|
-
{{#if
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
{{#if hasLogoLink}}
|
|
7
|
+
<a href="{{logoHref}}" @click="{{_onLogoClick}}" title="{{logoTitle}}" aria-label="{{logoAriaLabel}}">
|
|
8
|
+
<img id="udex-footer__logo-image" src="{{currentLogoUrl}}" class="{{logoClass}}" alt="{{logoAlt}}"/>
|
|
9
|
+
</a>
|
|
10
10
|
{{else}}
|
|
11
|
-
<img id="udex-footer__logo-image" src="{{
|
|
11
|
+
<img id="udex-footer__logo-image" src="{{currentLogoUrl}}" class="{{logoClass}}" alt="{{logoAlt}}"/>
|
|
12
|
+
{{/if}}
|
|
13
|
+
{{#if hasTagline}}
|
|
14
|
+
<img id="udex-footer__tagline-image" src="{{currentTaglineUrl}}" class="{{taglineClass}}" alt="{{taglineAlt}}"/>
|
|
12
15
|
{{/if}}
|
|
13
16
|
</div>
|
|
14
17
|
{{/if}}
|
|
@@ -83,40 +86,40 @@
|
|
|
83
86
|
{{/if}}
|
|
84
87
|
|
|
85
88
|
<udex-divider class="udex-footer__divider"></udex-divider>
|
|
89
|
+
</div>
|
|
86
90
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
{{/if}}
|
|
100
|
-
<span class="udex-footer__copyright-text">{{copyrightText}}</span>
|
|
101
|
-
</div>
|
|
102
|
-
|
|
103
|
-
{{#if socialLinksArray.length}}
|
|
104
|
-
<div class="udex-footer__social-container">
|
|
105
|
-
{{#each socialLinksArray}}
|
|
106
|
-
<udex-social-media-button
|
|
107
|
-
type="{{this.name}}"
|
|
108
|
-
url="{{this.url}}"
|
|
109
|
-
target="{{this.target}}"
|
|
110
|
-
accessible-name="{{this.accessibleName}}"
|
|
111
|
-
data-name="{{this.name}}"
|
|
112
|
-
data-id="{{this.id}}"
|
|
113
|
-
@ui5-click="{{../_onSocialMediaLinkClick}}"
|
|
114
|
-
></udex-social-media-button>
|
|
115
|
-
{{/each}}
|
|
116
|
-
</div>
|
|
91
|
+
<div class="udex-footer__copyright">
|
|
92
|
+
{{#if isChineseLang}}
|
|
93
|
+
<span class="udex-footer__copyright-chinese-text">
|
|
94
|
+
<a
|
|
95
|
+
href="{{chineseIcpNumberLink}}"
|
|
96
|
+
title="{{chineseICPNumber}}"
|
|
97
|
+
class="udex-footer__copyright-chinese-link"
|
|
98
|
+
target="_blank">
|
|
99
|
+
{{chineseICPNumber}}
|
|
100
|
+
</a>
|
|
101
|
+
{{chineseSecurityNetworkNumber}}
|
|
102
|
+
</span>
|
|
117
103
|
{{/if}}
|
|
104
|
+
<span class="udex-footer__copyright-text">{{copyrightText}}</span>
|
|
118
105
|
</div>
|
|
119
106
|
|
|
107
|
+
{{#if socialLinksArray.length}}
|
|
108
|
+
<div class="udex-footer__social-container">
|
|
109
|
+
{{#each socialLinksArray}}
|
|
110
|
+
<udex-social-media-button
|
|
111
|
+
type="{{this.name}}"
|
|
112
|
+
url="{{this.url}}"
|
|
113
|
+
target="{{this.target}}"
|
|
114
|
+
accessible-name="{{this.accessibleName}}"
|
|
115
|
+
data-name="{{this.name}}"
|
|
116
|
+
data-id="{{this.id}}"
|
|
117
|
+
@ui5-click="{{../_onSocialMediaLinkClick}}"
|
|
118
|
+
></udex-social-media-button>
|
|
119
|
+
{{/each}}
|
|
120
|
+
</div>
|
|
121
|
+
{{/if}}
|
|
122
|
+
|
|
120
123
|
<udex-button
|
|
121
124
|
class="udex-footer__back-to-top-button"
|
|
122
125
|
icon="back-to-top"
|
package/src/Footer.ts
CHANGED
|
@@ -199,7 +199,7 @@ class UDExFooter extends UI5Element {
|
|
|
199
199
|
* @public
|
|
200
200
|
*/
|
|
201
201
|
@property({ type: String })
|
|
202
|
-
logoTitle
|
|
202
|
+
logoTitle?: string;
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
* Defines the Logo URL
|
|
@@ -208,7 +208,7 @@ class UDExFooter extends UI5Element {
|
|
|
208
208
|
* @public
|
|
209
209
|
*/
|
|
210
210
|
@property({ type: String })
|
|
211
|
-
logoUrl
|
|
211
|
+
logoUrl?: string;
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
214
|
* Defines the optional component href link for the logo.
|
|
@@ -219,6 +219,51 @@ class UDExFooter extends UI5Element {
|
|
|
219
219
|
@property({ type: String })
|
|
220
220
|
logoLink: string = "";
|
|
221
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Defines the tagline alt text.
|
|
224
|
+
*
|
|
225
|
+
* @default ""
|
|
226
|
+
* @public
|
|
227
|
+
*/
|
|
228
|
+
@property({ type: String })
|
|
229
|
+
taglineAlt?: string;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Defines the tagline url.
|
|
233
|
+
*
|
|
234
|
+
* @default ""
|
|
235
|
+
* @public
|
|
236
|
+
*/
|
|
237
|
+
@property({ type: String })
|
|
238
|
+
taglineUrl?: string;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Defines the chinese tagline url.
|
|
242
|
+
*
|
|
243
|
+
* @default ""
|
|
244
|
+
* @public
|
|
245
|
+
*/
|
|
246
|
+
@property({ type: String })
|
|
247
|
+
chineseTaglineUrl?: string;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Defines the chinese logo url
|
|
251
|
+
*
|
|
252
|
+
* @default ""
|
|
253
|
+
* @public
|
|
254
|
+
*/
|
|
255
|
+
@property({ type: String })
|
|
256
|
+
chineseLogoUrl?: string;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Defines the optional component href link for the chinese logo.
|
|
260
|
+
*
|
|
261
|
+
* @default ""
|
|
262
|
+
* @public
|
|
263
|
+
*/
|
|
264
|
+
@property({ type: String })
|
|
265
|
+
chineseLogoLink?: string;
|
|
266
|
+
|
|
222
267
|
/**
|
|
223
268
|
* List of the Quick links
|
|
224
269
|
*
|
|
@@ -398,10 +443,6 @@ class UDExFooter extends UI5Element {
|
|
|
398
443
|
window.scrollTo(0, 0);
|
|
399
444
|
}
|
|
400
445
|
|
|
401
|
-
get parsedRef(): string | undefined {
|
|
402
|
-
return (this.logoLink && this.logoLink.length > 0) ? this.logoLink : undefined;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
446
|
get quickLinksArray(): FooterLink[] {
|
|
406
447
|
return parseArrayFromString<FooterLink>(this.quickLinks);
|
|
407
448
|
}
|
|
@@ -493,6 +534,40 @@ class UDExFooter extends UI5Element {
|
|
|
493
534
|
return getLanguage()?.toLowerCase() === "zh_cn";
|
|
494
535
|
}
|
|
495
536
|
|
|
537
|
+
get hasLogo(): boolean {
|
|
538
|
+
return !!(this.logoUrl || this.chineseLogoUrl);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
get hasLogoLink(): boolean {
|
|
542
|
+
return !!(this.logoLink || this.chineseLogoLink);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
get currentLogoUrl(): string | undefined {
|
|
546
|
+
return this.isChineseLang && this.chineseLogoUrl ? this.chineseLogoUrl : this.logoUrl;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
get logoHref(): string {
|
|
550
|
+
return this.isChineseLang && this.chineseLogoLink ? this.chineseLogoLink : this.logoLink;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
get hasTagline(): boolean {
|
|
554
|
+
return !!(this.taglineUrl || this.chineseTaglineUrl);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
get currentTaglineUrl(): string | undefined {
|
|
558
|
+
return this.isChineseLang && this.chineseTaglineUrl ? this.chineseTaglineUrl : this.taglineUrl;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
get taglineClass(): string {
|
|
562
|
+
const root = "udex-footer__tagline-image";
|
|
563
|
+
return this.isChineseLang && this.chineseTaglineUrl ? `${root}-chinese` : root;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
get logoClass(): string {
|
|
567
|
+
const root = "udex-footer__logo-image";
|
|
568
|
+
return this.isChineseLang && this.chineseLogoUrl ? `${root}-chinese` : root;
|
|
569
|
+
}
|
|
570
|
+
|
|
496
571
|
_onLogoClick(e: PointerEvent): void {
|
|
497
572
|
this.fireFooterBaseEvent(e, "logo-click");
|
|
498
573
|
}
|
package/src/HeroBanner.hbs
CHANGED
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
<slot id="udex-hero-banner__content" name="content" part="content"></slot>
|
|
39
39
|
|
|
40
40
|
{{#if hasAdditionalContent}}
|
|
41
|
-
<udex-media-player source="http://media.w3.org/2010/05/sintel/trailer.mp4" aspect-ratio="16:9"></udex-media-player>
|
|
42
41
|
<slot id="udex-hero-banner__additionalContent" name="additionalContent" part="additionalContent"></slot>
|
|
43
42
|
{{/if}}
|
|
44
43
|
{{/inline}}
|
package/src/PromoTile.ts
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
|
2
|
+
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
|
3
|
+
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
|
4
|
+
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
|
|
5
|
+
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
|
|
6
|
+
import type { ResizeObserverCallback } from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js";
|
|
7
|
+
import ResizeHandler from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js";
|
|
8
|
+
import { isDesktop } from "@ui5/webcomponents-base/dist/Device.js";
|
|
9
|
+
import jsxRenderer from "@ui5/webcomponents-base/renderer/JsxRenderer.js";
|
|
10
|
+
import PromoTileTemplate from "./PromoTileTemplate.js";
|
|
11
|
+
import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
|
|
12
|
+
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
13
|
+
import { PROMO_TILE, PROMO_TILE_ICON } from "./generated/i18n/i18n-defaults.js";
|
|
14
|
+
import { BreakpointUtils } from "./utils/Breakpoints.js";
|
|
15
|
+
import type UDExButton from "./Button.js";
|
|
16
|
+
import UDExButtonSize from "./types/ButtonSize.js";
|
|
17
|
+
import UDExButtonDesign from "./types/ButtonDesign.js";
|
|
18
|
+
import { UDExPromoTileColorSheme, UDExPromoTileMode } from "./types/PromoTile.js";
|
|
19
|
+
|
|
20
|
+
// Styles
|
|
21
|
+
import PromoTileCss from "./generated/themes/PromoTile.css.js";
|
|
22
|
+
|
|
23
|
+
export enum UDExOrientation {
|
|
24
|
+
Vertical = "Vertical",
|
|
25
|
+
Horizontal = "Horizontal",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @class
|
|
30
|
+
*
|
|
31
|
+
* <h3 class="comment-api-title">Overview</h3>
|
|
32
|
+
*
|
|
33
|
+
*
|
|
34
|
+
* <h3>Usage</h3>
|
|
35
|
+
*
|
|
36
|
+
* For the <code>udex-promo-tile</code>
|
|
37
|
+
* <h3>ES6 Module Import</h3>
|
|
38
|
+
*
|
|
39
|
+
* <code>import "@sapudex/web-components/dist/PromoTile.js";</code>
|
|
40
|
+
*
|
|
41
|
+
* @constructor
|
|
42
|
+
* @extends UI5Element
|
|
43
|
+
* @tagname udex-promo-tile
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
@customElement({
|
|
47
|
+
tag: "udex-promo-tile",
|
|
48
|
+
renderer: jsxRenderer,
|
|
49
|
+
styles: PromoTileCss,
|
|
50
|
+
template: PromoTileTemplate,
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Triggered when the user clicks on the CTA button
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
@event("button-click", { cancelable: true, bubbles: true })
|
|
59
|
+
|
|
60
|
+
class UDExPromoTile extends UI5Element {
|
|
61
|
+
eventDetails!: {
|
|
62
|
+
"button-click": void,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Defines the text content of the Promo Tile.
|
|
67
|
+
*
|
|
68
|
+
* @slot content
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
@slot({ type: HTMLElement, "default": true })
|
|
72
|
+
content!: Array<HTMLElement>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Defines the orientation of the Promo Tile component.
|
|
76
|
+
*
|
|
77
|
+
* @type {string}
|
|
78
|
+
* @defaultvalue "Vertical"
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
@property({ type: String })
|
|
82
|
+
orientation: `${UDExOrientation}` = UDExOrientation.Vertical;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Defines the UI5 icon name in the pictogram section.
|
|
86
|
+
*
|
|
87
|
+
* @type {string}
|
|
88
|
+
* @defaultvalue ""
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
@property({ type: String })
|
|
92
|
+
icon?: string;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Defines the image aria label and alt in the pictogram section.
|
|
96
|
+
*
|
|
97
|
+
* @type {string}
|
|
98
|
+
* @defaultvalue ""
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
@property({ type: String })
|
|
102
|
+
imageLabel?: string;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Defines the logo URL in the pictogram section.
|
|
106
|
+
*
|
|
107
|
+
* @type {string}
|
|
108
|
+
* @defaultvalue ""
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
@property({ type: String })
|
|
112
|
+
logoUrl?: string;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Defines the header text of the promo tile.
|
|
116
|
+
*
|
|
117
|
+
* @type {string}
|
|
118
|
+
* @defaultvalue ""
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
@property({ type: String })
|
|
122
|
+
header?: string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Defines the eyebrow text of the promo tile.
|
|
126
|
+
*
|
|
127
|
+
* @type {string}
|
|
128
|
+
* @defaultvalue ""
|
|
129
|
+
* @public
|
|
130
|
+
*/
|
|
131
|
+
@property({ type: String })
|
|
132
|
+
eyebrow?: string;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Defines the CTA button label
|
|
136
|
+
*
|
|
137
|
+
* @type {string}
|
|
138
|
+
* @defaultvalue ""
|
|
139
|
+
* @public
|
|
140
|
+
*/
|
|
141
|
+
@property({ type: String })
|
|
142
|
+
button?: string;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Defines the CTA button design
|
|
146
|
+
*
|
|
147
|
+
* @type {string}
|
|
148
|
+
* @defaultvalue ""
|
|
149
|
+
* @public
|
|
150
|
+
*/
|
|
151
|
+
@property({ type: String })
|
|
152
|
+
buttonDesign?: UDExButtonDesign;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Defines the color scheme of the Promo Tile.
|
|
156
|
+
*
|
|
157
|
+
* @type {string}
|
|
158
|
+
* @defaultvalue ""
|
|
159
|
+
* @public
|
|
160
|
+
*/
|
|
161
|
+
@property({ type: String })
|
|
162
|
+
colorScheme?: UDExPromoTileColorSheme;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Defines the accessible name of the component.
|
|
166
|
+
*
|
|
167
|
+
* @type {string}
|
|
168
|
+
* @defaultvalue ""
|
|
169
|
+
* @public
|
|
170
|
+
*/
|
|
171
|
+
@property({ type: String })
|
|
172
|
+
accessibleName?: string;
|
|
173
|
+
|
|
174
|
+
@i18n("@sapudex/web-components")
|
|
175
|
+
static i18nBundle: I18nBundle;
|
|
176
|
+
|
|
177
|
+
_handleResizeBound: ResizeObserverCallback;
|
|
178
|
+
_button: UDExButton | undefined;
|
|
179
|
+
_colorMode: UDExPromoTileMode = UDExPromoTileMode.light;
|
|
180
|
+
_lightModeColors: Array<number> = [1, 2];
|
|
181
|
+
_darkModeColors: Array<number> = [7, 8, 9, 10];
|
|
182
|
+
|
|
183
|
+
constructor() {
|
|
184
|
+
super();
|
|
185
|
+
this._handleResizeBound = this._handleResize.bind(this);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
onEnterDOM(): void {
|
|
189
|
+
if (isDesktop()) {
|
|
190
|
+
this.setAttribute("desktop", "");
|
|
191
|
+
}
|
|
192
|
+
ResizeHandler.register(this, this._handleResizeBound);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
onExitDOM(): void {
|
|
196
|
+
ResizeHandler.deregister(this, this._handleResizeBound);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
onAfterRendering() {
|
|
200
|
+
this._button = this.getButton();
|
|
201
|
+
this.applyColorScheme();
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
_handleResize(): void {
|
|
205
|
+
if (this._button) {
|
|
206
|
+
this._button.size = this.isMobile ? UDExButtonSize.Medium : UDExButtonSize.Large;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
getButton(): UDExButton | undefined {
|
|
211
|
+
return this.shadowRoot!.querySelector<UDExButton>(
|
|
212
|
+
"[udex-button]",
|
|
213
|
+
)!;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
applyColorScheme(): void {
|
|
217
|
+
if (!this.colorScheme) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
this._colorMode = this.checkColorMode(this.colorScheme);
|
|
222
|
+
const eyebrowColor = this.checkEyebrowColor(this.colorScheme);
|
|
223
|
+
|
|
224
|
+
if (this._colorMode === UDExPromoTileMode.dark) {
|
|
225
|
+
if (this._button) {
|
|
226
|
+
this._button.design = this.buttonDesign || UDExButtonDesign.Secondary;
|
|
227
|
+
}
|
|
228
|
+
this.style.setProperty("--udex-promo-tile-icon-fill-color", `var(--udexCoreTextLight)`);
|
|
229
|
+
}
|
|
230
|
+
this.style.setProperty("--udex-promo-tile-background", `var(--udexColor${this.colorScheme})`);
|
|
231
|
+
this.style.setProperty("--udex-promo-tile-eyebrow-color", `var(--udexColor${eyebrowColor})`);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
getColorNumber(colorScheme: string): number {
|
|
235
|
+
const match = colorScheme.match(/\d+/);
|
|
236
|
+
return match ? parseInt(match[0]) : 0;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
checkColorMode(colorScheme: string): UDExPromoTileMode {
|
|
240
|
+
const number = this.getColorNumber(colorScheme);
|
|
241
|
+
|
|
242
|
+
if (number && this._darkModeColors.includes(number)) {
|
|
243
|
+
return UDExPromoTileMode.dark;
|
|
244
|
+
}
|
|
245
|
+
return UDExPromoTileMode.light;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
checkEyebrowColor(colorScheme: string): string {
|
|
249
|
+
const number = this.getColorNumber(colorScheme);
|
|
250
|
+
let color: string = UDExPromoTileColorSheme.Blue8;
|
|
251
|
+
|
|
252
|
+
if (number === 7) {
|
|
253
|
+
color = "NeutralWhite";
|
|
254
|
+
} else if (this._darkModeColors.includes(number)) {
|
|
255
|
+
color = colorScheme.replace(`${number}`, `${number - 7}`);
|
|
256
|
+
} else if (this._lightModeColors.includes(number)) {
|
|
257
|
+
color = colorScheme.replace(`${number}`, `${number + 7}`);
|
|
258
|
+
}
|
|
259
|
+
return color;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
get isMobile(): boolean {
|
|
263
|
+
return BreakpointUtils.isAtMost("S");
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
get promoTileContainerText(): string {
|
|
267
|
+
return this.accessibleName || this.header || UDExPromoTile.i18nBundle.getText(PROMO_TILE);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
get _showPictogram(): boolean {
|
|
271
|
+
return !!this.icon || !!this.logoUrl;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
get _showLogo(): boolean {
|
|
275
|
+
return !this.icon && !!this.logoUrl;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
get _imageLabel(): string {
|
|
279
|
+
return this.imageLabel || UDExPromoTile.i18nBundle.getText(PROMO_TILE_ICON);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
handleCTAButtonClick(e: Event) {
|
|
283
|
+
e.preventDefault();
|
|
284
|
+
this.fireDecoratorEvent("button-click");
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
UDExPromoTile.define();
|
|
289
|
+
|
|
290
|
+
export default UDExPromoTile;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type UDExPromoTile from "./PromoTile.js";
|
|
2
|
+
import UI5Icon from "@ui5/webcomponents/dist/Icon.js";
|
|
3
|
+
import IconMode from "@ui5/webcomponents/dist/types/IconMode.js";
|
|
4
|
+
import UDExButton from "./Button.js";
|
|
5
|
+
import UDExButtonSize from "./types/ButtonSize.js";
|
|
6
|
+
import UDExButtonAccessibleRole from "./types/ButtonAccessibleRole.js";
|
|
7
|
+
|
|
8
|
+
export default function PromoTileTemplate(this: UDExPromoTile) {
|
|
9
|
+
const rootClass = "udex-promo-tile";
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
role="region"
|
|
14
|
+
class={`${rootClass}__container ${rootClass}--${this.orientation?.toLowerCase()} ${rootClass}--${this._colorMode}`}
|
|
15
|
+
aria-label={this.promoTileContainerText}>
|
|
16
|
+
{this._showPictogram &&
|
|
17
|
+
<div
|
|
18
|
+
part="image"
|
|
19
|
+
class={{
|
|
20
|
+
"udex-promo-tile__pictogram": true,
|
|
21
|
+
"udex-promo-tile__pictogram--logo": this.logoUrl
|
|
22
|
+
}}
|
|
23
|
+
title={this._imageLabel}>
|
|
24
|
+
{this.icon &&
|
|
25
|
+
<UI5Icon
|
|
26
|
+
class={`${rootClass}__icon`}
|
|
27
|
+
name={this.icon?.toLowerCase()}
|
|
28
|
+
mode={IconMode.Decorative}
|
|
29
|
+
accessibleName={this._imageLabel}>
|
|
30
|
+
</UI5Icon>}
|
|
31
|
+
{this._showLogo &&
|
|
32
|
+
<img
|
|
33
|
+
src={this.logoUrl}
|
|
34
|
+
class={`${rootClass}__icon`}
|
|
35
|
+
aria-label={this._imageLabel}
|
|
36
|
+
alt={this._imageLabel} />}
|
|
37
|
+
</div>
|
|
38
|
+
}
|
|
39
|
+
<div part="content" class={`${rootClass}__content`}>
|
|
40
|
+
<div class={`${rootClass}__text`}>
|
|
41
|
+
{this.eyebrow &&
|
|
42
|
+
<div class={`${rootClass}__eyebrow eyebrow--l`}>{this.eyebrow}</div>
|
|
43
|
+
}
|
|
44
|
+
{this.header &&
|
|
45
|
+
<div part="header" class={`${rootClass}__header`}>{this.header}</div>
|
|
46
|
+
}
|
|
47
|
+
<slot></slot>
|
|
48
|
+
</div>
|
|
49
|
+
{!!this.button && footerSection.call(this, rootClass)}
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function footerSection(this: UDExPromoTile, rootClass: string) {
|
|
55
|
+
return (
|
|
56
|
+
<>
|
|
57
|
+
<div part="footer" class={`${rootClass}__footer`}>
|
|
58
|
+
<UDExButton class={`${rootClass}__btn`}
|
|
59
|
+
size={UDExButtonSize.Large}
|
|
60
|
+
design={this.buttonDesign}
|
|
61
|
+
onClick={this.handleCTAButtonClick}
|
|
62
|
+
accessibleRole={UDExButtonAccessibleRole.Button}>
|
|
63
|
+
{this.button}
|
|
64
|
+
</UDExButton>
|
|
65
|
+
</div>
|
|
66
|
+
</>
|
|
67
|
+
);
|
|
68
|
+
}
|
package/src/Quote.ts
CHANGED
|
@@ -20,6 +20,11 @@ export enum UDExMaskType {
|
|
|
20
20
|
rectangle = "rectangle"
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
export enum UDExImagePlacement {
|
|
24
|
+
left = "left",
|
|
25
|
+
right = "right"
|
|
26
|
+
}
|
|
27
|
+
|
|
23
28
|
/**
|
|
24
29
|
* @class
|
|
25
30
|
*
|
|
@@ -82,7 +87,7 @@ class UDExQuote extends UI5Element {
|
|
|
82
87
|
* @default "large"
|
|
83
88
|
*/
|
|
84
89
|
@property()
|
|
85
|
-
imageSize: `${UDExSizeType}` =
|
|
90
|
+
imageSize: `${UDExSizeType}` = UDExSizeType.large;
|
|
86
91
|
|
|
87
92
|
/**
|
|
88
93
|
* Defines text size
|
|
@@ -91,7 +96,7 @@ class UDExQuote extends UI5Element {
|
|
|
91
96
|
* @default "large"
|
|
92
97
|
*/
|
|
93
98
|
@property()
|
|
94
|
-
textSize: `${UDExSizeType}` =
|
|
99
|
+
textSize: `${UDExSizeType}` = UDExSizeType.large;
|
|
95
100
|
|
|
96
101
|
/**
|
|
97
102
|
* Defines image mask
|
|
@@ -100,7 +105,16 @@ class UDExQuote extends UI5Element {
|
|
|
100
105
|
* @default "avatar"
|
|
101
106
|
*/
|
|
102
107
|
@property()
|
|
103
|
-
mask: `${UDExMaskType}` =
|
|
108
|
+
mask: `${UDExMaskType}` = UDExMaskType.avatar;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Defines image placement
|
|
112
|
+
*
|
|
113
|
+
* @public
|
|
114
|
+
* @default "left"
|
|
115
|
+
*/
|
|
116
|
+
@property()
|
|
117
|
+
imagePlacement: `${UDExImagePlacement}` = UDExImagePlacement.left;
|
|
104
118
|
}
|
|
105
119
|
|
|
106
120
|
UDExQuote.define();
|