@lab-anssi/ui-kit 1.14.4 → 1.15.0

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.
@@ -0,0 +1,3 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99999 8.78132L11.3 5.48132L12.2427 6.42399L7.99999 10.6667L3.75732 6.42399L4.69999 5.48132L7.99999 8.78132Z" fill="#161616"/>
3
+ </svg>
package/dist/index.d.ts CHANGED
@@ -15,3 +15,4 @@ export { default as PresentationANSSI } from "./lab/vitrines-produits/briques/Pr
15
15
  export { default as RejoindreLaCommunaute } from "./lab/vitrines-produits/briques/RejoindreLaCommunaute.svelte";
16
16
  export { default as BandeauTitre } from "./lab/blog/BandeauTitre.svelte";
17
17
  export { default as PageCrisp } from "./lab/blog/PageCrisp.svelte";
18
+ export { default as ListeArticles } from "./lab/blog/ListeArticles.svelte";
package/dist/index.js CHANGED
@@ -15,3 +15,4 @@ export { default as PresentationANSSI } from "./lab/vitrines-produits/briques/Pr
15
15
  export { default as RejoindreLaCommunaute } from "./lab/vitrines-produits/briques/RejoindreLaCommunaute.svelte";
16
16
  export { default as BandeauTitre } from "./lab/blog/BandeauTitre.svelte";
17
17
  export { default as PageCrisp } from "./lab/blog/PageCrisp.svelte";
18
+ export { default as ListeArticles } from "./lab/blog/ListeArticles.svelte";
@@ -11,6 +11,7 @@
11
11
  />
12
12
 
13
13
  <script>import { estLien } from "../../types.js";
14
+ import ComposantTag from "./Tag.svelte";
14
15
  export let titre;
15
16
  export let description = "";
16
17
  export let filAriane = [];
@@ -38,9 +39,7 @@ let filArianeVisible = window.matchMedia("(min-width: 576px)").matches;
38
39
  <div class="conteneur-texte">
39
40
  {#if tag}
40
41
  <div class="conteneur-tag">
41
- <span class="tag" style="background: {tag.couleurFond}; color: {tag.couleurTexte};"
42
- >{tag.label}</span
43
- >
42
+ <ComposantTag {tag} />
44
43
  </div>
45
44
  {/if}
46
45
  <div class="conteneur-corps">
@@ -77,15 +76,6 @@ let filArianeVisible = window.matchMedia("(min-width: 576px)").matches;
77
76
  .conteneur-bandeau-entete .contenu-bandeau-entete .conteneur-texte .conteneur-tag {
78
77
  padding-top: 8px;
79
78
  }
80
- .conteneur-bandeau-entete .contenu-bandeau-entete .conteneur-texte .conteneur-tag .tag {
81
- padding: 2px 8px;
82
- border-radius: 12px;
83
- font-family: Marianne;
84
- font-size: 0.75rem;
85
- font-weight: 400;
86
- line-height: 1.25rem;
87
- display: flex;
88
- }
89
79
  .conteneur-bandeau-entete .contenu-bandeau-entete .conteneur-texte .conteneur-corps {
90
80
  display: flex;
91
81
  flex-direction: column;
@@ -0,0 +1,67 @@
1
+ <script>import ComposantTag from "./Tag.svelte";
2
+ import Fleche from "../icones/Fleche.svelte";
3
+ export let article;
4
+ export let categorie;
5
+ </script>
6
+
7
+ <a class="carte-article" href={article.href}>
8
+ <div class="conteneur-texte">
9
+ <ComposantTag tag={categorie} />
10
+ <p>{article.titre}</p>
11
+ </div>
12
+ <div class="conteneur-fleche">
13
+ <Fleche direction="droite" />
14
+ </div>
15
+ </a>
16
+
17
+ <style>.carte-article {
18
+ display: flex;
19
+ flex-direction: column;
20
+ align-items: flex-start;
21
+ border-radius: 8px;
22
+ border: 1px solid #dddddd;
23
+ background: white;
24
+ padding: 24px 24px 52px 24px;
25
+ gap: 12px;
26
+ font-family: Marianne;
27
+ text-decoration: none;
28
+ position: relative;
29
+ }
30
+ .carte-article:visited {
31
+ color: unset;
32
+ }
33
+ .carte-article:hover {
34
+ background: #f6f6f6;
35
+ }
36
+ .carte-article:active {
37
+ background: #ededed;
38
+ }
39
+ .carte-article:focus-visible {
40
+ outline: 2px solid var(--couleur-focus);
41
+ outline-offset: 2px;
42
+ }
43
+ .carte-article .conteneur-texte {
44
+ display: flex;
45
+ flex-direction: column;
46
+ gap: 8px;
47
+ max-width: 100%;
48
+ }
49
+ .carte-article .conteneur-texte p {
50
+ margin: 0;
51
+ color: var(--liste-articles-couleur-texte);
52
+ font-size: 1rem;
53
+ font-style: normal;
54
+ font-weight: 700;
55
+ line-height: 1.5rem;
56
+ }
57
+ .carte-article .conteneur-fleche {
58
+ position: absolute;
59
+ bottom: 24px;
60
+ right: 24px;
61
+ width: 16px;
62
+ height: 16px;
63
+ padding: 0;
64
+ display: flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+ }</style>
@@ -0,0 +1,20 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { ResumeArticle, Tag } from "../../types";
3
+ declare const __propDef: {
4
+ props: {
5
+ article: ResumeArticle;
6
+ categorie: Tag;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {};
12
+ exports?: {} | undefined;
13
+ bindings?: string | undefined;
14
+ };
15
+ export type CarteArticleProps = typeof __propDef.props;
16
+ export type CarteArticleEvents = typeof __propDef.events;
17
+ export type CarteArticleSlots = typeof __propDef.slots;
18
+ export default class CarteArticle extends SvelteComponent<CarteArticleProps, CarteArticleEvents, CarteArticleSlots> {
19
+ }
20
+ export {};
@@ -0,0 +1,65 @@
1
+ <svelte:options
2
+ customElement={{
3
+ tag: "lab-anssi-liste-articles",
4
+ props: {
5
+ articles: { reflect: false, type: "Array", attribute: "articles" },
6
+ categories: { reflect: false, type: "Object", attribute: "categories" },
7
+ idCategorieChoisie: { reflect: false, type: "String", attribute: "id-categorie-choisie" },
8
+ },
9
+ }}
10
+ />
11
+
12
+ <script>import CarteArticle from "./CarteArticle.svelte";
13
+ import ListeDeroulante from "./ListeDeroulante.svelte";
14
+ export let articles;
15
+ export let categories;
16
+ export let idCategorieChoisie = "tous";
17
+ const optionsFiltrage = [
18
+ { label: "Tous les articles", valeur: "tous" },
19
+ ...Object.entries(categories).map(([idCategorie, donnees]) => ({
20
+ label: donnees.label,
21
+ valeur: idCategorie
22
+ }))
23
+ ];
24
+ $: articlesVisibles = idCategorieChoisie === "tous" ? articles : articles.filter((a) => a.idCategorie === idCategorieChoisie);
25
+ </script>
26
+
27
+ <div class="liste-articles">
28
+ <ListeDeroulante bind:valeur={idCategorieChoisie} options={optionsFiltrage} />
29
+ <h2>
30
+ {idCategorieChoisie === "tous" ? "Tous les articles" : categories[idCategorieChoisie].label}
31
+ </h2>
32
+ <div class="conteneur-articles">
33
+ {#each articlesVisibles as article, index (index)}
34
+ <CarteArticle {article} categorie={categories[article.idCategorie]} />
35
+ {/each}
36
+ </div>
37
+ </div>
38
+
39
+ <style>.liste-articles {
40
+ padding: 48px 16px;
41
+ max-width: 1200px;
42
+ margin: 0 auto;
43
+ font-family: Marianne;
44
+ display: flex;
45
+ flex-direction: column;
46
+ gap: 32px;
47
+ }
48
+ @media (min-width: 932px) {
49
+ .liste-articles {
50
+ padding: 48px 24px;
51
+ }
52
+ }
53
+ .liste-articles h2 {
54
+ margin: 0;
55
+ color: #161616;
56
+ font-size: 1.75rem;
57
+ font-style: normal;
58
+ font-weight: 700;
59
+ line-height: 2.25rem;
60
+ }
61
+ .liste-articles .conteneur-articles {
62
+ gap: 16px;
63
+ display: grid;
64
+ grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
65
+ }</style>
@@ -0,0 +1,21 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { CategoriesArticle, ResumeArticle } from "../../types";
3
+ declare const __propDef: {
4
+ props: {
5
+ articles: ResumeArticle[];
6
+ categories: CategoriesArticle;
7
+ idCategorieChoisie?: string;
8
+ };
9
+ events: {
10
+ [evt: string]: CustomEvent<any>;
11
+ };
12
+ slots: {};
13
+ exports?: {} | undefined;
14
+ bindings?: string | undefined;
15
+ };
16
+ export type ListeArticlesProps = typeof __propDef.props;
17
+ export type ListeArticlesEvents = typeof __propDef.events;
18
+ export type ListeArticlesSlots = typeof __propDef.slots;
19
+ export default class ListeArticles extends SvelteComponent<ListeArticlesProps, ListeArticlesEvents, ListeArticlesSlots> {
20
+ }
21
+ export {};
@@ -0,0 +1,56 @@
1
+ <script>import { srcAsset } from "../../assets/assets";
2
+ export let valeur;
3
+ export let options;
4
+ </script>
5
+
6
+ <div class="conteneur-liste-deroulante">
7
+ <div class="conteneur-select">
8
+ <img
9
+ src={srcAsset("/icones/fleche-basse-noir.svg")}
10
+ alt="Icône de flêche de la liste déroulante"
11
+ />
12
+ <select bind:value={valeur}>
13
+ {#each options as option, index (index)}
14
+ <option label={option.label} value={option.valeur} />
15
+ {/each}
16
+ </select>
17
+ </div>
18
+ </div>
19
+
20
+ <style>.conteneur-select {
21
+ position: relative;
22
+ width: fit-content;
23
+ }
24
+ .conteneur-select img {
25
+ position: absolute;
26
+ right: 12px;
27
+ top: 12px;
28
+ pointer-events: none;
29
+ }
30
+ .conteneur-select select {
31
+ appearance: none;
32
+ padding: 8px 38px 8px 16px;
33
+ border-top-left-radius: 4px;
34
+ border-top-right-radius: 4px;
35
+ border: none;
36
+ box-shadow: inset 0 -2px 0 0 #3a3a3a;
37
+ cursor: pointer;
38
+ color: #3a3a3a;
39
+ font-family: Marianne;
40
+ font-size: 1rem;
41
+ font-style: normal;
42
+ font-weight: 400;
43
+ line-height: 1.5rem;
44
+ background: #eeeeee;
45
+ }
46
+ .conteneur-select select:hover {
47
+ background: #f6f6f6;
48
+ }
49
+ .conteneur-select select:focus-visible {
50
+ outline: 2px solid var(--couleur-focus);
51
+ outline-offset: 2px;
52
+ }
53
+ .conteneur-select select option {
54
+ font-size: 1rem;
55
+ line-height: 1.5rem;
56
+ }</style>
@@ -0,0 +1,22 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ valeur: string;
5
+ options: {
6
+ label: string;
7
+ valeur: unknown;
8
+ }[];
9
+ };
10
+ events: {
11
+ [evt: string]: CustomEvent<any>;
12
+ };
13
+ slots: {};
14
+ exports?: {} | undefined;
15
+ bindings?: string | undefined;
16
+ };
17
+ export type ListeDeroulanteProps = typeof __propDef.props;
18
+ export type ListeDeroulanteEvents = typeof __propDef.events;
19
+ export type ListeDeroulanteSlots = typeof __propDef.slots;
20
+ export default class ListeDeroulante extends SvelteComponent<ListeDeroulanteProps, ListeDeroulanteEvents, ListeDeroulanteSlots> {
21
+ }
22
+ export {};
@@ -0,0 +1,22 @@
1
+ <script>export let tag = null;
2
+ </script>
3
+
4
+ <span class="tag" style="background: {tag.couleurFond}; color: {tag.couleurTexte};">
5
+ {tag.label}
6
+ </span>
7
+
8
+ <style>.tag {
9
+ padding: 2px 8px;
10
+ border-radius: 12px;
11
+ font-family: Marianne;
12
+ font-size: 0.75rem;
13
+ font-weight: 400;
14
+ line-height: 1.25rem;
15
+ display: inline-block;
16
+ width: fit-content;
17
+ white-space: nowrap;
18
+ max-width: 100%;
19
+ box-sizing: border-box;
20
+ overflow: hidden;
21
+ text-overflow: ellipsis;
22
+ }</style>
@@ -0,0 +1,19 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { Tag } from "../../types";
3
+ declare const __propDef: {
4
+ props: {
5
+ tag?: Tag;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ exports?: {} | undefined;
12
+ bindings?: string | undefined;
13
+ };
14
+ export type TagProps = typeof __propDef.props;
15
+ export type TagEvents = typeof __propDef.events;
16
+ export type TagSlots = typeof __propDef.slots;
17
+ export default class Tag extends SvelteComponent<TagProps, TagEvents, TagSlots> {
18
+ }
19
+ export {};
@@ -0,0 +1,25 @@
1
+ <script>export let direction = "gauche";
2
+ </script>
3
+
4
+ <svg
5
+ class={direction}
6
+ width="16"
7
+ height="16"
8
+ viewBox="0 0 16 16"
9
+ fill="none"
10
+ xmlns="http://www.w3.org/2000/svg"
11
+ >
12
+ <path
13
+ fill-rule="evenodd"
14
+ clip-rule="evenodd"
15
+ d="M5.21875 7.33336H13.3334V8.6667H5.21875L8.79475 12.2427L7.85208 13.1854L2.66675 8.00003L7.85208 2.8147L8.79475 3.75736L5.21875 7.33336Z"
16
+ fill="black"
17
+ />
18
+ </svg>
19
+
20
+ <style>svg.droite {
21
+ transform: rotate(180deg);
22
+ }
23
+ svg.droite path {
24
+ fill: var(--liste-articles-couleur-fleche);
25
+ }</style>
@@ -0,0 +1,18 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ direction?: "gauche" | "droite";
5
+ };
6
+ events: {
7
+ [evt: string]: CustomEvent<any>;
8
+ };
9
+ slots: {};
10
+ exports?: {} | undefined;
11
+ bindings?: string | undefined;
12
+ };
13
+ export type FlecheProps = typeof __propDef.props;
14
+ export type FlecheEvents = typeof __propDef.events;
15
+ export type FlecheSlots = typeof __propDef.slots;
16
+ export default class Fleche extends SvelteComponent<FlecheProps, FlecheEvents, FlecheSlots> {
17
+ }
18
+ export {};
package/dist/types.d.ts CHANGED
@@ -51,4 +51,10 @@ export type TableDesMatieres = {
51
51
  texte: string;
52
52
  id: string;
53
53
  }[];
54
+ export type ResumeArticle = {
55
+ idCategorie: string;
56
+ titre: string;
57
+ href: string;
58
+ };
59
+ export type CategoriesArticle = Record<string, Tag>;
54
60
  export {};