@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.
Files changed (141) hide show
  1. package/bundle.esm.js +1 -0
  2. package/cypress/specs/Accordion.cy.tsx +19 -0
  3. package/cypress/specs/AccordionItem.cy.tsx +9 -0
  4. package/cypress/specs/Footer.cy.tsx +48 -11
  5. package/cypress/specs/PromoTile.cy.tsx +124 -0
  6. package/cypress/specs/Quote.cy.tsx +65 -0
  7. package/cypress/support/component-imports.instrumented.ts +4 -0
  8. package/cypress/support/component-imports.src.ts +5 -1
  9. package/dist/Accordion.d.ts +15 -0
  10. package/dist/Accordion.js +19 -0
  11. package/dist/Accordion.js.map +1 -1
  12. package/dist/AccordionItem.d.ts +19 -0
  13. package/dist/AccordionItem.js +23 -0
  14. package/dist/AccordionItem.js.map +1 -1
  15. package/dist/AccordionItemTemplate.js +7 -2
  16. package/dist/AccordionItemTemplate.js.map +1 -1
  17. package/dist/AccordionTemplate.js +21 -1
  18. package/dist/AccordionTemplate.js.map +1 -1
  19. package/dist/Footer.d.ts +45 -3
  20. package/dist/Footer.js +41 -17
  21. package/dist/Footer.js.map +1 -1
  22. package/dist/PromoTile.d.ts +143 -0
  23. package/dist/PromoTile.js +198 -0
  24. package/dist/PromoTile.js.map +1 -0
  25. package/dist/PromoTileTemplate.d.ts +2 -0
  26. package/dist/PromoTileTemplate.js +22 -0
  27. package/dist/PromoTileTemplate.js.map +1 -0
  28. package/dist/Quote.d.ts +11 -0
  29. package/dist/Quote.js +18 -3
  30. package/dist/Quote.js.map +1 -1
  31. package/dist/Search.d.ts +3 -1
  32. package/dist/Search.js +1 -0
  33. package/dist/Search.js.map +1 -1
  34. package/dist/assets/{InputSuggestions-xcV7PZDf.js → InputSuggestions-9WQMOg4t.js} +1 -1
  35. package/dist/assets/{ListItemStandardExpandableTextTemplate-RYCr4pVL.js → ListItemStandardExpandableTextTemplate-BQaMMo_n.js} +1 -1
  36. package/dist/assets/{bundle.esm-bg-64miJ.js → bundle.esm-ZNiP-jPI.js} +210 -209
  37. package/dist/assets/messagebundle_en-DwlTjyni.js +1 -0
  38. package/dist/css/themes/AccordionItem.css +1 -1
  39. package/dist/css/themes/BreadcrumbsPopover.css +1 -1
  40. package/dist/css/themes/CountrySelector.css +1 -1
  41. package/dist/css/themes/Divider.css +1 -1
  42. package/dist/css/themes/Footer.css +1 -1
  43. package/dist/css/themes/HeroBanner.css +1 -1
  44. package/dist/css/themes/PromoTile.css +1 -0
  45. package/dist/css/themes/Quote.css +1 -1
  46. package/dist/css/themes/RatingIndicator.css +1 -1
  47. package/dist/css/themes/Slider.css +1 -1
  48. package/dist/css/themes/Tag.css +1 -1
  49. package/dist/custom-elements-internal.json +614 -160
  50. package/dist/custom-elements.json +572 -128
  51. package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
  52. package/dist/generated/i18n/i18n-defaults.d.ts +3 -1
  53. package/dist/generated/i18n/i18n-defaults.js +3 -1
  54. package/dist/generated/i18n/i18n-defaults.js.map +1 -1
  55. package/dist/generated/templates/FooterTemplate.lit.js +33 -32
  56. package/dist/generated/templates/FooterTemplate.lit.js.map +1 -1
  57. package/dist/generated/templates/HeroBannerTemplate.lit.js +1 -1
  58. package/dist/generated/templates/HeroBannerTemplate.lit.js.map +1 -1
  59. package/dist/generated/themes/AccordionItem.css.d.ts +1 -1
  60. package/dist/generated/themes/AccordionItem.css.js +1 -1
  61. package/dist/generated/themes/AccordionItem.css.js.map +1 -1
  62. package/dist/generated/themes/BreadcrumbsPopover.css.d.ts +1 -1
  63. package/dist/generated/themes/BreadcrumbsPopover.css.js +1 -1
  64. package/dist/generated/themes/BreadcrumbsPopover.css.js.map +1 -1
  65. package/dist/generated/themes/CountrySelector.css.d.ts +1 -1
  66. package/dist/generated/themes/CountrySelector.css.js +1 -1
  67. package/dist/generated/themes/CountrySelector.css.js.map +1 -1
  68. package/dist/generated/themes/Divider.css.d.ts +1 -1
  69. package/dist/generated/themes/Divider.css.js +1 -1
  70. package/dist/generated/themes/Divider.css.js.map +1 -1
  71. package/dist/generated/themes/Footer.css.d.ts +1 -1
  72. package/dist/generated/themes/Footer.css.js +1 -1
  73. package/dist/generated/themes/Footer.css.js.map +1 -1
  74. package/dist/generated/themes/HeroBanner.css.d.ts +1 -1
  75. package/dist/generated/themes/HeroBanner.css.js +1 -1
  76. package/dist/generated/themes/HeroBanner.css.js.map +1 -1
  77. package/dist/generated/themes/PromoTile.css.d.ts +2 -0
  78. package/dist/generated/themes/PromoTile.css.js +8 -0
  79. package/dist/generated/themes/PromoTile.css.js.map +1 -0
  80. package/dist/generated/themes/Quote.css.d.ts +1 -1
  81. package/dist/generated/themes/Quote.css.js +1 -1
  82. package/dist/generated/themes/Quote.css.js.map +1 -1
  83. package/dist/generated/themes/RatingIndicator.css.d.ts +1 -1
  84. package/dist/generated/themes/RatingIndicator.css.js +1 -1
  85. package/dist/generated/themes/RatingIndicator.css.js.map +1 -1
  86. package/dist/generated/themes/Slider.css.d.ts +1 -1
  87. package/dist/generated/themes/Slider.css.js +1 -1
  88. package/dist/generated/themes/Slider.css.js.map +1 -1
  89. package/dist/generated/themes/Tag.css.d.ts +1 -1
  90. package/dist/generated/themes/Tag.css.js +1 -1
  91. package/dist/generated/themes/Tag.css.js.map +1 -1
  92. package/dist/messagebundle.properties +6 -0
  93. package/dist/messagebundle_en.properties +2 -0
  94. package/dist/types/PromoTile.d.ts +60 -0
  95. package/dist/types/PromoTile.js +63 -0
  96. package/dist/types/PromoTile.js.map +1 -0
  97. package/dist/utils/debounce.d.ts +3 -1
  98. package/dist/utils/debounce.js +16 -4
  99. package/dist/utils/debounce.js.map +1 -1
  100. package/dist/vscode.html-custom-data.json +102 -0
  101. package/dist/web-types.json +230 -5
  102. package/package.json +1 -1
  103. package/src/Accordion.ts +19 -0
  104. package/src/AccordionItem.ts +28 -0
  105. package/src/AccordionItemTemplate.tsx +25 -10
  106. package/src/AccordionTemplate.tsx +22 -1
  107. package/src/Footer.hbs +39 -36
  108. package/src/Footer.ts +81 -6
  109. package/src/HeroBanner.hbs +0 -1
  110. package/src/PromoTile.ts +290 -0
  111. package/src/PromoTileTemplate.tsx +68 -0
  112. package/src/Quote.ts +17 -3
  113. package/src/Search.ts +1 -0
  114. package/src/generated/i18n/i18n-defaults.ts +2 -2
  115. package/src/generated/templates/FooterTemplate.lit.ts +33 -32
  116. package/src/generated/templates/HeroBannerTemplate.lit.ts +1 -1
  117. package/src/generated/themes/AccordionItem.css.ts +1 -1
  118. package/src/generated/themes/BreadcrumbsPopover.css.ts +1 -1
  119. package/src/generated/themes/CountrySelector.css.ts +1 -1
  120. package/src/generated/themes/Divider.css.ts +1 -1
  121. package/src/generated/themes/Footer.css.ts +1 -1
  122. package/src/generated/themes/HeroBanner.css.ts +1 -1
  123. package/src/generated/themes/PromoTile.css.ts +9 -0
  124. package/src/generated/themes/Quote.css.ts +1 -1
  125. package/src/generated/themes/RatingIndicator.css.ts +1 -1
  126. package/src/generated/themes/Slider.css.ts +1 -1
  127. package/src/generated/themes/Tag.css.ts +1 -1
  128. package/src/i18n/messagebundle.properties +6 -0
  129. package/src/i18n/messagebundle_en.properties +2 -0
  130. package/src/themes/AccordionItem.css +61 -22
  131. package/src/themes/BreadcrumbsPopover.css +2 -1
  132. package/src/themes/CountrySelector.css +4 -0
  133. package/src/themes/Divider.css +2 -1
  134. package/src/themes/Footer.css +44 -9
  135. package/src/themes/HeroBanner.css +34 -32
  136. package/src/themes/PromoTile.css +152 -0
  137. package/src/themes/Quote.css +21 -24
  138. package/src/themes/Tag.css +18 -24
  139. package/src/types/PromoTile.ts +61 -0
  140. package/src/utils/debounce.ts +19 -4
  141. package/dist/assets/messagebundle_en-BHfPJk-2.js +0 -1
package/bundle.esm.js CHANGED
@@ -72,6 +72,7 @@ import "./dist/Pagination.js";
72
72
  import "./dist/PasswordField.js";
73
73
  import "./dist/PhoneNumberField.js";
74
74
  import "./dist/ProgressBar.js";
75
+ import "./dist/PromoTile.js";
75
76
  import "./dist/Quote.js";
76
77
  import "./dist/RadioButton.js";
77
78
  import "./dist/RangeSlider.js";
@@ -1,4 +1,5 @@
1
1
  import { UDExAccordion, UDExAccordionItem } from "../support/component-imports.js";
2
+ import {UDExAccordionHeadlineLevel} from "../../src/Accordion.js";
2
3
 
3
4
  const defaultAccordion = <UDExAccordion headline="Test headline" id="accordionComponent">
4
5
  <UDExAccordionItem label="Some label for item 1" numberBadge="72">
@@ -44,6 +45,24 @@ describe("Accordion", () => {
44
45
  cy.get("[udex-accordion]").find("udex-accordion-item").should("have.length", 5);
45
46
  });
46
47
 
48
+ it("renders default tag of the accordion headline", () => {
49
+ cy.get("[udex-accordion]").shadow().find(".udex-accordion__headline").then($el => {
50
+ expect($el.get(0).tagName).to.equal("H3")
51
+ })
52
+ });
53
+
54
+ it("renders right tag of the accordion headline", () => {
55
+ cy.mount(<UDExAccordion headline="Test headline" headlineLevel={UDExAccordionHeadlineLevel.H1}>
56
+ <UDExAccordionItem label="Some label for item 1" numberBadge="72">
57
+ <div>Lorem ipsum dolor sit amet</div>
58
+ </UDExAccordionItem>
59
+ </UDExAccordion>)
60
+
61
+ cy.get("[udex-accordion]").shadow().find(".udex-accordion__headline").then($el => {
62
+ expect($el.get(0).tagName).to.equal("H1")
63
+ });
64
+ });
65
+
47
66
  it("clicking on expand all btn shows hidden", () => {
48
67
  cy.get("[udex-accordion]").shadow().find(".udex-accordion__btn").click()
49
68
 
@@ -8,6 +8,10 @@ const expandedAccordionItem = <UDExAccordionItem label="Some label for item 1" n
8
8
  <div>some content<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Amet aperiam aut eum ipsum natus necessitatibus neque officiis repellendus totam voluptatum!</p></div>
9
9
  </UDExAccordionItem>
10
10
 
11
+ const accordionItemLarge = <UDExAccordionItem label="Some label for item 1" labelSize="Large">
12
+ <div>some content<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Amet aperiam aut eum ipsum natus necessitatibus neque officiis repellendus totam voluptatum!</p></div>
13
+ </UDExAccordionItem>
14
+
11
15
  describe('AccordionItem', () => {
12
16
 
13
17
  beforeEach(() => {
@@ -26,6 +30,11 @@ describe('AccordionItem', () => {
26
30
  cy.get("[udex-accordion-item]").click().shadow().find(".udex-accordion-item__content").should("exist").and("be.visible")
27
31
  });
28
32
 
33
+ it("render different headline size", () => {
34
+ cy.mount(accordionItemLarge);
35
+ cy.get("[udex-accordion-item]").click().shadow().find(".udex-accordion-item__content").should("exist");
36
+ });
37
+
29
38
  it("click on accordion item add necessary class and change aria-expanded to true", () => {
30
39
  cy.get("[udex-accordion-item]").click().shadow().find(".udex-accordion-item__header").should("have.attr", "aria-expanded")
31
40
  });
@@ -2,12 +2,18 @@ import { UDExFooter } from "../support/component-imports.js";
2
2
  import { quickLinks, trendingLinks, aboutLinks, siteInformationLinks, socialLinks } from "../fixtures/footer-links.js";
3
3
  import { setLanguage } from "@ui5/webcomponents-base/dist/config/Language.js";
4
4
 
5
+ const taglineAlt = "SAP tagline alt";
6
+ const chineseLogoUrl = "./stories/footer/chinese-logo.svg";
7
+ const chineseLogoLink = "https://www.sap.cn/index.html";
8
+ const taglineUrl = "./stories/footer/tagline.svg";
9
+ const chineseTaglineUrl = "./stories/footer/chinese-tagline.svg";
10
+
5
11
  const defaultFooter = <UDExFooter
6
12
  id="footer"
7
13
  logoLink="#test"
8
14
  logoTitle="SAP Title"
9
15
  logoAriaLabel="SAP Homepage"
10
- logoUrl='./assets/sap-logo.svg'
16
+ logoUrl='https://cdn.udex.services.sap.com/dds/design-tokens/assets/logos/sap-logo.svg'
11
17
  contactNumbersList='[{"country":"France","number":"400-619-0727"},{"country":"United State","number":"1-800-872-1727"}]'
12
18
  localCountryNumbersLink='#'
13
19
  chatWithUsLink='#'
@@ -16,7 +22,12 @@ const defaultFooter = <UDExFooter
16
22
  aboutLinks = {JSON.stringify(aboutLinks)}
17
23
  siteInformationLinks = {JSON.stringify(siteInformationLinks)}
18
24
  socialLinks = {JSON.stringify(socialLinks)}
19
- contactUsLink='#'>
25
+ contactUsLink='#'
26
+ tagline-alt={taglineAlt}
27
+ tagline-url={taglineUrl}
28
+ chinese-tagline-url={chineseTaglineUrl}
29
+ chinese-logo-url={chineseLogoUrl}
30
+ chinese-logo-link={chineseLogoLink}>
20
31
  </UDExFooter>
21
32
 
22
33
  describe("Footer", () => {
@@ -70,16 +81,17 @@ describe("Footer", () => {
70
81
  });
71
82
 
72
83
  it("sets data-id attribute to social links", () => {
73
- cy.get("#footer").shadow().find(".udex-footer__social-container [udex-social-media-button]").each(($socialLink, index) => {
74
- expect($socialLink[0]).attr("data-id").eqls(socialLinks[index].id)
75
- })
76
- });
84
+ cy.get("#footer").shadow().find(".udex-footer__social-container [udex-social-media-button]").each(($socialLink, index) => {
85
+ expect($socialLink[0]).attr("data-id").eqls(socialLinks[index].id)
86
+ })
87
+ });
77
88
 
78
- it("renders chinese text when specified in url", () => {
79
- setLanguage("zh_cn")
80
- cy.mount(defaultFooter)
81
- cy.get("#footer").shadow().find(".udex-footer__copyright-chinese-text").should("have.text", "ICP_NUMBER PUBLIC_SECURITY_NETWORK_NUMBER")
82
- cy.get("#footer").shadow().find(".udex-footer__copyright-chinese-link").should("have.attr", "href", "https://beian.miit.gov.cn/")
89
+ it("renders tagline image", () => {
90
+ cy.get("#footer").shadow().find(".udex-footer__tagline-image").should("have.attr", "src", taglineUrl);
91
+ });
92
+
93
+ it("renders tagline image alt", () => {
94
+ cy.get("#footer").shadow().find(".udex-footer__tagline-image").should("have.attr", "alt", taglineAlt);
83
95
  });
84
96
 
85
97
  describe("Desktop tests", () => {
@@ -309,4 +321,29 @@ describe("Footer", () => {
309
321
  cy.get("#footer").shadow().find("udex-accordion-item.udex-footer__action-item").should("exist")
310
322
  });
311
323
  });
324
+
325
+ describe("Footer chinese", () => {
326
+ beforeEach(() => {
327
+ cy.viewport(1920, 1080);
328
+ setLanguage("zh_cn");
329
+ cy.get("#footer").shadow().as("footer");
330
+ });
331
+
332
+ it("renders chinese text when specified in url", () => {
333
+ cy.get("@footer").find(".udex-footer__copyright-chinese-text").should("have.text", "ICP_NUMBER PUBLIC_SECURITY_NETWORK_NUMBER")
334
+ cy.get("@footer").find(".udex-footer__copyright-chinese-link").should("have.attr", "href", "https://beian.miit.gov.cn/")
335
+ });
336
+
337
+ it("renders chinese logo", () => {
338
+ cy.get("@footer").find(".udex-footer__logo-image-chinese").should("have.attr", "src", chineseLogoUrl);
339
+ });
340
+
341
+ it("renders chinese logo link", () => {
342
+ cy.get("@footer").find(".udex-footer__logo a").should("have.attr", "href", chineseLogoLink);
343
+ });
344
+
345
+ it("renders chinese tagline image", () => {
346
+ cy.get("@footer").find(".udex-footer__tagline-image-chinese").should("have.attr", "src", chineseTaglineUrl);
347
+ });
348
+ });
312
349
  });
@@ -0,0 +1,124 @@
1
+ import { UDExPromoTile } from "../support/component-imports.js";
2
+
3
+ const eyebrow = "Eyebrow";
4
+ const header = "Header";
5
+ const iconName = "add";
6
+ const imageLabel = "image label";
7
+ const logoUrl = "http://test.com";
8
+ const buttonLabel = "Button";
9
+ const design = "Tertiary";
10
+ const colorScheme = "Grey9";
11
+ const promoTile = <UDExPromoTile>Text</UDExPromoTile>;
12
+ const simplePromoTile = <UDExPromoTile eyebrow={eyebrow} header={header}>Text</UDExPromoTile>;
13
+ const iconPromoTile = <UDExPromoTile icon={iconName} image-label={imageLabel}>Text</UDExPromoTile>;
14
+ const logoPromoTile = <UDExPromoTile logoUrl={logoUrl} image-label={imageLabel}>Text</UDExPromoTile>;
15
+ const buttonPromoTile = <UDExPromoTile button={buttonLabel} button-design={design}>Text</UDExPromoTile>;
16
+ const horizontalPromoTile = <UDExPromoTile orientation="Horizontal" button={buttonLabel}>Text</UDExPromoTile>;
17
+ const darkPromoTile = <UDExPromoTile color-scheme={colorScheme} button={buttonLabel}>Text</UDExPromoTile>;
18
+
19
+ describe("Promo Tile", () => {
20
+ it("renders simple promo tile", () => {
21
+ cy.mount(promoTile)
22
+ cy.get("[udex-promo-tile]").shadow().find(".udex-promo-tile__container").should("be.visible");
23
+ });
24
+
25
+ it("renders promo tile with default classes", () => {
26
+ cy.mount(promoTile)
27
+ cy.get("[udex-promo-tile]").shadow().find(".udex-promo-tile__container").should("have.class", "udex-promo-tile--vertical");
28
+ cy.get("[udex-promo-tile]").shadow().find(".udex-promo-tile__container").should("have.class", "udex-promo-tile--light");
29
+ });
30
+
31
+ it("renders promo tile with default aria label", () => {
32
+ cy.mount(promoTile)
33
+ cy.get("[udex-promo-tile]").shadow().find(".udex-promo-tile__container").should("have.attr", "aria-label", "Promo Tile");
34
+ });
35
+
36
+ it("renders promo tile without footer", () => {
37
+ cy.mount(promoTile)
38
+ cy.get("[udex-promo-tile]").shadow().find(".udex-promo-tile__footer").should("not.exist");
39
+ });
40
+
41
+ it("renders promo tile in horizontal orientation", () => {
42
+ cy.mount(horizontalPromoTile)
43
+ cy.get("[udex-promo-tile]").shadow().find(".udex-promo-tile__container").should("have.class", "udex-promo-tile--horizontal");
44
+ });
45
+
46
+ it("renders promo tile with eyebrow", () => {
47
+ cy.mount(simplePromoTile)
48
+ cy.get("[udex-promo-tile]").shadow().find(".udex-promo-tile__eyebrow").should("have.text", eyebrow);
49
+ });
50
+
51
+ it("renders promo tile with header", () => {
52
+ cy.mount(simplePromoTile)
53
+ cy.get("[udex-promo-tile]").shadow().find(".udex-promo-tile__container").should("have.attr", "aria-label", header);
54
+ cy.get("[udex-promo-tile]").shadow().find(".udex-promo-tile__header").should("have.text", header);
55
+ });
56
+
57
+ it("renders promo tile with UI5 icon", () => {
58
+ cy.mount(iconPromoTile)
59
+ cy.get("[udex-promo-tile]").shadow().find("[ui5-icon]").should("have.attr", "name", iconName);
60
+ cy.get("[udex-promo-tile]").shadow().find("[ui5-icon]").should("have.attr", "accessible-name", imageLabel);
61
+ });
62
+
63
+ it("renders promo tile with custom logo", () => {
64
+ cy.mount(logoPromoTile)
65
+ cy.get("[udex-promo-tile]").shadow().find(".udex-promo-tile__pictogram").should("have.class", "udex-promo-tile__pictogram--logo");
66
+ cy.get("[udex-promo-tile]").shadow().find("img").should("have.attr", "src", logoUrl);
67
+ cy.get("[udex-promo-tile]").shadow().find("img").should("have.attr", "alt", imageLabel);
68
+ });
69
+
70
+ it("renders promo tile with dark color scheme", () => {
71
+ cy.mount(darkPromoTile)
72
+ cy.get("[udex-promo-tile]").shadow().find(".udex-promo-tile__container").should("have.class", "udex-promo-tile--dark");
73
+ cy.get("[udex-promo-tile]").shadow().find("[udex-button]").should("have.attr", "design", "Secondary");
74
+ });
75
+ });
76
+
77
+ describe("Promo Tile - CTA button", () => {
78
+ beforeEach(() => {
79
+ cy.mount(buttonPromoTile)
80
+ })
81
+
82
+ it("renders promo tile with CTA button", () => {
83
+ cy.get("[udex-promo-tile]").shadow().find(".udex-promo-tile__footer").should("be.visible");
84
+ cy.get("[udex-promo-tile]").shadow().find("[udex-button]").shadow().find("button").should("have.attr", "aria-label", buttonLabel);
85
+ });
86
+
87
+ it("renders promo tile with CTA default desktop size", () => {
88
+ cy.get("[udex-promo-tile]").shadow().find("[udex-button]").should("have.attr", "size", "Large");
89
+ });
90
+
91
+ it("renders promo tile with CTA button Tertiary design", () => {
92
+ cy.get("[udex-promo-tile]").shadow().find("[udex-button]").should("have.attr", "design", design);
93
+ });
94
+
95
+ it("button click emits \"button-click\" event", () => {
96
+ const stub = cy.stub();
97
+ cy.get("[udex-promo-tile]").then($tiles => {
98
+ $tiles.get(0).addEventListener("button-click", stub);
99
+ });
100
+ cy.get("[udex-promo-tile]").shadow().find("[udex-button]").click()
101
+ .then(() => {
102
+ expect(stub).to.have.been.called;
103
+ });
104
+ });
105
+ });
106
+
107
+ describe("Promo Tile - Mobile tests", () => {
108
+ beforeEach(() => {
109
+ cy.simulateDevice();
110
+ cy.mount(horizontalPromoTile);
111
+ });
112
+
113
+ it("renders promo tile with smaller CTA button size", () => {
114
+ cy.get("[udex-promo-tile]").shadow().find("[udex-button]").should("have.attr", "size", "Medium");
115
+ });
116
+
117
+ it("renders promo tile with mobile design", () => {
118
+ cy.get("[udex-promo-tile]").shadow().find(".udex-promo-tile__container").then($tiles => {
119
+ const tileStyles = window.getComputedStyle($tiles[0]);
120
+ expect(tileStyles.padding).eqls("24px");
121
+ expect(tileStyles.flexDirection).eqls("column");
122
+ })
123
+ });
124
+ });
@@ -0,0 +1,65 @@
1
+ import {UDExFilterMenu, UDExQuote} from "../support/component-imports.js";
2
+ import { UDExLink } from "../support/component-imports.js";
3
+ import { UDExMaskType, UDExSizeType, UDExImagePlacement } from "../../src/Quote.js";
4
+
5
+
6
+ const componentQuote = <UDExQuote
7
+ image-size={UDExSizeType.large}
8
+ text-size={UDExSizeType.large}
9
+ mask={UDExMaskType.avatar}>
10
+ <img
11
+ alt="John Ford avatar"
12
+ slot="image"
13
+ style="border-radius: 100px;"
14
+ src="https://cdn.udex.services.sap.com/dds/design-tokens/assets/logos/sap-logo.svg"
15
+ />
16
+ It is great for data management and comparing data. It does analysis of data
17
+ and compares old data and new data as well. Data is easily stored and easily
18
+ editable.
19
+ <span slot="author">John Ford, Job Title, Company, Inc.</span>
20
+ <UDExLink
21
+ slot="link"
22
+ design="Default"
23
+ interactive-area-size="Normal"
24
+ wrapping-type="Normal">
25
+ Read more
26
+ </UDExLink>
27
+ </UDExQuote>
28
+
29
+ describe("Quote", () => {
30
+ beforeEach(() => {
31
+ cy.mount(componentQuote)
32
+ })
33
+
34
+ it("Default slot content renders correctly", () => {
35
+ cy.get("[udex-quote]").shadow().find(".content-container__text").should("exist");
36
+ });
37
+
38
+ it("Image slot content renders correctly", () => {
39
+ cy.get("[udex-quote]").shadow().find("[slot=image]").should("exist");
40
+ });
41
+
42
+ it("Author slot content renders correctly", () => {
43
+ cy.get("[udex-quote]").shadow().find("[slot=author]").should("exist");
44
+ });
45
+
46
+ it("Link slot content renders correctly", () => {
47
+ cy.get("[udex-quote]").shadow().find("[slot=link]").should("exist");
48
+ });
49
+
50
+ it("Updates image placement to 'right' correctly", () => {
51
+ cy.get("[udex-quote]").then($quote => {
52
+ const quote = $quote[0] as UDExQuote;
53
+ quote.imagePlacement = UDExImagePlacement.right;
54
+ });
55
+ cy.get("[udex-quote]").should("have.attr", "image-placement", "right");
56
+ });
57
+
58
+ it("Updates image size correctly", () => {
59
+ cy.get("[udex-quote]").then($quote => {
60
+ const quote = $quote[0] as UDExQuote;
61
+ quote.imageSize = UDExSizeType.small;
62
+ });
63
+ cy.get("[udex-quote]").should("have.attr", "image-size", "small");
64
+ });
65
+ });
@@ -52,6 +52,8 @@ import UDExFilterMenuItem from "../../instrumented/FilterMenuItem.js";
52
52
  import UDExFilterMenuGroupHeader from "../../instrumented/FilterMenuGroupHeader.js";
53
53
  import UDExFilterMenuSelectAll from "../../instrumented/FilterMenuSelectAll.js";
54
54
  import UDExSocialMediaButton from "../../instrumented/SocialMediaButton.js";
55
+ import UDExPromoTile from "../../instrumented/PromoTile.js";
56
+ import UDExQuote from "../../instrumented/Quote.js";
55
57
 
56
58
  export {
57
59
  UDExAccordion,
@@ -77,6 +79,7 @@ export {
77
79
  UDExLinkListItem,
78
80
  UDExListItem,
79
81
  UDExPhoneNumberField,
82
+ UDExPromoTile,
80
83
  UDExRatingBar,
81
84
  UDExRatingIndicator,
82
85
  UDExReview,
@@ -108,4 +111,5 @@ export {
108
111
  UDExUploadItem,
109
112
  UDExWizard,
110
113
  UDExWizardStep,
114
+ UDExQuote,
111
115
  };
@@ -52,6 +52,8 @@ import UDExFilterMenuItem from "../../src/FilterMenuItem.js";
52
52
  import UDExFilterMenuGroupHeader from "../../src/FilterMenuGroupHeader.js";
53
53
  import UDExFilterMenuSelectAll from "../../src/FilterMenuSelectAll.js";
54
54
  import UDExSocialMediaButton from "../../src/SocialMediaButton.js";
55
+ import UDExPromoTile from "../../src/PromoTile.js";
56
+ import UDExQuote from "../../src/Quote.js";
55
57
 
56
58
  export {
57
59
  UDExAccordion,
@@ -77,6 +79,7 @@ export {
77
79
  UDExLinkListItem,
78
80
  UDExListItem,
79
81
  UDExPhoneNumberField,
82
+ UDExPromoTile,
80
83
  UDExRatingBar,
81
84
  UDExRatingIndicator,
82
85
  UDExReview,
@@ -107,5 +110,6 @@ export {
107
110
  UDExUpload,
108
111
  UDExUploadItem,
109
112
  UDExWizard,
110
- UDExWizardStep
113
+ UDExWizardStep,
114
+ UDExQuote,
111
115
  };
@@ -5,6 +5,14 @@ import type UDExAccordionItem from "./AccordionItem.js";
5
5
  type UDExAccordionToggleItemsEventDetail = {
6
6
  isOpen: boolean;
7
7
  };
8
+ export declare enum UDExAccordionHeadlineLevel {
9
+ H1 = "H1",
10
+ H2 = "H2",
11
+ H3 = "H3",
12
+ H4 = "H4",
13
+ H5 = "H5",
14
+ H6 = "H6"
15
+ }
8
16
  /**
9
17
  * @class
10
18
  *
@@ -54,6 +62,13 @@ declare class UDExAccordion extends UI5Element {
54
62
  * @public
55
63
  */
56
64
  headline: string;
65
+ /**
66
+ * Defines the semantic level of the headline.
67
+ *
68
+ * @default UDExAccordionHeadlineLevel.h3
69
+ * @public
70
+ */
71
+ headlineLevel: UDExAccordionHeadlineLevel;
57
72
  /**
58
73
  * Slot for accordion items.
59
74
  *
package/dist/Accordion.js CHANGED
@@ -18,6 +18,15 @@ import AccordionTemplate from "./AccordionTemplate.js";
18
18
  import { COLLAPSE_ALL, EXPAND_ALL } from "./generated/i18n/i18n-defaults.js";
19
19
  // Styles
20
20
  import AccordionCss from "./generated/themes/Accordion.css.js";
21
+ export var UDExAccordionHeadlineLevel;
22
+ (function (UDExAccordionHeadlineLevel) {
23
+ UDExAccordionHeadlineLevel["H1"] = "H1";
24
+ UDExAccordionHeadlineLevel["H2"] = "H2";
25
+ UDExAccordionHeadlineLevel["H3"] = "H3";
26
+ UDExAccordionHeadlineLevel["H4"] = "H4";
27
+ UDExAccordionHeadlineLevel["H5"] = "H5";
28
+ UDExAccordionHeadlineLevel["H6"] = "H6";
29
+ })(UDExAccordionHeadlineLevel || (UDExAccordionHeadlineLevel = {}));
21
30
  /**
22
31
  * @class
23
32
  *
@@ -40,6 +49,13 @@ import AccordionCss from "./generated/themes/Accordion.css.js";
40
49
  let UDExAccordion = UDExAccordion_1 = class UDExAccordion extends UI5Element {
41
50
  constructor() {
42
51
  super();
52
+ /**
53
+ * Defines the semantic level of the headline.
54
+ *
55
+ * @default UDExAccordionHeadlineLevel.h3
56
+ * @public
57
+ */
58
+ this.headlineLevel = UDExAccordionHeadlineLevel.H3;
43
59
  this._allExpanded = false;
44
60
  this._activeItemIndex = -1;
45
61
  }
@@ -133,6 +149,9 @@ __decorate([
133
149
  __decorate([
134
150
  property({ type: String })
135
151
  ], UDExAccordion.prototype, "headline", void 0);
152
+ __decorate([
153
+ property()
154
+ ], UDExAccordion.prototype, "headlineLevel", void 0);
136
155
  __decorate([
137
156
  slot({ type: HTMLElement, "default": true, individualSlots: true })
138
157
  ], UDExAccordion.prototype, "_items", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../src/Accordion.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AAEnE,OAAO,WAAW,MAAM,iDAAiD,CAAC;AAC1E,OAAO,+CAA+C,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAE7E,SAAS;AACT,OAAO,YAAY,MAAM,qCAAqC,CAAC;AAK/D;;;;;;;;;;;;;;;;;;GAkBG;AAeH,IAAM,aAAa,qBAAnB,MAAM,aAAc,SAAQ,UAAU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/D,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,YAAY;YACtB,CAAC,CAAC,eAAa,CAAC,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC;YAChD,CAAC,CAAC,eAAa,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;YAC1B,OAAO;gBACL,IAAI,EAAE,EAAE;aACT,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AApIG;IADD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;mDACtB;AASvB;IADD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDACC;AAQ3B;IADD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACL;AASpB;IADD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CACP;AASlB;IADD,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;6CAChC;AAG7B;IADN,IAAI,CAAC,yBAAyB,CAAC;uCACF;AAjD1B,aAAa;IAdlB,aAAa,CAAC;QACb,GAAG,EAAE,gBAAgB;QACrB,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,YAAY;QACpB,QAAQ,EAAE,iBAAiB;KAC5B,CAAC;IAEF;;;;OAIG;;IACF,KAAK,CAAC,cAAc,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;GAEnC,aAAa,CA+IlB;AAED,aAAa,CAAC,MAAM,EAAE,CAAC;AAEvB,eAAe,aAAa,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/renderer/JsxRenderer.js\";\nimport \"@ui5/webcomponents-icons/dist/feeder-arrow.js\";\nimport { isEnter, isSpace } from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport AccordionTemplate from \"./AccordionTemplate.js\";\nimport type UDExAccordionItem from \"./AccordionItem.js\";\nimport { COLLAPSE_ALL, EXPAND_ALL } from \"./generated/i18n/i18n-defaults.js\";\n\n// Styles\nimport AccordionCss from \"./generated/themes/Accordion.css.js\";\n\ntype UDExAccordionToggleItemsEventDetail = {\n isOpen: boolean\n}\n/**\n * @class\n *\n * <h3 class=\"comment-api-title\">Overview</h3>\n *\n *\n * <h3>Usage</h3>\n *\n * For the <code>udex-accordion</code>\n * <h3>ES6 Module Import</h3>\n *\n * <code>import \"@sapudex/web-components/dist/Accordion.js\";</code>\n *\n * @constructor\n * @author SAP SE\n * @extends UI5Element\n * @tagname udex-accordion\n * @public\n */\n@customElement({\n tag: \"udex-accordion\",\n renderer: jsxRenderer,\n styles: AccordionCss,\n template: AccordionTemplate,\n})\n\n/**\n * Triggered when the user clicks on the Expand/Collapse All button..\n *\n * @public\n */\n@event(\"toggle-items\", { bubbles: true })\n\nclass UDExAccordion extends UI5Element {\n eventDetails!: {\n \"toggle-items\": UDExAccordionToggleItemsEventDetail,\n };\n\n /**\n * Used internally to store expand/collapse button state.\n *\n * @private\n */\n @property({ type: Boolean, noAttribute: true })\n _allExpanded!: boolean;\n\n /**\n * Defines if expandAll button should be displayed.\n *\n * @default false\n * @public\n */\n @property({ type: Boolean })\n hideExpandButton!: boolean;\n\n /**\n * Defines direction of the accordion component.\n *\n * @private\n */\n @property({ type: String })\n _direction?: string;\n\n /**\n * Defines the headline text of the accordion component.\n *\n * @default \"\"\n * @public\n */\n @property({ type: String })\n headline!: string;\n\n /**\n * Slot for accordion items.\n *\n * @slot\n * @public\n */\n @slot({ type: HTMLElement, \"default\": true, individualSlots: true })\n _items!: Array<UDExAccordionItem>;\n\n @i18n(\"@sapudex/web-components\")\n static i18nBundle: I18nBundle;\n\n _activeItemIndex: number;\n\n constructor() {\n super();\n this._allExpanded = false;\n this._activeItemIndex = -1;\n }\n\n onEnterDOM() {\n this.updateAllExpandedStatus();\n }\n\n toggleAllHandler(e: Event) {\n e.preventDefault();\n this._allExpanded = !this._allExpanded;\n this.toggleOpenItems(this._allExpanded);\n this.fireDecoratorEvent(\"toggle-items\", { isOpen: this._allExpanded });\n }\n\n toggleOpenItems(isOpen: boolean) {\n this._items.forEach(item => {\n item.expanded = isOpen;\n });\n }\n\n toggleKeyAllHandler(e: KeyboardEvent) {\n if (isEnter(e) || isSpace(e)) {\n this.toggleAllHandler(e);\n }\n }\n\n keydownHandler(e: KeyboardEvent) {\n if (e.key !== \"Tab\") {\n e.preventDefault();\n }\n const len = this._items.length;\n const focusOnItem = (itemIndex: number) => {\n const item = this._items[itemIndex];\n this._activeItemIndex = itemIndex;\n (item?.shadowRoot?.querySelector(\".udex-accordion-item__header\") as HTMLElement)?.focus();\n };\n\n switch (e.key) {\n case \"Home\":\n focusOnItem(0);\n break;\n case \"End\":\n focusOnItem(len - 1);\n break;\n case \"ArrowUp\":\n if (this._activeItemIndex > 0) {\n focusOnItem(this._activeItemIndex - 1);\n } else if (this._activeItemIndex === 0) {\n focusOnItem(len - 1);\n }\n break;\n case \"ArrowDown\":\n if (this._activeItemIndex < len - 1) {\n focusOnItem(this._activeItemIndex + 1);\n } else if (this._activeItemIndex === len - 1) {\n focusOnItem(0);\n }\n break;\n default:\n break;\n }\n }\n\n itemFocusHandler(e: CustomEvent) {\n const target = e.target as UDExAccordionItem;\n if (target) {\n this._activeItemIndex = this._items?.indexOf(target) ?? -1;\n }\n }\n\n updateAllExpandedStatus() {\n this._allExpanded = this._items.every(item => item.expanded);\n }\n\n get toggleAllText(): string {\n return this._allExpanded\n ? UDExAccordion.i18nBundle.getText(COLLAPSE_ALL)\n : UDExAccordion.i18nBundle.getText(EXPAND_ALL);\n }\n\n get items(): {item: UDExAccordionItem}[] {\n return this._items.map(el => {\n return {\n item: el,\n };\n });\n }\n}\n\nUDExAccordion.define();\n\nexport default UDExAccordion;\n"]}
1
+ {"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../src/Accordion.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AAEnE,OAAO,WAAW,MAAM,iDAAiD,CAAC;AAC1E,OAAO,+CAA+C,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAE7E,SAAS;AACT,OAAO,YAAY,MAAM,qCAAqC,CAAC;AAM/D,MAAM,CAAN,IAAY,0BAOX;AAPD,WAAY,0BAA0B;IACpC,uCAAS,CAAA;IACT,uCAAS,CAAA;IACT,uCAAS,CAAA;IACT,uCAAS,CAAA;IACT,uCAAS,CAAA;IACT,uCAAS,CAAA;AACX,CAAC,EAPW,0BAA0B,KAA1B,0BAA0B,QAOrC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AAeH,IAAM,aAAa,qBAAnB,MAAM,aAAc,SAAQ,UAAU;IA8DpC;QACE,KAAK,EAA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import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport i18n from \"@ui5/webcomponents-base/dist/decorators/i18n.js\";\nimport type I18nBundle from \"@ui5/webcomponents-base/dist/i18nBundle.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/renderer/JsxRenderer.js\";\nimport \"@ui5/webcomponents-icons/dist/feeder-arrow.js\";\nimport { isEnter, isSpace } from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport AccordionTemplate from \"./AccordionTemplate.js\";\nimport type UDExAccordionItem from \"./AccordionItem.js\";\nimport { COLLAPSE_ALL, EXPAND_ALL } from \"./generated/i18n/i18n-defaults.js\";\n\n// Styles\nimport AccordionCss from \"./generated/themes/Accordion.css.js\";\n\ntype UDExAccordionToggleItemsEventDetail = {\n isOpen: boolean\n}\n\nexport enum UDExAccordionHeadlineLevel {\n H1 = \"H1\",\n H2 = \"H2\",\n H3 = \"H3\",\n H4 = \"H4\",\n H5 = \"H5\",\n H6 = \"H6\"\n}\n\n/**\n * @class\n *\n * <h3 class=\"comment-api-title\">Overview</h3>\n *\n *\n * <h3>Usage</h3>\n *\n * For the <code>udex-accordion</code>\n * <h3>ES6 Module Import</h3>\n *\n * <code>import \"@sapudex/web-components/dist/Accordion.js\";</code>\n *\n * @constructor\n * @author SAP SE\n * @extends UI5Element\n * @tagname udex-accordion\n * @public\n */\n@customElement({\n tag: \"udex-accordion\",\n renderer: jsxRenderer,\n styles: AccordionCss,\n template: AccordionTemplate,\n})\n\n/**\n * Triggered when the user clicks on the Expand/Collapse All button..\n *\n * @public\n */\n@event(\"toggle-items\", { bubbles: true })\n\nclass UDExAccordion extends UI5Element {\n eventDetails!: {\n \"toggle-items\": UDExAccordionToggleItemsEventDetail,\n };\n\n /**\n * Used internally to store expand/collapse button state.\n *\n * @private\n */\n @property({ type: Boolean, noAttribute: true })\n _allExpanded!: boolean;\n\n /**\n * Defines if expandAll button should be displayed.\n *\n * @default false\n * @public\n */\n @property({ type: Boolean })\n hideExpandButton!: boolean;\n\n /**\n * Defines direction of the accordion component.\n *\n * @private\n */\n @property({ type: String })\n _direction?: string;\n\n /**\n * Defines the headline text of the accordion component.\n *\n * @default \"\"\n * @public\n */\n @property({ type: String })\n headline!: string;\n\n /**\n * Defines the semantic level of the headline.\n *\n * @default UDExAccordionHeadlineLevel.h3\n * @public\n */\n @property()\n headlineLevel: UDExAccordionHeadlineLevel = UDExAccordionHeadlineLevel.H3;\n\n /**\n * Slot for accordion items.\n *\n * @slot\n * @public\n */\n @slot({ type: HTMLElement, \"default\": true, individualSlots: true })\n _items!: Array<UDExAccordionItem>;\n\n @i18n(\"@sapudex/web-components\")\n static i18nBundle: I18nBundle;\n\n _activeItemIndex: number;\n\n constructor() {\n super();\n this._allExpanded = false;\n this._activeItemIndex = -1;\n }\n\n onEnterDOM() {\n this.updateAllExpandedStatus();\n }\n\n toggleAllHandler(e: Event) {\n e.preventDefault();\n this._allExpanded = !this._allExpanded;\n this.toggleOpenItems(this._allExpanded);\n this.fireDecoratorEvent(\"toggle-items\", { isOpen: this._allExpanded });\n }\n\n toggleOpenItems(isOpen: boolean) {\n this._items.forEach(item => {\n item.expanded = isOpen;\n });\n }\n\n toggleKeyAllHandler(e: KeyboardEvent) {\n if (isEnter(e) || isSpace(e)) {\n this.toggleAllHandler(e);\n }\n }\n\n keydownHandler(e: KeyboardEvent) {\n if (e.key !== \"Tab\") {\n e.preventDefault();\n }\n const len = this._items.length;\n const focusOnItem = (itemIndex: number) => {\n const item = this._items[itemIndex];\n this._activeItemIndex = itemIndex;\n (item?.shadowRoot?.querySelector(\".udex-accordion-item__header\") as HTMLElement)?.focus();\n };\n\n switch (e.key) {\n case \"Home\":\n focusOnItem(0);\n break;\n case \"End\":\n focusOnItem(len - 1);\n break;\n case \"ArrowUp\":\n if (this._activeItemIndex > 0) {\n focusOnItem(this._activeItemIndex - 1);\n } else if (this._activeItemIndex === 0) {\n focusOnItem(len - 1);\n }\n break;\n case \"ArrowDown\":\n if (this._activeItemIndex < len - 1) {\n focusOnItem(this._activeItemIndex + 1);\n } else if (this._activeItemIndex === len - 1) {\n focusOnItem(0);\n }\n break;\n default:\n break;\n }\n }\n\n itemFocusHandler(e: CustomEvent) {\n const target = e.target as UDExAccordionItem;\n if (target) {\n this._activeItemIndex = this._items?.indexOf(target) ?? -1;\n }\n }\n\n updateAllExpandedStatus() {\n this._allExpanded = this._items.every(item => item.expanded);\n }\n\n get toggleAllText(): string {\n return this._allExpanded\n ? UDExAccordion.i18nBundle.getText(COLLAPSE_ALL)\n : UDExAccordion.i18nBundle.getText(EXPAND_ALL);\n }\n\n get items(): {item: UDExAccordionItem}[] {\n return this._items.map(el => {\n return {\n item: el,\n };\n });\n }\n}\n\nUDExAccordion.define();\n\nexport default UDExAccordion;\n"]}
@@ -1,4 +1,8 @@
1
1
  import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
+ export declare enum UDExAccordionItemTitleSize {
3
+ Standard = "Standard",
4
+ Large = "Large"
5
+ }
2
6
  /**
3
7
  * @class
4
8
  *
@@ -37,6 +41,20 @@ declare class UDExAccordionItem extends UI5Element {
37
41
  * @public
38
42
  */
39
43
  label: string;
44
+ /**
45
+ * Defines the size of label.
46
+ *
47
+ * @default UDExAccordionItemTitleSize.Standard
48
+ * @public
49
+ */
50
+ labelSize: UDExAccordionItemTitleSize;
51
+ /**
52
+ * Defines icon name to be display with title.
53
+ *
54
+ * @default ""
55
+ * @public
56
+ */
57
+ labelIcon: string;
40
58
  /**
41
59
  * Defines if the accordion item is expanded by default
42
60
  *
@@ -67,6 +85,7 @@ declare class UDExAccordionItem extends UI5Element {
67
85
  constructor();
68
86
  onAfterRendering(): void;
69
87
  onEnterDOM(): void;
88
+ setContentHeight(): void;
70
89
  contentKeydown(e: KeyboardEvent): void;
71
90
  itemClickHandler(e: Event): void;
72
91
  focusHandler(): void;
@@ -15,6 +15,11 @@ import { isDesktop } from "@ui5/webcomponents-base/dist/Device.js";
15
15
  import AccordionItemTemplate from "./AccordionItemTemplate.js";
16
16
  // Styles
17
17
  import AccordionItemCss from "./generated/themes/AccordionItem.css.js";
18
+ export var UDExAccordionItemTitleSize;
19
+ (function (UDExAccordionItemTitleSize) {
20
+ UDExAccordionItemTitleSize["Standard"] = "Standard";
21
+ UDExAccordionItemTitleSize["Large"] = "Large";
22
+ })(UDExAccordionItemTitleSize || (UDExAccordionItemTitleSize = {}));
18
23
  /**
19
24
  * @class
20
25
  *
@@ -37,6 +42,13 @@ import AccordionItemCss from "./generated/themes/AccordionItem.css.js";
37
42
  let UDExAccordionItem = class UDExAccordionItem extends UI5Element {
38
43
  constructor() {
39
44
  super();
45
+ /**
46
+ * Defines the size of label.
47
+ *
48
+ * @default UDExAccordionItemTitleSize.Standard
49
+ * @public
50
+ */
51
+ this.labelSize = UDExAccordionItemTitleSize.Standard;
40
52
  /**
41
53
  * Defines if the accordion item is expanded by default
42
54
  *
@@ -54,18 +66,23 @@ let UDExAccordionItem = class UDExAccordionItem extends UI5Element {
54
66
  }
55
67
  onAfterRendering() {
56
68
  this.handleDirection();
69
+ this.setContentHeight();
57
70
  }
58
71
  onEnterDOM() {
59
72
  if (isDesktop()) {
60
73
  this.setAttribute("desktop", "");
61
74
  }
62
75
  }
76
+ setContentHeight() {
77
+ this.style.setProperty("--udex-accordion-item-content-max-height", `${this.shadowRoot?.querySelector(".udex-accordion-item__content")?.scrollHeight}px`);
78
+ }
63
79
  contentKeydown(e) {
64
80
  e.stopPropagation();
65
81
  }
66
82
  itemClickHandler(e) {
67
83
  e.preventDefault();
68
84
  this.expanded = !this.expanded;
85
+ this.setContentHeight();
69
86
  this.fireDecoratorEvent("accordion-item-click");
70
87
  }
71
88
  focusHandler() {
@@ -94,6 +111,12 @@ __decorate([
94
111
  __decorate([
95
112
  property()
96
113
  ], UDExAccordionItem.prototype, "label", void 0);
114
+ __decorate([
115
+ property()
116
+ ], UDExAccordionItem.prototype, "labelSize", void 0);
117
+ __decorate([
118
+ property()
119
+ ], UDExAccordionItem.prototype, "labelIcon", void 0);
97
120
  __decorate([
98
121
  property({ type: Boolean })
99
122
  ], UDExAccordionItem.prototype, "expanded", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionItem.js","sourceRoot":"","sources":["../src/AccordionItem.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,aAAa,MAAM,0DAA0D,CAAC;AACrF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,IAAI,MAAM,iDAAiD,CAAC;AACnE,OAAO,KAAK,MAAM,yDAAyD,CAAC;AAC5E,OAAO,WAAW,MAAM,iDAAiD,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAE/D,SAAS;AACT,OAAO,gBAAgB,MAAM,yCAAyC,CAAC;AAEvE;;;;;;;;;;;;;;;;;;GAkBG;AAoBH,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IA0DxC;QACE,KAAK,EAAE,CAAC;QApCV;;;;;WAKG;QAED,aAAQ,GAAG,KAAK,CAAC;QAEnB;;;;;WAKG;QAED,WAAM,GAAG,KAAK,CAAC;IAqBjB,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAED,UAAU;QACR,IAAI,SAAS,EAAE,EAAE,CAAC;YAChB,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAED,cAAc,CAAC,CAAgB;QAC7B,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E,WAAW;QACrB,MAAM,EAAE,gBAAgB;QACxB,QAAQ,EAAE,qBAAqB;KAChC,CAAC;IAEF;;;OAGG;;IACF,KAAK,CAAC,sBAAsB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAEjD;;;OAGG;;IACF,KAAK,CAAC,sBAAsB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;GAE3C,iBAAiB,CAuGtB;AAED,iBAAiB,CAAC,MAAM,EAAE,CAAC;AAE3B,eAAe,iBAAiB,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/renderer/JsxRenderer.js\";\nimport { isEnter, isSpace } from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport { isDesktop } from \"@ui5/webcomponents-base/dist/Device.js\";\nimport AccordionItemTemplate from \"./AccordionItemTemplate.js\";\n\n// Styles\nimport AccordionItemCss from \"./generated/themes/AccordionItem.css.js\";\n\n/**\n * @class\n *\n * <h3 class=\"comment-api-title\">Overview</h3>\n *\n *\n * <h3>Usage</h3>\n *\n * For the <code>udex-accordion-item</code>\n * <h3>ES6 Module Import</h3>\n *\n * <code>import \"@sapudex/web-components/dist/AccordionItem.js\";</code>\n *\n * @constructor\n * @author SAP SE\n * @extends UI5Element\n * @tagname udex-accordion-item\n * @public\n */\n@customElement({\n tag: \"udex-accordion-item\",\n renderer: jsxRenderer,\n styles: AccordionItemCss,\n template: AccordionItemTemplate,\n})\n\n/**\n * Triggered when the user focuses on an accordion item.\n * @public\n */\n@event(\"accordion-item-focus\", { bubbles: true })\n\n/**\n * Triggered when the user clicks on an accordion item.\n * @public\n */\n@event(\"accordion-item-click\", { bubbles: true })\n\nclass UDExAccordionItem extends UI5Element {\n eventDetails!: {\n \"accordion-item-focus\": void,\n \"accordion-item-click\": void,\n };\n /**\n * Defines the Badge at the end of the label item.\n *\n * @default \"\"\n * @public\n */\n @property()\n numberBadge!: string;\n\n /**\n * Defines the label of the accordion item component.\n *\n * @default \"\"\n * @public\n */\n @property()\n label!: string;\n\n /**\n * Defines if the accordion item is expanded by default\n *\n * @default false\n * @public\n */\n @property({ type: Boolean })\n expanded = false;\n\n /**\n * Used internally to understand the component's open or closed state.\n *\n * @default false\n * @private\n */\n @property({ type: Boolean, noAttribute: true })\n isOpen = false;\n\n /**\n * Defines direction of the accordion item.\n *\n * @public\n */\n @property({ type: String })\n _direction?: string;\n\n /**\n * Slot for accordion item content.\n *\n * @slot\n * @public\n */\n @slot({ type: Node, \"default\": true })\n content!: Array<Node>;\n\n constructor() {\n super();\n }\n\n onAfterRendering() {\n this.handleDirection();\n }\n\n onEnterDOM(): void {\n if (isDesktop()) {\n this.setAttribute(\"desktop\", \"\");\n }\n }\n\n contentKeydown(e: KeyboardEvent) {\n e.stopPropagation();\n }\n\n itemClickHandler(e: Event) {\n e.preventDefault();\n this.expanded = !this.expanded;\n this.fireDecoratorEvent(\"accordion-item-click\");\n }\n\n focusHandler() {\n this.fireDecoratorEvent(\"accordion-item-focus\");\n }\n\n keydownHandler(e: KeyboardEvent) {\n if (isEnter(e) || isSpace(e)) {\n this.itemClickHandler(e);\n }\n }\n\n handleDirection() {\n const directionStyles: string = window\n .getComputedStyle(this)\n .getPropertyValue(\"direction\");\n\n if (!directionStyles) {\n this._direction = \"ltr\";\n } else {\n this._direction = directionStyles;\n }\n }\n}\n\nUDExAccordionItem.define();\n\nexport default UDExAccordionItem;\n"]}
1
+ {"version":3,"file":"AccordionItem.js","sourceRoot":"","sources":["../src/AccordionItem.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,aAAa,MAAM,0DAA0D,CAAC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,EAAE,CAAC;kDACd;AA1EpB,iBAAiB;IAnBtB,aAAa,CAAC;QACb,GAAG,EAAE,qBAAqB;QAC1B,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,gBAAgB;QACxB,QAAQ,EAAE,qBAAqB;KAChC,CAAC;IAEF;;;OAGG;;IACF,KAAK,CAAC,sBAAsB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAEjD;;;OAGG;;IACF,KAAK,CAAC,sBAAsB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;GAE3C,iBAAiB,CA+HtB;AAED,iBAAiB,CAAC,MAAM,EAAE,CAAC;AAE3B,eAAe,iBAAiB,CAAC","sourcesContent":["import UI5Element from \"@ui5/webcomponents-base/dist/UI5Element.js\";\nimport customElement from \"@ui5/webcomponents-base/dist/decorators/customElement.js\";\nimport property from \"@ui5/webcomponents-base/dist/decorators/property.js\";\nimport slot from \"@ui5/webcomponents-base/dist/decorators/slot.js\";\nimport event from \"@ui5/webcomponents-base/dist/decorators/event-strict.js\";\nimport jsxRenderer from \"@ui5/webcomponents-base/renderer/JsxRenderer.js\";\nimport { isEnter, isSpace } from \"@ui5/webcomponents-base/dist/Keys.js\";\nimport { isDesktop } from \"@ui5/webcomponents-base/dist/Device.js\";\nimport AccordionItemTemplate from \"./AccordionItemTemplate.js\";\n\n// Styles\nimport AccordionItemCss from \"./generated/themes/AccordionItem.css.js\";\n\nexport enum UDExAccordionItemTitleSize {\n Standard = \"Standard\",\n Large = \"Large\"\n}\n/**\n * @class\n *\n * <h3 class=\"comment-api-title\">Overview</h3>\n *\n *\n * <h3>Usage</h3>\n *\n * For the <code>udex-accordion-item</code>\n * <h3>ES6 Module Import</h3>\n *\n * <code>import \"@sapudex/web-components/dist/AccordionItem.js\";</code>\n *\n * @constructor\n * @author SAP SE\n * @extends UI5Element\n * @tagname udex-accordion-item\n * @public\n */\n@customElement({\n tag: \"udex-accordion-item\",\n renderer: jsxRenderer,\n styles: AccordionItemCss,\n template: AccordionItemTemplate,\n})\n\n/**\n * Triggered when the user focuses on an accordion item.\n * @public\n */\n@event(\"accordion-item-focus\", { bubbles: true })\n\n/**\n * Triggered when the user clicks on an accordion item.\n * @public\n */\n@event(\"accordion-item-click\", { bubbles: true })\n\nclass UDExAccordionItem extends UI5Element {\n eventDetails!: {\n \"accordion-item-focus\": void,\n \"accordion-item-click\": void,\n };\n /**\n * Defines the Badge at the end of the label item.\n *\n * @default \"\"\n * @public\n */\n @property()\n numberBadge!: string;\n\n /**\n * Defines the label of the accordion item component.\n *\n * @default \"\"\n * @public\n */\n @property()\n label!: string;\n\n /**\n * Defines the size of label.\n *\n * @default UDExAccordionItemTitleSize.Standard\n * @public\n */\n @property()\n labelSize: UDExAccordionItemTitleSize = UDExAccordionItemTitleSize.Standard;\n\n /**\n * Defines icon name to be display with title.\n *\n * @default \"\"\n * @public\n */\n @property()\n labelIcon!: string;\n\n /**\n * Defines if the accordion item is expanded by default\n *\n * @default false\n * @public\n */\n @property({ type: Boolean })\n expanded = false;\n\n /**\n * Used internally to understand the component's open or closed state.\n *\n * @default false\n * @private\n */\n @property({ type: Boolean, noAttribute: true })\n isOpen = false;\n\n /**\n * Defines direction of the accordion item.\n *\n * @public\n */\n @property({ type: String })\n _direction?: string;\n\n /**\n * Slot for accordion item content.\n *\n * @slot\n * @public\n */\n @slot({ type: Node, \"default\": true })\n content!: Array<Node>;\n\n constructor() {\n super();\n }\n\n onAfterRendering() {\n this.handleDirection();\n this.setContentHeight();\n }\n\n onEnterDOM(): void {\n if (isDesktop()) {\n this.setAttribute(\"desktop\", \"\");\n }\n }\n\n setContentHeight() {\n this.style.setProperty(\"--udex-accordion-item-content-max-height\", `${this.shadowRoot?.querySelector(\".udex-accordion-item__content\")?.scrollHeight}px`);\n }\n\n contentKeydown(e: KeyboardEvent) {\n e.stopPropagation();\n }\n\n itemClickHandler(e: Event) {\n e.preventDefault();\n this.expanded = !this.expanded;\n this.setContentHeight();\n this.fireDecoratorEvent(\"accordion-item-click\");\n }\n\n focusHandler() {\n this.fireDecoratorEvent(\"accordion-item-focus\");\n }\n\n keydownHandler(e: KeyboardEvent) {\n if (isEnter(e) || isSpace(e)) {\n this.itemClickHandler(e);\n }\n }\n\n handleDirection() {\n const directionStyles: string = window\n .getComputedStyle(this)\n .getPropertyValue(\"direction\");\n\n if (!directionStyles) {\n this._direction = \"ltr\";\n } else {\n this._direction = directionStyles;\n }\n }\n}\n\nUDExAccordionItem.define();\n\nexport default UDExAccordionItem;\n"]}