@lab-anssi/ui-kit 1.19.0 → 1.20.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.
- package/README.md +29 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lab/Tag.svelte +47 -0
- package/dist/lab/{blog/Tag.svelte.d.ts → Tag.svelte.d.ts} +4 -2
- package/dist/lab/blog/BandeauTitre.svelte +8 -4
- package/dist/lab/blog/BandeauTitre.svelte.d.ts +2 -2
- package/dist/lab/blog/CarteArticle.svelte +6 -2
- package/dist/lab/blog/CarteArticle.svelte.d.ts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/webcomponents/lab-anssi-ui-kit.iife.js +31 -31
- package/dist/webcomponents/lab-anssi-ui-kit.jsx.d.ts +7 -1
- package/package.json +1 -2
- package/dist/lab/blog/Tag.svelte +0 -22
package/README.md
CHANGED
|
@@ -15,17 +15,40 @@
|
|
|
15
15
|
|
|
16
16
|
## Storybook des composants
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
> Nous parlons de _Storybook_ car c'est le terme généralement employé, mais nous utilisons [Histoire](https://histoire.dev/).
|
|
19
|
+
> Nous avons fait ce choix car au moment de la création de notre repo, Storybook n'était pas compatible Svelte.
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
Lors de la release d'une nouvelle version de l'UI Kit, le Storybook des composants [est déployé sur Github Pages : https://betagouv.github.io/lab-anssi-ui-kit/](https://betagouv.github.io/lab-anssi-ui-kit/).
|
|
21
22
|
|
|
22
23
|
## Architecture de build
|
|
23
24
|
|
|
24
|
-
Cette librairie a pour objectif de produire des composants Svelte et leurs équivalents [
|
|
25
|
+
Cette librairie a pour objectif de produire des composants Svelte et leurs équivalents [WebComponent](https://developer.mozilla.org/en-US/docs/Web/API/Web_components).
|
|
25
26
|
|
|
26
27
|
L'architecture pour produire du Svelte utilise [SvelteKit](https://svelte.dev/docs/kit/packaging), configuré via le wizard `npx sv create`.
|
|
27
|
-
C'est ce qui explique les nombreux fichiers de configuration Svelte (Prettier, Vitest, etc
|
|
28
|
+
C'est ce qui explique les nombreux fichiers de configuration Svelte (Prettier, Vitest, etc.) : ils ont été rajoutés par le wizard.
|
|
28
29
|
|
|
29
|
-
Pour rajouter le build des
|
|
30
|
+
Pour rajouter le build des WebComponents, on rajoute manuellement un fichier de configuration [`vite.webcomponents.config.ts`](./vite.webcomponents.config.ts) et des appels à la commande `vite -c vite.webcomponents.config.ts build` lors des étapes de build du package.
|
|
30
31
|
|
|
31
|
-
Résultat : dans le repertoire `dist/` on retrouvera les composants Svelte et leurs équivalents Webcomponents.
|
|
32
|
+
Résultat : dans le repertoire `dist/` on retrouvera les composants Svelte et leurs équivalents Webcomponents.
|
|
33
|
+
Tout le contenu de `dist/` est publié via `npm publish`.
|
|
34
|
+
|
|
35
|
+
## Développement en local
|
|
36
|
+
|
|
37
|
+
La commande principale pour le développement en local est `npm run story:dev`.
|
|
38
|
+
La sortie devrait ressembler à :
|
|
39
|
+
|
|
40
|
+
```shell
|
|
41
|
+
|
|
42
|
+
$ npm run story:dev
|
|
43
|
+
|
|
44
|
+
@lab-anssi/ui-kit@1.19.0 story:dev
|
|
45
|
+
HISTOIRE_ENV=development histoire dev
|
|
46
|
+
Re-optimizing dependencies because lockfile has changed
|
|
47
|
+
Using 5 threads for story collection
|
|
48
|
+
Collect stories start all
|
|
49
|
+
➜ Local: http://localhost:6006/
|
|
50
|
+
➜ Network: use --host to expose
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Après cette commande, le Storybook local est disponible sur http://localhost:6006/.
|
|
54
|
+
Il devrait ressembler [au Storybook disponible en ligne](https://betagouv.github.io/lab-anssi-ui-kit/).
|
package/dist/index.d.ts
CHANGED
|
@@ -19,3 +19,4 @@ export { default as ListeArticles } from "./lab/blog/ListeArticles.svelte";
|
|
|
19
19
|
export { default as Icone } from "./lab/Icone.svelte";
|
|
20
20
|
export { default as Bouton } from "./lab/Bouton.svelte";
|
|
21
21
|
export { default as Lien } from "./lab/Lien.svelte";
|
|
22
|
+
export { default as Tag } from "./lab/Tag.svelte";
|
package/dist/index.js
CHANGED
|
@@ -19,3 +19,4 @@ export { default as ListeArticles } from "./lab/blog/ListeArticles.svelte";
|
|
|
19
19
|
export { default as Icone } from "./lab/Icone.svelte";
|
|
20
20
|
export { default as Bouton } from "./lab/Bouton.svelte";
|
|
21
21
|
export { default as Lien } from "./lab/Lien.svelte";
|
|
22
|
+
export { default as Tag } from "./lab/Tag.svelte";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<svelte:options
|
|
2
|
+
customElement={{
|
|
3
|
+
tag: "lab-anssi-tag",
|
|
4
|
+
props: {
|
|
5
|
+
couleurFond: { reflect: false, type: "String", attribute: "couleur-fond" },
|
|
6
|
+
couleurTexte: { reflect: false, type: "String", attribute: "couleur-texte" },
|
|
7
|
+
label: { reflect: false, type: "String", attribute: "label" },
|
|
8
|
+
taille: { reflect: false, type: "String", attribute: "taille" },
|
|
9
|
+
},
|
|
10
|
+
}}
|
|
11
|
+
/>
|
|
12
|
+
|
|
13
|
+
<script>export let label;
|
|
14
|
+
export let couleurTexte;
|
|
15
|
+
export let couleurFond;
|
|
16
|
+
export let taille = "sm";
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<span class="tag {taille}" style:background={couleurFond} style:color={couleurTexte}>
|
|
20
|
+
{label}
|
|
21
|
+
</span>
|
|
22
|
+
|
|
23
|
+
<style>.tag {
|
|
24
|
+
color: var(--tag-couleur-texte);
|
|
25
|
+
background-color: var(--tag-couleur-fond);
|
|
26
|
+
font-family: Marianne;
|
|
27
|
+
font-weight: 400;
|
|
28
|
+
display: inline-block;
|
|
29
|
+
width: fit-content;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
max-width: 100%;
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
text-overflow: ellipsis;
|
|
35
|
+
}
|
|
36
|
+
.tag.sm {
|
|
37
|
+
font-size: 0.75rem;
|
|
38
|
+
line-height: 1.25rem;
|
|
39
|
+
padding: 2px 8px;
|
|
40
|
+
border-radius: 12px;
|
|
41
|
+
}
|
|
42
|
+
.tag.md {
|
|
43
|
+
font-size: 0.875rem;
|
|
44
|
+
line-height: 1.5rem;
|
|
45
|
+
padding: 4px 12px;
|
|
46
|
+
border-radius: 16px;
|
|
47
|
+
}</style>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type { Tag } from "../../types";
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
|
-
|
|
4
|
+
label: string;
|
|
5
|
+
couleurTexte: string | undefined;
|
|
6
|
+
couleurFond: string | undefined;
|
|
7
|
+
taille?: "sm" | "md";
|
|
6
8
|
};
|
|
7
9
|
events: {
|
|
8
10
|
[evt: string]: CustomEvent<any>;
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
/>
|
|
12
12
|
|
|
13
13
|
<script>import { estLien } from "../../types.js";
|
|
14
|
-
import
|
|
14
|
+
import Tag from "../Tag.svelte";
|
|
15
15
|
export let titre;
|
|
16
16
|
export let description = "";
|
|
17
17
|
export let filAriane = [];
|
|
18
|
-
export let
|
|
18
|
+
export let infosTag = null;
|
|
19
19
|
let filArianeVisible = window.matchMedia("(min-width: 576px)").matches;
|
|
20
20
|
</script>
|
|
21
21
|
|
|
@@ -37,9 +37,13 @@ let filArianeVisible = window.matchMedia("(min-width: 576px)").matches;
|
|
|
37
37
|
</div>
|
|
38
38
|
{/if}
|
|
39
39
|
<div class="conteneur-texte">
|
|
40
|
-
{#if
|
|
40
|
+
{#if infosTag}
|
|
41
41
|
<div class="conteneur-tag">
|
|
42
|
-
<
|
|
42
|
+
<Tag
|
|
43
|
+
couleurFond={infosTag.couleurFond}
|
|
44
|
+
couleurTexte={infosTag.couleurTexte}
|
|
45
|
+
label={infosTag.label}
|
|
46
|
+
/>
|
|
43
47
|
</div>
|
|
44
48
|
{/if}
|
|
45
49
|
<div class="conteneur-corps">
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import { type NoeudFilAriane, type
|
|
2
|
+
import { type NoeudFilAriane, type InfosTag } from "../../types.js";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
titre: string;
|
|
6
6
|
description?: string;
|
|
7
7
|
filAriane?: NoeudFilAriane[];
|
|
8
|
-
|
|
8
|
+
infosTag?: InfosTag | null;
|
|
9
9
|
};
|
|
10
10
|
events: {
|
|
11
11
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import Tag from "../Tag.svelte";
|
|
2
2
|
import Fleche from "../icones/Fleche.svelte";
|
|
3
3
|
export let article;
|
|
4
4
|
export let categorie;
|
|
@@ -6,7 +6,11 @@ export let categorie;
|
|
|
6
6
|
|
|
7
7
|
<a class="carte-article" href={article.href}>
|
|
8
8
|
<div class="conteneur-texte">
|
|
9
|
-
<
|
|
9
|
+
<Tag
|
|
10
|
+
couleurFond={categorie.couleurFond}
|
|
11
|
+
couleurTexte={categorie.couleurTexte}
|
|
12
|
+
label={categorie.label}
|
|
13
|
+
/>
|
|
10
14
|
<p>{article.titre}</p>
|
|
11
15
|
</div>
|
|
12
16
|
<div class="conteneur-fleche">
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
import type { ResumeArticle,
|
|
2
|
+
import type { ResumeArticle, InfosTag } from "../../types";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
article: ResumeArticle;
|
|
6
|
-
categorie:
|
|
6
|
+
categorie: InfosTag;
|
|
7
7
|
};
|
|
8
8
|
events: {
|
|
9
9
|
[evt: string]: CustomEvent<any>;
|
package/dist/types.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ type Feuille = {
|
|
|
41
41
|
};
|
|
42
42
|
export type NoeudFilAriane = Lien | Feuille;
|
|
43
43
|
export declare const estLien: (noeud: NoeudFilAriane) => noeud is Lien;
|
|
44
|
-
export type
|
|
44
|
+
export type InfosTag = {
|
|
45
45
|
label: string;
|
|
46
46
|
couleurTexte: string;
|
|
47
47
|
couleurFond: string;
|
|
@@ -56,5 +56,5 @@ export type ResumeArticle = {
|
|
|
56
56
|
titre: string;
|
|
57
57
|
href: string;
|
|
58
58
|
};
|
|
59
|
-
export type CategoriesArticle = Record<string,
|
|
59
|
+
export type CategoriesArticle = Record<string, InfosTag>;
|
|
60
60
|
export {};
|