@sapudex/web-components 2.2.0 → 2.4.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/.eslintignore +3 -0
- package/bundle.esm.js +3 -0
- package/cypress/fixtures/contact-numbers.ts +10 -0
- package/cypress/fixtures/event-ribbon-links.ts +5 -0
- package/cypress/specs/Accordion.cy.tsx +25 -2
- package/cypress/specs/AccordionItem.cy.tsx +1 -1
- package/cypress/specs/Avatar.cy.tsx +1 -1
- package/cypress/specs/AvatarGroup.cy.tsx +1 -2
- package/cypress/specs/Badge.cy.tsx +1 -1
- package/cypress/specs/Contact.cy.tsx +92 -0
- package/cypress/specs/ContactItem.cy.tsx +56 -0
- package/cypress/specs/CountrySelector.cy.tsx +10 -4
- package/cypress/specs/EventRibbon.cy.tsx +110 -0
- package/cypress/specs/Footer.cy.tsx +1 -1
- package/cypress/specs/ListItem.cy.tsx +1 -1
- package/cypress/specs/PhoneNumberField.cy.tsx +4 -2
- package/cypress/specs/Review.cy.tsx +1 -3
- package/cypress/specs/ReviewItem.cy.tsx +1 -1
- package/cypress/specs/SecondaryNavigationDesktop.cy.tsx +123 -116
- package/cypress/specs/SecondaryNavigationMobile.cy.tsx +27 -38
- package/cypress/specs/SelectBox.cy.tsx +93 -88
- package/cypress/specs/Slider.cy.tsx +1 -1
- package/cypress/specs/StatusBadge.cy.tsx +1 -1
- package/cypress/specs/StatusMessage.cy.tsx +1 -1
- package/cypress/specs/Switch.cy.tsx +1 -2
- package/cypress/specs/Table.cy.tsx +1 -9
- package/cypress/specs/Tag.cy.tsx +1 -1
- package/cypress/specs/TagGroup.cy.tsx +1 -2
- package/cypress/specs/TextField.cy.tsx +1 -1
- package/cypress/specs/Textarea.cy.tsx +1 -1
- package/cypress/specs/Toast.cy.tsx +1 -1
- package/cypress/specs/Tooltip.cy.tsx +1 -2
- package/cypress/specs/TruncatedText.cy.tsx +2 -1
- package/cypress/specs/Upload.cy.tsx +1 -2
- package/cypress/specs/UploadItem.cy.tsx +1 -1
- package/cypress/specs/Wizard.cy.tsx +7 -4
- package/cypress/support/commands.ts +31 -2
- package/cypress/support/component-imports.instrumented.ts +95 -0
- package/cypress/support/component-imports.src.ts +95 -0
- package/cypress/support/component.ts +1 -1
- package/cypress.config.ts +6 -0
- package/dist/Accordion.d.ts +7 -1
- package/dist/Accordion.js +3 -3
- package/dist/Accordion.js.map +1 -1
- package/dist/Assets.js +31 -0
- package/dist/Assets.js.map +1 -1
- package/dist/AssetsVariables.js +4 -0
- package/dist/AssetsVariables.js.map +1 -1
- package/dist/Button.d.ts +7 -0
- package/dist/Button.js +3 -0
- package/dist/Button.js.map +1 -1
- package/dist/Contact.d.ts +102 -0
- package/dist/Contact.js +152 -0
- package/dist/Contact.js.map +1 -0
- package/dist/ContactItem.d.ts +67 -0
- package/dist/ContactItem.js +96 -0
- package/dist/ContactItem.js.map +1 -0
- package/dist/ContactItemTemplate.d.ts +2 -0
- package/dist/ContactItemTemplate.js +13 -0
- package/dist/ContactItemTemplate.js.map +1 -0
- package/dist/ContactTemplate.d.ts +4 -0
- package/dist/ContactTemplate.js +29 -0
- package/dist/ContactTemplate.js.map +1 -0
- package/dist/CountrySelector.d.ts +2 -4
- package/dist/CountrySelector.js +3 -5
- package/dist/CountrySelector.js.map +1 -1
- package/dist/DatePicker.js +2 -1
- package/dist/DatePicker.js.map +1 -1
- package/dist/EventRibbon.d.ts +80 -0
- package/dist/EventRibbon.js +111 -0
- package/dist/EventRibbon.js.map +1 -0
- package/dist/EventRibbonTemplate.d.ts +2 -0
- package/dist/EventRibbonTemplate.js +7 -0
- package/dist/EventRibbonTemplate.js.map +1 -0
- package/dist/Footer.d.ts +0 -1
- package/dist/Footer.js +7 -9
- package/dist/Footer.js.map +1 -1
- package/dist/HeroBanner.d.ts +1 -1
- package/dist/List.d.ts +1 -1
- package/dist/List.js +1 -1
- package/dist/List.js.map +1 -1
- package/dist/MastheadItem.d.ts +1 -3
- package/dist/MastheadItem.js +6 -11
- package/dist/MastheadItem.js.map +1 -1
- package/dist/MastheadMenu.d.ts +0 -1
- package/dist/MastheadMenu.js +2 -4
- package/dist/MastheadMenu.js.map +1 -1
- package/dist/MastheadProfileMenu.d.ts +0 -1
- package/dist/MastheadProfileMenu.js +2 -4
- package/dist/MastheadProfileMenu.js.map +1 -1
- package/dist/MastheadShell.d.ts +4 -1
- package/dist/MastheadShell.js +21 -5
- package/dist/MastheadShell.js.map +1 -1
- package/dist/Pagination.d.ts +17 -3
- package/dist/Pagination.js +33 -31
- package/dist/Pagination.js.map +1 -1
- package/dist/PhoneNumberField.d.ts +5 -5
- package/dist/PhoneNumberField.js +1 -1
- package/dist/PhoneNumberField.js.map +1 -1
- package/dist/SearchableListBase.d.ts +9 -0
- package/dist/SearchableListBase.js +15 -3
- package/dist/SearchableListBase.js.map +1 -1
- package/dist/SecondaryNavigation.d.ts +0 -1
- package/dist/SecondaryNavigation.js +2 -4
- package/dist/SecondaryNavigation.js.map +1 -1
- package/dist/TextField.d.ts +7 -0
- package/dist/TextField.js +3 -0
- package/dist/TextField.js.map +1 -1
- package/dist/Wizard.d.ts +20 -1
- package/dist/Wizard.js +22 -9
- package/dist/Wizard.js.map +1 -1
- package/dist/WizardTemplate.js +1 -1
- package/dist/WizardTemplate.js.map +1 -1
- package/dist/assets/{InputSuggestions-KGCQrV_T.js → InputSuggestions-CYW_6A8K.js} +1 -1
- package/dist/assets/{ListItemStandardExpandableTextTemplate-D4zLIdLd.js → ListItemStandardExpandableTextTemplate-BDrgWGjT.js} +1 -1
- package/dist/assets/{bundle.esm-Diw1zQ-o.js → bundle.esm-DRCvw6Ji.js} +235 -225
- package/dist/assets/messagebundle_en-BK8-Eyic.js +1 -0
- package/dist/css/themes/Accordion.css +1 -1
- package/dist/css/themes/Button.css +1 -1
- package/dist/css/themes/Contact.css +1 -0
- package/dist/css/themes/ContactItem.css +1 -0
- package/dist/css/themes/DatePickerPopover.css +1 -1
- package/dist/css/themes/EventRibbon.css +1 -0
- package/dist/css/themes/MastheadCountrySelector.css +1 -1
- package/dist/css/themes/MastheadItem.css +1 -1
- package/dist/css/themes/MastheadShell.css +1 -1
- package/dist/css/themes/Modal.css +1 -1
- package/dist/css/themes/Pagination.css +1 -1
- package/dist/css/themes/RatingIndicator.css +1 -1
- package/dist/css/themes/Slider.css +1 -1
- package/dist/css/themes/TextField.css +1 -1
- package/dist/custom-elements-internal.json +823 -99
- package/dist/custom-elements.json +783 -83
- package/dist/data/CountryListISO3166.d.ts +13 -4
- package/dist/data/CountryListISO3166.js +8 -0
- package/dist/data/CountryListISO3166.js.map +1 -1
- 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/AccordionTemplate.lit.js +4 -2
- package/dist/generated/templates/AccordionTemplate.lit.js.map +1 -1
- package/dist/generated/templates/MastheadItemTemplate.lit.js +25 -22
- package/dist/generated/templates/MastheadItemTemplate.lit.js.map +1 -1
- package/dist/generated/templates/PaginationTemplate.lit.js +1 -1
- package/dist/generated/templates/PaginationTemplate.lit.js.map +1 -1
- package/dist/generated/templates/PhoneNumberFieldTemplate.lit.js +2 -2
- package/dist/generated/templates/PhoneNumberFieldTemplate.lit.js.map +1 -1
- package/dist/generated/themes/Accordion.css.d.ts +1 -1
- package/dist/generated/themes/Accordion.css.js +1 -1
- package/dist/generated/themes/Accordion.css.js.map +1 -1
- package/dist/generated/themes/Button.css.d.ts +1 -1
- package/dist/generated/themes/Button.css.js +1 -1
- package/dist/generated/themes/Button.css.js.map +1 -1
- package/dist/generated/themes/Contact.css.d.ts +2 -0
- package/dist/generated/themes/Contact.css.js +8 -0
- package/dist/generated/themes/Contact.css.js.map +1 -0
- package/dist/generated/themes/ContactItem.css.d.ts +2 -0
- package/dist/generated/themes/ContactItem.css.js +8 -0
- package/dist/generated/themes/ContactItem.css.js.map +1 -0
- package/dist/generated/themes/DatePickerPopover.css.d.ts +1 -1
- package/dist/generated/themes/DatePickerPopover.css.js +1 -1
- package/dist/generated/themes/DatePickerPopover.css.js.map +1 -1
- package/dist/generated/themes/EventRibbon.css.d.ts +2 -0
- package/dist/generated/themes/EventRibbon.css.js +8 -0
- package/dist/generated/themes/EventRibbon.css.js.map +1 -0
- package/dist/generated/themes/MastheadCountrySelector.css.d.ts +1 -1
- package/dist/generated/themes/MastheadCountrySelector.css.js +1 -1
- package/dist/generated/themes/MastheadCountrySelector.css.js.map +1 -1
- package/dist/generated/themes/MastheadItem.css.d.ts +1 -1
- package/dist/generated/themes/MastheadItem.css.js +1 -1
- package/dist/generated/themes/MastheadItem.css.js.map +1 -1
- package/dist/generated/themes/MastheadShell.css.d.ts +1 -1
- package/dist/generated/themes/MastheadShell.css.js +1 -1
- package/dist/generated/themes/MastheadShell.css.js.map +1 -1
- package/dist/generated/themes/Modal.css.d.ts +1 -1
- package/dist/generated/themes/Modal.css.js +1 -1
- package/dist/generated/themes/Modal.css.js.map +1 -1
- package/dist/generated/themes/Pagination.css.d.ts +1 -1
- package/dist/generated/themes/Pagination.css.js +1 -1
- package/dist/generated/themes/Pagination.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/TextField.css.d.ts +1 -1
- package/dist/generated/themes/TextField.css.js +1 -1
- package/dist/generated/themes/TextField.css.js.map +1 -1
- package/dist/messagebundle.properties +5 -0
- package/dist/messagebundle_en.properties +3 -0
- package/dist/types/ContactItemIcon.d.ts +6 -0
- package/dist/types/ContactItemIcon.js +8 -0
- package/dist/types/ContactItemIcon.js.map +1 -0
- package/dist/types/EventRibbon.d.ts +37 -0
- package/dist/types/EventRibbon.js +43 -0
- package/dist/types/EventRibbon.js.map +1 -0
- package/dist/utils/parseArrayFromString.d.ts +2 -0
- package/dist/utils/parseArrayFromString.js +5 -0
- package/dist/utils/parseArrayFromString.js.map +1 -0
- package/dist/vscode.html-custom-data.json +183 -1
- package/dist/web-types.json +321 -2
- package/filter-coverage.js +58 -0
- package/package.json +8 -3
- package/src/Accordion.hbs +13 -9
- package/src/Accordion.ts +7 -4
- package/src/Assets.ts +29 -0
- package/src/AssetsVariables.ts +4 -0
- package/src/Button.ts +9 -0
- package/src/Contact.ts +200 -0
- package/src/ContactItem.ts +119 -0
- package/src/ContactItemTemplate.tsx +22 -0
- package/src/ContactTemplate.tsx +105 -0
- package/src/CountrySelector.ts +5 -8
- package/src/DatePicker.ts +2 -1
- package/src/EventRibbon.ts +143 -0
- package/src/EventRibbonTemplate.tsx +18 -0
- package/src/Footer.ts +7 -10
- package/src/List.ts +1 -1
- package/src/MastheadItem.hbs +8 -0
- package/src/MastheadItem.ts +8 -16
- package/src/MastheadMenu.ts +2 -5
- package/src/MastheadProfileMenu.ts +2 -5
- package/src/MastheadShell.ts +25 -5
- package/src/Pagination.hbs +7 -3
- package/src/Pagination.ts +48 -31
- package/src/PhoneNumberField.hbs +1 -1
- package/src/PhoneNumberField.ts +7 -2
- package/src/SearchableListBase.ts +24 -3
- package/src/SecondaryNavigation.ts +3 -5
- package/src/TextField.ts +9 -0
- package/src/Wizard.ts +39 -11
- package/src/WizardTemplate.tsx +5 -1
- package/src/data/CountryListISO3166.ts +10 -2
- package/src/generated/i18n/i18n-defaults.ts +2 -2
- package/src/generated/templates/AccordionTemplate.lit.ts +4 -2
- package/src/generated/templates/MastheadItemTemplate.lit.ts +25 -22
- package/src/generated/templates/PaginationTemplate.lit.ts +1 -1
- package/src/generated/templates/PhoneNumberFieldTemplate.lit.ts +1 -1
- package/src/generated/themes/Accordion.css.ts +1 -1
- package/src/generated/themes/Button.css.ts +1 -1
- package/src/generated/themes/Contact.css.ts +9 -0
- package/src/generated/themes/ContactItem.css.ts +9 -0
- package/src/generated/themes/DatePickerPopover.css.ts +1 -1
- package/src/generated/themes/EventRibbon.css.ts +9 -0
- package/src/generated/themes/MastheadCountrySelector.css.ts +1 -1
- package/src/generated/themes/MastheadItem.css.ts +1 -1
- package/src/generated/themes/MastheadShell.css.ts +1 -1
- package/src/generated/themes/Modal.css.ts +1 -1
- package/src/generated/themes/Pagination.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/TextField.css.ts +1 -1
- package/src/i18n/messagebundle.properties +5 -0
- package/src/i18n/messagebundle_en.properties +3 -0
- package/src/themes/Accordion.css +1 -0
- package/src/themes/Button.css +74 -26
- package/src/themes/Contact.css +184 -0
- package/src/themes/ContactItem.css +44 -0
- package/src/themes/DatePickerPopover.css +64 -6
- package/src/themes/EventRibbon.css +411 -0
- package/src/themes/MastheadCountrySelector.css +8 -5
- package/src/themes/MastheadItem.css +12 -4
- package/src/themes/MastheadShell.css +3 -1
- package/src/themes/Modal.css +8 -4
- package/src/themes/Pagination.css +19 -0
- package/src/themes/TextField.css +2 -13
- package/src/types/ContactItemIcon.ts +7 -0
- package/src/types/EventRibbon.ts +51 -0
- package/src/utils/parseArrayFromString.ts +5 -0
- package/swap-component-imports.js +18 -0
- package/dist/assets/messagebundle_en-CVKgy_9L.js +0 -1
package/src/Contact.ts
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
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 jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
|
|
6
|
+
import ContactTemplate from "./ContactTemplate.js";
|
|
7
|
+
import type UDExContactItem from "./ContactItem.js";
|
|
8
|
+
import type UI5ResponsivePopover from "@ui5/webcomponents/dist/ResponsivePopover.js";
|
|
9
|
+
import parseArrayFromString from "./utils/parseArrayFromString.js";
|
|
10
|
+
import {
|
|
11
|
+
LOCAL_COUNTRY_NAMES, COMPLETE_LIST_OF, CALL_US_TODAY, CONTACT_US,
|
|
12
|
+
} from "./generated/i18n/i18n-defaults.js";
|
|
13
|
+
import i18n from "@ui5/webcomponents-base/decorators/i18n.js";
|
|
14
|
+
import type I18nBundle from "@ui5/webcomponents-base/i18nBundle.js";
|
|
15
|
+
|
|
16
|
+
// Styles
|
|
17
|
+
import ContactCss from "./generated/themes/Contact.css.js";
|
|
18
|
+
import { BreakpointUtils } from "./utils/Breakpoints.js";
|
|
19
|
+
|
|
20
|
+
export type ContactNumber = {
|
|
21
|
+
number: string;
|
|
22
|
+
country: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @class
|
|
27
|
+
*
|
|
28
|
+
* <h3 class="comment-api-title">Overview</h3>
|
|
29
|
+
*
|
|
30
|
+
*
|
|
31
|
+
* <h3>Usage</h3>
|
|
32
|
+
*
|
|
33
|
+
* For the <code>udex-contact</code>
|
|
34
|
+
* <h3>ES6 Module Import</h3>
|
|
35
|
+
*
|
|
36
|
+
* <code>import "@sapudex/web-components/dist/Contact.js";</code>
|
|
37
|
+
*
|
|
38
|
+
* @constructor
|
|
39
|
+
* @extends UI5Element
|
|
40
|
+
* @tagname udex-contact
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
@customElement({
|
|
44
|
+
tag: "udex-contact",
|
|
45
|
+
renderer: jsxRenderer,
|
|
46
|
+
styles: ContactCss,
|
|
47
|
+
template: ContactTemplate,
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
class UDExContact extends UI5Element {
|
|
51
|
+
/**
|
|
52
|
+
* Defines the <code>text</code> for the contact button.
|
|
53
|
+
*
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
@property({ type: String })
|
|
57
|
+
buttonText!: string;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* List of the contact numbers
|
|
61
|
+
*
|
|
62
|
+
* @default "[]"
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
@property({ type: String })
|
|
66
|
+
contactNumbers: string = "";
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Defines the local country numbers link's href
|
|
70
|
+
*
|
|
71
|
+
* @default ""
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
@property({ type: String })
|
|
75
|
+
localCountryNumbersLink: string = "";
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Defines if the initial focus should be prevented.
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
@property({ type: Boolean })
|
|
82
|
+
preventInitialFocus!: boolean;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Defines if the focus should be returned to the previously focused element.
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
@property({ type: Boolean })
|
|
89
|
+
preventFocusRestore!: boolean;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Defines the accessible name of the component.
|
|
93
|
+
* @default undefined
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
@property({ type: String })
|
|
97
|
+
accessibleName?: string;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Defines the IDs of the elements that label the component.
|
|
101
|
+
* @default undefined
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
@property({ type: String })
|
|
105
|
+
accessibleNameRef?: string;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Slot for list items.
|
|
109
|
+
*
|
|
110
|
+
* @slot items
|
|
111
|
+
* @public
|
|
112
|
+
*/
|
|
113
|
+
@slot({ type: HTMLElement, "default": true })
|
|
114
|
+
items!: Array<UDExContactItem>;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Defines the mobile mode for component
|
|
118
|
+
*
|
|
119
|
+
* @private
|
|
120
|
+
*/
|
|
121
|
+
@property({ type: Boolean })
|
|
122
|
+
_isMobileMode: boolean = BreakpointUtils.isAtMost("M");
|
|
123
|
+
|
|
124
|
+
_screenResizeHandler: () => void;
|
|
125
|
+
_screenResizeHandlerAttached?: boolean;
|
|
126
|
+
|
|
127
|
+
@i18n("@sapudex/web-components")
|
|
128
|
+
static i18nBundle: I18nBundle;
|
|
129
|
+
|
|
130
|
+
constructor() {
|
|
131
|
+
super();
|
|
132
|
+
this._screenResizeHandler = this._screenResize.bind(this);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
onEnterDOM() {
|
|
136
|
+
this._attachScreenResizeHandler();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
onExitDOM() {
|
|
140
|
+
this._detachScreenResizeHandler();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
_openPopover(): void {
|
|
144
|
+
this._responsivePopover.open = !this._responsivePopover.open;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
_closePopover(): void {
|
|
148
|
+
this._responsivePopover.open = false;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
_screenResize(): void {
|
|
152
|
+
this._isMobileMode = BreakpointUtils.isAtMost("M");
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
_attachScreenResizeHandler(): void {
|
|
156
|
+
if (!this._screenResizeHandlerAttached) {
|
|
157
|
+
window.addEventListener("resize", this._screenResizeHandler);
|
|
158
|
+
this._screenResizeHandlerAttached = true;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
_detachScreenResizeHandler(): void {
|
|
163
|
+
if (this._screenResizeHandlerAttached) {
|
|
164
|
+
window.removeEventListener("resize", this._screenResizeHandler);
|
|
165
|
+
this._screenResizeHandlerAttached = false;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
get _contactNumbersArray(): ContactNumber[] {
|
|
170
|
+
return parseArrayFromString<ContactNumber>(this.contactNumbers);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
get _responsivePopover(): UI5ResponsivePopover {
|
|
174
|
+
return this.shadowRoot!.querySelector<UI5ResponsivePopover>(".udex-contact__popover")!;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
get _completeListTitle(): string {
|
|
178
|
+
return `${UDExContact.i18nBundle.getText(COMPLETE_LIST_OF)} `;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
get _localCountryTitle(): string {
|
|
182
|
+
return UDExContact.i18nBundle.getText(LOCAL_COUNTRY_NAMES);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
get _numbersTitle(): string {
|
|
186
|
+
return UDExContact.i18nBundle.getText(CALL_US_TODAY);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
get _contactUsTitle(): string {
|
|
190
|
+
return UDExContact.i18nBundle.getText(CONTACT_US);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
get _hasNumbersList(): boolean {
|
|
194
|
+
return this._contactNumbersArray.length > 0;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
UDExContact.define();
|
|
199
|
+
|
|
200
|
+
export default UDExContact;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
|
2
|
+
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
|
3
|
+
import slot from "@ui5/webcomponents-base/decorators/slot.js";
|
|
4
|
+
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
|
5
|
+
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
|
|
6
|
+
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
|
|
7
|
+
import ContactItemTemplate from "./ContactItemTemplate.js";
|
|
8
|
+
import { UDExTarget } from "./types/common.js";
|
|
9
|
+
import UDExContactItemIcon from "./types/ContactItemIcon.js";
|
|
10
|
+
import "@ui5/webcomponents-icons/dist/headset.js";
|
|
11
|
+
import "@ui5/webcomponents-icons/dist/discussion-2.js";
|
|
12
|
+
import "@ui5/webcomponents-icons/dist/email.js";
|
|
13
|
+
|
|
14
|
+
// Styles
|
|
15
|
+
import ContactItemCss from "./generated/themes/ContactItem.css.js";
|
|
16
|
+
|
|
17
|
+
type UDExContactItemClickEventDetail = {
|
|
18
|
+
originalEvent: Event,
|
|
19
|
+
item: UDExContactItem,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @class
|
|
24
|
+
*
|
|
25
|
+
* <h3 class="comment-api-title">Overview</h3>
|
|
26
|
+
*
|
|
27
|
+
*
|
|
28
|
+
* <h3>Usage</h3>
|
|
29
|
+
*
|
|
30
|
+
* For the <code>udex-contact-item</code>
|
|
31
|
+
* <h3>ES6 Module Import</h3>
|
|
32
|
+
*
|
|
33
|
+
* <code>import "@sapudex/web-components/dist/ContactItem.js";</code>
|
|
34
|
+
*
|
|
35
|
+
* @constructor
|
|
36
|
+
* @extends UI5Element
|
|
37
|
+
* @tagname udex-contact-item
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
@customElement({
|
|
41
|
+
tag: "udex-contact-item",
|
|
42
|
+
renderer: jsxRenderer,
|
|
43
|
+
styles: ContactItemCss,
|
|
44
|
+
template: ContactItemTemplate,
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Fires when item is clicked
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
@event("item-click", {
|
|
53
|
+
bubbles: true,
|
|
54
|
+
cancelable: true,
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
class UDExContactItem extends UI5Element {
|
|
58
|
+
eventDetails!: {
|
|
59
|
+
"item-click": UDExContactItemClickEventDetail,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Defines the label for the item.
|
|
64
|
+
*
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
@property({ type: String })
|
|
68
|
+
label!: string;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Defines the href for the item.
|
|
72
|
+
*
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
@property({ type: String })
|
|
76
|
+
href!: string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Defines the icon name for the item.
|
|
80
|
+
*
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
@property({ type: String })
|
|
84
|
+
icon?: `${UDExContactItemIcon}`;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Defines target for the item
|
|
88
|
+
*
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
@property({ type: String })
|
|
92
|
+
target: `${UDExTarget}` = UDExTarget._self;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Slot for the item content.
|
|
96
|
+
*
|
|
97
|
+
* @slot
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
|
+
@slot({ type: Node, "default": true })
|
|
101
|
+
content!: Array<Node>;
|
|
102
|
+
|
|
103
|
+
_fireItemClickEvent(e: Event): void {
|
|
104
|
+
this.fireDecoratorEvent("item-click", {
|
|
105
|
+
item: this,
|
|
106
|
+
originalEvent: e,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
get _iconName(): string | undefined {
|
|
111
|
+
if (this.icon) {
|
|
112
|
+
return UDExContactItemIcon[this.icon].toLowerCase();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
UDExContactItem.define();
|
|
118
|
+
|
|
119
|
+
export default UDExContactItem;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type ContactItem from "./ContactItem.js";
|
|
2
|
+
import UI5Icon from "@ui5/webcomponents/dist/Icon.js";
|
|
3
|
+
import UDExLink from "./Link.js";
|
|
4
|
+
|
|
5
|
+
export default function ContactItemTemplate(this: ContactItem) {
|
|
6
|
+
return (
|
|
7
|
+
<div class="udex-contact-item">
|
|
8
|
+
{this.icon && <UI5Icon class="udex-contact-item__icon" name={this._iconName} mode="Decorative"></UI5Icon>}
|
|
9
|
+
<div class="udex-contact-item__content">
|
|
10
|
+
{labelContent.call(this)}
|
|
11
|
+
<p class="udex-contact-item__description"><slot></slot></p>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function labelContent(this: ContactItem) {
|
|
18
|
+
if (this.href) {
|
|
19
|
+
return <UDExLink onClick={this._fireItemClickEvent} target={this.target} class="udex-contact-item__link" href={this.href}>{this.label}</UDExLink>;
|
|
20
|
+
}
|
|
21
|
+
return <span class="udex-contact-item__text">{this.label}</span>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type Contact from "./Contact.js";
|
|
2
|
+
import UDExButtonSize from "./types/ButtonSize.js";
|
|
3
|
+
import UDExButtonDesign from "./types/ButtonDesign.js";
|
|
4
|
+
import UDExButton from "./Button.js";
|
|
5
|
+
import UDExLink from "./Link.js";
|
|
6
|
+
import ButtonType from "@ui5/webcomponents/dist/types/ButtonType.js";
|
|
7
|
+
import UI5ResponsivePopover from "@ui5/webcomponents/dist/ResponsivePopover.js";
|
|
8
|
+
import PopoverPlacement from "@ui5/webcomponents/dist/types/PopoverPlacement.js";
|
|
9
|
+
import PopoverHorizontalAlign from "@ui5/webcomponents/dist/types/PopoverHorizontalAlign.js";
|
|
10
|
+
import PopupAccessibleRole from "@ui5/webcomponents/dist/types/PopupAccessibleRole.js";
|
|
11
|
+
import UDExButtonAccessibleRole from "./types/ButtonAccessibleRole.js";
|
|
12
|
+
import "@ui5/webcomponents-icons/dist/discussion-2.js";
|
|
13
|
+
import "@ui5/webcomponents-icons/dist/decline.js";
|
|
14
|
+
|
|
15
|
+
export default function ContactTemplate(this: Contact) {
|
|
16
|
+
return (
|
|
17
|
+
<div class="udex-contact">
|
|
18
|
+
{responsivePopover.call(this)}
|
|
19
|
+
{openerButton.call(this)}
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function responsivePopover(this: Contact) {
|
|
25
|
+
return (
|
|
26
|
+
<UI5ResponsivePopover
|
|
27
|
+
id={`${this._id}-popover`}
|
|
28
|
+
opener={`${this._id}-opener`}
|
|
29
|
+
class="udex-contact__popover"
|
|
30
|
+
placement={PopoverPlacement.Top}
|
|
31
|
+
horizontalAlign={PopoverHorizontalAlign.End}
|
|
32
|
+
accessible-role={PopupAccessibleRole.Dialog}
|
|
33
|
+
preventInitialFocus={this.preventInitialFocus}
|
|
34
|
+
preventFocusRestore={this.preventFocusRestore}
|
|
35
|
+
accessibleName={this.accessibleName}
|
|
36
|
+
accessibleNameRef={this.accessibleNameRef}
|
|
37
|
+
hideArrow={true}>
|
|
38
|
+
<div
|
|
39
|
+
class={{
|
|
40
|
+
"udex-contact__call-us": true,
|
|
41
|
+
"udex-contact__call-us_empty": !this._hasNumbersList,
|
|
42
|
+
}}>
|
|
43
|
+
{!this._hasNumbersList && <span class="udex-contact__call-us-heading">{this._contactUsTitle}</span>}
|
|
44
|
+
<UDExButton
|
|
45
|
+
class="udex-contact__close-btn"
|
|
46
|
+
icon="sap-icon://decline"
|
|
47
|
+
type="Button"
|
|
48
|
+
onClick={this._closePopover}
|
|
49
|
+
size={UDExButtonSize.Medium}
|
|
50
|
+
design={UDExButtonDesign.Invisible}
|
|
51
|
+
accessible-role={UDExButtonAccessibleRole.Button}
|
|
52
|
+
icon-only>
|
|
53
|
+
</UDExButton>
|
|
54
|
+
{this._hasNumbersList && callUsSection.call(this)}
|
|
55
|
+
</div>
|
|
56
|
+
<div class="udex-contact__items"><slot></slot></div>
|
|
57
|
+
</UI5ResponsivePopover>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function openerButton(this: Contact) {
|
|
62
|
+
return (
|
|
63
|
+
<div id={`${this._id}-opener`} class="udex-contact__opener">
|
|
64
|
+
<UDExButton
|
|
65
|
+
onClick={this._openPopover}
|
|
66
|
+
class="udex-contact__button"
|
|
67
|
+
design={UDExButtonDesign.Primary}
|
|
68
|
+
size={UDExButtonSize.Large}
|
|
69
|
+
type={ButtonType.Button}
|
|
70
|
+
accessibleName={this._isMobileMode ? this.buttonText : undefined}
|
|
71
|
+
tooltip={this._isMobileMode ? this.buttonText : undefined}
|
|
72
|
+
icon="sap-icon://discussion-2">
|
|
73
|
+
{!this._isMobileMode && this.buttonText}
|
|
74
|
+
</UDExButton>
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function callUsSection(this: Contact) {
|
|
80
|
+
return (
|
|
81
|
+
<>
|
|
82
|
+
<h4 class="udex-contact__call-us-title">{this._numbersTitle}</h4>
|
|
83
|
+
<div class="udex-contact__numbers">
|
|
84
|
+
{this._contactNumbersArray.map(({ number, country }) => (
|
|
85
|
+
<div class="udex-contact__number-wrapper">
|
|
86
|
+
<span class="udex-contact__country">{country}</span>
|
|
87
|
+
<UDExLink
|
|
88
|
+
class="udex-contact__number"
|
|
89
|
+
href={"tel:".concat(number)}>
|
|
90
|
+
{number}
|
|
91
|
+
</UDExLink>
|
|
92
|
+
</div>
|
|
93
|
+
))}
|
|
94
|
+
</div>
|
|
95
|
+
<p class="udex-contact__complete-list">
|
|
96
|
+
{this._completeListTitle}
|
|
97
|
+
<UDExLink
|
|
98
|
+
class="udex-contact__local-country-link"
|
|
99
|
+
href={this.localCountryNumbersLink}>
|
|
100
|
+
{this._localCountryTitle}
|
|
101
|
+
</UDExLink>
|
|
102
|
+
</p>
|
|
103
|
+
</>
|
|
104
|
+
);
|
|
105
|
+
}
|
package/src/CountrySelector.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
|
2
2
|
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
|
|
3
3
|
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
|
4
|
-
import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
|
|
5
|
-
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
6
4
|
import executeTemplate from "@ui5/webcomponents-base/dist/renderer/executeTemplate.js";
|
|
7
5
|
import {
|
|
8
6
|
isEscape,
|
|
@@ -267,15 +265,12 @@ class UDExCountrySelector extends UDExSearchableListBase {
|
|
|
267
265
|
|
|
268
266
|
countryList: Country[] = CountryListDB;
|
|
269
267
|
selectedCountry!: Country | undefined;
|
|
270
|
-
_trigger!:
|
|
268
|
+
_trigger!: UDExTextField;
|
|
271
269
|
|
|
272
270
|
_dropdown!: UDExDropdown;
|
|
273
271
|
_search!: Search;
|
|
274
272
|
_handleResizeBound: ResizeObserverCallback;
|
|
275
273
|
|
|
276
|
-
@i18n("@sapudex/web-components")
|
|
277
|
-
static i18nBundle: I18nBundle;
|
|
278
|
-
|
|
279
274
|
constructor() {
|
|
280
275
|
super();
|
|
281
276
|
this._shouldFilterItems = false;
|
|
@@ -314,16 +309,18 @@ class UDExCountrySelector extends UDExSearchableListBase {
|
|
|
314
309
|
this._trigger = this.getTrigger();
|
|
315
310
|
}
|
|
316
311
|
|
|
317
|
-
getTrigger():
|
|
318
|
-
return this.shadowRoot!.querySelector("
|
|
312
|
+
getTrigger(): UDExTextField {
|
|
313
|
+
return this.shadowRoot!.querySelector<UDExTextField>("[udex-text-field]")!;
|
|
319
314
|
}
|
|
320
315
|
|
|
321
316
|
_dropdownClose() {
|
|
322
317
|
this.fireDecoratorEvent("close");
|
|
318
|
+
this._trigger.iconActive = false;
|
|
323
319
|
}
|
|
324
320
|
|
|
325
321
|
_dropdownOpen() {
|
|
326
322
|
this.fireDecoratorEvent("open");
|
|
323
|
+
this._trigger.iconActive = true;
|
|
327
324
|
}
|
|
328
325
|
|
|
329
326
|
_dropdownBeforeOpen() {
|
package/src/DatePicker.ts
CHANGED
|
@@ -230,12 +230,13 @@ class UDExDatePicker extends DateComponentBase {
|
|
|
230
230
|
|
|
231
231
|
_afterDropdownClose(): void {
|
|
232
232
|
this._dropdownTrigger.active = false;
|
|
233
|
+
this._dropdownTrigger.iconActive = false;
|
|
233
234
|
this._dropdownTrigger.shadowRoot?.querySelector("input")?.blur();
|
|
234
235
|
this._tempValue = "";
|
|
235
236
|
}
|
|
236
237
|
|
|
237
238
|
_afterDropdownOpen(): void {
|
|
238
|
-
this._dropdownTrigger.
|
|
239
|
+
this._dropdownTrigger.iconActive = true;
|
|
239
240
|
}
|
|
240
241
|
|
|
241
242
|
_closeRespPopover(): void {
|
|
@@ -0,0 +1,143 @@
|
|
|
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 jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
|
|
5
|
+
import type {
|
|
6
|
+
UDExEventRibbonColorSheme, UDExEventRibbonLink, UDExEventRibbonIcon, UDExEventRibbonLogo,
|
|
7
|
+
} from "./types/EventRibbon.js";
|
|
8
|
+
import { eventLogoText, UDExEventRibbonMode } from "./types/EventRibbon.js";
|
|
9
|
+
import "@ui5/webcomponents-icons/add-calendar.js";
|
|
10
|
+
import "@ui5/webcomponents-icons/media-play.js";
|
|
11
|
+
import EventRibbonTemplate from "./EventRibbonTemplate.js";
|
|
12
|
+
|
|
13
|
+
// Styles
|
|
14
|
+
import EventRibbonCss from "./generated/themes/EventRibbon.css.js";
|
|
15
|
+
import { isEnter, isSpace } from "@ui5/webcomponents-base/dist/Keys.js";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @class
|
|
19
|
+
*
|
|
20
|
+
* <h3 class="comment-api-title">Overview</h3>
|
|
21
|
+
*
|
|
22
|
+
*
|
|
23
|
+
* <h3>Usage</h3>
|
|
24
|
+
*
|
|
25
|
+
* For the <code>udex-event-ribbon</code>
|
|
26
|
+
* <h3>ES6 Module Import</h3>
|
|
27
|
+
*
|
|
28
|
+
* <code>import "@sapudex/web-components/dist/EventRibbon.js";</code>
|
|
29
|
+
*
|
|
30
|
+
* @constructor
|
|
31
|
+
* @extends UI5Element
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
@customElement({
|
|
35
|
+
tag: "udex-event-ribbon",
|
|
36
|
+
renderer: jsxRenderer,
|
|
37
|
+
styles: EventRibbonCss,
|
|
38
|
+
template: EventRibbonTemplate,
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
class UDExEventRibbon extends UI5Element {
|
|
42
|
+
/**
|
|
43
|
+
* Defines the text of the event logo.
|
|
44
|
+
*
|
|
45
|
+
* @default ""
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
@property({ type: String })
|
|
49
|
+
eventLogo!: `${UDExEventRibbonLogo}`;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Defines the link details of the event ribbon.
|
|
53
|
+
*
|
|
54
|
+
* @default "{}"
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
@property({ type: String })
|
|
58
|
+
eventLink: string = "{}";
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Defines the icon displayed next to the link.
|
|
62
|
+
*
|
|
63
|
+
* @default ""
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
@property({ type: String })
|
|
67
|
+
eventLinkIcon!: `${UDExEventRibbonIcon}`;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Defines the text displayed in event ribbon.
|
|
71
|
+
*
|
|
72
|
+
* @default ""
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
@property({ type: String })
|
|
76
|
+
eventText!: string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Defines whether event-ribbon uses dark or light theme.
|
|
80
|
+
*
|
|
81
|
+
* @default "light"
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
84
|
+
@property({ type: String })
|
|
85
|
+
mode: `${UDExEventRibbonMode}` = UDExEventRibbonMode.light;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Defines the solid background color.
|
|
89
|
+
*
|
|
90
|
+
* @default "Blue"
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
@property({ type: String })
|
|
94
|
+
backgroundColorScheme!: UDExEventRibbonColorSheme;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Allows control over the background image source.
|
|
98
|
+
*
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
@property({ type: String })
|
|
102
|
+
backgroundImage?: string;
|
|
103
|
+
|
|
104
|
+
_eventLink!: UDExEventRibbonLink;
|
|
105
|
+
|
|
106
|
+
onBeforeRendering(): void {
|
|
107
|
+
this._eventLink = JSON.parse(this.eventLink);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
onAfterRendering(): void {
|
|
111
|
+
this.applyColorScheme();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
applyColorScheme(): void {
|
|
115
|
+
const backgroundColorLowercase = this.backgroundColorScheme.toLowerCase();
|
|
116
|
+
const backgroundColor: string = `var(--udex-event-ribbon-${this.mode}-${backgroundColorLowercase}-default-background-color)`;
|
|
117
|
+
const backgroundColorHover: string = `var(--udex-event-ribbon-${this.mode}-${backgroundColorLowercase}-hover-background-color)`;
|
|
118
|
+
|
|
119
|
+
this.style.setProperty("--udex-event-ribbon-background-color", backgroundColor);
|
|
120
|
+
this.style.setProperty("--udex-event-ribbon-hover-background-color", backgroundColorHover);
|
|
121
|
+
|
|
122
|
+
this.style.setProperty("--udex-event-ribbon-background-image", `url("${this.backgroundImage}")`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
handleKeyDown(e: KeyboardEvent): void {
|
|
126
|
+
if (isSpace(e) || isEnter(e)) {
|
|
127
|
+
e.preventDefault();
|
|
128
|
+
this.shadowRoot!.querySelector("a")?.click();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
get eventLogoAlt(): string {
|
|
133
|
+
return eventLogoText[this.eventLogo];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
get eventLogoPath(): string {
|
|
137
|
+
return `https://cdn.udex.services.sap.com/dds/design-tokens/assets/logos/event-ribbon-logo-${this.eventLogo}.svg`;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
UDExEventRibbon.define();
|
|
142
|
+
|
|
143
|
+
export default UDExEventRibbon;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Icon from "@ui5/webcomponents/dist/Icon.js";
|
|
2
|
+
import type UDExEventRibbon from "./EventRibbon.js";
|
|
3
|
+
|
|
4
|
+
export default function EventRibbonTemplate(this: UDExEventRibbon) {
|
|
5
|
+
const { text, target, url } = this._eventLink;
|
|
6
|
+
return (
|
|
7
|
+
<a onKeyDown={this.handleKeyDown} role="banner" aria-label={this.eventText} class= {{ "udex-event-ribbon__container": true, "udex-event-ribbon__container-with-background-image": this.backgroundImage }} target={target} href={url} title={text}>
|
|
8
|
+
<div class="udex-event-ribbon__logo">
|
|
9
|
+
<img src={this.eventLogoPath} alt={this.eventLogoAlt}/>
|
|
10
|
+
</div>
|
|
11
|
+
{this.eventText && <p class="udex-event-ribbon__text">{this.eventText}</p>}
|
|
12
|
+
<div class="udex-event-ribbon__link-container">
|
|
13
|
+
{this.eventLinkIcon && <Icon name={this.eventLinkIcon}></Icon>}
|
|
14
|
+
<span>{text}</span>
|
|
15
|
+
</div>
|
|
16
|
+
</a>
|
|
17
|
+
);
|
|
18
|
+
}
|