@roadtrip/components 3.49.0 → 3.50.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/dist/cjs/road-badge_14.cjs.entry.js +52 -61
- package/dist/cjs/road-badge_14.cjs.entry.js.map +1 -1
- package/dist/collection/components/drawer/drawer.css +10 -4
- package/dist/collection/components/drawer/drawer.js +53 -62
- package/dist/collection/components/drawer/drawer.js.map +1 -1
- package/dist/esm/road-badge_14.entry.js +52 -61
- package/dist/esm/road-badge_14.entry.js.map +1 -1
- package/dist/html.html-data.json +3864 -0
- package/dist/roadtrip/{p-c58abbfb.entry.js → p-7df3bb5e.entry.js} +4 -4
- package/dist/roadtrip/p-7df3bb5e.entry.js.map +1 -0
- package/dist/roadtrip/roadtrip.esm.js +1 -1
- package/dist/types/components/drawer/drawer.d.ts +6 -6
- package/hydrate/index.js +53 -62
- package/hydrate/index.mjs +53 -62
- package/package.json +1 -1
- package/dist/roadtrip/p-c58abbfb.entry.js.map +0 -1
|
@@ -1893,7 +1893,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1893
1893
|
return trap;
|
|
1894
1894
|
};
|
|
1895
1895
|
|
|
1896
|
-
const drawerCss = ":host{--background:var(--road-surface);--color:var(--road-on-surface);--header-icon:var(--road-on-surface);--header-color:var(--road-on-surface);--header-background:var(--road-surface);--header-delimiter:0;--back-chevron-color:var(--road-icon);--max-height:auto;--z-index:10;position:fixed;top:0;left:0;z-index:var(--z-index);display:flex;justify-content:flex-start;width:100%;height:100%;overflow:hidden;font-family:var(--road-font, sans-serif);line-height:1.5;color:var(--color);visibility:hidden !important;opacity:0;transition:opacity 0.
|
|
1896
|
+
const drawerCss = ":host{--background:var(--road-surface);--color:var(--road-on-surface);--header-icon:var(--road-on-surface);--header-color:var(--road-on-surface);--header-background:var(--road-surface);--header-delimiter:0;--back-chevron-color:var(--road-icon);--max-height:auto;--z-index:10;position:fixed;top:0;left:0;z-index:var(--z-index);display:flex;justify-content:flex-start;width:100%;height:100%;overflow:hidden;font-family:var(--road-font, sans-serif);line-height:1.5;color:var(--color);visibility:hidden !important;opacity:0;transition:opacity 0.3s ease-out, visibility 0s linear 0.3s}.drawer-overlay{position:absolute;top:0;right:0;bottom:0;left:0;display:block;touch-action:none;cursor:pointer;background:var(--road-overlay)}.road-drawer-wrapper{width:100%}.road-drawer-wrapper .drawer-dialog{position:absolute;right:0;width:100%;pointer-events:none;transition:transform 0.3s ease-out;transform:translateX(-100%)}:host(.drawer-right){justify-content:flex-end}:host(.drawer-right) .road-drawer-wrapper .drawer-dialog{transform:translateX(100%)}:host(.drawer-left) .road-drawer-wrapper .drawer-dialog{left:0}:host(.drawer-bottom){align-items:flex-end}:host(.drawer-bottom) .road-drawer-wrapper .drawer-dialog{width:100%;max-height:var(--max-height);transform:translateY(100%)}:host(.drawer-bottom) .drawer-content{height:auto}.drawer-content{position:relative;display:flex;flex-direction:column;width:100%;height:100vh;max-height:100vh;pointer-events:auto;background-color:var(--background);background-clip:padding-box;box-shadow:var(--road-elevation-hight)}.drawer-header{display:flex;flex-shrink:0;align-items:center;justify-content:flex-end;color:var(--header-color);background:var(--header-background);border-color:var(--road-grey-300);border-style:solid;border-width:var(--header-delimiter)}.drawer-header road-icon{flex-shrink:0;color:var(--header-icon)}.drawer-footer{padding:var(--road-spacing-05);background-color:var(--road-surface)}.drawer-footer.remove-padding{padding:0}.drawer-header-inverse{--header-icon:var(--road-on-primary);--header-color:var(--road-on-primary);--header-background:var(--road-primary-variant);margin-bottom:2.5rem}.drawer-action,.drawer-close{display:flex;align-items:center;justify-content:center;padding:0.5rem;font-family:inherit;font-size:0.875rem;color:inherit;cursor:pointer;background:transparent;border:0;appearance:none;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}.drawer-header:not(.drawer-header-inverse) .drawer-action road-icon{color:var(--back-chevron-color)}.drawer-action~.drawer-title,.drawer-close~.drawer-title{padding-left:0}.drawer-action-left,.drawer-close-left{margin-right:auto}.drawer-title{display:flex;flex-grow:1;align-items:center;justify-content:center;padding-left:3.5rem;margin:0;font-size:var(--road-body-medium)}.drawer-body{overflow-y:auto;padding:0 var(--road-spacing-05) var(--road-spacing-05)}.drawer-body.remove-padding{padding:0}:host(.drawer-right) .drawer-body,:host(.drawer-left) .drawer-body{height:calc(100vh - 3.5rem)}.drawer-inner{padding:0 1rem 2.5rem}@media (min-width: 768px){.drawer-inner{padding:0 2rem 2.5rem}.drawer-body{padding:0 var(--road-spacing-08) var(--road-spacing-05)}.drawer-body.remove-padding{padding:0}.drawer-footer{padding:var(--road-spacing-05) var(--road-spacing-08)}.drawer-footer.remove-padding{padding:0}}:host(.drawer-open){visibility:visible !important;opacity:1;transition:opacity 0.3s ease-out, visibility 0s linear 0s}:host(.drawer-open) .road-drawer-wrapper .drawer-dialog{transform:none}";
|
|
1897
1897
|
const RoadDrawerStyle0 = drawerCss;
|
|
1898
1898
|
|
|
1899
1899
|
const Drawer = class {
|
|
@@ -1913,7 +1913,7 @@ const Drawer = class {
|
|
|
1913
1913
|
/**
|
|
1914
1914
|
* position of the drawer. e.g. left, right, bottom
|
|
1915
1915
|
*/
|
|
1916
|
-
this.position =
|
|
1916
|
+
this.position = "left";
|
|
1917
1917
|
/**
|
|
1918
1918
|
* Width of the drawer
|
|
1919
1919
|
*/
|
|
@@ -1942,6 +1942,19 @@ const Drawer = class {
|
|
|
1942
1942
|
const slot = event.target;
|
|
1943
1943
|
this.hasFooterContent = slot.assignedElements().length > 0;
|
|
1944
1944
|
};
|
|
1945
|
+
/**
|
|
1946
|
+
* Find and focus the first element in the drawer
|
|
1947
|
+
*/
|
|
1948
|
+
/**
|
|
1949
|
+
* Find and focus the first element in the drawer
|
|
1950
|
+
*/
|
|
1951
|
+
// private focusFirstElement() {
|
|
1952
|
+
// const firstElement = this.el.shadowRoot?.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [contenteditable], [tabindex]:not([tabindex="-1"])')[0] as HTMLElement;
|
|
1953
|
+
//
|
|
1954
|
+
// if (firstElement) {
|
|
1955
|
+
// firstElement.focus();
|
|
1956
|
+
// }
|
|
1957
|
+
// }
|
|
1945
1958
|
/**
|
|
1946
1959
|
* Close the dialog when clicking on the cross or layer
|
|
1947
1960
|
*/
|
|
@@ -1991,92 +2004,70 @@ const Drawer = class {
|
|
|
1991
2004
|
}
|
|
1992
2005
|
}, 100); // Timeout is used to ensure the drawer has been rendered when client wants to update the property at the same time
|
|
1993
2006
|
}
|
|
1994
|
-
// @Watch('isOpen')
|
|
1995
|
-
// handleOpen(openValue: boolean) {
|
|
1996
|
-
// if(openValue === true) {
|
|
1997
|
-
// this.onOpen.emit();
|
|
1998
|
-
// } else {
|
|
1999
|
-
// this.el.addEventListener('transitionend', () => {
|
|
2000
|
-
// this.onClose.emit();
|
|
2001
|
-
// this.el.shadowRoot && ((this.el.shadowRoot.querySelector('.drawer-body') as HTMLElement).scrollTop = 0);
|
|
2002
|
-
// }, { once: true});
|
|
2003
|
-
// }
|
|
2004
|
-
// }
|
|
2005
2007
|
handleOpen(openValue) {
|
|
2008
|
+
var _a;
|
|
2006
2009
|
if (openValue === true) {
|
|
2007
2010
|
this.onOpen.emit();
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
this.focusFirstElement();
|
|
2012
|
-
if ((_a = this.focusTrap) === null || _a === void 0 ? void 0 : _a.active) {
|
|
2013
|
-
(_b = this.focusTrap) === null || _b === void 0 ? void 0 : _b.unpause();
|
|
2011
|
+
this.el.addEventListener("transitionend", () => {
|
|
2012
|
+
if (this.enabledFocusTrap) {
|
|
2013
|
+
this.getOrCreateFocusTrap().activate();
|
|
2014
2014
|
}
|
|
2015
|
-
|
|
2016
|
-
(_c = this.focusTrap) === null || _c === void 0 ? void 0 : _c.activate();
|
|
2017
|
-
}
|
|
2018
|
-
}, 50); // Add a slight delay to ensure the element is rendered
|
|
2015
|
+
}, { once: true });
|
|
2019
2016
|
}
|
|
2020
2017
|
else {
|
|
2021
|
-
this.
|
|
2022
|
-
|
|
2023
|
-
(_a = this.focusTrap) === null || _a === void 0 ? void 0 : _a.deactivate();
|
|
2018
|
+
(_a = this.focusTrap) === null || _a === void 0 ? void 0 : _a.deactivate();
|
|
2019
|
+
this.el.addEventListener("transitionend", () => {
|
|
2024
2020
|
this.onClose.emit();
|
|
2025
|
-
this.el.shadowRoot &&
|
|
2021
|
+
this.el.shadowRoot &&
|
|
2022
|
+
(this.el.shadowRoot.querySelector(".drawer-body").scrollTop = 0);
|
|
2026
2023
|
}, { once: true });
|
|
2027
2024
|
}
|
|
2028
2025
|
}
|
|
2029
|
-
/**
|
|
2030
|
-
* Find and focus the first element in the drawer
|
|
2031
|
-
*/
|
|
2032
|
-
focusFirstElement() {
|
|
2033
|
-
var _a;
|
|
2034
|
-
const firstElement = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [contenteditable], [tabindex]:not([tabindex="-1"])')[0];
|
|
2035
|
-
if (firstElement) {
|
|
2036
|
-
firstElement.focus();
|
|
2037
|
-
}
|
|
2038
|
-
}
|
|
2039
2026
|
/**
|
|
2040
2027
|
* Close the dialog when press Escape key
|
|
2041
2028
|
*/
|
|
2042
2029
|
onEscape(event) {
|
|
2043
|
-
if (event.key ===
|
|
2030
|
+
if (event.key === "Escape" || event.key === "Esc") {
|
|
2044
2031
|
this.close();
|
|
2045
2032
|
}
|
|
2046
2033
|
}
|
|
2047
|
-
/**
|
|
2048
|
-
* Call close function when clicking an element with data-dismiss="modal" attribute
|
|
2049
|
-
*/
|
|
2050
2034
|
componentDidLoad() {
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
item.addEventListener('click', () => this.close());
|
|
2054
|
-
});
|
|
2055
|
-
const drawerContent = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(".road-drawer-wrapper");
|
|
2056
|
-
this.focusTrap = createFocusTrap(drawerContent, {
|
|
2057
|
-
onActivate: () => drawerContent === null || drawerContent === void 0 ? void 0 : drawerContent.classList.add("focus-trapped"),
|
|
2058
|
-
onDeactivate: () => drawerContent === null || drawerContent === void 0 ? void 0 : drawerContent.classList.remove("focus-trapped"),
|
|
2059
|
-
tabbableOptions: {
|
|
2060
|
-
getShadowRoot: true,
|
|
2061
|
-
},
|
|
2035
|
+
this.el.querySelectorAll('[data-dismiss="modal"]').forEach((item) => {
|
|
2036
|
+
item.addEventListener("click", () => this.close());
|
|
2062
2037
|
});
|
|
2063
2038
|
if (this.isOpen) {
|
|
2064
2039
|
this.handleOpen(true);
|
|
2065
2040
|
}
|
|
2066
2041
|
}
|
|
2042
|
+
getOrCreateFocusTrap() {
|
|
2043
|
+
var _a;
|
|
2044
|
+
if (!this.focusTrap) {
|
|
2045
|
+
const drawerContent = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(".road-drawer-wrapper");
|
|
2046
|
+
this.focusTrap = createFocusTrap(drawerContent, {
|
|
2047
|
+
onActivate: () => drawerContent === null || drawerContent === void 0 ? void 0 : drawerContent.classList.add("focus-trapped"),
|
|
2048
|
+
onDeactivate: () => drawerContent === null || drawerContent === void 0 ? void 0 : drawerContent.classList.remove("focus-trapped"),
|
|
2049
|
+
tabbableOptions: {
|
|
2050
|
+
getShadowRoot: true,
|
|
2051
|
+
},
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2054
|
+
return this.focusTrap;
|
|
2055
|
+
}
|
|
2067
2056
|
render() {
|
|
2068
2057
|
var _a, _b, _c;
|
|
2069
|
-
const drawerIsOpenClass = this.isOpen ?
|
|
2070
|
-
const removePaddingClass = this.removePadding ?
|
|
2071
|
-
const inverseHeaderClass = this.hasInverseHeader
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
const
|
|
2075
|
-
const
|
|
2058
|
+
const drawerIsOpenClass = this.isOpen ? "drawer-open" : "";
|
|
2059
|
+
const removePaddingClass = this.removePadding ? "remove-padding" : "";
|
|
2060
|
+
const inverseHeaderClass = this.hasInverseHeader
|
|
2061
|
+
? "drawer-header-inverse"
|
|
2062
|
+
: "";
|
|
2063
|
+
const ariaLabel = (_a = this.ariaLabel) !== null && _a !== void 0 ? _a : "drawer";
|
|
2064
|
+
const ariaLabelBack = (_b = this.ariaLabelBack) !== null && _b !== void 0 ? _b : "Back";
|
|
2065
|
+
const ariaLabelClose = (_c = this.ariaLabelClose) !== null && _c !== void 0 ? _c : "Close";
|
|
2066
|
+
const drawerDelimiterClass = this.drawerTitle && !this.hasInverseHeader ? "drawer-delimiter" : "";
|
|
2076
2067
|
const backIconElement = this.hasBackIcon ? (index.h("button", { type: "button", class: "drawer-action", "aria-label": ariaLabelBack, onClick: this.onClickBack }, index.h("road-icon", { icon: index$1.navigationChevron, rotate: "180" }), this.backText)) : null;
|
|
2077
2068
|
const closeIconElement = this.hasCloseIcon ? (index.h("button", { type: "button", class: "drawer-close", onClick: this.onClick, "aria-label": ariaLabelClose }, index.h("road-icon", { icon: index$1.navigationClose, "aria-hidden": "true" }))) : null;
|
|
2078
|
-
const drawerWidthValue = this.position ===
|
|
2079
|
-
return (index.h(index.Host, { key: '
|
|
2069
|
+
const drawerWidthValue = this.position === "bottom" ? "100%" : `${this.drawerWidth}px`;
|
|
2070
|
+
return (index.h(index.Host, { key: '283b6f1f997e92d9305b0ddf7191b568e1cd1587', class: `${drawerIsOpenClass} drawer-${this.position}`, tabindex: "0", role: "dialog", "aria-label": ariaLabel }, index.h("div", { key: 'cf42a9521522d35a5b2479ebabce388498cf410f', class: "road-drawer-wrapper" }, index.h("div", { key: 'a2c92e33dc4a758e5861c124d63f9228c75657a0', class: "drawer-overlay", onClick: this.onClick, tabindex: "-1" }), index.h("div", { key: 'b3cd8785eabb3dd1699248d48f8fc6179b24cbe3', class: "drawer-dialog", style: { maxWidth: drawerWidthValue }, role: "document" }, index.h("div", { key: '15da695b8585dedfb49b27882c84501b67a7a606', class: "drawer-content" }, index.h("header", { key: '601f047b868cf2794c7264ae6a12ba1d2699327e', class: `drawer-header ${inverseHeaderClass} ${drawerDelimiterClass}` }, backIconElement, this.drawerTitle ? (index.h("h2", { class: "drawer-title" }, this.drawerTitle)) : (index.h("div", { class: "drawer-title" }, index.h("slot", { name: "title" }))), closeIconElement), index.h("div", { key: '1cf0ad2e8393893fd26277179a9877961966e0f2', class: `drawer-body ${removePaddingClass}` }, index.h("slot", { key: '860817b92a5a97b74de9a60f403807ad9bc2b30d' })), index.h("footer", { key: '8b91123cef24c0f1fe3c36482f09f46558d575aa', class: `drawer-footer ${removePaddingClass}`, hidden: !this.hasFooterContent }, index.h("slot", { key: '1c459e52b42e59f2074ce603f57bcaec9a00d827', name: "footer", onSlotchange: this.onFooterSlotChange })))))));
|
|
2080
2071
|
}
|
|
2081
2072
|
get el() { return index.getElement(this); }
|
|
2082
2073
|
static get watchers() { return {
|