-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dropdown: implementing dropdown plugin #9532
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
--- | ||
{ | ||
"title": "Dropdown button", | ||
"language": "en", | ||
"category": "Plugins", | ||
"categoryfile": "plugins", | ||
"description": "Dropdown button to display a list of actions or links on click", | ||
"altLangPrefix": "dropdown", | ||
"dateModified": "2023-02-15" | ||
} | ||
--- | ||
<div class="alert alert-warning"> | ||
<h2>Unstable feature</h2> | ||
<p>To be used at <strong>your own risk</strong>. This feature described below can be removed in any subsequent minor/major release</p> | ||
<p><small><a href="https://wet-boew.github.io/wet-boew-documentation/decision/7.html">Learn more about the design decision around provisional features.</a></small></p> | ||
<p><small><a href="../provisional-en.html">Check other provisional features available.</a></small></p> | ||
</div> | ||
|
||
<span class="wb-prettify all-pre"></span> | ||
|
||
<h2>Purpose</h2> | ||
<p>Dropdown button to display a list of actions or links on click</p> | ||
|
||
<h2>Working example</h2> | ||
<ul> | ||
<li><a href="../../../demos/dropdown/dropdown-en.html">English example</a></li> | ||
<li><a href="../../../demos/dropdown/dropdown-fr.html">French example</a></li> | ||
</ul> | ||
|
||
<h2>Evaluation and report</h2> | ||
<p>There is no evaluation and report available for this component.</p> | ||
|
||
<h2>API (Version 1.0)</h2> | ||
<dl class="dl-horizontal"> | ||
<dt>Function</dt> | ||
<dd>Version 1.0</dd> | ||
<dt>Configuration</dt> | ||
<dd>Not applicable</dd> | ||
<dt>User interface (Template)</dt> | ||
<dd>Version 1.0</dd> | ||
<dt>Data source</dt> | ||
<dd>Version 1.0</dd> | ||
<dt>View and style</dt> | ||
<dd>Version 1.0</dd> | ||
<dt>i18n string</dt> | ||
<dd>Version 1.0</dd> | ||
</dl> | ||
|
||
<h3>Function</h3> | ||
<p>(Version 1.0)</p> | ||
<table class="table"> | ||
<tr> | ||
<th>Function type</th> | ||
<th>Name</th> | ||
<th>How to implement</th> | ||
<th>What it does</th> | ||
</tr> | ||
<tr> | ||
<td>jQuery Event</td> | ||
<td><code>wb-init.dropdown</code></td> | ||
<td>Triggered manually (e.g., <code>$( ".dropdown" ).trigger( "wb-init.dropdown" );</code>).</td> | ||
<td>Initializes the <code>.dropdown</code> plugin. This plugin will be initialized automatically unless the <code>.dropdown</code> element is added after the page load and wet-boew was initialized.</td> | ||
</tr> | ||
<tr> | ||
<td>jQuery Event</td> | ||
<td><code>wb-ready.dropdown</code></td> | ||
<td>Triggered automatically after the plugin initializes.</td> | ||
<td>Used to identify when and where the plugin initializes. | ||
<pre><code>$( document ).on( "wb-ready.dropdown", ".dropdown", function( event ) { | ||
});</code></pre> | ||
<pre><code>$elm.on( "wb-ready.dropdown", function( event ) { | ||
});</code></pre> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<h3>Configuration</h3> | ||
<p>Not applicable for this plugin.</p> | ||
|
||
<h3>User interface (Template)</h3> | ||
<p>Version 1.0</p> | ||
|
||
<pre><code><div class="dropdown"> | ||
<button class="btn btn-default dropdown-toggle" type="button">Dropdown</button> | ||
<ul class="dropdown-menu"> | ||
<li><a href="#">Link 1</a></li> | ||
<li><a href="#">Link 2</a></li> | ||
<li><a href="#">Link 3</a></li> | ||
<li><a href="#">Link 4</a></li> | ||
</ul> | ||
</div></code></pre> | ||
|
||
<h2>Source code</h2> | ||
<p><a href="https://github.com/wet-boew/wet-boew/tree/master/src/plugins/dropdown">Add to Calendar source code on GitHub</a></p> |
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,95 @@ | ||||||||||||||
--- | ||||||||||||||
{ | ||||||||||||||
"title": "Bouton de menu déroulant", | ||||||||||||||
"language": "fr", | ||||||||||||||
"category": "Plugiciels", | ||||||||||||||
"categoryfile": "plugins", | ||||||||||||||
"description": "Bouton affichant un menu déroulant d'actions ou de liens au clic", | ||||||||||||||
"altLangPrefix": "dropdown", | ||||||||||||||
"dateModified": "2023-02-15" | ||||||||||||||
} | ||||||||||||||
--- | ||||||||||||||
|
||||||||||||||
<div lang="en" class="alert alert-warning"> | ||||||||||||||
<h2>Unstable feature</h2> | ||||||||||||||
<p>To be used at <strong>your own risk</strong>. This feature described below can be removed in any subsequent minor/major release</p> | ||||||||||||||
<p><small><a href="https://wet-boew.github.io/wet-boew-documentation/decision/7.html">Learn more about the design decision around provisional features.</a></small></p> | ||||||||||||||
<p><small><a href="../provisional-fr.html">Check other provisional features available.</a></small></p> | ||||||||||||||
</div> | ||||||||||||||
|
||||||||||||||
Comment on lines
+13
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it going to be a provisional feature?
Suggested change
|
||||||||||||||
<span class="wb-prettify all-pre"></span> | ||||||||||||||
|
||||||||||||||
<h2>But</h2> | ||||||||||||||
<p>Bouton affichant un menu déroulant d'actions ou de liens au clic</p> | ||||||||||||||
|
||||||||||||||
<h2>Exemples pratiques</h2> | ||||||||||||||
<ul> | ||||||||||||||
<li><a href="../../../demos/dropdown/dropdown-en.html">Exemple en anglais</a></li> | ||||||||||||||
<li><a href="../../../demos/dropdown/dropdown-fr.html">Exemple en français</a></li> | ||||||||||||||
</ul> | ||||||||||||||
|
||||||||||||||
<h2>Évaluation et rapport</h2> | ||||||||||||||
<p>Il n'y a pas d'évaluation ni de rapport disponible pour cette composante.</p> | ||||||||||||||
|
||||||||||||||
<h2>API (Version 1.0)</h2> | ||||||||||||||
<dl class="dl-horizontal"> | ||||||||||||||
<dt>Fonction</dt> | ||||||||||||||
<dd>Version 1.0</dd> | ||||||||||||||
<dt>Configuration</dt> | ||||||||||||||
<dd>N'est pas applicable</dd> | ||||||||||||||
<dt>Interface utilisateur (Modèle)</dt> | ||||||||||||||
<dd>Version 1.0</dd> | ||||||||||||||
<dt>Source de données</dt> | ||||||||||||||
<dd>Version 1.0</dd> | ||||||||||||||
<dt>Affichage et style</dt> | ||||||||||||||
<dd>Version 1.0</dd> | ||||||||||||||
<dt>Chaîne de caractères i18n</dt> | ||||||||||||||
<dd>Version 1.0</dd> | ||||||||||||||
</dl> | ||||||||||||||
|
||||||||||||||
<h3>Fonction</h3> | ||||||||||||||
<p>(Version 1.0)</p> | ||||||||||||||
<table class="table"> | ||||||||||||||
<tr> | ||||||||||||||
<th>Type de fonction</th> | ||||||||||||||
<th>Nom</th> | ||||||||||||||
<th>Comment implémenter</th> | ||||||||||||||
<th>Fonction</th> | ||||||||||||||
</tr> | ||||||||||||||
<tr> | ||||||||||||||
<td>Événement jQuery</td> | ||||||||||||||
<td><code>wb-init.dropdown</code></td> | ||||||||||||||
<td>Déclenché manuellement (par exemple : <code>$( ".dropdown" ).trigger( "wb-init.dropdown" );</code>).</td> | ||||||||||||||
<td>Initialise la composante <code>.dropdown</code>. Cette composante sera initialisée automatiquement sauf si l'élément <code>.dropdown</code> est ajouté après le chargement de la page et l'initialisation de wet-boew.</td> | ||||||||||||||
</tr> | ||||||||||||||
<tr> | ||||||||||||||
<td>Événement jQuery</td> | ||||||||||||||
<td><code>wb-ready.dropdown</code></td> | ||||||||||||||
<td>Déclenché automatiquement après l'initialisation du plugin.</td> | ||||||||||||||
<td>Utilisé pour identifier quand et où la composante s'initialise. | ||||||||||||||
<pre><code>$( document ).on( "wb-ready.dropdown", ".dropdown", function( event ) { | ||||||||||||||
});</code></pre> | ||||||||||||||
<pre><code>$elm.on( "wb-ready.dropdown", function( event ) { | ||||||||||||||
});</code></pre> | ||||||||||||||
</td> | ||||||||||||||
</tr> | ||||||||||||||
</table> | ||||||||||||||
|
||||||||||||||
<h3>Configuration</h3> | ||||||||||||||
<p>N'est pas applicable pour cette composante.</p> | ||||||||||||||
|
||||||||||||||
<h3>Interface utilisateur (Modèle)</h3> | ||||||||||||||
<p>Version 1.0</p> | ||||||||||||||
|
||||||||||||||
<pre><code><div class="dropdown"> | ||||||||||||||
<button class="btn btn-default dropdown-toggle" type="button">Menu déroulant</button> | ||||||||||||||
<ul class="dropdown-menu"> | ||||||||||||||
<li><a href="#">Lien 1</a></li> | ||||||||||||||
<li><a href="#">Lien 2</a></li> | ||||||||||||||
<li><a href="#">Lien 3</a></li> | ||||||||||||||
<li><a href="#">Lien 4</a></li> | ||||||||||||||
</ul> | ||||||||||||||
</div></code></pre> | ||||||||||||||
|
||||||||||||||
<h2>Code source</h2> | ||||||||||||||
<p><a href="https://github.com/wet-boew/wet-boew/tree/master/src/plugins/dropdown">Code source d'Ajout au calendrier sur GitHub</a></p> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Web Experience Toolkit (WET) / Boîte à outils de l'expérience Web (BOEW) | ||
* wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html | ||
* | ||
* Extend: https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_dropdowns.scss | ||
*/ | ||
|
||
@mixin tabFocus() { | ||
outline: 5px auto rgb(0, 95, 204); | ||
outline-offset: -2px; | ||
} | ||
|
||
.wb-dropdown { | ||
@extend .dropdown; | ||
|
||
display: inline-block; | ||
|
||
.dropdown-menu { | ||
> li { | ||
> button { | ||
background: none; | ||
border: none; | ||
padding: .375em 1em; | ||
text-align: left; | ||
width: 100%; | ||
|
||
&:hover { | ||
background-color: rgba(0, 0, 0, .1); | ||
color: $text-color; | ||
} | ||
&:focus { @include tabFocus(); } | ||
&:focus-visible { @include tabFocus(); } | ||
} | ||
|
||
> a { | ||
padding: .375em 1em; | ||
|
||
&:hover { | ||
background-color: rgba(0, 0, 0, .1); | ||
color: $text-color; | ||
text-decoration: underline; | ||
} | ||
&:focus { | ||
@include tabFocus(); | ||
text-decoration: underline; | ||
} | ||
&:focus-visible { @include tabFocus(); } | ||
} | ||
} | ||
|
||
.wb-disable & { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we hide the button in disable mode? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed, we should keep the text inside the button into the page when viewed in Basic HTML mode. Like transforming the button into a paragraph. |
||
display: block; | ||
float: none; | ||
position: static; | ||
} | ||
} | ||
|
||
.dropdown-toggle { | ||
&:focus-visible { | ||
@include tabFocus(); | ||
} | ||
|
||
.dropdown-toggle-icon { | ||
font-size: 75%; | ||
margin-left: 8px; | ||
} | ||
} | ||
|
||
ul { | ||
display: none; | ||
|
||
.wb-disable & { | ||
display: block; | ||
} | ||
} | ||
|
||
&.open { | ||
.dropdown-toggle-icon { | ||
transform: rotate(180deg); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it going to be a provisional feature?