-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat(api): ajouts d'évènements dans l'api [DS-2052] (#1012)
Ajout des événements : Sur le éléments root (documentElement) : - dsfr.ready : lorsque le js est chargé - dsfr.start : au démarrage du moteur js du dsfr - dsfr.stop : à l'arrêt du moteur js du dsfr - dsfr.render : lors du rendu d'une instance - dsfr.resize : lors du changement de taille du viewport - dsfr.scroll-lock : au blocage du scroll - dsfr.scroll-unlock : au déblocage du scroll - dsfr.scheme : au chargement et changement du scheme (dark, light, auto) - dsfr.theme : au chargement et changement du theme (light, dark) Au niveau des instances, et remontées aux parents jusqu'au documentElement : - dsfr.click : au click sur un bouton - dsfr.disclose : à l'ouverture d'un disclosure - dsfr.conceal : à la fermeture d'un disclosure - dsfr.current : retourne l'élément ouvert d'un groupe de disclosure (accordions, tabs, etc.) - dsfr.dismiss : a la fermeture d'un tag supprimable - dsfr.toggle : au cochage d'un tag sélectionnable - dsfr.show : à l'affichage d'un tooltip - dsfr.hide : lorsque le tooltip est masqué
- Loading branch information
Showing
17 changed files
with
71 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import ns from '../../utilities/namespace.js'; | ||
|
||
const InstanceEvent = { | ||
CLICK: ns.event('click') | ||
}; | ||
|
||
export { InstanceEvent }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import ns from '../../utilities/namespace.js'; | ||
|
||
const RootEvent = { | ||
READY: ns.event('ready'), | ||
START: ns.event('start'), | ||
STOP: ns.event('stop'), | ||
RENDER: ns.event('render'), | ||
RESIZE: ns.event('resize'), | ||
BREAKPOINT: ns.event('breakpoint'), | ||
SCROLL_LOCK: ns.event('scroll-lock'), | ||
SCROLL_UNLOCK: ns.event('scroll-unlock') | ||
}; | ||
|
||
export { RootEvent }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const dispatch = (node, type, detail = null, bubbles = true, cancelable = false) => { | ||
const options = { bubbles: bubbles === true, cancelable: cancelable === true }; | ||
if (detail) options.detail = detail; | ||
const event = new CustomEvent(type, options); | ||
node.dispatchEvent(event); | ||
console.log(`Dispatched event: ${type}`); | ||
}; | ||
|
||
const rootDispatch = (type, detail = null, bubbles = false, cancelable = false) => dispatch(document.documentElement, type, detail, bubbles, cancelable); | ||
|
||
export { dispatch, rootDispatch }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters