@riverty/web-components 6.0.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/custom-elements.json +259 -2
- package/dist/cjs/{index-DJ4H_bFj.js → index-BnETQtSf.js} +9 -382
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/r-accordion-panel.cjs.entry.js +1 -1
- package/dist/cjs/r-accordion-section.cjs.entry.js +1 -1
- package/dist/cjs/r-accordion-trigger.cjs.entry.js +1 -1
- package/dist/cjs/r-accordion.cjs.entry.js +1 -1
- package/dist/cjs/r-alert.cjs.entry.js +9 -6
- package/dist/cjs/r-badge.cjs.entry.js +1 -1
- package/dist/cjs/r-button.cjs.entry.js +6 -2
- package/dist/cjs/r-checkbox-group.cjs.entry.js +1 -1
- package/dist/cjs/r-checkbox.cjs.entry.js +4 -4
- package/dist/cjs/r-design-system-devtools.cjs.entry.js +1 -1
- package/dist/cjs/r-dialog.cjs.entry.js +1 -1
- package/dist/cjs/r-hint_2.cjs.entry.js +3 -3
- package/dist/cjs/r-icon-button_2.cjs.entry.js +27 -7
- package/dist/cjs/r-icon.cjs.entry.js +2 -2
- package/dist/cjs/r-illustration.cjs.entry.js +396 -0
- package/dist/cjs/r-input-code.cjs.entry.js +34 -12
- package/dist/cjs/r-input-date.cjs.entry.js +7 -7
- package/dist/cjs/r-input-password.cjs.entry.js +3 -3
- package/dist/cjs/r-input-phone-number.cjs.entry.js +4 -4
- package/dist/cjs/r-input.cjs.entry.js +8 -5
- package/dist/cjs/r-list-item.cjs.entry.js +17 -16
- package/dist/cjs/r-pagination.cjs.entry.js +56 -50
- package/dist/cjs/r-panel.cjs.entry.js +6 -6
- package/dist/cjs/r-popover-action.cjs.entry.js +2 -2
- package/dist/cjs/r-popover-content.cjs.entry.js +2 -2
- package/dist/cjs/r-popover-headline.cjs.entry.js +2 -2
- package/dist/cjs/r-popover-trigger.cjs.entry.js +2 -2
- package/dist/cjs/r-popover.cjs.entry.js +46 -5
- package/dist/cjs/r-progress-bar.cjs.entry.js +2 -2
- package/dist/cjs/r-radio-button-description.cjs.entry.js +2 -2
- package/dist/cjs/r-radio-button-leading.cjs.entry.js +2 -2
- package/dist/cjs/r-radio-button-title.cjs.entry.js +2 -2
- package/dist/cjs/r-radio-button-trailing.cjs.entry.js +2 -2
- package/dist/cjs/r-radio-button.cjs.entry.js +8 -7
- package/dist/cjs/r-radio-group.cjs.entry.js +83 -10
- package/dist/cjs/r-select-option.cjs.entry.js +2 -2
- package/dist/cjs/r-select.cjs.entry.js +6 -4
- package/dist/cjs/r-skip-link.cjs.entry.js +2 -2
- package/dist/cjs/r-stepper-item.cjs.entry.js +19 -4
- package/dist/cjs/r-stepper.cjs.entry.js +76 -3
- package/dist/cjs/r-tab-panel.cjs.entry.js +2 -2
- package/dist/cjs/r-tab.cjs.entry.js +7 -3
- package/dist/cjs/r-tabs-list.cjs.entry.js +161 -3
- package/dist/cjs/r-tabs.cjs.entry.js +35 -7
- package/dist/cjs/r-textarea.cjs.entry.js +2 -2
- package/dist/cjs/r-toast-group.cjs.entry.js +13 -4
- package/dist/cjs/r-toast.cjs.entry.js +104 -15
- package/dist/cjs/web-components.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/alert/alert.css +6 -6
- package/dist/collection/components/alert/alert.js +7 -4
- package/dist/collection/components/button/button.js +30 -1
- package/dist/collection/components/button/exports.js +1 -0
- package/dist/collection/components/checkbox/checkbox.js +3 -3
- package/dist/collection/components/icon/exports.js +1 -1
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/icon/riverty-kit.js +1 -1
- package/dist/collection/components/icon-button/icon-button.js +22 -3
- package/dist/collection/components/illustration/data.js +112 -0
- package/dist/collection/components/illustration/exports.js +3 -0
- package/dist/collection/components/illustration/illustration.js +540 -0
- package/dist/collection/components/illustration/illustration.scss +56 -0
- package/dist/collection/components/illustration/illustrations-ui-kit.js +2 -0
- package/dist/collection/components/input/exports.js +3 -0
- package/dist/collection/components/input/input.css +3 -0
- package/dist/collection/components/input/input.js +100 -3
- package/dist/collection/components/input-code/exports.js +2 -2
- package/dist/collection/components/input-code/input-code.css +6 -0
- package/dist/collection/components/input-code/input-code.js +54 -16
- package/dist/collection/components/input-date/input-date.js +6 -6
- package/dist/collection/components/input-password/input-password.js +2 -2
- package/dist/collection/components/input-phone-number/input-phone-number.js +3 -3
- package/dist/collection/components/label/label.js +2 -2
- package/dist/collection/components/list-item/list-item/list-item.css +46 -12
- package/dist/collection/components/list-item/list-item/list-item.js +34 -14
- package/dist/collection/components/pagination/pagination.css +33 -72
- package/dist/collection/components/pagination/pagination.js +194 -48
- package/dist/collection/components/panel/panel.css +40 -17
- package/dist/collection/components/panel/panel.js +6 -6
- package/dist/collection/components/popover/popover.css +0 -1
- package/dist/collection/components/popover/popover.js +44 -3
- package/dist/collection/components/popover-action/popover-action.js +1 -1
- package/dist/collection/components/popover-content/popover-content.js +1 -1
- package/dist/collection/components/popover-headline/popover-headline.js +1 -1
- package/dist/collection/components/popover-trigger/popover-trigger.js +1 -1
- package/dist/collection/components/progress-bar/progress-bar.js +1 -1
- package/dist/collection/components/radio-button/radio-button.js +7 -6
- package/dist/collection/components/radio-button-description/radio-button-description.js +1 -1
- package/dist/collection/components/radio-button-leading/radio-button-leading.js +1 -1
- package/dist/collection/components/radio-button-title/radio-button-title.js +1 -1
- package/dist/collection/components/radio-button-trailing/radio-button-trailing.js +1 -1
- package/dist/collection/components/radio-group/radio-group.css +4 -1
- package/dist/collection/components/radio-group/radio-group.js +100 -8
- package/dist/collection/components/select/select.js +5 -3
- package/dist/collection/components/select-option/select-option.js +1 -1
- package/dist/collection/components/skip-link/skip-link.js +1 -1
- package/dist/collection/components/stepper/stepper.css +5 -2
- package/dist/collection/components/stepper/stepper.js +125 -1
- package/dist/collection/components/stepper-item/stepper-item.css +25 -12
- package/dist/collection/components/stepper-item/stepper-item.js +36 -2
- package/dist/collection/components/tab/tab.css +29 -29
- package/dist/collection/components/tab/tab.js +5 -1
- package/dist/collection/components/tab-panel/tab-panel.js +1 -1
- package/dist/collection/components/tabs/tabs.js +34 -6
- package/dist/collection/components/tabs-list/exports.js +2 -0
- package/dist/collection/components/tabs-list/tabs-list.css +43 -2
- package/dist/collection/components/tabs-list/tabs-list.js +277 -1
- package/dist/collection/components/textarea/textarea.css +1 -1
- package/dist/collection/components/toast/toast.css +37 -11
- package/dist/collection/components/toast/toast.js +140 -18
- package/dist/collection/components/toast-group/toast-group.css +5 -11
- package/dist/collection/components/toast-group/toast-group.js +12 -3
- package/dist/collection/components/tooltip/tooltip.js +24 -4
- package/dist/esm/{index-Da7qOBFr.js → index-CTxpqopm.js} +9 -382
- package/dist/esm/loader.js +3 -3
- package/dist/esm/r-accordion-panel.entry.js +1 -1
- package/dist/esm/r-accordion-section.entry.js +1 -1
- package/dist/esm/r-accordion-trigger.entry.js +1 -1
- package/dist/esm/r-accordion.entry.js +1 -1
- package/dist/esm/r-alert.entry.js +9 -6
- package/dist/esm/r-badge.entry.js +1 -1
- package/dist/esm/r-button.entry.js +6 -2
- package/dist/esm/r-checkbox-group.entry.js +1 -1
- package/dist/esm/r-checkbox.entry.js +4 -4
- package/dist/esm/r-design-system-devtools.entry.js +1 -1
- package/dist/esm/r-dialog.entry.js +1 -1
- package/dist/esm/r-hint_2.entry.js +3 -3
- package/dist/esm/r-icon-button_2.entry.js +27 -7
- package/dist/esm/r-icon.entry.js +2 -2
- package/dist/esm/r-illustration.entry.js +394 -0
- package/dist/esm/r-input-code.entry.js +34 -12
- package/dist/esm/r-input-date.entry.js +7 -7
- package/dist/esm/r-input-password.entry.js +3 -3
- package/dist/esm/r-input-phone-number.entry.js +4 -4
- package/dist/esm/r-input.entry.js +8 -5
- package/dist/esm/r-list-item.entry.js +17 -16
- package/dist/esm/r-pagination.entry.js +56 -50
- package/dist/esm/r-panel.entry.js +6 -6
- package/dist/esm/r-popover-action.entry.js +2 -2
- package/dist/esm/r-popover-content.entry.js +2 -2
- package/dist/esm/r-popover-headline.entry.js +2 -2
- package/dist/esm/r-popover-trigger.entry.js +2 -2
- package/dist/esm/r-popover.entry.js +46 -5
- package/dist/esm/r-progress-bar.entry.js +2 -2
- package/dist/esm/r-radio-button-description.entry.js +2 -2
- package/dist/esm/r-radio-button-leading.entry.js +2 -2
- package/dist/esm/r-radio-button-title.entry.js +2 -2
- package/dist/esm/r-radio-button-trailing.entry.js +2 -2
- package/dist/esm/r-radio-button.entry.js +8 -7
- package/dist/esm/r-radio-group.entry.js +83 -10
- package/dist/esm/r-select-option.entry.js +2 -2
- package/dist/esm/r-select.entry.js +6 -4
- package/dist/esm/r-skip-link.entry.js +2 -2
- package/dist/esm/r-stepper-item.entry.js +19 -4
- package/dist/esm/r-stepper.entry.js +76 -3
- package/dist/esm/r-tab-panel.entry.js +2 -2
- package/dist/esm/r-tab.entry.js +7 -3
- package/dist/esm/r-tabs-list.entry.js +161 -3
- package/dist/esm/r-tabs.entry.js +35 -7
- package/dist/esm/r-textarea.entry.js +2 -2
- package/dist/esm/r-toast-group.entry.js +13 -4
- package/dist/esm/r-toast.entry.js +104 -15
- package/dist/esm/web-components.js +3 -3
- package/dist/types/components/alert/alert.d.ts +1 -0
- package/dist/types/components/button/button.d.ts +8 -1
- package/dist/types/components/button/exports.d.ts +2 -0
- package/dist/types/components/icon/{icon-data.d.ts → data.d.ts} +2 -1
- package/dist/types/components/icon/exports.d.ts +2 -1
- package/dist/types/components/icon/riverty-kit.d.ts +2 -1
- package/dist/types/components/icon-button/icon-button.d.ts +4 -0
- package/dist/types/components/illustration/data.d.ts +52 -0
- package/dist/types/components/illustration/exports.d.ts +23 -0
- package/dist/types/components/illustration/illustration.d.ts +51 -0
- package/dist/types/components/illustration/illustrations-ui-kit.d.ts +21 -0
- package/dist/types/components/input/exports.d.ts +6 -0
- package/dist/types/components/input/input.d.ts +31 -1
- package/dist/types/components/input-code/exports.d.ts +4 -4
- package/dist/types/components/input-code/input-code.d.ts +18 -4
- package/dist/types/components/list-item/list-item/list-item.d.ts +5 -3
- package/dist/types/components/pagination/pagination.d.ts +19 -0
- package/dist/types/components/popover/popover.d.ts +9 -0
- package/dist/types/components/radio-group/radio-group.d.ts +16 -0
- package/dist/types/components/stepper/stepper.d.ts +11 -0
- package/dist/types/components/stepper-item/stepper-item.d.ts +7 -0
- package/dist/types/components/tabs/tabs.d.ts +1 -0
- package/dist/types/components/tabs-list/exports.d.ts +4 -0
- package/dist/types/components/tabs-list/tabs-list.d.ts +38 -0
- package/dist/types/components/toast/toast.d.ts +20 -3
- package/dist/types/components/tooltip/tooltip.d.ts +5 -0
- package/dist/types/components.d.ts +360 -17
- package/dist/web-components/p-02b22f8e.entry.js +1 -0
- package/dist/web-components/{p-d054eb4d.entry.js → p-075a8dc8.entry.js} +1 -1
- package/dist/web-components/{p-8a66d20c.entry.js → p-0a34d33b.entry.js} +1 -1
- package/dist/web-components/{p-8c31cbd5.entry.js → p-10cc9983.entry.js} +1 -1
- package/dist/web-components/{p-d7726e46.entry.js → p-253068b9.entry.js} +1 -1
- package/dist/web-components/{p-3884c6e7.entry.js → p-3b8c8951.entry.js} +1 -1
- package/dist/web-components/{p-550e2237.entry.js → p-3beacdab.entry.js} +1 -1
- package/dist/web-components/{p-e2188953.entry.js → p-4214867d.entry.js} +1 -1
- package/dist/web-components/{p-3f60c6c0.entry.js → p-42c857e9.entry.js} +1 -1
- package/dist/web-components/{p-7fed6f4d.entry.js → p-44f87e16.entry.js} +1 -1
- package/dist/web-components/p-477614c5.entry.js +1 -0
- package/dist/web-components/{p-1da75540.entry.js → p-495ba3d2.entry.js} +1 -1
- package/dist/web-components/p-4de76291.entry.js +1 -0
- package/dist/web-components/{p-05738503.entry.js → p-55600d47.entry.js} +1 -1
- package/dist/web-components/p-562051aa.entry.js +1 -0
- package/dist/web-components/p-5b850e0f.entry.js +1 -0
- package/dist/web-components/p-6013dfc8.entry.js +1 -0
- package/dist/web-components/{p-6cc2ea2c.entry.js → p-62e7ae04.entry.js} +1 -1
- package/dist/web-components/p-71519d37.entry.js +1 -0
- package/dist/web-components/p-88f7b47f.entry.js +1 -0
- package/dist/web-components/p-8975a6a3.entry.js +1 -0
- package/dist/web-components/p-8e125826.entry.js +1 -0
- package/dist/web-components/p-91cc0bde.entry.js +1 -0
- package/dist/web-components/{p-0347feff.entry.js → p-93435fcd.entry.js} +1 -1
- package/dist/web-components/p-947969d7.entry.js +1 -0
- package/dist/web-components/p-95396b5c.entry.js +1 -0
- package/dist/web-components/p-9de3a1a5.entry.js +1 -0
- package/dist/web-components/p-9f583ed1.entry.js +1 -0
- package/dist/web-components/p-CTxpqopm.js +2 -0
- package/dist/web-components/{p-e5945c01.entry.js → p-a1086abe.entry.js} +1 -1
- package/dist/web-components/{p-f9d5004c.entry.js → p-bbba6d79.entry.js} +1 -1
- package/dist/web-components/{p-c478712b.entry.js → p-bde44ec4.entry.js} +1 -1
- package/dist/web-components/p-bfc7e6c0.entry.js +1 -0
- package/dist/web-components/p-c1030394.entry.js +1 -0
- package/dist/web-components/p-c1f59ed1.entry.js +1 -0
- package/dist/web-components/{p-26ef77d6.entry.js → p-c80a5541.entry.js} +1 -1
- package/dist/web-components/{p-9ef1bbee.entry.js → p-c96ee61a.entry.js} +1 -1
- package/dist/web-components/{p-8dac326b.entry.js → p-caf8f067.entry.js} +1 -1
- package/dist/web-components/p-cc363c3d.entry.js +1 -0
- package/dist/web-components/p-cf4ff357.entry.js +1 -0
- package/dist/web-components/p-d0310ed4.entry.js +1 -0
- package/dist/web-components/p-d1412932.entry.js +1 -0
- package/dist/web-components/{p-62b788bf.entry.js → p-d2447e30.entry.js} +1 -1
- package/dist/web-components/p-dc9cca06.entry.js +1 -0
- package/dist/web-components/p-e5b943a2.entry.js +1 -0
- package/dist/web-components/{p-4cc58c6a.entry.js → p-e67b13df.entry.js} +1 -1
- package/dist/web-components/p-efec231a.entry.js +1 -0
- package/dist/web-components/{p-4595fa8e.entry.js → p-f867e4c3.entry.js} +1 -1
- package/dist/web-components/web-components.esm.js +1 -1
- package/package.json +5 -2
- package/dist/collection/components/icon/bundled-icons/all-kit.json +0 -1
- package/dist/collection/components/icon/bundled-icons/riverty-kit.json +0 -1
- package/dist/web-components/bundled-icons/all-kit.json +0 -1
- package/dist/web-components/bundled-icons/riverty-kit.json +0 -1
- package/dist/web-components/p-0e4c8bf1.entry.js +0 -1
- package/dist/web-components/p-3a5a67e7.entry.js +0 -1
- package/dist/web-components/p-4254a383.entry.js +0 -1
- package/dist/web-components/p-5441b746.entry.js +0 -1
- package/dist/web-components/p-589baaf9.entry.js +0 -1
- package/dist/web-components/p-60341de2.entry.js +0 -1
- package/dist/web-components/p-60ca994e.entry.js +0 -1
- package/dist/web-components/p-6303b9fe.entry.js +0 -1
- package/dist/web-components/p-63fd817d.entry.js +0 -1
- package/dist/web-components/p-673dbfd0.entry.js +0 -1
- package/dist/web-components/p-67fa3f84.entry.js +0 -1
- package/dist/web-components/p-6a4f3836.entry.js +0 -1
- package/dist/web-components/p-70784685.entry.js +0 -1
- package/dist/web-components/p-8b4d2448.entry.js +0 -1
- package/dist/web-components/p-Da7qOBFr.js +0 -2
- package/dist/web-components/p-a0dbde7c.entry.js +0 -1
- package/dist/web-components/p-a71485d8.entry.js +0 -1
- package/dist/web-components/p-a7d22c76.entry.js +0 -1
- package/dist/web-components/p-ae251d2f.entry.js +0 -1
- package/dist/web-components/p-b98ab649.entry.js +0 -1
- package/dist/web-components/p-b9e3b3d6.entry.js +0 -1
- package/dist/web-components/p-c1e748f2.entry.js +0 -1
- package/dist/web-components/p-d433a828.entry.js +0 -1
- package/dist/web-components/p-d819c8e5.entry.js +0 -1
- package/dist/web-components/p-f7adb875.entry.js +0 -1
- /package/dist/collection/components/icon/{icon-data.js → data.js} +0 -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: '
|
|
161
|
+
return (h(Host, { key: '19666af123fe058aa3e654c153ad84ec16861a59', scrollable: `${this.scrollable}`, role: "tablist" }, h("div", { key: '5de7241f57b419133f81ae565bf517873a8e9268', class: "r-tabs-list" }, this.scrollable &&
|
|
162
|
+
h("div", { key: 'ff5edcbb61dd4ba9be3e0baf22822edbcbf8ec6d', "aria-hidden": "true", class: "r-tabs-list--scroll-button-container" }, this.renderScrollButton('left', this.firstItemVisible, this.scrollLeft, this.scrollLeftTooltip), !this.firstItemVisible && h("div", { key: '76fbeab529e2a7869ac7e946b1c0863969114888', class: "r-tabs-list--scroll-indicator" })), h("div", { key: 'd520b386242700c000daf85eba8d50fb014fc616', class: "r-tabs-list--tabs-container", ref: (el) => this.containerRef = el, onScroll: this.updateScrollState }, h("slot", { key: 'f8534275445ed4d32154519f0a8f592ee7ea3353' })), this.scrollable &&
|
|
163
|
+
h("div", { key: '8ca03d4864eba5af975de4dd6dc6fd3c3e8be108', "aria-hidden": "true", class: "r-tabs-list--scroll-button-container" }, !this.lastItemVisible && h("div", { key: '1a0534b79bbe3273a73f48530a3a17ccac0d7826', 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,
|
|
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--
|
|
35
|
-
--r-toast--host--
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
--r-toast--host--animation-duration: 0.2s;
|
|
35
|
+
--r-toast--host--animation-name: fade-out;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host(:not(:last-child)) {
|
|
39
|
+
margin-bottom: var(--r-toast-group--spacing, 0);
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
:host {
|
|
41
43
|
animation-duration: var(--r-toast--host--animation-duration, 0.3s);
|
|
42
44
|
animation-fill-mode: var(--r-toast--host--animation-fill-mode, forwards);
|
|
43
|
-
animation-name: var(--r-toast--host--animation-name,
|
|
45
|
+
animation-name: var(--r-toast--host--animation-name, fade-in);
|
|
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,
|
|
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) {
|
|
@@ -65,8 +67,8 @@
|
|
|
65
67
|
--r-button--border-color: transparent;
|
|
66
68
|
--r-button--background-color: transparent;
|
|
67
69
|
position: relative;
|
|
68
|
-
top: -8px;
|
|
69
|
-
right: -8px;
|
|
70
|
+
margin-top: -8px;
|
|
71
|
+
margin-right: -8px;
|
|
70
72
|
}
|
|
71
73
|
:host .r-toast--trailing-button:hover {
|
|
72
74
|
--r-button--color: var(--r-text-strong, #000000);
|
|
@@ -77,11 +79,33 @@
|
|
|
77
79
|
}
|
|
78
80
|
@media (prefers-reduced-motion) {
|
|
79
81
|
:host {
|
|
80
|
-
|
|
81
|
-
|
|
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
|
+
}
|
|
92
|
+
to {
|
|
93
|
+
opacity: 1;
|
|
94
|
+
max-height: var(--r-toast--host--height-expanded);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
@keyframes fade-out {
|
|
98
|
+
from {
|
|
99
|
+
opacity: 1;
|
|
100
|
+
max-height: var(--r-toast--host--height-expanded);
|
|
101
|
+
margin-top: var(--r-spacing-100, 1rem);
|
|
102
|
+
}
|
|
103
|
+
to {
|
|
104
|
+
opacity: 0;
|
|
105
|
+
max-height: 0;
|
|
106
|
+
margin-top: 0;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
85
109
|
.r-toast {
|
|
86
110
|
font-family: var(--r-toast--font-family, var(--r-font-family-text, system-ui));
|
|
87
111
|
font-size: var(--r-toast--font-size, var(--r-font-size-400, 1rem));
|
|
@@ -95,10 +119,11 @@
|
|
|
95
119
|
border-color: var(--r-toast--border-color, var(--r-status-info-regular, #3e5c73));
|
|
96
120
|
background-color: var(--r-toast--background-color, var(--r-status-info-soft, #f8fafb));
|
|
97
121
|
box-sizing: var(--r-toast--box-sizing, border-box);
|
|
98
|
-
transition: var(--r-toast--transition,
|
|
122
|
+
transition: var(--r-toast--transition, none);
|
|
99
123
|
}
|
|
100
124
|
.r-toast--main {
|
|
101
125
|
flex: var(--r-toast--content--flex, 1);
|
|
126
|
+
word-break: var(--r-toast--content--word-break, break-word);
|
|
102
127
|
}
|
|
103
128
|
.r-toast--leading-icon {
|
|
104
129
|
color: var(--r-toast--leading-icon--color, var(--r-status-info-regular, #3e5c73));
|
|
@@ -119,6 +144,7 @@
|
|
|
119
144
|
font-size: var(--r-toast--content--font-size, var(--r-font-size-300, 0.875rem));
|
|
120
145
|
font-weight: var(--r-toast--content--font-weight, var(--r-font-weight-regular, 400));
|
|
121
146
|
margin-top: var(--r-toast--content--margin-top, 0);
|
|
147
|
+
word-break: var(--r-toast--content--word-break, break-word);
|
|
122
148
|
}
|
|
123
149
|
.r-toast--action {
|
|
124
150
|
display: var(--r-toast--action--display, flex);
|
|
@@ -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,22 @@ 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
|
+
// Only emit if still connected to DOM
|
|
67
|
+
if (this.host.isConnected) {
|
|
68
|
+
this.toastDismissed.emit();
|
|
69
|
+
}
|
|
70
|
+
// Clear height after fade-out completes as final cleanup
|
|
71
|
+
this.host.style.setProperty('--r-toast--host--height-expanded', null);
|
|
72
|
+
}
|
|
73
|
+
else if (event.animationName === 'fade-in') {
|
|
74
|
+
// Clear height restriction after fade-in completes to allow natural resizing
|
|
75
|
+
// The toast can now grow/shrink dynamically without animation constraints
|
|
76
|
+
this.host.style.setProperty('--r-toast--host--height-expanded', null);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
62
79
|
this.handleTrailingButtonClick = () => {
|
|
63
80
|
this.rClickToastTrailingIcon.emit();
|
|
64
81
|
this.dismiss();
|
|
@@ -73,12 +90,29 @@ export class Toast {
|
|
|
73
90
|
* hide the toast before the auto-dismiss timer expires.
|
|
74
91
|
*/
|
|
75
92
|
async dismiss() {
|
|
76
|
-
|
|
93
|
+
// Re-measure height before fade-out to ensure smooth collapse animation
|
|
94
|
+
// This captures the current natural height for the animation
|
|
95
|
+
this.updateHeightVariable();
|
|
77
96
|
this.isOpen = false;
|
|
78
97
|
this.toastDismiss.emit();
|
|
98
|
+
this.animationCompleted = false;
|
|
79
99
|
if (this.removalTimer)
|
|
80
100
|
clearTimeout(this.removalTimer);
|
|
81
|
-
this.removalTimer = setTimeout(() =>
|
|
101
|
+
this.removalTimer = setTimeout(() => {
|
|
102
|
+
if (!this.animationCompleted && this.host.isConnected) {
|
|
103
|
+
this.toastDismissed.emit();
|
|
104
|
+
}
|
|
105
|
+
// Safely remove from DOM - check parent exists and contains this element
|
|
106
|
+
if (this.host.isConnected && this.host.parentNode) {
|
|
107
|
+
try {
|
|
108
|
+
this.host.remove();
|
|
109
|
+
}
|
|
110
|
+
catch (e) {
|
|
111
|
+
// In test environments, element may have already been removed
|
|
112
|
+
// or DOM structure changed - silently ignore
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}, this.delayBeforeRemoval);
|
|
82
116
|
}
|
|
83
117
|
/**
|
|
84
118
|
* Reveals the toast notification by setting it to a visible state.
|
|
@@ -86,27 +120,62 @@ export class Toast {
|
|
|
86
120
|
* automatically dismiss the toast after the specified duration.
|
|
87
121
|
*/
|
|
88
122
|
async reveal() {
|
|
123
|
+
// Measure height for smooth fade-in animation
|
|
124
|
+
await this.measureAndPrepareHeight();
|
|
89
125
|
this.isOpen = true;
|
|
90
|
-
|
|
126
|
+
// Only emit if still connected to DOM
|
|
127
|
+
if (this.host.isConnected) {
|
|
128
|
+
this.toastReveal.emit();
|
|
129
|
+
}
|
|
91
130
|
if (this.delayTimer)
|
|
92
131
|
clearTimeout(this.delayTimer);
|
|
93
132
|
if (this.isDismissManual)
|
|
94
133
|
return;
|
|
95
134
|
if (this.hasDelay)
|
|
96
135
|
this.startDelayTimer();
|
|
136
|
+
return this;
|
|
97
137
|
}
|
|
98
138
|
/**
|
|
99
139
|
* Hides toast, keeps it in dom.
|
|
100
140
|
* */
|
|
101
141
|
async hide() {
|
|
142
|
+
this.updateHeightVariable();
|
|
102
143
|
this.isOpen = false;
|
|
103
|
-
|
|
144
|
+
// Only emit if still connected to DOM
|
|
145
|
+
if (this.host.isConnected) {
|
|
146
|
+
this.toastHide.emit();
|
|
147
|
+
}
|
|
148
|
+
return this;
|
|
104
149
|
}
|
|
105
150
|
/**
|
|
106
151
|
* Toggles visibility of the toast.
|
|
107
152
|
* */
|
|
108
153
|
async toggle() {
|
|
109
154
|
this.isOpen ? this.hide() : this.reveal();
|
|
155
|
+
return this;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Measures the natural height of toast and prepares it for reveal animation.
|
|
159
|
+
* This should be called on newly added toasts before they are revealed.
|
|
160
|
+
*/
|
|
161
|
+
async measureAndPrepareHeight() {
|
|
162
|
+
return new Promise((resolve) => {
|
|
163
|
+
requestAnimationFrame(() => {
|
|
164
|
+
// Temporarily override animation to prevent visual glitches during measurement
|
|
165
|
+
const tempStyle = this.host.style.cssText;
|
|
166
|
+
this.host.style.cssText = tempStyle + '; animation: none !important; max-height: none !important; height: auto !important;';
|
|
167
|
+
// Force reflow and measure
|
|
168
|
+
this.host.offsetHeight;
|
|
169
|
+
const height = this.host.scrollHeight;
|
|
170
|
+
// Restore original style
|
|
171
|
+
this.host.style.cssText = tempStyle;
|
|
172
|
+
// Set the measured height for animation
|
|
173
|
+
if (height > 0) {
|
|
174
|
+
this.host.style.setProperty('--r-toast--host--height-expanded', `${height}px`);
|
|
175
|
+
}
|
|
176
|
+
resolve();
|
|
177
|
+
});
|
|
178
|
+
});
|
|
110
179
|
}
|
|
111
180
|
handleOpenChange() {
|
|
112
181
|
this.isOpen ? this.hide() : this.reveal();
|
|
@@ -168,7 +237,28 @@ export class Toast {
|
|
|
168
237
|
}
|
|
169
238
|
}
|
|
170
239
|
componentWillLoad() {
|
|
171
|
-
|
|
240
|
+
// Set initial state but don't trigger reveal yet - let mutation observer handle it
|
|
241
|
+
this.isOpen = this.open;
|
|
242
|
+
}
|
|
243
|
+
async componentDidLoad() {
|
|
244
|
+
this.host.addEventListener('animationend', this.handleAnimationEnd);
|
|
245
|
+
// Measure and store the toast height for smooth initial fade-in animation
|
|
246
|
+
await this.measureAndPrepareHeight();
|
|
247
|
+
// Start auto-dismiss timer if configured and toast is initially open
|
|
248
|
+
if (this.isOpen && !this.isDismissManual && this.hasDelay) {
|
|
249
|
+
this.startDelayTimer();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
updateHeightVariable() {
|
|
253
|
+
// Use requestAnimationFrame to ensure the element is fully rendered
|
|
254
|
+
requestAnimationFrame(() => {
|
|
255
|
+
if (this.host.offsetHeight > 0) {
|
|
256
|
+
this.host.style.setProperty('--r-toast--host--height-expanded', `${this.host.offsetHeight}px`);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
disconnectedCallback() {
|
|
261
|
+
this.host.removeEventListener('animationend', this.handleAnimationEnd);
|
|
172
262
|
}
|
|
173
263
|
render() {
|
|
174
264
|
const { headline, href, action, target, trailingIcon } = this;
|
|
@@ -188,14 +278,14 @@ export class Toast {
|
|
|
188
278
|
name: trailingIcon,
|
|
189
279
|
size: 'm'
|
|
190
280
|
};
|
|
191
|
-
return (h(Host, Object.assign({ key: '
|
|
192
|
-
h("div", { key: '
|
|
193
|
-
h("h2", { key: '
|
|
194
|
-
h("div", { key: '
|
|
195
|
-
h("div", { key: '
|
|
196
|
-
h("r-button", Object.assign({ key: '
|
|
197
|
-
h("div", { key: '
|
|
198
|
-
h("r-icon-button", Object.assign({ key: '
|
|
281
|
+
return (h(Host, Object.assign({ key: '4fa8a3d2db292941933f73437d823f3f6581d626' }, hostAttrs, { id: this.uniqueId, "data-visually-hidden": `${this.isOpen ? 'false' : 'true'}`, style: { visibility: this.isOpen ? 'visible' : 'hidden' } }), h("div", { key: '20506092a2459d836918da00f1670cf18730a42c', class: "r-toast" }, this.hasLeading &&
|
|
282
|
+
h("div", { key: '384ce331ff3825bc01323bbb6f3972ccd4198223', class: "r-toast--leading" }, this.hasLeadingSlot && h("slot", { key: 'eb455c5729d37431b8576dfcaff6eceead5000bb', name: "leading" }), this.leadingIconVisible && h("r-icon", Object.assign({ key: '3b0b3e9d9516a072d5c3b5ca50ab3353cdf20053', class: "r-toast--leading-icon" }, leadingIconAttrs))), h("div", { key: 'dcfc949dda66a2437cbb4b3e2847266e55ab83d6', class: "r-toast--main" }, this.hasHeadline &&
|
|
283
|
+
h("h2", { key: 'c1abf4f2b6abc7b53db6727ff09f027d4b2a940d', class: "r-toast--headline" }, h("slot", { key: '9b6a57199eac2a4e0f96d38cc0b3d02adc2bb279', name: "headline" }, headline)), this.hasContent &&
|
|
284
|
+
h("div", { key: '6c182bd58efe6cd404ae7b20ee2464f3965b889d', class: "r-toast--content r-typography" }, h("slot", { key: 'a49fd6e859f1b512069fc3bed9c0c21da35d78cc', onSlotchange: this.handleSlotChange })), this.hasAction &&
|
|
285
|
+
h("div", { key: 'b0282c4677483b96b3eac7ddbdb2e13ae245ebe2', class: "r-toast--action" }, h("slot", { key: 'e267d02a4e39a443865c1c0a62f3d6ed06e2a319', name: "action" }, this.hasActionLink &&
|
|
286
|
+
h("r-button", Object.assign({ key: '8785094717619bd69c5e711873598b2fb7eeb5be', class: "r-toast--action-link", variant: "text-inline", size: "small" }, actionAttrs), action)))), this.hasTrailing &&
|
|
287
|
+
h("div", { key: '066ecbc6346ed516aa9dd193505a26544bbdf92f', class: "r-toast--trailing" }, this.hasTrailingSlot && h("slot", { key: '890fd983d1208ea514b89aeaf394ae82c1d1ec55', name: "trailing" }), this.isDismissManual &&
|
|
288
|
+
h("r-icon-button", Object.assign({ key: '2b9e06adc46cf1a726d5d78f7cedb2d1405b4c72' }, trailingIconAttrs, { class: "r-toast--trailing-button", onClick: this.handleTrailingButtonClick, label: this.dismissLabel }), h("slot", { key: '7349c7b3422f194852609c2cdf150a5dc4498aa9', name: "dismiss" }))))));
|
|
199
289
|
}
|
|
200
290
|
static get is() { return "r-toast"; }
|
|
201
291
|
static get encapsulation() { return "shadow"; }
|
|
@@ -606,6 +696,21 @@ export class Toast {
|
|
|
606
696
|
"resolved": "any",
|
|
607
697
|
"references": {}
|
|
608
698
|
}
|
|
699
|
+
}, {
|
|
700
|
+
"method": "toastDismissed",
|
|
701
|
+
"name": "dismissed",
|
|
702
|
+
"bubbles": true,
|
|
703
|
+
"cancelable": true,
|
|
704
|
+
"composed": true,
|
|
705
|
+
"docs": {
|
|
706
|
+
"tags": [],
|
|
707
|
+
"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."
|
|
708
|
+
},
|
|
709
|
+
"complexType": {
|
|
710
|
+
"original": "any",
|
|
711
|
+
"resolved": "any",
|
|
712
|
+
"references": {}
|
|
713
|
+
}
|
|
609
714
|
}];
|
|
610
715
|
}
|
|
611
716
|
static get methods() {
|
|
@@ -629,7 +734,7 @@ export class Toast {
|
|
|
629
734
|
},
|
|
630
735
|
"reveal": {
|
|
631
736
|
"complexType": {
|
|
632
|
-
"signature": "() => Promise<
|
|
737
|
+
"signature": "() => Promise<this>",
|
|
633
738
|
"parameters": [],
|
|
634
739
|
"references": {
|
|
635
740
|
"Promise": {
|
|
@@ -637,7 +742,7 @@ export class Toast {
|
|
|
637
742
|
"id": "global::Promise"
|
|
638
743
|
}
|
|
639
744
|
},
|
|
640
|
-
"return": "Promise<
|
|
745
|
+
"return": "Promise<this>"
|
|
641
746
|
},
|
|
642
747
|
"docs": {
|
|
643
748
|
"text": "Reveals the toast notification by setting it to a visible state. \nIf the auto-dismiss delay is enabled, it will start the timer to \nautomatically dismiss the toast after the specified duration.",
|
|
@@ -646,7 +751,7 @@ export class Toast {
|
|
|
646
751
|
},
|
|
647
752
|
"hide": {
|
|
648
753
|
"complexType": {
|
|
649
|
-
"signature": "() => Promise<
|
|
754
|
+
"signature": "() => Promise<this>",
|
|
650
755
|
"parameters": [],
|
|
651
756
|
"references": {
|
|
652
757
|
"Promise": {
|
|
@@ -654,7 +759,7 @@ export class Toast {
|
|
|
654
759
|
"id": "global::Promise"
|
|
655
760
|
}
|
|
656
761
|
},
|
|
657
|
-
"return": "Promise<
|
|
762
|
+
"return": "Promise<this>"
|
|
658
763
|
},
|
|
659
764
|
"docs": {
|
|
660
765
|
"text": "Hides toast, keeps it in dom.",
|
|
@@ -662,6 +767,23 @@ export class Toast {
|
|
|
662
767
|
}
|
|
663
768
|
},
|
|
664
769
|
"toggle": {
|
|
770
|
+
"complexType": {
|
|
771
|
+
"signature": "() => Promise<this>",
|
|
772
|
+
"parameters": [],
|
|
773
|
+
"references": {
|
|
774
|
+
"Promise": {
|
|
775
|
+
"location": "global",
|
|
776
|
+
"id": "global::Promise"
|
|
777
|
+
}
|
|
778
|
+
},
|
|
779
|
+
"return": "Promise<this>"
|
|
780
|
+
},
|
|
781
|
+
"docs": {
|
|
782
|
+
"text": "Toggles visibility of the toast.",
|
|
783
|
+
"tags": []
|
|
784
|
+
}
|
|
785
|
+
},
|
|
786
|
+
"measureAndPrepareHeight": {
|
|
665
787
|
"complexType": {
|
|
666
788
|
"signature": "() => Promise<void>",
|
|
667
789
|
"parameters": [],
|
|
@@ -674,7 +796,7 @@ export class Toast {
|
|
|
674
796
|
"return": "Promise<void>"
|
|
675
797
|
},
|
|
676
798
|
"docs": {
|
|
677
|
-
"text": "
|
|
799
|
+
"text": "Measures the natural height of toast and prepares it for reveal animation.\nThis should be called on newly added toasts before they are revealed.",
|
|
678
800
|
"tags": []
|
|
679
801
|
}
|
|
680
802
|
}
|