@roadtrip/components 3.50.0 → 3.51.1
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 +3 -2
- package/dist/cjs/road-badge_14.cjs.entry.js.map +1 -1
- package/dist/collection/components/drawer/drawer.css +2 -0
- package/dist/collection/components/drawer/drawer.js +2 -1
- package/dist/collection/components/drawer/drawer.js.map +1 -1
- package/dist/collection/components/drawer/drawer.stories.js +1 -1
- package/dist/esm/road-badge_14.entry.js +3 -2
- package/dist/esm/road-badge_14.entry.js.map +1 -1
- package/dist/roadtrip/{p-7df3bb5e.entry.js → p-6a8da86b.entry.js} +2 -2
- package/dist/roadtrip/p-6a8da86b.entry.js.map +1 -0
- package/dist/roadtrip/roadtrip.esm.js +1 -1
- package/hydrate/index.js +4 -3
- package/hydrate/index.mjs +4 -3
- package/package.json +1 -1
- package/dist/roadtrip/p-7df3bb5e.entry.js.map +0 -1
|
@@ -130,7 +130,9 @@
|
|
|
130
130
|
flex-direction: column;
|
|
131
131
|
width: 100%;
|
|
132
132
|
height: 100vh;
|
|
133
|
+
height: 100dvh; /* DVH to handle safari behavior and we keep vh for fallback */
|
|
133
134
|
max-height: 100vh;
|
|
135
|
+
max-height: 100dvh; /* DVH to handle safari behavior and we keep vh for fallback */
|
|
134
136
|
pointer-events: auto;
|
|
135
137
|
background-color: var(--background);
|
|
136
138
|
background-clip: padding-box;
|
|
@@ -159,6 +159,7 @@ export class Drawer {
|
|
|
159
159
|
tabbableOptions: {
|
|
160
160
|
getShadowRoot: true,
|
|
161
161
|
},
|
|
162
|
+
preventScroll: true,
|
|
162
163
|
});
|
|
163
164
|
}
|
|
164
165
|
return this.focusTrap;
|
|
@@ -177,7 +178,7 @@ export class Drawer {
|
|
|
177
178
|
const backIconElement = this.hasBackIcon ? (h("button", { type: "button", class: "drawer-action", "aria-label": ariaLabelBack, onClick: this.onClickBack }, h("road-icon", { icon: navigationChevron, rotate: "180" }), this.backText)) : null;
|
|
178
179
|
const closeIconElement = this.hasCloseIcon ? (h("button", { type: "button", class: "drawer-close", onClick: this.onClick, "aria-label": ariaLabelClose }, h("road-icon", { icon: navigationClose, "aria-hidden": "true" }))) : null;
|
|
179
180
|
const drawerWidthValue = this.position === "bottom" ? "100%" : `${this.drawerWidth}px`;
|
|
180
|
-
return (h(Host, { key: '
|
|
181
|
+
return (h(Host, { key: 'f3f7bb36db4476325b4e7a879a739529bc79d964', class: `${drawerIsOpenClass} drawer-${this.position}`, tabindex: "0", role: "dialog", "aria-label": ariaLabel }, h("div", { key: '407cd4cc74d0f94f43cb306e8e7c819b771493dd', class: "road-drawer-wrapper" }, h("div", { key: '2f09ca1bfff5bf81ed94a277910dbb6017d0b984', class: "drawer-overlay", onClick: this.onClick, tabindex: "-1" }), h("div", { key: 'ae71f5011512dd1dd2a3cdd69b7ca6c8838b787f', class: "drawer-dialog", style: { maxWidth: drawerWidthValue }, role: "document" }, h("div", { key: '94cf3ed5d1a5e62cf15ec3a20a6bb786a240d61a', class: "drawer-content" }, h("header", { key: '58c9716838a98d57a0f147aed96c7b06d98ac9cf', class: `drawer-header ${inverseHeaderClass} ${drawerDelimiterClass}` }, backIconElement, this.drawerTitle ? (h("h2", { class: "drawer-title" }, this.drawerTitle)) : (h("div", { class: "drawer-title" }, h("slot", { name: "title" }))), closeIconElement), h("div", { key: '5d97f008d5514de90fac3c7d6c517882216aee00', class: `drawer-body ${removePaddingClass}` }, h("slot", { key: '53a401cd8b6295017d4903e7626d2ab643ad8b26' })), h("footer", { key: 'e1c65d15af977b46484d35c6b93def36c3523fdb', class: `drawer-footer ${removePaddingClass}`, hidden: !this.hasFooterContent }, h("slot", { key: 'c7b7694a70fb98a9057d5292acbf6bdda42267c5', name: "footer", onSlotchange: this.onFooterSlotChange })))))));
|
|
181
182
|
}
|
|
182
183
|
static get is() { return "road-drawer"; }
|
|
183
184
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|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AE,EAC5C,MAAM,EAAE,CAAC,IAAI,CAAC,gBAAgB;4BAE9B,6DAAM,IAAI,EAAC,QAAQ,EAAC,YAAY,EAAE,IAAI,CAAC,kBAAkB,GAAI,CACtD,CACL,CACF,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n Listen,\n Method,\n Prop,\n h,\n Host,\n Watch,\n State,\n} from \"@stencil/core\";\nimport { navigationClose, navigationChevron } from \"../../../icons\";\nimport { createFocusTrap, FocusTrap } from \"focus-trap\";\n\n/**\n * @slot - Content of the drawer.\n * @slot title - replace the title with a custom title section when `'drawerTitle'` is not set\n * @slot footer - footer of the drawer\n * `<div slot=\"footer\">`\n `<road-button color=\"primary\" outline=\"true\" expand=\"true\">Annuler</road-button>`\n `<road-button color=\"primary\" expand=\"true\" class=\"mb-0\">Valider</road-button>`\n ` </div>`\n */\n\n@Component({\n tag: \"road-drawer\",\n styleUrl: \"drawer.css\",\n shadow: true,\n})\nexport class Drawer {\n /**\n * Current reference of the drawer\n */\n @Element() el!: HTMLRoadDrawerElement;\n\n /**\n * Set isOpen property to true to open the drawer\n */\n @Prop({ mutable: true }) isOpen: boolean = false;\n\n /**\n * Set removePadding property to true to remove padding for drawer body\n */\n @Prop({ mutable: true }) removePadding: boolean = false;\n\n /**\n * position of the drawer. e.g. left, right, bottom\n */\n @Prop() position: string = \"left\";\n\n /**\n * Width of the drawer\n */\n @Prop() drawerWidth: number = 480;\n\n /**\n * Inverse header colors\n */\n @Prop() hasInverseHeader: boolean = false;\n\n /**\n * Show / hide back icon\n */\n @Prop() hasBackIcon: boolean = false;\n\n /**\n * Show / hide back icon\n */\n @Prop() backText?: string;\n\n /**\n * Title of the drawer in the header bar\n */\n @Prop() drawerTitle?: string;\n\n /**\n * Aria label of the drawer\n */\n @Prop() ariaLabel?: string;\n\n /**\n * Aria label of the drawer\n */\n @Prop() ariaLabelBack?: string;\n\n /**\n * Aria label of the drawer\n */\n @Prop() ariaLabelClose?: string;\n\n /**\n * Show / hide close icon\n */\n @Prop() hasCloseIcon: boolean = true;\n\n /**\n * Override focus trap\n */\n @Prop() enabledFocusTrap: boolean = true;\n\n /**\n * Indicate when opening the drawer\n */\n @Event({ eventName: \"open\" }) onOpen!: EventEmitter<void>;\n\n /**\n * Indicate when closing the drawer\n */\n @Event({ eventName: \"close\" }) onClose!: EventEmitter<void>;\n\n /**\n * Indicate when return to previous state of the drawer content\n */\n @Event({ eventName: \"back\" }) onBack!: EventEmitter<void>;\n\n /**\n * Focus trap state\n */\n @State() focusTrap?: FocusTrap;\n\n /**\n * Footer Content state\n */\n @State() hasFooterContent = false;\n\n /**\n * Open the drawer\n */\n @Method()\n async open() {\n this.isOpen = true;\n }\n\n /**\n * Close the drawer\n */\n @Method()\n async close() {\n this.isOpen = false;\n }\n\n /**\n * Return to previous state of the drawer content\n */\n @Method()\n async back() {\n this.onBack.emit();\n }\n\n /**\n * Enable/disable focus trap so it can be overrided by the client in case of something appearing over the drawer like a modal for example\n */\n @Watch(\"enabledFocusTrap\")\n handleFocusTrapProp(value: boolean) {\n setTimeout(() => {\n if (value) {\n this.focusTrap?.unpause();\n } else {\n this.focusTrap?.pause();\n }\n }, 100); // Timeout is used to ensure the drawer has been rendered when client wants to update the property at the same time\n }\n\n@Watch(\"isOpen\")\nhandleOpen(openValue: boolean) {\n if (openValue === true) {\n this.onOpen.emit();\n this.el.addEventListener(\n \"transitionend\",\n () => {\n if (this.enabledFocusTrap) {\n this.getOrCreateFocusTrap().activate();\n }\n },\n { once: true },\n );\n } else {\n this.focusTrap?.deactivate();\n this.el.addEventListener(\n \"transitionend\",\n () => {\n this.onClose.emit();\n this.el.shadowRoot &&\n ((this.el.shadowRoot.querySelector(\".drawer-body\") as HTMLElement).scrollTop = 0);\n },\n { once: true },\n );\n }\n}\n\n private onFooterSlotChange = (event: Event) => {\n const slot = event.target as HTMLSlotElement;\n this.hasFooterContent = slot.assignedElements().length > 0;\n };\n\n /**\n * Find and focus the first element in the drawer\n */\n /**\n * Find and focus the first element in the drawer\n */\n // private focusFirstElement() {\n // 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;\n //\n // if (firstElement) {\n // firstElement.focus();\n // }\n // }\n\n /**\n * Close the dialog when clicking on the cross or layer\n */\n private onClick = (ev: UIEvent) => {\n ev.stopPropagation();\n ev.preventDefault();\n\n this.close();\n };\n\n /**\n * Close the dialog when clicking on the cross or layer\n */\n private onClickBack = (event: MouseEvent) => {\n event.stopPropagation();\n event.preventDefault();\n\n this.back();\n };\n\n /**\n * Close the dialog when press Escape key\n */\n @Listen(\"keyup\", { target: \"document\" })\n onEscape(event: KeyboardEvent) {\n if (event.key === \"Escape\" || event.key === \"Esc\") {\n this.close();\n }\n }\n\n componentDidLoad() {\n this.el.querySelectorAll('[data-dismiss=\"modal\"]').forEach((item) => {\n item.addEventListener(\"click\", () => this.close());\n });\n\n if (this.isOpen) {\n this.handleOpen(true);\n }\n}\n\nprivate getOrCreateFocusTrap(): FocusTrap {\n if (!this.focusTrap) {\n const drawerContent = this.el.shadowRoot?.querySelector(\".road-drawer-wrapper\");\n this.focusTrap = createFocusTrap(drawerContent as HTMLElement, {\n onActivate: () => drawerContent?.classList.add(\"focus-trapped\"),\n onDeactivate: () => drawerContent?.classList.remove(\"focus-trapped\"),\n tabbableOptions: {\n getShadowRoot: true,\n },\n });\n }\n return this.focusTrap;\n}\n\n render() {\n const drawerIsOpenClass = this.isOpen ? \"drawer-open\" : \"\";\n const removePaddingClass = this.removePadding ? \"remove-padding\" : \"\";\n const inverseHeaderClass = this.hasInverseHeader\n ? \"drawer-header-inverse\"\n : \"\";\n const ariaLabel = this.ariaLabel ?? \"drawer\";\n const ariaLabelBack = this.ariaLabelBack ?? \"Back\";\n const ariaLabelClose = this.ariaLabelClose ?? \"Close\";\n const drawerDelimiterClass =\n this.drawerTitle && !this.hasInverseHeader ? \"drawer-delimiter\" : \"\";\n const backIconElement = this.hasBackIcon ? (\n <button\n type=\"button\"\n class=\"drawer-action\"\n aria-label={ariaLabelBack}\n onClick={this.onClickBack}\n >\n <road-icon icon={navigationChevron} rotate=\"180\"></road-icon>\n {this.backText}\n </button>\n ) : null;\n const closeIconElement = this.hasCloseIcon ? (\n <button\n type=\"button\"\n class=\"drawer-close\"\n onClick={this.onClick}\n aria-label={ariaLabelClose}\n >\n <road-icon icon={navigationClose} aria-hidden=\"true\"></road-icon>\n </button>\n ) : null;\n const drawerWidthValue =\n this.position === \"bottom\" ? \"100%\" : `${this.drawerWidth}px`;\n\n return (\n <Host\n class={`${drawerIsOpenClass} drawer-${this.position}`}\n tabindex=\"0\"\n role=\"dialog\"\n aria-label={ariaLabel}\n >\n <div class=\"road-drawer-wrapper\">\n <div\n class=\"drawer-overlay\"\n onClick={this.onClick}\n tabindex=\"-1\"\n ></div>\n <div\n class=\"drawer-dialog\"\n style={{ maxWidth: drawerWidthValue }}\n role=\"document\"\n >\n <div class=\"drawer-content\">\n <header\n class={`drawer-header ${inverseHeaderClass} ${drawerDelimiterClass}`}\n >\n {backIconElement}\n {this.drawerTitle ? (\n <h2 class=\"drawer-title\">{this.drawerTitle}</h2>\n ) : (\n <div class=\"drawer-title\">\n <slot name=\"title\" />\n </div>\n )}\n {closeIconElement}\n </header>\n <div class={`drawer-body ${removePaddingClass}`}>\n <slot />\n </div>\n <footer\n class={`drawer-footer ${removePaddingClass}`}\n hidden={!this.hasFooterContent}\n >\n <slot name=\"footer\" onSlotchange={this.onFooterSlotChange} />\n </footer>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EAEL,MAAM,EACN,MAAM,EACN,IAAI,EACJ,CAAC,EACD,IAAI,EACJ,KAAK,EACL,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAa,MAAM,YAAY,CAAC;AAExD;;;;;;;;GAQG;AAOH,MAAM,OAAO,MAAM;IALnB;QAWE;;WAEG;QACsB,WAAM,GAAY,KAAK,CAAC;QAEjD;;WAEG;QACsB,kBAAa,GAAY,KAAK,CAAC;QAExD;;WAEG;QACK,aAAQ,GAAW,MAAM,CAAC;QAElC;;WAEG;QACK,gBAAW,GAAW,GAAG,CAAC;QAElC;;WAEG;QACK,qBAAgB,GAAY,KAAK,CAAC;QAE1C;;WAEG;QACK,gBAAW,GAAY,KAAK,CAAC;QA2BrC;;WAEG;QACK,iBAAY,GAAY,IAAI,CAAC;QAErC;;WAEG;QACK,qBAAgB,GAAY,IAAI,CAAC;QAsBzC;;WAEG;QACM,qBAAgB,GAAG,KAAK,CAAC;QAmE1B,uBAAkB,GAAG,CAAC,KAAY,EAAE,EAAE;YAC5C,MAAM,IAAI,GAAG,KAAK,CAAC,MAAyB,CAAC;YAC7C,IAAI,CAAC,gBAAgB,G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BACf,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAClB,UAAI,KAAK,EAAC,cAAc,IAAE,IAAI,CAAC,WAAW,CAAM,CACjD,CAAC,CAAC,CAAC,CACF,WAAK,KAAK,EAAC,cAAc;gCACvB,YAAM,IAAI,EAAC,OAAO,GAAG,CACjB,CACP;4BACA,gBAAgB,CACV;wBACT,4DAAK,KAAK,EAAE,eAAe,kBAAkB,EAAE;4BAC7C,8DAAQ,CACJ;wBACN,+DACE,KAAK,EAAE,iBAAiB,kBAAkB,EAAE,EAC5C,MAAM,EAAE,CAAC,IAAI,CAAC,gBAAgB;4BAE9B,6DAAM,IAAI,EAAC,QAAQ,EAAC,YAAY,EAAE,IAAI,CAAC,kBAAkB,GAAI,CACtD,CACL,CACF,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n Listen,\n Method,\n Prop,\n h,\n Host,\n Watch,\n State,\n} from \"@stencil/core\";\nimport { navigationClose, navigationChevron } from \"../../../icons\";\nimport { createFocusTrap, FocusTrap } from \"focus-trap\";\n\n/**\n * @slot - Content of the drawer.\n * @slot title - replace the title with a custom title section when `'drawerTitle'` is not set\n * @slot footer - footer of the drawer\n * `<div slot=\"footer\">`\n `<road-button color=\"primary\" outline=\"true\" expand=\"true\">Annuler</road-button>`\n `<road-button color=\"primary\" expand=\"true\" class=\"mb-0\">Valider</road-button>`\n ` </div>`\n */\n\n@Component({\n tag: \"road-drawer\",\n styleUrl: \"drawer.css\",\n shadow: true,\n})\nexport class Drawer {\n /**\n * Current reference of the drawer\n */\n @Element() el!: HTMLRoadDrawerElement;\n\n /**\n * Set isOpen property to true to open the drawer\n */\n @Prop({ mutable: true }) isOpen: boolean = false;\n\n /**\n * Set removePadding property to true to remove padding for drawer body\n */\n @Prop({ mutable: true }) removePadding: boolean = false;\n\n /**\n * position of the drawer. e.g. left, right, bottom\n */\n @Prop() position: string = \"left\";\n\n /**\n * Width of the drawer\n */\n @Prop() drawerWidth: number = 480;\n\n /**\n * Inverse header colors\n */\n @Prop() hasInverseHeader: boolean = false;\n\n /**\n * Show / hide back icon\n */\n @Prop() hasBackIcon: boolean = false;\n\n /**\n * Show / hide back icon\n */\n @Prop() backText?: string;\n\n /**\n * Title of the drawer in the header bar\n */\n @Prop() drawerTitle?: string;\n\n /**\n * Aria label of the drawer\n */\n @Prop() ariaLabel?: string;\n\n /**\n * Aria label of the drawer\n */\n @Prop() ariaLabelBack?: string;\n\n /**\n * Aria label of the drawer\n */\n @Prop() ariaLabelClose?: string;\n\n /**\n * Show / hide close icon\n */\n @Prop() hasCloseIcon: boolean = true;\n\n /**\n * Override focus trap\n */\n @Prop() enabledFocusTrap: boolean = true;\n\n /**\n * Indicate when opening the drawer\n */\n @Event({ eventName: \"open\" }) onOpen!: EventEmitter<void>;\n\n /**\n * Indicate when closing the drawer\n */\n @Event({ eventName: \"close\" }) onClose!: EventEmitter<void>;\n\n /**\n * Indicate when return to previous state of the drawer content\n */\n @Event({ eventName: \"back\" }) onBack!: EventEmitter<void>;\n\n /**\n * Focus trap state\n */\n @State() focusTrap?: FocusTrap;\n\n /**\n * Footer Content state\n */\n @State() hasFooterContent = false;\n\n /**\n * Open the drawer\n */\n @Method()\n async open() {\n this.isOpen = true;\n }\n\n /**\n * Close the drawer\n */\n @Method()\n async close() {\n this.isOpen = false;\n }\n\n /**\n * Return to previous state of the drawer content\n */\n @Method()\n async back() {\n this.onBack.emit();\n }\n\n /**\n * Enable/disable focus trap so it can be overrided by the client in case of something appearing over the drawer like a modal for example\n */\n @Watch(\"enabledFocusTrap\")\n handleFocusTrapProp(value: boolean) {\n setTimeout(() => {\n if (value) {\n this.focusTrap?.unpause();\n } else {\n this.focusTrap?.pause();\n }\n }, 100); // Timeout is used to ensure the drawer has been rendered when client wants to update the property at the same time\n }\n\n@Watch(\"isOpen\")\nhandleOpen(openValue: boolean) {\n if (openValue === true) {\n this.onOpen.emit();\n this.el.addEventListener(\n \"transitionend\",\n () => {\n if (this.enabledFocusTrap) {\n this.getOrCreateFocusTrap().activate();\n }\n },\n { once: true },\n );\n } else {\n this.focusTrap?.deactivate();\n this.el.addEventListener(\n \"transitionend\",\n () => {\n this.onClose.emit();\n this.el.shadowRoot &&\n ((this.el.shadowRoot.querySelector(\".drawer-body\") as HTMLElement).scrollTop = 0);\n },\n { once: true },\n );\n }\n}\n\n private onFooterSlotChange = (event: Event) => {\n const slot = event.target as HTMLSlotElement;\n this.hasFooterContent = slot.assignedElements().length > 0;\n };\n\n /**\n * Find and focus the first element in the drawer\n */\n /**\n * Find and focus the first element in the drawer\n */\n // private focusFirstElement() {\n // 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;\n //\n // if (firstElement) {\n // firstElement.focus();\n // }\n // }\n\n /**\n * Close the dialog when clicking on the cross or layer\n */\n private onClick = (ev: UIEvent) => {\n ev.stopPropagation();\n ev.preventDefault();\n\n this.close();\n };\n\n /**\n * Close the dialog when clicking on the cross or layer\n */\n private onClickBack = (event: MouseEvent) => {\n event.stopPropagation();\n event.preventDefault();\n\n this.back();\n };\n\n /**\n * Close the dialog when press Escape key\n */\n @Listen(\"keyup\", { target: \"document\" })\n onEscape(event: KeyboardEvent) {\n if (event.key === \"Escape\" || event.key === \"Esc\") {\n this.close();\n }\n }\n\n componentDidLoad() {\n this.el.querySelectorAll('[data-dismiss=\"modal\"]').forEach((item) => {\n item.addEventListener(\"click\", () => this.close());\n });\n\n if (this.isOpen) {\n this.handleOpen(true);\n }\n}\n\nprivate getOrCreateFocusTrap(): FocusTrap {\n if (!this.focusTrap) {\n const drawerContent = this.el.shadowRoot?.querySelector(\".road-drawer-wrapper\");\n this.focusTrap = createFocusTrap(drawerContent as HTMLElement, {\n onActivate: () => drawerContent?.classList.add(\"focus-trapped\"),\n onDeactivate: () => drawerContent?.classList.remove(\"focus-trapped\"),\n tabbableOptions: {\n getShadowRoot: true,\n },\n preventScroll: true,\n });\n }\n return this.focusTrap;\n}\n\n render() {\n const drawerIsOpenClass = this.isOpen ? \"drawer-open\" : \"\";\n const removePaddingClass = this.removePadding ? \"remove-padding\" : \"\";\n const inverseHeaderClass = this.hasInverseHeader\n ? \"drawer-header-inverse\"\n : \"\";\n const ariaLabel = this.ariaLabel ?? \"drawer\";\n const ariaLabelBack = this.ariaLabelBack ?? \"Back\";\n const ariaLabelClose = this.ariaLabelClose ?? \"Close\";\n const drawerDelimiterClass =\n this.drawerTitle && !this.hasInverseHeader ? \"drawer-delimiter\" : \"\";\n const backIconElement = this.hasBackIcon ? (\n <button\n type=\"button\"\n class=\"drawer-action\"\n aria-label={ariaLabelBack}\n onClick={this.onClickBack}\n >\n <road-icon icon={navigationChevron} rotate=\"180\"></road-icon>\n {this.backText}\n </button>\n ) : null;\n const closeIconElement = this.hasCloseIcon ? (\n <button\n type=\"button\"\n class=\"drawer-close\"\n onClick={this.onClick}\n aria-label={ariaLabelClose}\n >\n <road-icon icon={navigationClose} aria-hidden=\"true\"></road-icon>\n </button>\n ) : null;\n const drawerWidthValue =\n this.position === \"bottom\" ? \"100%\" : `${this.drawerWidth}px`;\n\n return (\n <Host\n class={`${drawerIsOpenClass} drawer-${this.position}`}\n tabindex=\"0\"\n role=\"dialog\"\n aria-label={ariaLabel}\n >\n <div class=\"road-drawer-wrapper\">\n <div\n class=\"drawer-overlay\"\n onClick={this.onClick}\n tabindex=\"-1\"\n ></div>\n <div\n class=\"drawer-dialog\"\n style={{ maxWidth: drawerWidthValue }}\n role=\"document\"\n >\n <div class=\"drawer-content\">\n <header\n class={`drawer-header ${inverseHeaderClass} ${drawerDelimiterClass}`}\n >\n {backIconElement}\n {this.drawerTitle ? (\n <h2 class=\"drawer-title\">{this.drawerTitle}</h2>\n ) : (\n <div class=\"drawer-title\">\n <slot name=\"title\" />\n </div>\n )}\n {closeIconElement}\n </header>\n <div class={`drawer-body ${removePaddingClass}`}>\n <slot />\n </div>\n <footer\n class={`drawer-footer ${removePaddingClass}`}\n hidden={!this.hasFooterContent}\n >\n <slot name=\"footer\" onSlotchange={this.onFooterSlotChange} />\n </footer>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -1889,7 +1889,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
1889
1889
|
return trap;
|
|
1890
1890
|
};
|
|
1891
1891
|
|
|
1892
|
-
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}";
|
|
1892
|
+
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;height:100dvh;max-height:100vh;max-height:100dvh;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}";
|
|
1893
1893
|
const RoadDrawerStyle0 = drawerCss;
|
|
1894
1894
|
|
|
1895
1895
|
const Drawer = class {
|
|
@@ -2045,6 +2045,7 @@ const Drawer = class {
|
|
|
2045
2045
|
tabbableOptions: {
|
|
2046
2046
|
getShadowRoot: true,
|
|
2047
2047
|
},
|
|
2048
|
+
preventScroll: true,
|
|
2048
2049
|
});
|
|
2049
2050
|
}
|
|
2050
2051
|
return this.focusTrap;
|
|
@@ -2063,7 +2064,7 @@ const Drawer = class {
|
|
|
2063
2064
|
const backIconElement = this.hasBackIcon ? (h("button", { type: "button", class: "drawer-action", "aria-label": ariaLabelBack, onClick: this.onClickBack }, h("road-icon", { icon: navigationChevron, rotate: "180" }), this.backText)) : null;
|
|
2064
2065
|
const closeIconElement = this.hasCloseIcon ? (h("button", { type: "button", class: "drawer-close", onClick: this.onClick, "aria-label": ariaLabelClose }, h("road-icon", { icon: navigationClose, "aria-hidden": "true" }))) : null;
|
|
2065
2066
|
const drawerWidthValue = this.position === "bottom" ? "100%" : `${this.drawerWidth}px`;
|
|
2066
|
-
return (h(Host, { key: '
|
|
2067
|
+
return (h(Host, { key: 'f3f7bb36db4476325b4e7a879a739529bc79d964', class: `${drawerIsOpenClass} drawer-${this.position}`, tabindex: "0", role: "dialog", "aria-label": ariaLabel }, h("div", { key: '407cd4cc74d0f94f43cb306e8e7c819b771493dd', class: "road-drawer-wrapper" }, h("div", { key: '2f09ca1bfff5bf81ed94a277910dbb6017d0b984', class: "drawer-overlay", onClick: this.onClick, tabindex: "-1" }), h("div", { key: 'ae71f5011512dd1dd2a3cdd69b7ca6c8838b787f', class: "drawer-dialog", style: { maxWidth: drawerWidthValue }, role: "document" }, h("div", { key: '94cf3ed5d1a5e62cf15ec3a20a6bb786a240d61a', class: "drawer-content" }, h("header", { key: '58c9716838a98d57a0f147aed96c7b06d98ac9cf', class: `drawer-header ${inverseHeaderClass} ${drawerDelimiterClass}` }, backIconElement, this.drawerTitle ? (h("h2", { class: "drawer-title" }, this.drawerTitle)) : (h("div", { class: "drawer-title" }, h("slot", { name: "title" }))), closeIconElement), h("div", { key: '5d97f008d5514de90fac3c7d6c517882216aee00', class: `drawer-body ${removePaddingClass}` }, h("slot", { key: '53a401cd8b6295017d4903e7626d2ab643ad8b26' })), h("footer", { key: 'e1c65d15af977b46484d35c6b93def36c3523fdb', class: `drawer-footer ${removePaddingClass}`, hidden: !this.hasFooterContent }, h("slot", { key: 'c7b7694a70fb98a9057d5292acbf6bdda42267c5', name: "footer", onSlotchange: this.onFooterSlotChange })))))));
|
|
2067
2068
|
}
|
|
2068
2069
|
get el() { return getElement(this); }
|
|
2069
2070
|
static get watchers() { return {
|