@sapudex/web-components 2.20.1 → 2.21.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 (85) hide show
  1. package/bundle.esm.js +2 -0
  2. package/cypress/specs/Feed.cy.tsx +72 -0
  3. package/cypress/specs/FeedItem.cy.tsx +82 -0
  4. package/cypress/specs/Footer.cy.tsx +45 -1
  5. package/cypress/support/component-imports.instrumented.ts +4 -0
  6. package/cypress/support/component-imports.src.ts +4 -0
  7. package/dist/AssetsVariables.js +4 -0
  8. package/dist/AssetsVariables.js.map +1 -1
  9. package/dist/Feed.d.ts +88 -0
  10. package/dist/Feed.js +103 -0
  11. package/dist/Feed.js.map +1 -0
  12. package/dist/FeedItem.d.ts +114 -0
  13. package/dist/FeedItem.js +131 -0
  14. package/dist/FeedItem.js.map +1 -0
  15. package/dist/FeedItemTemplate.d.ts +2 -0
  16. package/dist/FeedItemTemplate.js +16 -0
  17. package/dist/FeedItemTemplate.js.map +1 -0
  18. package/dist/FeedTemplate.d.ts +2 -0
  19. package/dist/FeedTemplate.js +19 -0
  20. package/dist/FeedTemplate.js.map +1 -0
  21. package/dist/Footer.d.ts +14 -2
  22. package/dist/Footer.js +10 -4
  23. package/dist/Footer.js.map +1 -1
  24. package/dist/FooterTemplate.js +3 -3
  25. package/dist/FooterTemplate.js.map +1 -1
  26. package/dist/assets/{InputSuggestions-yR1p8cXL.js → InputSuggestions-B0P5JAFd.js} +1 -1
  27. package/dist/assets/{ListItemStandardExpandableTextTemplate-BovnAV24.js → ListItemStandardExpandableTextTemplate-CFj3_UAT.js} +1 -1
  28. package/dist/assets/{bundle.esm-C7AybWk0.js → bundle.esm-BaPBMfCT.js} +216 -210
  29. package/dist/assets/messagebundle_en-D_yCmNrd.js +1 -0
  30. package/dist/css/themes/Feed.css +1 -0
  31. package/dist/css/themes/FeedItem.css +1 -0
  32. package/dist/css/themes/Footer.css +1 -1
  33. package/dist/css/themes/MediaPlayer.css +1 -1
  34. package/dist/css/themes/RatingIndicator.css +1 -1
  35. package/dist/css/themes/Slider.css +1 -1
  36. package/dist/custom-elements-internal.json +694 -207
  37. package/dist/custom-elements.json +597 -135
  38. package/dist/generated/assets/i18n/messagebundle_en.json +1 -1
  39. package/dist/generated/i18n/i18n-defaults.d.ts +2 -1
  40. package/dist/generated/i18n/i18n-defaults.js +2 -1
  41. package/dist/generated/i18n/i18n-defaults.js.map +1 -1
  42. package/dist/generated/themes/Feed.css.d.ts +2 -0
  43. package/dist/generated/themes/Feed.css.js +8 -0
  44. package/dist/generated/themes/Feed.css.js.map +1 -0
  45. package/dist/generated/themes/FeedItem.css.d.ts +2 -0
  46. package/dist/generated/themes/FeedItem.css.js +8 -0
  47. package/dist/generated/themes/FeedItem.css.js.map +1 -0
  48. package/dist/generated/themes/Footer.css.d.ts +1 -1
  49. package/dist/generated/themes/Footer.css.js +1 -1
  50. package/dist/generated/themes/Footer.css.js.map +1 -1
  51. package/dist/generated/themes/MediaPlayer.css.d.ts +1 -1
  52. package/dist/generated/themes/MediaPlayer.css.js +1 -1
  53. package/dist/generated/themes/MediaPlayer.css.js.map +1 -1
  54. package/dist/generated/themes/RatingIndicator.css.d.ts +1 -1
  55. package/dist/generated/themes/RatingIndicator.css.js +1 -1
  56. package/dist/generated/themes/RatingIndicator.css.js.map +1 -1
  57. package/dist/generated/themes/Slider.css.d.ts +1 -1
  58. package/dist/generated/themes/Slider.css.js +1 -1
  59. package/dist/generated/themes/Slider.css.js.map +1 -1
  60. package/dist/messagebundle.properties +3 -0
  61. package/dist/messagebundle_en.properties +1 -0
  62. package/dist/vscode.html-custom-data.json +104 -0
  63. package/dist/web-types.json +232 -1
  64. package/package.json +1 -1
  65. package/src/AssetsVariables.ts +4 -0
  66. package/src/Feed.ts +144 -0
  67. package/src/FeedItem.ts +198 -0
  68. package/src/FeedItemTemplate.tsx +60 -0
  69. package/src/FeedTemplate.tsx +66 -0
  70. package/src/Footer.ts +20 -4
  71. package/src/FooterTemplate.tsx +29 -39
  72. package/src/generated/i18n/i18n-defaults.ts +2 -2
  73. package/src/generated/themes/Feed.css.ts +9 -0
  74. package/src/generated/themes/FeedItem.css.ts +9 -0
  75. package/src/generated/themes/Footer.css.ts +1 -1
  76. package/src/generated/themes/MediaPlayer.css.ts +1 -1
  77. package/src/generated/themes/RatingIndicator.css.ts +1 -1
  78. package/src/generated/themes/Slider.css.ts +1 -1
  79. package/src/i18n/messagebundle.properties +3 -0
  80. package/src/i18n/messagebundle_en.properties +1 -0
  81. package/src/themes/Feed.css +51 -0
  82. package/src/themes/FeedItem.css +60 -0
  83. package/src/themes/Footer.css +9 -5
  84. package/src/themes/MediaPlayer.css +1 -1
  85. package/dist/assets/messagebundle_en-BhTYnZbC.js +0 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@sapudex/web-components",
4
- "version": "2.20.1",
4
+ "version": "2.21.0",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1534,6 +1534,217 @@
1534
1534
  "events": []
1535
1535
  }
1536
1536
  },
1537
+ {
1538
+ "name": "udex-feed",
1539
+ "description": "<h3 class=\"comment-api-title\">Overview</h3>\n\n\n<h3>Usage</h3>\n\nFor the <code>udex-feed</code>\n<h3>ES6 Module Import</h3>\n\n<code>import \"@sapudex/web-components/dist/Feed.js\";</code>\n---\n\n\n### **Events:**\n - **button-click** - Triggered when the user clicks on the CTA button\n\n### **Slots:**\n - **items** - Slot for feed items.",
1540
+ "doc-url": "",
1541
+ "attributes": [
1542
+ {
1543
+ "name": "icon",
1544
+ "description": "Defines the UI5 icon name in the pictogram section.",
1545
+ "value": { "type": "string | undefined", "default": "\"\"" }
1546
+ },
1547
+ {
1548
+ "name": "image-url",
1549
+ "description": "Defines the image URL in the pictogram section.",
1550
+ "value": { "type": "string | undefined", "default": "\"\"" }
1551
+ },
1552
+ {
1553
+ "name": "image-label",
1554
+ "description": "Defines the image aria label and alt in the pictogram section.",
1555
+ "value": { "type": "string | undefined", "default": "\"\"" }
1556
+ },
1557
+ {
1558
+ "name": "header",
1559
+ "description": "Defines the header text of the component.",
1560
+ "value": { "type": "string | undefined", "default": "\"\"" }
1561
+ },
1562
+ {
1563
+ "name": "button",
1564
+ "description": "Defines the CTA button label",
1565
+ "value": { "type": "string | undefined", "default": "\"\"" }
1566
+ },
1567
+ {
1568
+ "name": "button-design",
1569
+ "description": "Defines the CTA button design",
1570
+ "value": {
1571
+ "type": "UDExButtonDesign",
1572
+ "default": "\"UDExButtonDesign.Secondary\""
1573
+ }
1574
+ },
1575
+ {
1576
+ "name": "accessible-name",
1577
+ "description": "Defines the accessible ARIA name of the component.",
1578
+ "value": { "type": "string | undefined", "default": "undefined" }
1579
+ }
1580
+ ],
1581
+ "slots": [{ "name": "items", "description": "Slot for feed items." }],
1582
+ "events": [
1583
+ {
1584
+ "name": "button-click",
1585
+ "description": "Triggered when the user clicks on the CTA button"
1586
+ }
1587
+ ],
1588
+ "js": {
1589
+ "properties": [
1590
+ {
1591
+ "name": "icon",
1592
+ "description": "Defines the UI5 icon name in the pictogram section.",
1593
+ "value": { "type": "string | undefined" }
1594
+ },
1595
+ {
1596
+ "name": "image-url",
1597
+ "description": "Defines the image URL in the pictogram section.",
1598
+ "value": { "type": "string | undefined" }
1599
+ },
1600
+ {
1601
+ "name": "image-label",
1602
+ "description": "Defines the image aria label and alt in the pictogram section.",
1603
+ "value": { "type": "string | undefined" }
1604
+ },
1605
+ {
1606
+ "name": "header",
1607
+ "description": "Defines the header text of the component.",
1608
+ "value": { "type": "string | undefined" }
1609
+ },
1610
+ {
1611
+ "name": "button",
1612
+ "description": "Defines the CTA button label",
1613
+ "value": { "type": "string | undefined" }
1614
+ },
1615
+ {
1616
+ "name": "button-design",
1617
+ "description": "Defines the CTA button design",
1618
+ "value": { "type": "UDExButtonDesign" }
1619
+ },
1620
+ {
1621
+ "name": "accessible-name",
1622
+ "description": "Defines the accessible ARIA name of the component.",
1623
+ "value": { "type": "string | undefined" }
1624
+ }
1625
+ ],
1626
+ "events": [
1627
+ {
1628
+ "name": "button-click",
1629
+ "description": "Triggered when the user clicks on the CTA button"
1630
+ }
1631
+ ]
1632
+ }
1633
+ },
1634
+ {
1635
+ "name": "udex-feed-item",
1636
+ "description": "<h3 class=\"comment-api-title\">Overview</h3>\n\n\n<h3>Usage</h3>\n\nFor the <code>udex-feed-item</code>\n<h3>ES6 Module Import</h3>\n\n<code>import \"@sapudex/web-components/dist/FeedItem.js\";</code>\n---\n\n\n### **Events:**\n - **item-click** - Fires when item is clicked\n\n### **Slots:**\n - **avatar** - Receives the avatar",
1637
+ "doc-url": "",
1638
+ "attributes": [
1639
+ {
1640
+ "name": "text",
1641
+ "description": "Defines the link text",
1642
+ "value": { "type": "string | undefined", "default": "undefined" }
1643
+ },
1644
+ {
1645
+ "name": "href",
1646
+ "description": "Defines the link text URL",
1647
+ "value": { "type": "string", "default": "\"\"" }
1648
+ },
1649
+ {
1650
+ "name": "target",
1651
+ "description": "Defines target for the link",
1652
+ "value": { "type": "UDExTarget", "default": "UDExTarget._self" }
1653
+ },
1654
+ {
1655
+ "name": "details",
1656
+ "description": "Defines the link text details",
1657
+ "value": { "type": "string | undefined", "default": "undefined" }
1658
+ },
1659
+ {
1660
+ "name": "accessible-name",
1661
+ "description": "Defines the accessible ARIA name of the link.",
1662
+ "value": { "type": "string | undefined", "default": "undefined" }
1663
+ },
1664
+ {
1665
+ "name": "date",
1666
+ "description": "Defines the date of the event",
1667
+ "value": { "type": "string | undefined", "default": "undefined" }
1668
+ },
1669
+ {
1670
+ "name": "location",
1671
+ "description": "Defines the location of the event",
1672
+ "value": { "type": "string | undefined", "default": "undefined" }
1673
+ },
1674
+ {
1675
+ "name": "icon",
1676
+ "description": "Defines the UI5 icon name",
1677
+ "value": { "type": "string | undefined", "default": "undefined" }
1678
+ },
1679
+ {
1680
+ "name": "icon-accessible-name",
1681
+ "description": "Defines the UI5 icon label",
1682
+ "value": { "type": "string | undefined", "default": "undefined" }
1683
+ }
1684
+ ],
1685
+ "slots": [{ "name": "avatar", "description": "Receives the avatar" }],
1686
+ "events": [
1687
+ {
1688
+ "name": "item-click",
1689
+ "description": "Fires when item is clicked"
1690
+ }
1691
+ ],
1692
+ "js": {
1693
+ "properties": [
1694
+ {
1695
+ "name": "text",
1696
+ "description": "Defines the link text",
1697
+ "value": { "type": "string | undefined" }
1698
+ },
1699
+ {
1700
+ "name": "href",
1701
+ "description": "Defines the link text URL",
1702
+ "value": { "type": "string" }
1703
+ },
1704
+ {
1705
+ "name": "target",
1706
+ "description": "Defines target for the link",
1707
+ "value": { "type": "UDExTarget" }
1708
+ },
1709
+ {
1710
+ "name": "details",
1711
+ "description": "Defines the link text details",
1712
+ "value": { "type": "string | undefined" }
1713
+ },
1714
+ {
1715
+ "name": "accessible-name",
1716
+ "description": "Defines the accessible ARIA name of the link.",
1717
+ "value": { "type": "string | undefined" }
1718
+ },
1719
+ {
1720
+ "name": "date",
1721
+ "description": "Defines the date of the event",
1722
+ "value": { "type": "string | undefined" }
1723
+ },
1724
+ {
1725
+ "name": "location",
1726
+ "description": "Defines the location of the event",
1727
+ "value": { "type": "string | undefined" }
1728
+ },
1729
+ {
1730
+ "name": "icon",
1731
+ "description": "Defines the UI5 icon name",
1732
+ "value": { "type": "string | undefined" }
1733
+ },
1734
+ {
1735
+ "name": "icon-accessible-name",
1736
+ "description": "Defines the UI5 icon label",
1737
+ "value": { "type": "string | undefined" }
1738
+ }
1739
+ ],
1740
+ "events": [
1741
+ {
1742
+ "name": "item-click",
1743
+ "description": "Fires when item is clicked"
1744
+ }
1745
+ ]
1746
+ }
1747
+ },
1537
1748
  {
1538
1749
  "name": "udex-filter-menu",
1539
1750
  "description": "<h3 class=\"comment-api-title\">Overview</h3>\n\n\n<h3>Usage</h3>\n\nFor the <code>udex-filter-menu</code>\n<h3>ES6 Module Import</h3>\n\n<code>import \"@sapudex/web-components/dist/UDExFilterMenu.js\";</code>\n---\n\n\n### **Events:**\n - **reset-click** - Fired event when the user click on a reset button on the footer.\n- **result-click** - Fired event when the user click on a result button on the footer.\n- **select-all** - Fired event when the user click on Select All header item.\n- **before-open** - Fired before the dropdown pane is opened.\n- **after-open** - Fired after the dropdown pane is opened.\n- **before-close** - Fired before the dropdown pane is closed.\n- **after-close** - Fired after the dropdown pane is closed.\n- **selection-change** - \n- **submit-search** - Fired event when the user clicks on the submitted icon in the search.\n- **reset-search** - Fired event when the user clicks on the reset button in the search.\n- **change-search** - Fired event when the user submitted the value in the search.\n- **first-icon-click** - Fired event when the user clicks on the first icon.\n- **second-icon-click** - Fired event when the user clicks on the second icon.\n\n### **Methods:**\n - **close(): _void_** - Close the dropdown.\n- **resetSearch()** - Reset the search value.\n\n### **Slots:**\n - **default** - Slot for items.",
@@ -2532,6 +2743,16 @@
2532
2743
  "name": "chinese-icp-number-link",
2533
2744
  "description": "Defines a href for the chinese ICP Number link",
2534
2745
  "value": { "type": "string", "default": "chineseICPDefaultLink" }
2746
+ },
2747
+ {
2748
+ "name": "chinese-icp-number",
2749
+ "description": "Defines text for the chinese ICP Number",
2750
+ "value": { "type": "string" }
2751
+ },
2752
+ {
2753
+ "name": "chinese-security-network-number",
2754
+ "description": "Defines text for the chinese security network number",
2755
+ "value": { "type": "string" }
2535
2756
  }
2536
2757
  ],
2537
2758
  "slots": [
@@ -2711,6 +2932,16 @@
2711
2932
  "name": "chinese-icp-number-link",
2712
2933
  "description": "Defines a href for the chinese ICP Number link",
2713
2934
  "value": { "type": "string" }
2935
+ },
2936
+ {
2937
+ "name": "chinese-icp-number",
2938
+ "description": "Defines text for the chinese ICP Number",
2939
+ "value": { "type": "string" }
2940
+ },
2941
+ {
2942
+ "name": "chinese-security-network-number",
2943
+ "description": "Defines text for the chinese security network number",
2944
+ "value": { "type": "string" }
2714
2945
  }
2715
2946
  ],
2716
2947
  "events": [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@sapudex/web-components",
4
- "version": "2.20.1",
4
+ "version": "2.21.0",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
7
7
  },
@@ -58,6 +58,10 @@ const variablesOverwrite = `
58
58
  ${getScopedVarName("--_ui5_input_focus_outline_color")}: var(--sapContent_FocusColor);
59
59
  }
60
60
 
61
+ [udex-feed] {
62
+ ${getScopedVarName("--_ui5_icon_transform_scale")}: none;
63
+ }
64
+
61
65
  .sapUiSizeCompact,
62
66
  .ui5-content-density-compact,
63
67
  [data-ui5-compact-size] {
package/src/Feed.ts ADDED
@@ -0,0 +1,144 @@
1
+ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
+ import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
3
+ import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
4
+ import property from "@ui5/webcomponents-base/dist/decorators/property.js";
5
+ import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
6
+ import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
7
+ import UDExButtonDesign from "./types/ButtonDesign.js";
8
+ import FeedItem from "./FeedItem.js";
9
+ import type UDExFeedItem from "./FeedItem.js";
10
+ import FeedTemplate from "./FeedTemplate.js";
11
+
12
+ // Styles
13
+ import FeedCss from "./generated/themes/Feed.css.js";
14
+
15
+ /**
16
+ * @class
17
+ *
18
+ * <h3 class="comment-api-title">Overview</h3>
19
+ *
20
+ *
21
+ * <h3>Usage</h3>
22
+ *
23
+ * For the <code>udex-feed</code>
24
+ * <h3>ES6 Module Import</h3>
25
+ *
26
+ * <code>import "@sapudex/web-components/dist/Feed.js";</code>
27
+ *
28
+ *
29
+ * @constructor
30
+ * @extends UI5Element
31
+ * @tagname udex-feed
32
+ * @public
33
+ */
34
+ @customElement({
35
+ tag: "udex-feed",
36
+ renderer: jsxRenderer,
37
+ styles: FeedCss,
38
+ template: FeedTemplate,
39
+ dependencies: [FeedItem],
40
+ })
41
+
42
+ /**
43
+ * Triggered when the user clicks on the CTA button
44
+ *
45
+ * @public
46
+ */
47
+ @event("button-click", { cancelable: true, bubbles: true })
48
+
49
+ class UDExFeed extends UI5Element {
50
+ eventDetails!: {
51
+ "button-click": void
52
+ };
53
+ /**
54
+ * Slot for feed items.
55
+ *
56
+ * @slot items
57
+ * @public
58
+ */
59
+ @slot({ type: HTMLElement, individualSlots: true })
60
+ items!: Array<UDExFeedItem>;
61
+
62
+ /**
63
+ * Defines the UI5 icon name in the pictogram section.
64
+ *
65
+ * @default ""
66
+ * @public
67
+ */
68
+ @property({ type: String })
69
+ icon?: string;
70
+
71
+ /**
72
+ * Defines the image URL in the pictogram section.
73
+ *
74
+ * @default ""
75
+ * @public
76
+ */
77
+ @property({ type: String })
78
+ imageUrl?: string;
79
+
80
+ /**
81
+ * Defines the image aria label and alt in the pictogram section.
82
+ *
83
+ * @default ""
84
+ * @public
85
+ */
86
+ @property({ type: String })
87
+ imageLabel?: string;
88
+
89
+ /**
90
+ * Defines the header text of the component.
91
+ *
92
+ * @default ""
93
+ * @public
94
+ */
95
+ @property({ type: String })
96
+ header?: string;
97
+
98
+ /**
99
+ * Defines the CTA button label
100
+ *
101
+ * @default ""
102
+ * @public
103
+ */
104
+ @property({ type: String })
105
+ button?: string;
106
+
107
+ /**
108
+ * Defines the CTA button design
109
+ *
110
+ * @default "UDExButtonDesign.Secondary"
111
+ * @public
112
+ */
113
+ @property()
114
+ buttonDesign: UDExButtonDesign = UDExButtonDesign.Secondary;
115
+
116
+ /**
117
+ * Defines the accessible ARIA name of the component.
118
+ *
119
+ * @default undefined
120
+ * @public
121
+ */
122
+ @property()
123
+ accessibleName?: string;
124
+
125
+ get _showPictogram(): boolean {
126
+ return !!this.icon || !!this.imageUrl;
127
+ }
128
+
129
+ get _showImage(): boolean {
130
+ return !this.icon && !!this.imageUrl;
131
+ }
132
+
133
+ get _imageLabel(): string {
134
+ return this.imageLabel || "";
135
+ }
136
+
137
+ handleCTAButtonClick() {
138
+ this.fireDecoratorEvent("button-click");
139
+ }
140
+ }
141
+
142
+ UDExFeed.define();
143
+
144
+ export default UDExFeed;
@@ -0,0 +1,198 @@
1
+ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
+ import { UDExTarget } from "./types/common.js";
3
+ import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.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 slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
7
+ import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
8
+ import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
9
+ import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
10
+ import FeedItemTemplate from "./FeedItemTemplate.js";
11
+ import { LOCATION } from "./generated/i18n/i18n-defaults.js";
12
+
13
+ // Styles
14
+ import FeedItemCss from "./generated/themes/FeedItem.css.js";
15
+
16
+ type UDExFeedItemClickEventDetail = {
17
+ originalEvent: Event,
18
+ item: UDExFeedItem,
19
+ }
20
+
21
+ export type FeedDate = {
22
+ day: string;
23
+ month: string;
24
+ };
25
+
26
+ /**
27
+ * @class
28
+ *
29
+ * <h3 class="comment-api-title">Overview</h3>
30
+ *
31
+ *
32
+ * <h3>Usage</h3>
33
+ *
34
+ * For the <code>udex-feed-item</code>
35
+ * <h3>ES6 Module Import</h3>
36
+ *
37
+ * <code>import "@sapudex/web-components/dist/FeedItem.js";</code>
38
+ *
39
+ * @constructor
40
+ * @extends UI5Element
41
+ * @tagname udex-feed-item
42
+ * @public
43
+ */
44
+ @customElement({
45
+ tag: "udex-feed-item",
46
+ renderer: jsxRenderer,
47
+ styles: FeedItemCss,
48
+ template: FeedItemTemplate,
49
+ })
50
+
51
+ /**
52
+ * Fires when item is clicked
53
+ *
54
+ * @public
55
+ */
56
+ @event("item-click", { bubbles: true, cancelable: true })
57
+
58
+ class UDExFeedItem extends UI5Element {
59
+ eventDetails!: {
60
+ "item-click": UDExFeedItemClickEventDetail,
61
+ };
62
+
63
+ /**
64
+ * Defines the link text
65
+ *
66
+ * @default undefined
67
+ * @public
68
+ */
69
+ @property({ type: String })
70
+ text?: string;
71
+
72
+ /**
73
+ * Defines the link text URL
74
+ *
75
+ * @default ""
76
+ * @public
77
+ */
78
+ @property({ type: String })
79
+ href!: string;
80
+
81
+ /**
82
+ * Defines target for the link
83
+ *
84
+ * @default UDExTarget._self
85
+ * @public
86
+ */
87
+ @property()
88
+ target: UDExTarget = UDExTarget._self;
89
+
90
+ /**
91
+ * Defines the link text details
92
+ *
93
+ * @default undefined
94
+ * @public
95
+ */
96
+ @property({ type: String })
97
+ details?: string;
98
+
99
+ /**
100
+ * Defines the accessible ARIA name of the link.
101
+ *
102
+ * @default undefined
103
+ * @public
104
+ */
105
+ @property()
106
+ accessibleName?: string;
107
+
108
+ /**
109
+ * Defines the date of the event
110
+ *
111
+ * @default undefined
112
+ * @public
113
+ */
114
+ @property({ type: String })
115
+ date?: string;
116
+
117
+ /**
118
+ * Defines the location of the event
119
+ *
120
+ * @default undefined
121
+ * @public
122
+ */
123
+ @property({ type: String })
124
+ location?: string;
125
+
126
+ /**
127
+ * Defines the UI5 icon name
128
+ *
129
+ * @default undefined
130
+ * @public
131
+ */
132
+ @property({ type: String })
133
+ icon?: string;
134
+
135
+ /**
136
+ * Defines the UI5 icon label
137
+ *
138
+ * @default undefined
139
+ * @public
140
+ */
141
+ @property({ type: String })
142
+ iconAccessibleName?: string;
143
+
144
+ /**
145
+ * Receives the avatar
146
+ *
147
+ * @slot avatar
148
+ * @public
149
+ */
150
+ @slot({ type: HTMLElement })
151
+ avatar!: Array<HTMLElement>;
152
+
153
+ @i18n("@sapudex/web-components")
154
+ static i18nBundle: I18nBundle;
155
+
156
+ get _date(): FeedDate {
157
+ return this.formatDate(this.date);
158
+ }
159
+
160
+ get _showAvatar(): boolean {
161
+ return !!this.avatar.length;
162
+ }
163
+
164
+ get _showIcon(): boolean {
165
+ return !!this.icon && !this._showAvatar;
166
+ }
167
+
168
+ get _showDate(): boolean {
169
+ return !!this.date && !this._showAvatar && !this._showIcon;
170
+ }
171
+
172
+ get locationIconLabel(): string {
173
+ return UDExFeedItem.i18nBundle.getText(LOCATION);
174
+ }
175
+
176
+ formatDate(d: string | undefined): FeedDate {
177
+ if (!d) {
178
+ return { day: "", month: "" };
179
+ }
180
+ const date = new Date(d);
181
+ const day = date.toLocaleString("default", { day: "2-digit" });
182
+ let month = date.toLocaleString("default", { month: "short" });
183
+ month = month.charAt(0).toUpperCase() + month.slice(1);
184
+ return { day, month };
185
+ }
186
+
187
+ handleLinkClick(e: Event): void {
188
+ this.fireDecoratorEvent("item-click", {
189
+ item: this,
190
+ originalEvent: e,
191
+ });
192
+ }
193
+ }
194
+
195
+ UDExFeedItem.define();
196
+
197
+ export default UDExFeedItem;
198
+ export type { UDExFeedItemClickEventDetail };
@@ -0,0 +1,60 @@
1
+ import type FeedItem from "./FeedItem.js";
2
+ import UI5Icon from "@ui5/webcomponents/dist/Icon.js";
3
+ import IconMode from "@ui5/webcomponents/dist/types/IconMode.js";
4
+ import IconDesign from "@ui5/webcomponents/dist/types/IconDesign.js";
5
+ import UDExLink from "./Link.js";
6
+
7
+ export default function FeedItemTemplate(this: FeedItem) {
8
+ const rootClass = "udex-feed-item";
9
+
10
+ return (
11
+ <div class={rootClass}>
12
+ {this._showAvatar &&
13
+ <slot name="avatar" slot="avatar" aria-hidden="true"></slot>
14
+ }
15
+ {this._showIcon &&
16
+ <UI5Icon
17
+ class={`${rootClass}__icon`}
18
+ name={this.icon?.toLowerCase()}
19
+ mode={IconMode.Decorative}
20
+ accessibleName={this.iconAccessibleName}>
21
+ </UI5Icon>
22
+ }
23
+ {this._showDate &&
24
+ <div class={`${rootClass}__date`}
25
+ aria-label={this.date}>
26
+ <span class={`${rootClass}__month`}>{this._date.month}</span>
27
+ <span class={`${rootClass}__day`}>{this._date.day}</span>
28
+ </div>
29
+ }
30
+ {(this.text || this.details || this.location) &&
31
+ <div class={`${rootClass}__content`}>
32
+ <UDExLink
33
+ class={`${rootClass}__link`}
34
+ accessibleName={this.accessibleName}
35
+ href={this.href}
36
+ target={this.target}
37
+ onClick={this.handleLinkClick}>
38
+ {this.text}
39
+ </UDExLink>
40
+ {this.details &&
41
+ <p class={`${rootClass}__details`}>
42
+ {this.details}
43
+ </p>
44
+ }
45
+ {this.location &&
46
+ <p class={`${rootClass}__location`}>
47
+ <UI5Icon
48
+ name="map"
49
+ mode={IconMode.Decorative}
50
+ design={IconDesign.Neutral}
51
+ accessibleName={this.locationIconLabel}>
52
+ </UI5Icon>
53
+ {this.location}
54
+ </p>
55
+ }
56
+ </div>
57
+ }
58
+ </div>
59
+ );
60
+ }