Gathering detailed insights and metrics for @ewc-lib/ewc-dialog
Gathering detailed insights and metrics for @ewc-lib/ewc-dialog
Gathering detailed insights and metrics for @ewc-lib/ewc-dialog
Gathering detailed insights and metrics for @ewc-lib/ewc-dialog
npm install @ewc-lib/ewc-dialog
Typescript
Module System
Node Version
NPM Version
76.8
Supply Chain
97.8
Quality
95.6
Maintenance
100
Vulnerability
98.7
License
Total Downloads
2,362
Last Day
1
Last Week
28
Last Month
268
Last Year
2,154
Minified
Minified + Gzipped
Latest Version
3.2.1-beta
Package Id
@ewc-lib/ewc-dialog@3.2.1-beta
Unpacked Size
305.16 kB
Size
110.72 kB
File Count
21
NPM Version
10.8.2
Node Version
18.19.0
Published on
Jul 02, 2025
Cumulative downloads
Total Downloads
Last Day
-87.5%
1
Compared to previous day
Last Week
-77.2%
28
Compared to previous week
Last Month
-25.8%
268
Compared to previous month
Last Year
935.6%
2,154
Compared to previous year
1
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.
1npm install @ewc-lib/ewc-dialog
Import the component in your application:
1// Using ES modules 2import "@ewc-lib/ewc-css-common/custom-props.css" 3import "@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:
1<ewc-dialog> 2 <template data-title><span>Title appears here</span></template> 3 4 <template data-scrollable-content> 5 <span>This is the where scrollable content appears - e.g. a longer text w/ explaining something.</span> 6 </template> 7 8 <template data-fixed-content> 9 <span>This is the where fixed content appears. For example, a checkbox or buttons.</span> 10 </template> 11</ewc-dialog>
1const scrollableContent = document.createElement('template'); 2scrollableContent.innerHTML = ... 3myDialog.scrollableContent = scrollableContent 4 5// 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.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
No vulnerabilities found.
No security vulnerabilities found.