@riverty/web-components 6.0.0 → 6.1.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 (107) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/custom-elements.json +99 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/r-alert.cjs.entry.js +1 -1
  5. package/dist/cjs/r-icon-button_2.cjs.entry.js +4 -4
  6. package/dist/cjs/r-icon.cjs.entry.js +1 -1
  7. package/dist/cjs/r-input-code.cjs.entry.js +7 -7
  8. package/dist/cjs/r-input.cjs.entry.js +4 -2
  9. package/dist/cjs/r-list-item.cjs.entry.js +16 -15
  10. package/dist/cjs/r-panel.cjs.entry.js +5 -5
  11. package/dist/cjs/r-stepper-item.cjs.entry.js +1 -1
  12. package/dist/cjs/r-stepper.cjs.entry.js +1 -1
  13. package/dist/cjs/r-tab-panel.cjs.entry.js +1 -1
  14. package/dist/cjs/r-tab.cjs.entry.js +6 -2
  15. package/dist/cjs/r-tabs-list.cjs.entry.js +160 -2
  16. package/dist/cjs/r-tabs.cjs.entry.js +34 -6
  17. package/dist/cjs/r-textarea.cjs.entry.js +1 -1
  18. package/dist/cjs/r-toast-group.cjs.entry.js +2 -2
  19. package/dist/cjs/r-toast.cjs.entry.js +30 -10
  20. package/dist/cjs/web-components.cjs.js +1 -1
  21. package/dist/collection/components/alert/alert.css +2 -3
  22. package/dist/collection/components/icon/bundled-icons/riverty-kit.json +1 -1
  23. package/dist/collection/components/icon/riverty-kit.js +1 -1
  24. package/dist/collection/components/icon-button/icon-button.js +22 -3
  25. package/dist/collection/components/input/exports.js +2 -0
  26. package/dist/collection/components/input/input.js +54 -2
  27. package/dist/collection/components/input-code/exports.js +2 -2
  28. package/dist/collection/components/input-code/input-code.js +13 -13
  29. package/dist/collection/components/list-item/list-item/list-item.css +46 -12
  30. package/dist/collection/components/list-item/list-item/list-item.js +34 -14
  31. package/dist/collection/components/panel/panel.css +40 -17
  32. package/dist/collection/components/panel/panel.js +6 -6
  33. package/dist/collection/components/stepper/stepper.css +1 -1
  34. package/dist/collection/components/stepper-item/stepper-item.css +3 -3
  35. package/dist/collection/components/tab/tab.css +29 -29
  36. package/dist/collection/components/tab/tab.js +5 -1
  37. package/dist/collection/components/tab-panel/tab-panel.js +1 -1
  38. package/dist/collection/components/tabs/tabs.js +34 -6
  39. package/dist/collection/components/tabs-list/exports.js +2 -0
  40. package/dist/collection/components/tabs-list/tabs-list.css +43 -2
  41. package/dist/collection/components/tabs-list/tabs-list.js +277 -1
  42. package/dist/collection/components/textarea/textarea.css +1 -1
  43. package/dist/collection/components/toast/toast.css +35 -9
  44. package/dist/collection/components/toast/toast.js +43 -9
  45. package/dist/collection/components/toast-group/toast-group.css +1 -1
  46. package/dist/collection/components/toast-group/toast-group.js +1 -1
  47. package/dist/collection/components/tooltip/tooltip.js +2 -2
  48. package/dist/esm/loader.js +1 -1
  49. package/dist/esm/r-alert.entry.js +1 -1
  50. package/dist/esm/r-icon-button_2.entry.js +4 -4
  51. package/dist/esm/r-icon.entry.js +1 -1
  52. package/dist/esm/r-input-code.entry.js +7 -7
  53. package/dist/esm/r-input.entry.js +4 -2
  54. package/dist/esm/r-list-item.entry.js +16 -15
  55. package/dist/esm/r-panel.entry.js +5 -5
  56. package/dist/esm/r-stepper-item.entry.js +1 -1
  57. package/dist/esm/r-stepper.entry.js +1 -1
  58. package/dist/esm/r-tab-panel.entry.js +1 -1
  59. package/dist/esm/r-tab.entry.js +6 -2
  60. package/dist/esm/r-tabs-list.entry.js +161 -3
  61. package/dist/esm/r-tabs.entry.js +34 -6
  62. package/dist/esm/r-textarea.entry.js +1 -1
  63. package/dist/esm/r-toast-group.entry.js +2 -2
  64. package/dist/esm/r-toast.entry.js +30 -10
  65. package/dist/esm/web-components.js +1 -1
  66. package/dist/types/components/icon/exports.d.ts +1 -0
  67. package/dist/types/components/icon/icon-data.d.ts +1 -0
  68. package/dist/types/components/icon/riverty-kit.d.ts +1 -0
  69. package/dist/types/components/icon-button/icon-button.d.ts +4 -0
  70. package/dist/types/components/input/exports.d.ts +4 -0
  71. package/dist/types/components/input/input.d.ts +17 -1
  72. package/dist/types/components/input-code/exports.d.ts +4 -4
  73. package/dist/types/components/input-code/input-code.d.ts +3 -3
  74. package/dist/types/components/list-item/list-item/list-item.d.ts +5 -3
  75. package/dist/types/components/tabs/tabs.d.ts +1 -0
  76. package/dist/types/components/tabs-list/exports.d.ts +4 -0
  77. package/dist/types/components/tabs-list/tabs-list.d.ts +38 -0
  78. package/dist/types/components/toast/toast.d.ts +11 -0
  79. package/dist/types/components.d.ts +89 -12
  80. package/dist/web-components/bundled-icons/riverty-kit.json +1 -1
  81. package/dist/web-components/{p-3a5a67e7.entry.js → p-159822fe.entry.js} +1 -1
  82. package/dist/web-components/p-19407a14.entry.js +1 -0
  83. package/dist/web-components/{p-4254a383.entry.js → p-4f261b63.entry.js} +1 -1
  84. package/dist/web-components/{p-673dbfd0.entry.js → p-50893211.entry.js} +1 -1
  85. package/dist/web-components/{p-e5945c01.entry.js → p-5eeb7002.entry.js} +1 -1
  86. package/dist/web-components/p-6bb44ec6.entry.js +1 -0
  87. package/dist/web-components/p-7ce57332.entry.js +1 -0
  88. package/dist/web-components/p-92c7cf33.entry.js +1 -0
  89. package/dist/web-components/{p-ae251d2f.entry.js → p-b96d59ca.entry.js} +1 -1
  90. package/dist/web-components/p-ba801820.entry.js +1 -0
  91. package/dist/web-components/p-bfc8c077.entry.js +1 -0
  92. package/dist/web-components/p-c05b05da.entry.js +1 -0
  93. package/dist/web-components/p-c95b6470.entry.js +1 -0
  94. package/dist/web-components/{p-05738503.entry.js → p-cd5daad2.entry.js} +1 -1
  95. package/dist/web-components/p-cdd88c5a.entry.js +1 -0
  96. package/dist/web-components/{p-a71485d8.entry.js → p-e4dc60f0.entry.js} +1 -1
  97. package/dist/web-components/web-components.esm.js +1 -1
  98. package/package.json +1 -1
  99. package/dist/web-components/p-0e4c8bf1.entry.js +0 -1
  100. package/dist/web-components/p-5441b746.entry.js +0 -1
  101. package/dist/web-components/p-60ca994e.entry.js +0 -1
  102. package/dist/web-components/p-6303b9fe.entry.js +0 -1
  103. package/dist/web-components/p-6a4f3836.entry.js +0 -1
  104. package/dist/web-components/p-8b4d2448.entry.js +0 -1
  105. package/dist/web-components/p-a0dbde7c.entry.js +0 -1
  106. package/dist/web-components/p-b9e3b3d6.entry.js +0 -1
  107. package/dist/web-components/p-e2188953.entry.js +0 -1
@@ -2,15 +2,56 @@
2
2
  display: block;
3
3
  }
4
4
 
5
+ :host([variant=compact]) {
6
+ --r-tabs-list--r-tab--margin-right: 0;
7
+ --r-tabs-list--r-tab--flex: 1;
8
+ --r-tab--width: 100%;
9
+ }
10
+
11
+ :host([scrollable=true]) {
12
+ --r-tabs-list--tabs-container--margin: -6px 4px ;
13
+ }
14
+
15
+ :host([border=branded]) {
16
+ --r-tab--marker--background-color: var(--r-border-brand-vanguard, #527a42);
17
+ }
18
+
5
19
  .r-tabs-list {
6
20
  display: var(--r-tabs-list--display, flex);
7
- margin-bottom: var(--r-tabs-list--margin-bottom, 40px);
21
+ margin-bottom: var(--r-tabs-list--margin-bottom, var(--r-spacing-250, 2.5rem));
8
22
  border-bottom-width: var(--r-tabs-list--border-bottom-width, 1px);
9
23
  border-bottom-style: var(--r-tabs-list--border-bottom-style, solid);
10
24
  border-bottom-color: var(--r-tabs-list--border-bottom-color, var(--r-border-softer, #c9c9c9));
11
25
  }
26
+ .r-tabs-list--scroll-button {
27
+ --r-icon-button--border-radius: var(--r-tabs-list--border-radius, 0);
28
+ --r-icon-button--width: var(--r-tabs-list--scroll-button--width, var(--r-spacing-200, 2rem));
29
+ --r-icon-button--height: var(--r-tabs-list--scroll-button--height, var(--r-spacing-200, 2rem));
30
+ }
31
+ .r-tabs-list--tabs-container {
32
+ display: var(--r-tabs-list--tabs-container--display, flex);
33
+ flex: var(--r-tabs-list--tabs-container--flex, 1);
34
+ overflow: var(--r-tabs-list--tabs-container--overflow, scroll hidden);
35
+ scroll-snap-type: var(--r-tabs-list--tabs-container--scroll-snap-type, x proximity);
36
+ scrollbar-width: var(--r-tabs-list--tabs-container--scrollbar-width, none);
37
+ margin: var(--r-tabs-list--tabs-container--margin, -6px);
38
+ padding: var(--r-tabs-list--tabs-container--padding, 6px);
39
+ }
40
+ .r-tabs-list--scroll-button-container {
41
+ display: var(--r-tabs-list--scroll-button-container--display, flex);
42
+ align-items: var(--r-tabs-list--scroll-button-container--align-items, start);
43
+ gap: var(--r-tabs-list--scroll-button-container--gap, var(--r-spacing-025, 0.25rem));
44
+ }
45
+ .r-tabs-list--scroll-indicator {
46
+ margin-top: var(--r-tabs-list--scroll-indicator--margin, 2px);
47
+ width: var(--r-tabs-list--scroll-button--after--width, 1px);
48
+ height: var(--r-tabs-list--scroll-button--after--height, var(--r-spacing-175, 1.75rem));
49
+ background-color: var(--r-tabs-list----scroll-indicator--background-color, var(--r-border-softer, #c9c9c9));
50
+ z-index: var(--r-tabs-list----scroll-indicator--z-index, 1);
51
+ }
12
52
  .r-tabs-list ::slotted(r-tab) {
13
- margin-right: var(--r-tabs-list--r-tab--margin-right, 40px);
53
+ margin-right: var(--r-tabs-list--r-tab--margin-right, var(--r-spacing-250, 2.5rem));
54
+ flex: var(--r-tabs-list--r-tab--flex, none);
14
55
  }
15
56
  .r-tabs-list ::slotted(r-tab:last-of-type) {
16
57
  margin-right: var(--r-tabs-list--r-tab--last-of-type--margin-right, 0);
@@ -1,7 +1,166 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  export class RTabsList {
3
+ constructor() {
4
+ /**
5
+ * Visual variant of the tab list
6
+ * @defaulr 'expanded'
7
+ * */
8
+ this.variant = 'expanded';
9
+ /**
10
+ * Border style of the active tab
11
+ * @default 'standard'
12
+ * */
13
+ this.border = 'standard';
14
+ /** Indicates if the tab list is scrollable */
15
+ this.scrollable = false;
16
+ /** Indicates if the first tab is fully visible */
17
+ this.firstItemVisible = true;
18
+ /** Indicates if the last tab is fully visible */
19
+ this.lastItemVisible = false;
20
+ this.initiatizeResizeObserver = () => {
21
+ if (!this.containerRef || this.resizeObserver)
22
+ return;
23
+ this.resizeObserver = new ResizeObserver(() => this.updateScrollState());
24
+ this.resizeObserver.observe(this.containerRef);
25
+ };
26
+ this.updateScrollState = () => {
27
+ if (!this.containerRef)
28
+ return;
29
+ const { scrollWidth, clientWidth } = this.containerRef;
30
+ const containerRect = this.containerRef.getBoundingClientRect();
31
+ const tabs = Array.from(this.tabElements);
32
+ // Check if content is scrollable
33
+ this.scrollable = scrollWidth > clientWidth;
34
+ if (!this.scrollable || tabs.length === 0) {
35
+ this.firstItemVisible = true;
36
+ this.lastItemVisible = true;
37
+ return;
38
+ }
39
+ const firstTab = tabs[0];
40
+ const firstTabRect = firstTab.getBoundingClientRect();
41
+ this.firstItemVisible = firstTabRect.left >= containerRect.left - 1;
42
+ const lastTab = tabs[tabs.length - 1];
43
+ const lastTabRect = lastTab.getBoundingClientRect();
44
+ this.lastItemVisible = lastTabRect.right <= containerRect.right + 1;
45
+ };
46
+ this.getVisibleTabOnLeft = () => {
47
+ if (!this.containerRef)
48
+ return null;
49
+ const containerRect = this.containerRef.getBoundingClientRect();
50
+ const tabs = Array.from(this.tabElements);
51
+ // Find first tab that's partially or fully visible from the left
52
+ for (const tab of tabs) {
53
+ const tabRect = tab.getBoundingClientRect();
54
+ if (tabRect.right > containerRect.left + 1) {
55
+ return tab;
56
+ }
57
+ }
58
+ return;
59
+ };
60
+ this.getVisibleTabOnRight = () => {
61
+ if (!this.containerRef)
62
+ return null;
63
+ const containerRect = this.containerRef.getBoundingClientRect();
64
+ const tabs = Array.from(this.tabElements);
65
+ for (let i = tabs.length - 1; i >= 0; i--) {
66
+ const tab = tabs[i];
67
+ const tabRect = tab.getBoundingClientRect();
68
+ if (tabRect.left < containerRect.right - 1) {
69
+ return tab;
70
+ }
71
+ }
72
+ return null;
73
+ };
74
+ this.scrollLeft = () => {
75
+ if (!this.containerRef)
76
+ return;
77
+ const visibleTab = this.getVisibleTabOnLeft();
78
+ if (!visibleTab)
79
+ return;
80
+ const tabs = Array.from(this.tabElements);
81
+ const currentIndex = tabs.indexOf(visibleTab);
82
+ const prevTab = currentIndex > 0 ? tabs[currentIndex - 1] : null;
83
+ if (!prevTab)
84
+ return;
85
+ const containerLeft = this.containerRef.getBoundingClientRect().left;
86
+ const prevTabLeft = prevTab.getBoundingClientRect().left;
87
+ const offset = prevTabLeft - containerLeft;
88
+ this.containerRef.scrollBy({
89
+ left: offset,
90
+ behavior: 'smooth'
91
+ });
92
+ };
93
+ this.scrollRight = () => {
94
+ if (!this.containerRef)
95
+ return;
96
+ const visibleTab = this.getVisibleTabOnRight();
97
+ if (!visibleTab)
98
+ return;
99
+ const tabs = Array.from(this.tabElements);
100
+ const currentIndex = tabs.indexOf(visibleTab);
101
+ const nextTab = currentIndex < tabs.length - 1 ? tabs[currentIndex + 1] : null;
102
+ if (!nextTab)
103
+ return;
104
+ const containerRight = this.containerRef.getBoundingClientRect().right;
105
+ const nextTabRight = nextTab.getBoundingClientRect().right;
106
+ const offset = nextTabRight - containerRight;
107
+ this.containerRef.scrollBy({
108
+ left: offset,
109
+ behavior: 'smooth'
110
+ });
111
+ };
112
+ this.scrollToActiveTab = (activeTabElement) => {
113
+ if (!this.containerRef || !this.scrollable)
114
+ return;
115
+ const activeTab = activeTabElement || this.host.querySelector('r-tab[active]');
116
+ if (!activeTab)
117
+ return;
118
+ const containerRect = this.containerRef.getBoundingClientRect();
119
+ const activeTabRect = activeTab.getBoundingClientRect();
120
+ // Check if already fully visible
121
+ const isVisible = activeTabRect.left >= containerRect.left &&
122
+ activeTabRect.right <= containerRect.right;
123
+ if (isVisible)
124
+ return;
125
+ // Center the active tab
126
+ const offset = (activeTabRect.left - containerRect.left) -
127
+ (containerRect.width / 2) +
128
+ (activeTabRect.width / 2);
129
+ this.containerRef.scrollBy({
130
+ left: offset,
131
+ behavior: 'smooth'
132
+ });
133
+ };
134
+ this.renderScrollButton = (direction, disabled, onClick, tooltip) => {
135
+ const iconName = direction === 'left' ? 'angle-left' : 'angle-right';
136
+ const button = (h("r-icon-button", { onRClick: onClick, disabled: disabled, name: iconName, size: "s", rTabindex: -1, class: "r-tabs-list--scroll-button" }));
137
+ if (tooltip) {
138
+ return (h("r-tooltip", { text: tooltip, position: "top" }, button));
139
+ }
140
+ return button;
141
+ };
142
+ }
143
+ /** Listen for "click" event on `<r-tab>` */
144
+ tabChangeAction(event) {
145
+ this.scrollToActiveTab(event.target);
146
+ }
147
+ /** `<r-tab>` group of elements */
148
+ get tabElements() {
149
+ return this.host.querySelectorAll('r-tab');
150
+ }
151
+ componentDidLoad() {
152
+ this.updateScrollState();
153
+ this.initiatizeResizeObserver();
154
+ this.scrollToActiveTab();
155
+ }
156
+ disconnectedCallback() {
157
+ var _a;
158
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
159
+ }
3
160
  render() {
4
- return (h(Host, { key: '98a63f5b2df8649a90efc639cf745537eb903446', role: "tablist" }, h("div", { key: 'f1f0ce63461fed127e2e0789e941404545265b51', class: "r-tabs-list" }, h("slot", { key: 'e8302171cd66fba6332ed3301be7370dff43e69d' }))));
161
+ return (h(Host, { key: '8191b15343491c66259b583930ee73916c6bbd9e', scrollable: `${this.scrollable}`, role: "tablist" }, h("div", { key: 'e5c2a308889986b80549aba5b9a7bec8e6961891', class: "r-tabs-list" }, this.scrollable &&
162
+ h("div", { key: '62e6abb4a9e5ff9c553162c6de4176c8ce4c0407', "aria-hidden": "true", class: "r-tabs-list--scroll-button-container" }, this.renderScrollButton('left', this.firstItemVisible, this.scrollLeft, this.scrollLeftTooltip), !this.firstItemVisible && h("div", { key: '62e5c2ca7e76323ff367940cd9ab1cb6e5b6db74', class: "r-tabs-list--scroll-indicator" })), h("div", { key: '5f0b264eb4abaf51d4e2f3a85a92d89ff9e378f5', class: "r-tabs-list--tabs-container", ref: (el) => this.containerRef = el, onScroll: this.updateScrollState }, h("slot", { key: '38f6060007491fa9b50cf7cf7d36372c32e63d97' })), this.scrollable &&
163
+ h("div", { key: 'd51473735f550b81b5ba630126fe3bcc41848648', "aria-hidden": "true", class: "r-tabs-list--scroll-button-container" }, !this.lastItemVisible && h("div", { key: '89d712984dd7797cbca0df86989cf8eedcd95a61', class: "r-tabs-list--scroll-indicator" }), this.renderScrollButton('right', this.lastItemVisible, this.scrollRight, this.scrollRightTooltip)))));
5
164
  }
6
165
  static get is() { return "r-tabs-list"; }
7
166
  static get encapsulation() { return "shadow"; }
@@ -15,4 +174,121 @@ export class RTabsList {
15
174
  "$": ["tabs-list.css"]
16
175
  };
17
176
  }
177
+ static get properties() {
178
+ return {
179
+ "variant": {
180
+ "type": "string",
181
+ "attribute": "variant",
182
+ "mutable": false,
183
+ "complexType": {
184
+ "original": "TabListVariant",
185
+ "resolved": "\"compact\" | \"expanded\"",
186
+ "references": {
187
+ "TabListVariant": {
188
+ "location": "import",
189
+ "path": "./exports",
190
+ "id": "src/components/tabs-list/exports.ts::TabListVariant"
191
+ }
192
+ }
193
+ },
194
+ "required": false,
195
+ "optional": false,
196
+ "docs": {
197
+ "tags": [{
198
+ "name": "defaulr",
199
+ "text": "'expanded'"
200
+ }],
201
+ "text": "Visual variant of the tab list"
202
+ },
203
+ "getter": false,
204
+ "setter": false,
205
+ "reflect": true,
206
+ "defaultValue": "'expanded'"
207
+ },
208
+ "border": {
209
+ "type": "string",
210
+ "attribute": "border",
211
+ "mutable": false,
212
+ "complexType": {
213
+ "original": "ActiveTabBorder",
214
+ "resolved": "\"branded\" | \"standard\"",
215
+ "references": {
216
+ "ActiveTabBorder": {
217
+ "location": "import",
218
+ "path": "./exports",
219
+ "id": "src/components/tabs-list/exports.ts::ActiveTabBorder"
220
+ }
221
+ }
222
+ },
223
+ "required": false,
224
+ "optional": false,
225
+ "docs": {
226
+ "tags": [{
227
+ "name": "default",
228
+ "text": "'standard'"
229
+ }],
230
+ "text": "Border style of the active tab"
231
+ },
232
+ "getter": false,
233
+ "setter": false,
234
+ "reflect": true,
235
+ "defaultValue": "'standard'"
236
+ },
237
+ "scrollLeftTooltip": {
238
+ "type": "string",
239
+ "attribute": "scroll-left-tooltip",
240
+ "mutable": false,
241
+ "complexType": {
242
+ "original": "string",
243
+ "resolved": "string",
244
+ "references": {}
245
+ },
246
+ "required": false,
247
+ "optional": false,
248
+ "docs": {
249
+ "tags": [],
250
+ "text": "Tooltip visibility for left scroll button"
251
+ },
252
+ "getter": false,
253
+ "setter": false,
254
+ "reflect": false
255
+ },
256
+ "scrollRightTooltip": {
257
+ "type": "string",
258
+ "attribute": "scroll-right-tooltip",
259
+ "mutable": false,
260
+ "complexType": {
261
+ "original": "string",
262
+ "resolved": "string",
263
+ "references": {}
264
+ },
265
+ "required": false,
266
+ "optional": false,
267
+ "docs": {
268
+ "tags": [],
269
+ "text": "Tooltip visibility for left right button"
270
+ },
271
+ "getter": false,
272
+ "setter": false,
273
+ "reflect": false
274
+ }
275
+ };
276
+ }
277
+ static get states() {
278
+ return {
279
+ "scrollable": {},
280
+ "firstItemVisible": {},
281
+ "lastItemVisible": {}
282
+ };
283
+ }
284
+ static get elementRef() { return "host"; }
285
+ static get listeners() {
286
+ return [{
287
+ "name": "tabChange",
288
+ "method": "tabChangeAction",
289
+ "target": undefined,
290
+ "capture": false,
291
+ "passive": false
292
+ }];
293
+ }
18
294
  }
@@ -76,7 +76,7 @@
76
76
  padding: var(--r-textarea--input--padding, var(--r-textarea--input--padding-top, 0.688em) var(--r-textarea--input--padding-right, 0.625em) var(--r-textarea--input--padding-bottom, 0.688em) var(--r-textarea--input--padding-left, 0.625em));
77
77
  margin-top: var(--r-textarea--input--margin-top, 0);
78
78
  resize: var(--r-textarea--input--resize, both);
79
- z-index: var(--r-textarea--input--z-index, 1);
79
+ z-index: var(--r-textarea--input--z-index, initial);
80
80
  outline: var(--r-textarea--input--outline, none);
81
81
  outline-offset: var(--r-textarea--input--outline-offset, 0);
82
82
  pointer-events: var(--r-textarea--input--pointer-events, auto);
@@ -31,23 +31,25 @@
31
31
  }
32
32
 
33
33
  :host([data-visually-hidden=true]) {
34
- --r-toast--host--transition: all 0.15s;
35
- --r-toast--host--transition-delay: 0.15s;
36
- --r-toast--host--opacity: 0;
37
- --r-toast--host--height-expanded: 0;
34
+ --r-toast--host--animation-name: fade-out;
35
+ }
36
+
37
+ :host(:not(:last-child)) {
38
+ margin-bottom: var(--r-toast-group--spacing, 0);
38
39
  }
39
40
 
40
41
  :host {
41
42
  animation-duration: var(--r-toast--host--animation-duration, 0.3s);
42
43
  animation-fill-mode: var(--r-toast--host--animation-fill-mode, forwards);
43
- animation-name: var(--r-toast--host--animation-name, none);
44
+ animation-name: var(--r-toast--host--animation-name, fade-in);
45
+ animation-timing-function: var(--r-toast--host--animation-timing-function, ease-in-out);
44
46
  box-sizing: var(--r-toast--host--box-sizing, border-box);
45
47
  display: var(--r-toast--host--display, block);
46
48
  height: var(--r-toast--host--height, var(--r-toast--host--height-expanded, auto));
47
49
  opacity: var(--r-toast--host--opacity, 1);
48
50
  overflow: var(--r-toast--host--overflow, hidden);
49
51
  position: var(--r-toast--host--position, relative);
50
- transition: var(--r-toast--host--transition, all 0.3s);
52
+ transition: var(--r-toast--host--transition, none);
51
53
  transition-delay: var(--r-toast--host--transition-delay, 0s);
52
54
  }
53
55
  :host ::slotted(p) {
@@ -77,11 +79,35 @@
77
79
  }
78
80
  @media (prefers-reduced-motion) {
79
81
  :host {
80
- --r-toast--transition: none;
81
- --r-toast--host--animation-name: none;
82
+ transition: none;
83
+ animation-name: none;
82
84
  }
83
85
  }
84
86
 
87
+ @keyframes fade-in {
88
+ from {
89
+ opacity: 0;
90
+ max-height: 0;
91
+ margin-bottom: 0;
92
+ }
93
+ to {
94
+ opacity: 1;
95
+ max-height: fit-content;
96
+ margin-bottom: var(--r-toast-group--spacing, 0);
97
+ }
98
+ }
99
+ @keyframes fade-out {
100
+ from {
101
+ opacity: 1;
102
+ max-height: fit-content;
103
+ margin-bottom: var(--r-toast-group--spacing, 0);
104
+ }
105
+ to {
106
+ opacity: 0;
107
+ max-height: 0;
108
+ margin-bottom: 0;
109
+ }
110
+ }
85
111
  .r-toast {
86
112
  font-family: var(--r-toast--font-family, var(--r-font-family-text, system-ui));
87
113
  font-size: var(--r-toast--font-size, var(--r-font-size-400, 1rem));
@@ -95,7 +121,7 @@
95
121
  border-color: var(--r-toast--border-color, var(--r-status-info-regular, #3e5c73));
96
122
  background-color: var(--r-toast--background-color, var(--r-status-info-soft, #f8fafb));
97
123
  box-sizing: var(--r-toast--box-sizing, border-box);
98
- transition: var(--r-toast--transition, all 0.3s);
124
+ transition: var(--r-toast--transition, none);
99
125
  }
100
126
  .r-toast--main {
101
127
  flex: var(--r-toast--content--flex, 1);
@@ -41,6 +41,7 @@ export class Toast {
41
41
  * @default 300
42
42
  * */
43
43
  this.delayBeforeRemoval = 300;
44
+ this.animationCompleted = false;
44
45
  /** Unique id for each accordion item/row */
45
46
  this.uniqueId = `r-toast-${Date.now().toString(32)}${Math.random().toString(32)}`.replace(/\./g, '');
46
47
  this.hasElContent = (selector) => {
@@ -59,6 +60,12 @@ export class Toast {
59
60
  clearTimeout(this.delayTimer);
60
61
  }, time);
61
62
  };
63
+ this.handleAnimationEnd = (event) => {
64
+ if (event.animationName === 'fade-out') {
65
+ this.animationCompleted = true;
66
+ this.toastDismissed.emit();
67
+ }
68
+ };
62
69
  this.handleTrailingButtonClick = () => {
63
70
  this.rClickToastTrailingIcon.emit();
64
71
  this.dismiss();
@@ -76,9 +83,15 @@ export class Toast {
76
83
  this.host.style.setProperty('--r-toast--host--height-expanded', `${this.host.offsetHeight}px`);
77
84
  this.isOpen = false;
78
85
  this.toastDismiss.emit();
86
+ this.animationCompleted = false;
79
87
  if (this.removalTimer)
80
88
  clearTimeout(this.removalTimer);
81
- this.removalTimer = setTimeout(() => this.host.remove(), this.delayBeforeRemoval);
89
+ this.removalTimer = setTimeout(() => {
90
+ if (!this.animationCompleted) {
91
+ this.toastDismissed.emit();
92
+ }
93
+ this.host.remove();
94
+ }, this.delayBeforeRemoval);
82
95
  }
83
96
  /**
84
97
  * Reveals the toast notification by setting it to a visible state.
@@ -170,6 +183,12 @@ export class Toast {
170
183
  componentWillLoad() {
171
184
  this.open ? this.reveal() : this.hide();
172
185
  }
186
+ componentDidLoad() {
187
+ this.host.addEventListener('animationend', this.handleAnimationEnd);
188
+ }
189
+ disconnectedCallback() {
190
+ this.host.removeEventListener('animationend', this.handleAnimationEnd);
191
+ }
173
192
  render() {
174
193
  const { headline, href, action, target, trailingIcon } = this;
175
194
  const hostAttrs = this.announced ? {
@@ -188,14 +207,14 @@ export class Toast {
188
207
  name: trailingIcon,
189
208
  size: 'm'
190
209
  };
191
- return (h(Host, Object.assign({ key: '11d9a9cce4598984682419e16e15fe7b729f3407' }, hostAttrs, { id: this.uniqueId, "data-visually-hidden": `${this.isOpen ? 'false' : 'true'}` }), h("div", { key: '54ec630d4a3ae1cd904eed72f4232188f1fd4449', class: "r-toast" }, this.hasLeading &&
192
- h("div", { key: 'ac681856ff541aa8d86be8b4c2e252c5768cc4d7', class: "r-toast--leading" }, this.hasLeadingSlot && h("slot", { key: 'f0fe00eedca4b8fa3515cf57c3eaaded40879fc7', name: "leading" }), this.leadingIconVisible && h("r-icon", Object.assign({ key: 'd5028dd6a0af6cbe6c8f602bf9de2cf0b5e23ed5', class: "r-toast--leading-icon" }, leadingIconAttrs))), h("div", { key: '9a093ec50d733c0b5d84802d4e6de301dced145f', class: "r-toast--main" }, this.hasHeadline &&
193
- h("h2", { key: '5fd2dd5139c14e7f95d12f987fa2aa14b746f9ee', class: "r-toast--headline" }, h("slot", { key: '9951ba737e8a10a1f9a68dc72c18f4b42645a13c', name: "headline" }, headline)), this.hasContent &&
194
- h("div", { key: 'd476014ac425fff629df7e17f8fd5bdd7dd508e2', class: "r-toast--content r-typography" }, h("slot", { key: '34d63dad6ff75a19f3faa4a20b683495ebfb0b0f', onSlotchange: this.handleSlotChange })), this.hasAction &&
195
- h("div", { key: '61ee7f4922349100f78d6dde6a55cf78ff1de2bd', class: "r-toast--action" }, h("slot", { key: '8e70ff93aac9ef4e086f539aba2797122dc5402e', name: "action" }, this.hasActionLink &&
196
- h("r-button", Object.assign({ key: '556f7182d22ac37ec60653da44667f9a4d2b6cab', class: "r-toast--action-link", variant: "text-inline", size: "small" }, actionAttrs), action)))), this.hasTrailing &&
197
- h("div", { key: '806708fbaec919dea26c83f0e2446a9b4c9377cb', class: "r-toast--trailing" }, this.hasTrailingSlot && h("slot", { key: '91f35c745b8de0797085a7829743415bfc5f2ce1', name: "trailing" }), this.isDismissManual &&
198
- h("r-icon-button", Object.assign({ key: '9fe07d3faeeda5cf46494167868dfc664f11d80f' }, trailingIconAttrs, { class: "r-toast--trailing-button", onClick: this.handleTrailingButtonClick, label: this.dismissLabel }), h("slot", { key: 'fc3bd145b42458c857d84cac443ccde89ca6c1db', name: "dismiss" }))))));
210
+ return (h(Host, Object.assign({ key: '72b7c716dc4cdb477d038c53d74909ccc25b2969' }, hostAttrs, { id: this.uniqueId, "data-visually-hidden": `${this.isOpen ? 'false' : 'true'}` }), h("div", { key: '1432abcf651e29aca897b15fe84f7f587ad276dc', class: "r-toast" }, this.hasLeading &&
211
+ h("div", { key: 'd7b672519074880fa6f6f3c4c2177dc11b73a872', class: "r-toast--leading" }, this.hasLeadingSlot && h("slot", { key: 'bbe0f9862ff7cb439116b2eb3041ce98ed1ddcb8', name: "leading" }), this.leadingIconVisible && h("r-icon", Object.assign({ key: 'ecf6d11d1a699b5d37d5a18eb9df678629cff3af', class: "r-toast--leading-icon" }, leadingIconAttrs))), h("div", { key: '2e90162bc7cb3144356efc4072db6d8743bb08d1', class: "r-toast--main" }, this.hasHeadline &&
212
+ h("h2", { key: 'd2872eb73463a0b074524d279f94c4482abe1e82', class: "r-toast--headline" }, h("slot", { key: '20086f692f4de101e874bef083dfaa299a09a849', name: "headline" }, headline)), this.hasContent &&
213
+ h("div", { key: '91cf6f661abe2442e362826b735c5448aeac8953', class: "r-toast--content r-typography" }, h("slot", { key: 'e156039d4cdbc81511cb8135570523b86b360007', onSlotchange: this.handleSlotChange })), this.hasAction &&
214
+ h("div", { key: '3e1e1d09dbbcd144c3ff426b0611ea9e2b8bf664', class: "r-toast--action" }, h("slot", { key: 'c746ab13ece27873eef3fbef5e8be29992f8a416', name: "action" }, this.hasActionLink &&
215
+ h("r-button", Object.assign({ key: '36a864ecd40815f2b0a7241d635d5a3966e75997', class: "r-toast--action-link", variant: "text-inline", size: "small" }, actionAttrs), action)))), this.hasTrailing &&
216
+ h("div", { key: 'becd53f1c89e40e314f79d45886151a8f56c6e84', class: "r-toast--trailing" }, this.hasTrailingSlot && h("slot", { key: '818cf3bb17290a498d7c626e64662e42a6d5242d', name: "trailing" }), this.isDismissManual &&
217
+ h("r-icon-button", Object.assign({ key: '28c2963f0a1f673bb72991ba6c888b99c48b69bb' }, trailingIconAttrs, { class: "r-toast--trailing-button", onClick: this.handleTrailingButtonClick, label: this.dismissLabel }), h("slot", { key: '437e527e868b58e47f6b972220ddf2c657d3a7f2', name: "dismiss" }))))));
199
218
  }
200
219
  static get is() { return "r-toast"; }
201
220
  static get encapsulation() { return "shadow"; }
@@ -606,6 +625,21 @@ export class Toast {
606
625
  "resolved": "any",
607
626
  "references": {}
608
627
  }
628
+ }, {
629
+ "method": "toastDismissed",
630
+ "name": "dismissed",
631
+ "bubbles": true,
632
+ "cancelable": true,
633
+ "composed": true,
634
+ "docs": {
635
+ "tags": [],
636
+ "text": "Emitted when the dismiss toast animation is complete\nand the element has fully disappeared from the view.\nFired by dismiss(), by the auto-dismiss timer (delay), by changing open property, and by the trailing\ndismiss button."
637
+ },
638
+ "complexType": {
639
+ "original": "any",
640
+ "resolved": "any",
641
+ "references": {}
642
+ }
609
643
  }];
610
644
  }
611
645
  static get methods() {
@@ -39,5 +39,5 @@
39
39
  display: var(--r-toast-group--display, flex);
40
40
  flex-direction: var(--r-toast-group--flex-direction, column);
41
41
  justify-content: var(--r-toast-group--justify-content, flex-start);
42
- gap: var(--r-toast-group--gap, var(--r-spacing-100, 1rem));
42
+ --r-toast-group--spacing: var(--r-spacing-100, 1rem);
43
43
  }
@@ -22,7 +22,7 @@ export class ToastGroup {
22
22
  this.observeSlotContentChange();
23
23
  }
24
24
  render() {
25
- return (h(Host, { key: 'bbb13408cb02b62fe5f6ab1c09548509bfb3a195' }, h("div", { key: 'd82f7deff5b66aa8f9e19d29a5b34fc4b984c94d', class: "r-toast-group" }, h("slot", { key: '02a49bceae7197f72d5b80ba7d71374345d0f0c7' }))));
25
+ return (h(Host, { key: 'fa291737910745721236d14e38c54e7bf351b85e' }, h("div", { key: 'b755a032ee5b1152846946df270fd69ef4370a1a', class: "r-toast-group" }, h("slot", { key: 'd73b1e701b6b27b2e46f7f130bee1a16af2de53e' }))));
26
26
  }
27
27
  static get is() { return "r-toast-group"; }
28
28
  static get encapsulation() { return "scoped"; }
@@ -355,7 +355,7 @@ export class Tooltip {
355
355
  role: 'tooltip',
356
356
  'aria-hidden': `${!isShown}`
357
357
  };
358
- return (h(Host, Object.assign({ key: '1b2ce4ee1a9f9ca227b96e567fb61b560858734e' }, hostAttrs, { onMouseenter: this.handleHover, onMouseleave: this.removeTooltip }), h("div", { key: '1379aefd4bf69b312a9ce3ef443f5e9fe970f09e', class: "r-tooltip" }, h("div", Object.assign({ key: '80f00e66c8f01bb0df9107943c15d6616e4e7197', class: "r-tooltip--trigger", onFocus: this.handleFocus, onBlur: this.removeTooltip }, triggerAttrs), h("slot", { key: '42e1453731bdd404083e11d3d2f0ae4603e4c57b' })), h("div", Object.assign({ key: '00aa4f22f9c3e40d1c8e86cdd950ef1d160e29cf', class: "r-tooltip--content", ref: (el) => this.tooltip = el }, contentAttrs), text), h("div", { key: 'b717d5e45d3f970ee87f409d61a6353fb138fc7b', ref: (el) => this.arrow = el, class: "r-tooltip--arrow" }))));
358
+ return (h(Host, Object.assign({ key: '9b3e1226c3aa4c7a2cdefe1be4da3891ecb962c7' }, hostAttrs, { onMouseenter: this.handleHover, onMouseleave: this.removeTooltip }), h("div", { key: 'baf56908fb53986eb5cba9114a8679956e13a6ea', class: "r-tooltip" }, h("div", Object.assign({ key: '9528f90cbe833ba2f7ad2abcae432e77bd9a9470', class: "r-tooltip--trigger", onFocus: this.handleFocus, onBlur: this.removeTooltip }, triggerAttrs), h("slot", { key: 'c8159d843ca32e08015187d82d95c4bab7965ddb' })), h("div", Object.assign({ key: 'c4c02a0b5b461d872b2ea504dc38eb3d69be24f0', class: "r-tooltip--content", ref: (el) => this.tooltip = el }, contentAttrs), text), h("div", { key: '5667fcd6378a28e3c713de840bf65dfa0e094a91', ref: (el) => this.arrow = el, class: "r-tooltip--arrow" }))));
359
359
  }
360
360
  static get is() { return "r-tooltip"; }
361
361
  static get encapsulation() { return "shadow"; }
@@ -388,7 +388,7 @@ export class Tooltip {
388
388
  },
389
389
  "getter": false,
390
390
  "setter": false,
391
- "reflect": false,
391
+ "reflect": true,
392
392
  "defaultValue": "''"
393
393
  },
394
394
  "position": {