
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
@ewc-lib/ewc-dialog
Advanced tools
The EWC Dialog component provides a standardized modal dialog for Eurostat web applications. It offers a consistent visual identity across Eurostat digital products while allowing for customization to meet specific application needs.
Property | Attribute | Type | Default | Description |
---|---|---|---|---|
visible | Boolean | false | true to show modally, false to hide | |
width | width | Boolean | 90% | width of the dialog, preferrably in %. Default = 90% |
maxWidth | maxWidth | Boolean | 1200px | maximal width of the dialog |
dismissable | dismissable | Boolean | false | if true, allows closing by clicking outside of the dialog's area |
title | HTMLTemplateElement | null | HTMLTemplateElement containing HTML which is displayed as dialog title | |
scrollableContent | HTMLTemplateElement | null | HTMLTemplateElement containing HTML which is displayed in dialog's area for scrollable content | |
fixedContent | HTMLTemplateElement | null | HTMLTemplateElement containing HTML which is displayed in dialog's area for fixed content |
Note:
All attribs and props support modification at runtime.
Please see the screenshot above to see where scrollable-content and fixed-content are displayed within the dialog box.
npm install @ewc-lib/ewc-dialog
Import the component in your application:
// Using ES modules
import "@ewc-lib/ewc-css-common/custom-props.css"
import "@ewc-lib/ewc-dialog"
HTML-content can be set in either of two ways:
There are the following slots to set the respective content:
Please see the usage-example/ directory, which contains working examples of setting the 3 different content slots in both ways, via HTML or JS.
Note: The term "slot" used here refers to an alternative implementation of the standard shadow-DOM slot mechanism. The content becomes actually part of this component's shadow DOM.
Note: fixedContent can be omitted - the space is taken up by scrollableContent in that case.
This is done by setting one of the three attributes on a HTMLTemplateElement (which is a child of ewc-dialog) to indicate the content:
Example:
<ewc-dialog>
<template data-title><span>Title appears here</span></template>
<template data-scrollable-content>
<span>This is the where scrollable content appears - e.g. a longer text w/ explaining something.</span>
</template>
<template data-fixed-content>
<span>This is the where fixed content appears. For example, a checkbox or buttons.</span>
</template>
</ewc-dialog>
const scrollableContent = document.createElement('template');
scrollableContent.innerHTML = ...
myDialog.scrollableContent = scrollableContent
// similar for title and fixed content
The dialog has 2 aria attributes:
<dialog aria-labelledby="title" aria-describedby="ariaDescription">
This component supports a focus trap, with which the tab focus remains within the dialog box, meaning that it cycles through all tab-able elements and doesn't ever leave the dialog box.
If scrollableContent or fixedContent contains elements which should be included in the focus trap - for example links - there's the possibility to set the focus trap's last element (to the last focusable element in either scrollableContent or fixedContent) - after which the first element (the close button) is focussed again, thereby completing a cycle.
This is done by setting the attribute data-last-element approprietly.
Example:
...
const scrollableContent = document.createElement('template');
...
scrollableContent.innerHTML = `<a data-last-element href="https://ec.europa.eu/eurostat" title="Link to Estat">Some Link Text</a>`
...
This way, the focus remains trapped within the dialog - but also includes all tab-focusable elements within scrollableContent and/or fixedContent.
Note: The usage-example/ directory contains a working example of this.
The component is designed with accessibility in mind:
European Union Public License (EUPL)
3.2.2-beta
3.2.1-beta
3.2.0-beta
3.1.0-beta
3.0.6-beta
3.0.5-alpha
3.0.4-alpha
3.0.3-alpha
3.0.2-alpha
3.0.1-alpha
3.0.0-alpha
FAQs
## Overview
We found that @ewc-lib/ewc-dialog demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.